env_paths 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2cc22755ba9902f3b8f54858a6dd275f1fe700a
4
- data.tar.gz: 3509ff818d39a36d394bc9bde666fa2c467fb3b7
3
+ metadata.gz: f272d82bd2670a4f53b36df80085aaf9ae366f50
4
+ data.tar.gz: 8d294e1b1fca7b42a1d24de2b697a7c247718ef9
5
5
  SHA512:
6
- metadata.gz: 6c55f3fbd5708d5a0595d872a3d00ebdd4259376c8aa51a69af00396023dc4abf46aaad9915b922325c0387230ecce83e04bbcb6e4ca15cb6ef13d22e8814e85
7
- data.tar.gz: de871e6a93e54322e279e76772e112213ebd6a903ca2212dc85abbbabea7b140437c4cc835b81781d8d9358733df6b16a0f2362853a5fefff198f80346580b2a
6
+ metadata.gz: e7c7e9ad97c7439c0d1a82c38d6f36b9e01639900d41443c666bb0b8e4294b22a558594c9e377362ad3378d7fb397e31637014bd5bd44c9157a8e27ea9db823c
7
+ data.tar.gz: 814d433e63e1f2d990d37a72b29243ccb47202fc7c9538d2b69113d98f3447137e482697f3afd9ddd4581091b8bb8b2ef359e477acb2e5bddb1264391ebe5a8a
@@ -8,3 +8,5 @@ notifications:
8
8
  email:
9
9
  on_success: never
10
10
  on_failure: always
11
+ ignore:
12
+ - README.md
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- EnvPaths
1
+ EnvPaths [![Build Status](https://travis-ci.org/NickTomlin/env_paths.png?branch=master)](https://travis-ci.org/NickTomlin/env_paths.fury.io/rb/env_paths.svg)](https://badge.fury.io/rb/env_paths)
2
2
  ===
3
3
 
4
- Provides OS specific paths for your gem/application.
4
+ Provides OS specific paths for your gem/application. A ruby port of [`env-paths`](https://github.com/sindresorhus/env-paths).
5
5
 
6
6
  ## Installation
7
7
 
@@ -11,10 +11,10 @@ module EnvPaths
11
11
  OSData.new(
12
12
  ENV.fetch('XDG_DATA_HOME', File.join(HOMEDIR, '.local', 'share', app_name)),
13
13
  ENV.fetch('XDG_CONFIG_HOME', File.join(HOMEDIR, '.config', app_name)),
14
- ENV.FETCH('XDG_CACHE_HOME', File.join(HOMEDIR, '.cache', app_name)),
14
+ ENV.fetch('XDG_CACHE_HOME', File.join(HOMEDIR, '.cache', app_name)),
15
15
  # https://wiki.debian.org/XDGBaseDirectorySpecification#state
16
- ENV.FETCH('XDG_STATE_HOME', File.join(HOMEDIR, '.local', 'state', app_name)),
17
- File.join(Dir.tmpdir, ENV['user'], app_name)
16
+ ENV.fetch('XDG_STATE_HOME', File.join(HOMEDIR, '.local', 'state', app_name)),
17
+ File.join(Dir.tmpdir, Etc.getlogin, app_name)
18
18
  )
19
19
  end
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module EnvPaths
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
@@ -12,23 +12,43 @@ describe EnvPaths do
12
12
  end
13
13
 
14
14
  context 'MacOs' do
15
- it 'returs osx specific data' do
15
+ it 'returs OSX specific data' do
16
16
  allow(EnvPaths).to receive(:_platform).and_return('x86_64-darwin13.0')
17
17
  env_paths = EnvPaths.get('my_app')
18
18
 
19
- expect(env_paths.data).to match(%r{/Users/.*/Library/Application Support/my_app-ruby})
20
- expect(env_paths.config).to match(%r{/Users/.*/Library/Preferences/my_app-ruby})
21
- expect(env_paths.cache).to match(%r{/Users/.*/Library/Caches/my_app-ruby})
22
- expect(env_paths.log).to match(%r{/Users/.*/Library/Logs/my_app-ruby})
23
- expect(env_paths.temp).to match(%r{/var/folders/.*/my_app-ruby})
19
+ expect(env_paths.data).to match(%r{Library/Application Support/my_app-ruby})
20
+ expect(env_paths.config).to match(%r{Library/Preferences/my_app-ruby})
21
+ expect(env_paths.cache).to match(%r{Library/Caches/my_app-ruby})
22
+ expect(env_paths.log).to match(%r{Library/Logs/my_app-ruby})
23
+ expect(env_paths.temp).to include('my_app-ruby')
24
24
  end
25
25
  end
26
26
 
27
27
  context 'Linux' do
28
- it 'returs linux specific data'
28
+ it 'returs linux specific data' do
29
+ allow(EnvPaths).to receive(:_platform).and_return('hipster-linux')
30
+ env_paths = EnvPaths.get('my_app')
31
+
32
+ expect(env_paths.data).to match(%r{.local/share/my_app-ruby$})
33
+ expect(env_paths.config).to match(%r{.config/my_app-ruby$})
34
+ expect(env_paths.cache).to match(%r{.cache/my_app-ruby$})
35
+ expect(env_paths.log).to match(%r{.local/state/my_app-ruby$})
36
+ expect(env_paths.temp).to include('my_app-ruby')
37
+ end
38
+
39
+ it 'prefers XDG_* ENV settings to defaults'
29
40
  end
30
41
 
31
42
  context 'Windows' do
32
- it 'returs windows specific data'
43
+ it 'returs windows specific data' do
44
+ allow(EnvPaths).to receive(:_platform).and_return('win32')
45
+ env_paths = EnvPaths.get('my_app')
46
+
47
+ expect(env_paths.data).to include('Data')
48
+ expect(env_paths.config).to include('Config')
49
+ expect(env_paths.cache).to include('Cache')
50
+ expect(env_paths.log).to include('Log')
51
+ expect(env_paths.temp).not_to be_nil
52
+ end
33
53
  end
34
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env_paths
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Tomlin