user-configurations 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2fda9b9573e447416bad4ffb103711772648f30
4
- data.tar.gz: 56c5e266c5d7b96771e21c9a65e90b21947eddd2
3
+ metadata.gz: 2c3856c4369461f3a9c61e204cbfd682017b3cce
4
+ data.tar.gz: 975d073951f262349ffc9bd507383200f8c679ef
5
5
  SHA512:
6
- metadata.gz: ca664dcd42d89506d9a1d156d0eed09bd8cacc5dff2546e91a1c0c97bf7cc98d584174dd669831d33aa26ac5ffb88ebe0495657dacd876c5ceb5f05e765e435d
7
- data.tar.gz: 453bb35a33ce080dcc5c328c0441c9b3073daf272e3db93aaa73de77895ac51b3158507ecc3b2adf155216495ea51e740f6824212fb352ab5beb436127300989
6
+ metadata.gz: 2569c58ef1b0e0cb4fcab4668dfb1abf9a0219361286d764ee1d0db3eee70c740cf616f9b88e482b1e860fe02f9a1e2fbe7e0387152b92172e035db0ff471f97
7
+ data.tar.gz: d1ee2f9589ce4cd31e8e84a7696f79d4fdf01eed49003bc9b52de562940b130c1946f45614be91be8b15c37c1a4a99d485ce88af502bd78d5f4e63dc88b9baf6
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - '2.0.0'
4
+ - '2.1.0'
5
+ script: bundle exec rspec
data/CHANGELOG ADDED
@@ -0,0 +1,7 @@
1
+ 1.0.2
2
+
3
+ * Fix error on reading configurations, now it's has indifferent_access
4
+
5
+ 1.0.1
6
+
7
+ * First version
data/README.md CHANGED
@@ -17,25 +17,30 @@ Or install it yourself as:
17
17
 
18
18
  ## Usage
19
19
 
20
- ### Reading
20
+ ### Precedence
21
+
22
+ ENV > local > global
23
+
24
+ ### Writing
21
25
 
22
26
  ```ruby
23
27
  configs = UserConfigurations::Configuration.new('project')
24
- configs['user_name']
28
+ configs.store(user_name: 'stupied4ever')
25
29
  ```
26
30
 
27
- That will give to you the value of that configuration on a ENV variable, local,
28
- or global variable (with that precedence).
31
+ Will store on a local file placed on ```~/.project``` a [YAML][yaml] file
32
+ with ```user_name```.
29
33
 
30
- ### Writing
34
+ ### Reading
31
35
 
32
36
  ```ruby
33
37
  configs = UserConfigurations::Configuration.new('project')
34
- configs.store(user_name: 'stupied4ever')
38
+ configs['user_name'] # 'stupied4ever'
35
39
  ```
36
40
 
37
- Will store on a local file placed on ```~/.project``` a [YAML][yaml] file with
38
- ```user_name```.
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)
@@ -1,3 +1,3 @@
1
1
  module UserConfigurations
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -3,5 +3,5 @@ Bundler.setup
3
3
 
4
4
  require 'user-configurations'
5
5
 
6
- RSpec.configure do |_|
7
- end
6
+ require 'coveralls'
7
+ Coveralls.wear!
@@ -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.1
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-07 00:00:00.000000000 Z
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
- - ".gitignore"
37
- - ".rspec"
38
- - ".rubocop.yml"
39
- - ".rubocop_todo.yml"
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.0
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: