configster 0.0.2 → 0.1.0
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 +7 -0
- data/CHANGELOG.md +18 -1
- data/README.md +7 -1
- data/autotest/discover.rb +1 -0
- data/configster.gemspec +5 -2
- data/lib/configster/configster.rb +11 -5
- data/lib/configster/version.rb +1 -1
- data/spec/configster_spec.rb +10 -1
- data/spec/configurations/second_configuration.yml +4 -0
- data/spec/konfigured_klass_spec.rb +1 -0
- data/spec/spec_helper.rb +0 -2
- metadata +33 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 66d91500171b5ec4bf72d4f3f6ab148744ffda71d9fd6aa283414aa171883c8e
|
4
|
+
data.tar.gz: 6983600628bf7c1b888f61583e80940e7bd78e3d9771b981d9a8ab6c528e295c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 494c44c54437824119dde9bb25476d6c8bb203f3ddbb1fb6ce15b3044620e2aa1be1208b610a5f47441c3cf3eaa79f8b19d91d5242bc668b575b9b4eedf8047d
|
7
|
+
data.tar.gz: 46786200508ca5c0de3f3783c838a5ee3defb69f093ecdb1fdf1b1da4d9ab843bff757d11b145e6a37ba0ab58e64b30e73e86bed7aca9d4621cda163194818b2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 0.1.0 (March 6, 2025)
|
4
|
+
|
5
|
+
- Added support for Ruby 3.2
|
6
|
+
- Ruby 2.1 is now the minimum supported version
|
7
|
+
|
8
|
+
## 0.0.3 (November 12, 2012)
|
9
|
+
|
10
|
+
Features:
|
11
|
+
|
12
|
+
- Load a directory of configs instead of having to load all of them manually.
|
13
|
+
|
14
|
+
Documentation:
|
15
|
+
|
16
|
+
- Added example for loading a directory.
|
17
|
+
|
1
18
|
## 0.0.2 (September 12, 2012)
|
2
19
|
|
3
20
|
Features:
|
@@ -9,4 +26,4 @@ Documentation:
|
|
9
26
|
|
10
27
|
- Fixed a "bug" in the README.
|
11
28
|
- Added a note about accessing Configster directly.
|
12
|
-
- Added additional notes that reference the examples directory.
|
29
|
+
- Added additional notes that reference the examples directory.
|
data/README.md
CHANGED
@@ -27,6 +27,12 @@ For most applications, you'll want to load Configster before you start loading t
|
|
27
27
|
|
28
28
|
You can also pass a raw hash of stuff into `load!` as long as it's in the format of `"ClassName" => { 'variable' => 'whatever' }`
|
29
29
|
|
30
|
+
Configster.load!('MyAwesomeClass' => { :something => 'cool' })
|
31
|
+
|
32
|
+
Or load an entire directory:
|
33
|
+
|
34
|
+
Configster.load!(File.join(Rails.root, 'config', 'configster'))
|
35
|
+
|
30
36
|
Then, just include Configster in any classes you want:
|
31
37
|
|
32
38
|
class KonfiguredKlass
|
@@ -48,7 +54,7 @@ First, make yourself a nice little configuration file and save it to `~/my_sweet
|
|
48
54
|
Then, you'll write your application like this:
|
49
55
|
|
50
56
|
require 'configster'
|
51
|
-
Configster.load!(
|
57
|
+
Configster.load!(File.expand_path('~/my_sweet_app_credentials.yml'))
|
52
58
|
|
53
59
|
class MySweetApp
|
54
60
|
|
@@ -0,0 +1 @@
|
|
1
|
+
Autotest.add_discovery { "rspec2" }
|
data/configster.gemspec
CHANGED
@@ -16,7 +16,10 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
|
-
|
19
|
+
|
20
20
|
gem.add_development_dependency('rspec')
|
21
|
-
|
21
|
+
gem.add_development_dependency('ZenTest')
|
22
|
+
|
23
|
+
gem.required_ruby_version = ">= 2.1.0"
|
24
|
+
|
22
25
|
end
|
@@ -33,14 +33,20 @@ module Configster
|
|
33
33
|
# ===========================
|
34
34
|
def self.load!(configster_config)
|
35
35
|
@configster_config ||= { }
|
36
|
-
|
36
|
+
case configster_config
|
37
37
|
when Hash
|
38
|
-
configster_config
|
38
|
+
@configster_config.merge!(configster_config)
|
39
39
|
when String
|
40
|
-
|
40
|
+
if File.directory?(configster_config)
|
41
|
+
Dir.glob(File.join(configster_config, "*.yml")).each do |file|
|
42
|
+
@configster_config.merge!(YAML.load_file(file))
|
43
|
+
end
|
44
|
+
elsif File.exist?(configster_config)
|
45
|
+
@configster_config.merge!(YAML.load_file(configster_config))
|
46
|
+
else
|
47
|
+
raise "Unable to locate #{configster_config}"
|
48
|
+
end
|
41
49
|
end
|
42
|
-
|
43
|
-
@configster_config.merge!(new_config)
|
44
50
|
end
|
45
51
|
|
46
52
|
def self.config_for(klass)
|
data/lib/configster/version.rb
CHANGED
data/spec/configster_spec.rb
CHANGED
@@ -2,13 +2,22 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Configster do
|
4
4
|
|
5
|
-
subject
|
5
|
+
subject do
|
6
|
+
Configster.load!(File.join($spec_root, 'configurations', 'test_configuration.yml'))
|
7
|
+
Configster
|
8
|
+
end
|
9
|
+
|
6
10
|
it { should respond_to(:config_for) }
|
7
11
|
|
8
12
|
it "should be able to load the configuration for a specific class" do
|
9
13
|
Configster.config_for(KonfiguredKlass).should_not be_nil
|
10
14
|
end
|
11
15
|
|
16
|
+
it "should be able to load a directory of yml files" do
|
17
|
+
Configster.load!(File.join($spec_root, 'configurations'))
|
18
|
+
Configster.config_for('SecondConfiguration').should_not be_nil
|
19
|
+
end
|
20
|
+
|
12
21
|
it "should not destroy other configurations when loading additional configs" do
|
13
22
|
Configster.load!('test_thing' => { 'test' => true })
|
14
23
|
Configster.config_for('test_thing').test.should be_true
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Patrick Tulskie
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-03-04 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ZenTest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
25
41
|
description: Configster is a tidy little configuration management utility for your
|
26
42
|
application. Store your configuration as YAML outside of your application. You
|
27
43
|
probably haven't heard of it.
|
@@ -31,12 +47,13 @@ executables: []
|
|
31
47
|
extensions: []
|
32
48
|
extra_rdoc_files: []
|
33
49
|
files:
|
34
|
-
- .gitignore
|
50
|
+
- ".gitignore"
|
35
51
|
- CHANGELOG.md
|
36
52
|
- Gemfile
|
37
53
|
- LICENSE.txt
|
38
54
|
- README.md
|
39
55
|
- Rakefile
|
56
|
+
- autotest/discover.rb
|
40
57
|
- configster.gemspec
|
41
58
|
- examples/active_record_example.rb
|
42
59
|
- examples/httparty_example.rb
|
@@ -44,35 +61,35 @@ files:
|
|
44
61
|
- lib/configster/configster.rb
|
45
62
|
- lib/configster/version.rb
|
46
63
|
- spec/configster_spec.rb
|
64
|
+
- spec/configurations/second_configuration.yml
|
47
65
|
- spec/configurations/test_configuration.yml
|
48
66
|
- spec/konfigured_klass_spec.rb
|
49
67
|
- spec/spec_helper.rb
|
50
68
|
homepage: https://github.com/PatrickTulskie/configster
|
51
69
|
licenses: []
|
70
|
+
metadata: {}
|
52
71
|
post_install_message:
|
53
72
|
rdoc_options: []
|
54
73
|
require_paths:
|
55
74
|
- lib
|
56
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
76
|
requirements:
|
59
|
-
- -
|
77
|
+
- - ">="
|
60
78
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
79
|
+
version: 2.1.0
|
62
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
81
|
requirements:
|
65
|
-
- -
|
82
|
+
- - ">="
|
66
83
|
- !ruby/object:Gem::Version
|
67
84
|
version: '0'
|
68
85
|
requirements: []
|
69
|
-
|
70
|
-
rubygems_version: 1.8.8
|
86
|
+
rubygems_version: 3.0.3.1
|
71
87
|
signing_key:
|
72
|
-
specification_version:
|
88
|
+
specification_version: 4
|
73
89
|
summary: Configster keeps your configuration out of your application.
|
74
90
|
test_files:
|
75
91
|
- spec/configster_spec.rb
|
92
|
+
- spec/configurations/second_configuration.yml
|
76
93
|
- spec/configurations/test_configuration.yml
|
77
94
|
- spec/konfigured_klass_spec.rb
|
78
95
|
- spec/spec_helper.rb
|