mini-config 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 262bf26e7723a286af2f84c7d22785232e61ae7d
4
+ data.tar.gz: 7b6391a4db882b670aa063f4738fc76bf02adc69
5
+ SHA512:
6
+ metadata.gz: 0056fafceacee0f7c10d3009af69f9addf1af11560154bf20db251858b1586aac8a16cf477fa9eb7b618353fafb9bc1cb7e77a381a5b1773a5c67f5d6b91f523
7
+ data.tar.gz: 7e2e4f63f7e059e88279e85c5a7caf4412750503682b7caccf18a2a8b776799b604b6afd1a0e01dc536687d33bb41eea8d20fdc4739c126ecc68b0cd9dce0f43
data/.document ADDED
@@ -0,0 +1,3 @@
1
+ -
2
+ ChangeLog.md
3
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ Gemfile.lock
2
+ doc/
3
+ pkg/
4
+ vendor/cache/*.gem
5
+ **/.*.sw*
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.1.5
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --markup markdown --title "simple-config Documentation" --protected
data/ChangeLog.md ADDED
@@ -0,0 +1,4 @@
1
+ ### 0.1.0 / 2014-12-28
2
+
3
+ * Initial release:
4
+
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'kramdown'
7
+ gem 'pry'
8
+ gem 'cucumber', '~> 0.10.2'
9
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Joseph Weissman
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # mini-config
2
+
3
+ * [Homepage](https://rubygems.org/gems/simple-config)
4
+ * [Documentation](http://rubydoc.info/gems/simple-config/frames)
5
+ * [Email](mailto:jweissman1986 at gmail.com)
6
+
7
+ ## Description
8
+
9
+ A tiny-footprint config management thing for Ruby.
10
+
11
+ ## Features
12
+
13
+ * OpenStruct-based configuration for Ruby
14
+ * Tiny footprint (~6 loc)
15
+
16
+ ## Examples
17
+
18
+ require 'mini/config'
19
+
20
+ ExampleNamespace.configure do |en|
21
+ en.quux = 'flick'
22
+
23
+ en.x = OpenStruct.new
24
+ en.x.dx = 4
25
+ end
26
+
27
+ expect(ExampleNamespace.config.quux).to eql('flick')
28
+
29
+ ## Install
30
+
31
+ $ gem install simple-config
32
+
33
+ ## Synopsis
34
+
35
+ $ simple-config
36
+
37
+ ## Copyright
38
+
39
+ Copyright (c) 2014 Joseph Weissman
40
+
41
+ See {file:LICENSE.txt} for details.
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+
5
+ begin
6
+ require 'bundler'
7
+ rescue LoadError => e
8
+ warn e.message
9
+ warn "Run `gem install bundler` to install Bundler."
10
+ exit -1
11
+ end
12
+
13
+ begin
14
+ Bundler.setup(:development)
15
+ rescue Bundler::BundlerError => e
16
+ warn e.message
17
+ warn "Run `bundle install` to install missing gems."
18
+ exit e.status_code
19
+ end
20
+
21
+ require 'rake'
22
+
23
+ require 'rubygems/tasks'
24
+ Gem::Tasks.new
25
+
26
+ require 'rspec/core/rake_task'
27
+ RSpec::Core::RakeTask.new
28
+
29
+ task :test => :spec
30
+ task :default => :spec
31
+
32
+ require 'yard'
33
+ YARD::Rake::YardocTask.new
34
+ task :doc => :yard
35
+
36
+ require 'cucumber/rake/task'
37
+
38
+ Cucumber::Rake::Task.new do |t|
39
+ t.cucumber_opts = %w[--format pretty]
40
+ end
data/gemspec.yml ADDED
@@ -0,0 +1,14 @@
1
+ name: mini-config
2
+ summary: minimal configuration methods for ruby
3
+ description: a tiny-footprint config management thing for ruby
4
+ license: MIT
5
+ authors: Joseph Weissman
6
+ email: jweissman1986@gmail.com
7
+ homepage: https://rubygems.org/gems/mini-config
8
+
9
+ development_dependencies:
10
+ bundler: ~> 1.0
11
+ rake: ~> 0.8
12
+ rspec: ~> 2.4
13
+ rubygems-tasks: ~> 0.2
14
+ yard: ~> 0.8
@@ -0,0 +1,21 @@
1
+ require 'ostruct'
2
+ require 'mini/config/version'
3
+
4
+ module Mini::Config
5
+ def self.included(base)
6
+ base.send(:extend, ClassMethods)
7
+ end
8
+
9
+ module ClassMethods
10
+ def configure
11
+ yield config if block_given?
12
+ config
13
+ end
14
+
15
+ def config
16
+ @_configuration ||= OpenStruct.new
17
+ end
18
+ end
19
+
20
+ extend(ClassMethods)
21
+ end
@@ -0,0 +1,6 @@
1
+ module Mini
2
+ module Config
3
+ # simple-config version
4
+ VERSION = "0.1.3"
5
+ end
6
+ end
@@ -0,0 +1,60 @@
1
+ # encoding: utf-8
2
+
3
+ require 'yaml'
4
+
5
+ Gem::Specification.new do |gem|
6
+ gemspec = YAML.load_file('gemspec.yml')
7
+
8
+ gem.name = gemspec.fetch('name')
9
+ gem.version = gemspec.fetch('version') do
10
+ lib_dir = File.join(File.dirname(__FILE__),'lib')
11
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
12
+
13
+ require 'mini/config/version'
14
+ Mini::Config::VERSION
15
+ end
16
+
17
+ gem.summary = gemspec['summary']
18
+ gem.description = gemspec['description']
19
+ gem.licenses = Array(gemspec['license'])
20
+ gem.authors = Array(gemspec['authors'])
21
+ gem.email = gemspec['email']
22
+ gem.homepage = gemspec['homepage']
23
+
24
+ glob = lambda { |patterns| gem.files & Dir[*patterns] }
25
+
26
+ gem.files = `git ls-files`.split($/)
27
+ gem.files = glob[gemspec['files']] if gemspec['files']
28
+
29
+ gem.executables = gemspec.fetch('executables') do
30
+ glob['bin/*'].map { |path| File.basename(path) }
31
+ end
32
+ gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
33
+
34
+ gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
35
+ gem.test_files = glob[gemspec['test_files'] || '{test/{**/}*_test.rb']
36
+ gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
37
+
38
+ gem.require_paths = Array(gemspec.fetch('require_paths') {
39
+ %w[ext lib].select { |dir| File.directory?(dir) }
40
+ })
41
+
42
+ gem.requirements = gemspec['requirements']
43
+ gem.required_ruby_version = gemspec['required_ruby_version']
44
+ gem.required_rubygems_version = gemspec['required_rubygems_version']
45
+ gem.post_install_message = gemspec['post_install_message']
46
+
47
+ split = lambda { |string| string.split(/,\s*/) }
48
+
49
+ if gemspec['dependencies']
50
+ gemspec['dependencies'].each do |name,versions|
51
+ gem.add_dependency(name,split[versions])
52
+ end
53
+ end
54
+
55
+ if gemspec['development_dependencies']
56
+ gemspec['development_dependencies'].each do |name,versions|
57
+ gem.add_development_dependency(name,split[versions])
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ # configurate some examples
4
+ module ExampleNamespace; include Mini::Config end
5
+ module AnotherNamespace; include Mini::Config end
6
+
7
+ describe "simply configuring" do
8
+ it 'should expose an OpenStruct called #config' do
9
+ expect(ExampleNamespace.config).to be_a(OpenStruct)
10
+ end
11
+
12
+ it 'should #configure with a block' do
13
+ ExampleNamespace.configure do |en|
14
+ en.quux = 'flick'
15
+
16
+ en.x = OpenStruct.new
17
+ en.x.dx = 4
18
+ end
19
+
20
+ expect(ExampleNamespace.config.quux).to eql('flick')
21
+ expect(ExampleNamespace.config.x.dx).to eql(4)
22
+ end
23
+
24
+ it 'should not bleed between namespaces' do
25
+ ExampleNamespace.config.bar = 'baz'
26
+ AnotherNamespace.config.bar = 'foo'
27
+ expect(ExampleNamespace.config.bar).to eql('baz')
28
+ expect(AnotherNamespace.config.bar).to eql('foo')
29
+ end
30
+ end
@@ -0,0 +1,2 @@
1
+ require 'rspec'
2
+ require 'mini/config'
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mini-config
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - Joseph Weissman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubygems-tasks
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.8'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.8'
83
+ description: a tiny-footprint config management thing for ruby
84
+ email: jweissman1986@gmail.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files:
88
+ - ChangeLog.md
89
+ - LICENSE.txt
90
+ - README.md
91
+ files:
92
+ - ".document"
93
+ - ".gitignore"
94
+ - ".rspec"
95
+ - ".ruby-version"
96
+ - ".yardopts"
97
+ - ChangeLog.md
98
+ - Gemfile
99
+ - LICENSE.txt
100
+ - README.md
101
+ - Rakefile
102
+ - gemspec.yml
103
+ - lib/mini/.config.rb.swp
104
+ - lib/mini/config.rb
105
+ - lib/mini/config/.version.rb.swp
106
+ - lib/mini/config/version.rb
107
+ - mini-config.gemspec
108
+ - spec/config_spec.rb
109
+ - spec/spec_helper.rb
110
+ homepage: https://rubygems.org/gems/mini-config
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.4.3
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: minimal configuration methods for ruby
134
+ test_files: []