env_paths 0.0.2 → 1.0.0

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: f272d82bd2670a4f53b36df80085aaf9ae366f50
4
- data.tar.gz: 8d294e1b1fca7b42a1d24de2b697a7c247718ef9
3
+ metadata.gz: fa23c3678a7bf1bf6ddf27ca88c133301b5e8bca
4
+ data.tar.gz: 4a132162ea3b4593a33f5dfb464b4291b697d33c
5
5
  SHA512:
6
- metadata.gz: e7c7e9ad97c7439c0d1a82c38d6f36b9e01639900d41443c666bb0b8e4294b22a558594c9e377362ad3378d7fb397e31637014bd5bd44c9157a8e27ea9db823c
7
- data.tar.gz: 814d433e63e1f2d990d37a72b29243ccb47202fc7c9538d2b69113d98f3447137e482697f3afd9ddd4581091b8bb8b2ef359e477acb2e5bddb1264391ebe5a8a
6
+ metadata.gz: '09fea10406a8a9d59ffc8b1ed7504f1f157c0370d27179c621c991aeef4582c9ef7d0fb5d6a39b636763de54b85a1a66d6403a41cfafc0c1a61e762ad1b4b1a0'
7
+ data.tar.gz: c61384809f13718f8400451a47a99e13198aa35481c44af41479207011dd56544e41efd86a4559e4fd7a61dfeabac6f346617c39dd0e9919b4077f2877b65ac6
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /vendor/
10
11
  *.bundle
11
12
  *.so
12
13
  *.o
data/.rubocop.yml CHANGED
@@ -1,4 +1,23 @@
1
1
  Documentation:
2
2
  Enabled: false
3
+
3
4
  Metrics/LineLength:
4
5
  Enabled: false
6
+
7
+ Metrics/AbcSize:
8
+ Enabled: false
9
+
10
+ Metrics/BlockLength:
11
+ Enabled: false
12
+
13
+ Metrics/ClassLength:
14
+ Enabled: false
15
+
16
+ Metrics/CyclomaticComplexity:
17
+ Enabled: false
18
+
19
+ Metrics/ModuleLength:
20
+ Enabled: false
21
+
22
+ Metrics/PerceivedComplexity:
23
+ Enabled: false
data/README.md CHANGED
@@ -1,4 +1,4 @@
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)
1
+ EnvPaths ![Build Status](https://travis-ci.org/NickTomlin/env_paths.png?branch=master) [![Gem Version](https://badge.fury.io/rb/env_paths.svg)](https://badge.fury.io/rb/env_paths)
2
2
  ===
3
3
 
4
4
  Provides OS specific paths for your gem/application. A ruby port of [`env-paths`](https://github.com/sindresorhus/env-paths).
data/Rakefile CHANGED
@@ -9,4 +9,4 @@ Gem::PackageTask.new(spec)
9
9
  RuboCop::RakeTask.new
10
10
  RSpec::Core::RakeTask.new(:spec)
11
11
 
12
- task default: %w(rubocop spec)
12
+ task default: %w[rubocop spec]
data/env_paths.gemspec CHANGED
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'env_paths/version'
@@ -8,7 +7,7 @@ Gem::Specification.new do |spec|
8
7
  spec.version = EnvPaths::VERSION
9
8
  spec.authors = ['Nick Tomlin']
10
9
  spec.email = ['nick.tomlin@gmail.com']
11
- spec.summary = 'Environment specific paths. A port of npm\'s env-paths'
10
+ spec.summary = 'Environment specific paths. A port of node\'s env-paths'
12
11
  spec.license = 'MIT'
13
12
 
14
13
  spec.files = `git ls-files -z`.split("\x0")
@@ -17,7 +16,7 @@ Gem::Specification.new do |spec|
17
16
  spec.require_paths = ['lib']
18
17
 
19
18
  spec.add_development_dependency 'bundler', '~> 1.7'
20
- spec.add_development_dependency 'rspec', '~> 3.5'
21
19
  spec.add_development_dependency 'rake', '~> 10.0'
22
- spec.add_development_dependency 'rubocop', '~> 0.45.0'
20
+ spec.add_development_dependency 'rspec', '~> 3.5'
21
+ spec.add_development_dependency 'rubocop', '~> 0.51.0'
23
22
  end
data/lib/env_paths.rb CHANGED
@@ -9,11 +9,11 @@ module EnvPaths
9
9
  module Linux
10
10
  def self.config(app_name)
11
11
  OSData.new(
12
- ENV.fetch('XDG_DATA_HOME', File.join(HOMEDIR, '.local', 'share', app_name)),
13
- ENV.fetch('XDG_CONFIG_HOME', File.join(HOMEDIR, '.config', app_name)),
14
- ENV.fetch('XDG_CACHE_HOME', File.join(HOMEDIR, '.cache', app_name)),
12
+ File.join(ENV.fetch('XDG_DATA_HOME', File.join(HOMEDIR, '.local', 'share')), app_name),
13
+ File.join(ENV.fetch('XDG_CONFIG_HOME', File.join(HOMEDIR, '.config')), app_name),
14
+ File.join(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)),
16
+ File.join(ENV.fetch('XDG_STATE_HOME', File.join(HOMEDIR, '.local', 'state')), app_name),
17
17
  File.join(Dir.tmpdir, Etc.getlogin, app_name)
18
18
  )
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module EnvPaths
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
@@ -12,7 +12,7 @@ describe EnvPaths do
12
12
  end
13
13
 
14
14
  context 'MacOs' do
15
- it 'returs OSX specific data' do
15
+ it 'returns 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
 
@@ -25,22 +25,45 @@ describe EnvPaths do
25
25
  end
26
26
 
27
27
  context 'Linux' do
28
- it 'returs linux specific data' do
29
- allow(EnvPaths).to receive(:_platform).and_return('hipster-linux')
28
+ xdg_vars = %w[XDG_DATA_HOME XDG_CONFIG_HOME XDG_CACHE_HOME XDG_STATE_HOME]
29
+ platform = 'x86_64-linux'
30
+
31
+ it 'returns Linux-specific data' do
32
+ xdg_vars.each do |var|
33
+ allow(ENV).to receive(:fetch).with(var, anything) do |_, default|
34
+ default
35
+ end
36
+ end
37
+
38
+ allow(EnvPaths).to receive(:_platform).and_return(platform)
30
39
  env_paths = EnvPaths.get('my_app')
31
40
 
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$})
41
+ expect(env_paths.data).to match(%r{\.local/share/my_app-ruby$})
42
+ expect(env_paths.config).to match(%r{\.config/my_app-ruby$})
43
+ expect(env_paths.cache).to match(%r{\.cache/my_app-ruby$})
44
+ expect(env_paths.log).to match(%r{\.local/state/my_app-ruby$})
36
45
  expect(env_paths.temp).to include('my_app-ruby')
