user-configurations 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 +4 -4
- data/.travis.yml +5 -0
- data/CHANGELOG +7 -0
- data/README.md +13 -8
- data/lib/user_configurations/configuration.rb +3 -1
- data/lib/user_configurations/version.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- data/user-configurations.gemspec +4 -0
- metadata +41 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c3856c4369461f3a9c61e204cbfd682017b3cce
|
4
|
+
data.tar.gz: 975d073951f262349ffc9bd507383200f8c679ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2569c58ef1b0e0cb4fcab4668dfb1abf9a0219361286d764ee1d0db3eee70c740cf616f9b88e482b1e860fe02f9a1e2fbe7e0387152b92172e035db0ff471f97
|
7
|
+
data.tar.gz: d1ee2f9589ce4cd31e8e84a7696f79d4fdf01eed49003bc9b52de562940b130c1946f45614be91be8b15c37c1a4a99d485ce88af502bd78d5f4e63dc88b9baf6
|
data/.travis.yml
ADDED
data/CHANGELOG
ADDED
data/README.md
CHANGED
@@ -17,25 +17,30 @@ Or install it yourself as:
|
|
17
17
|
|
18
18
|
## Usage
|
19
19
|
|
20
|
-
###
|
20
|
+
### Precedence
|
21
|
+
|
22
|
+
ENV > local > global
|
23
|
+
|
24
|
+
### Writing
|
21
25
|
|
22
26
|
```ruby
|
23
27
|
configs = UserConfigurations::Configuration.new('project')
|
24
|
-
configs
|
28
|
+
configs.store(user_name: 'stupied4ever')
|
25
29
|
```
|
26
30
|
|
27
|
-
|
28
|
-
|
31
|
+
Will store on a local file placed on ```~/.project``` a [YAML][yaml] file
|
32
|
+
with ```user_name```.
|
29
33
|
|
30
|
-
###
|
34
|
+
### Reading
|
31
35
|
|
32
36
|
```ruby
|
33
37
|
configs = UserConfigurations::Configuration.new('project')
|
34
|
-
configs
|
38
|
+
configs['user_name'] # 'stupied4ever'
|
35
39
|
```
|
36
40
|
|
37
|
-
|
38
|
-
```
|
41
|
+
If you had a global file (```/etc/project```) with the ```user_name```
|
42
|
+
configurations, or an ```ENV``` var it would be readable too, just pay
|
43
|
+
attention on precendences.
|
39
44
|
|
40
45
|
## Contributing
|
41
46
|
|
@@ -1,10 +1,12 @@
|
|
1
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
2
|
+
|
1
3
|
module UserConfigurations
|
2
4
|
class Configuration < SimpleDelegator
|
3
5
|
attr_accessor :project_name
|
4
6
|
|
5
7
|
def initialize(project_name)
|
6
8
|
@project_name = project_name
|
7
|
-
super global.merge(user).merge(environment)
|
9
|
+
super global.merge(user).merge(environment).with_indifferent_access
|
8
10
|
end
|
9
11
|
|
10
12
|
def store(values)
|
data/spec/spec_helper.rb
CHANGED
data/user-configurations.gemspec
CHANGED
@@ -19,5 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
+
spec.add_dependency 'activesupport', '~> 3.0'
|
23
|
+
|
22
24
|
spec.add_development_dependency 'rspec', '~> 2.0'
|
25
|
+
spec.add_development_dependency 'coveralls', '~> 0.7'
|
26
|
+
|
23
27
|
end
|
metadata
CHANGED
@@ -1,29 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user-configurations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael da Silva Almeida
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rspec
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
|
-
- -
|
31
|
+
- - ~>
|
18
32
|
- !ruby/object:Gem::Version
|
19
33
|
version: '2.0'
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
|
-
- -
|
38
|
+
- - ~>
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.7'
|
27
55
|
description: |-
|
28
56
|
Configurations for a project, it will read from
|
29
57
|
env vars, local or global files
|
@@ -33,10 +61,12 @@ executables: []
|
|
33
61
|
extensions: []
|
34
62
|
extra_rdoc_files: []
|
35
63
|
files:
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
64
|
+
- .gitignore
|
65
|
+
- .rspec
|
66
|
+
- .rubocop.yml
|
67
|
+
- .rubocop_todo.yml
|
68
|
+
- .travis.yml
|
69
|
+
- CHANGELOG
|
40
70
|
- Gemfile
|
41
71
|
- LICENSE.txt
|
42
72
|
- README.md
|
@@ -56,21 +86,20 @@ require_paths:
|
|
56
86
|
- lib
|
57
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
58
88
|
requirements:
|
59
|
-
- -
|
89
|
+
- - '>='
|
60
90
|
- !ruby/object:Gem::Version
|
61
91
|
version: '0'
|
62
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
93
|
requirements:
|
64
|
-
- -
|
94
|
+
- - '>='
|
65
95
|
- !ruby/object:Gem::Version
|
66
96
|
version: '0'
|
67
97
|
requirements: []
|
68
98
|
rubyforge_project:
|
69
|
-
rubygems_version: 2.2.
|
99
|
+
rubygems_version: 2.2.2
|
70
100
|
signing_key:
|
71
101
|
specification_version: 4
|
72
102
|
summary: Configurations for a project
|
73
103
|
test_files:
|
74
104
|
- spec/spec_helper.rb
|
75
105
|
- spec/user_configurations/configuration_spec.rb
|
76
|
-
has_rdoc:
|