37
46
  end
38
47
 
39
- it 'prefers XDG_* ENV settings to defaults'
48
+ it 'prefers XDG_* ENV settings to defaults' do
49
+ xdg_vars.each do |var|
50
+ dir = var[/^XDG_(\w+)_HOME$/, 1].downcase
51
+ allow(ENV).to receive(:fetch).with(var, anything).and_return("/home/test/#{dir}")
52
+ end
53
+
54
+ allow(EnvPaths).to receive(:_platform).and_return(platform)
55
+ env_paths = EnvPaths.get('my_app')
56
+
57
+ expect(env_paths.data).to eq('/home/test/data/my_app-ruby')
58
+ expect(env_paths.config).to eq('/home/test/config/my_app-ruby')
59
+ expect(env_paths.cache).to eq('/home/test/cache/my_app-ruby')
60
+ expect(env_paths.log).to eq('/home/test/state/my_app-ruby')
61
+ expect(env_paths.temp).to include('my_app-ruby')
62
+ end
40
63
  end
41
64
 
42
65
  context 'Windows' do
43
- it 'returs windows specific data' do
66
+ it 'returns Windows-specific data' do
44
67
  allow(EnvPaths).to receive(:_platform).and_return('win32')
45
68
  env_paths = EnvPaths.get('my_app')
46
69
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env_paths
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Tomlin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-25 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,47 +25,47 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.5'
33
+ version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.5'
40
+ version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '3.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '3.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.45.0
61
+ version: 0.51.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.45.0
68
+ version: 0.51.0
69
69
  description:
70
70
  email:
71
71
  - nick.tomlin@gmail.com
@@ -106,10 +106,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.2.2
109
+ rubygems_version: 2.6.8
110
110
  signing_key:
111
111
  specification_version: 4
112
- summary: Environment specific paths. A port of npm's env-paths
112
+ summary: Environment specific paths. A port of node's env-paths
113
113
  test_files:
114
114
  - spec/env_paths_spec.rb
115
115
  - spec/spec_helper.rb