yambol 1.0.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/.coveralls.yml +1 -0
- data/.gitignore +17 -0
- data/.travis.yml +11 -0
- data/Gemfile +6 -0
- data/Guardfile +28 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +7 -0
- data/lib/yambol.rb +23 -0
- data/lib/yambol/version.rb +3 -0
- data/lib/yambol/yambol.rb +0 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/yambol_spec.rb +31 -0
- data/spec/yambol_test.yml +10 -0
- data/yambol.gemspec +27 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 46c2b3a093d1068529de0d9f1a553e7581026900
|
4
|
+
data.tar.gz: 4b42ea1bce62c384dc7c0511198c8a360b6def27
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 54e240ce8cd624212479163eca87cd1e1c4693cf68e587fbbd8febbcb4ebb73441a1dc4d8aae8e2730ac39db7becfff21446e036505e417c9f0ea2da0cbbdd26
|
7
|
+
data.tar.gz: 2e9d7e427a5111e1de39c5e1a2e3e861fa4c64b07deea0c893438bf086c585ca9ac1f465ab7c9bcf4e29c6b23cff3444cee7584d9cd7a441edfc66287355ecd8
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :minitest do
|
5
|
+
# with Minitest::Unit
|
6
|
+
watch(%r{^test/(.*)\/?test_(.*)\.rb})
|
7
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
8
|
+
watch(%r{^test/test_helper\.rb}) { 'test' }
|
9
|
+
|
10
|
+
# with Minitest::Spec
|
11
|
+
# watch(%r{^spec/(.*)_spec\.rb})
|
12
|
+
# watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
|
13
|
+
# watch(%r{^spec/spec_helper\.rb}) { 'spec' }
|
14
|
+
|
15
|
+
# Rails 4
|
16
|
+
# watch(%r{^app/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
|
17
|
+
# watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' }
|
18
|
+
# watch(%r{^app/controllers/(.+)_controller\.rb}) { |m| "test/integration/#{m[1]}_test.rb" }
|
19
|
+
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
|
20
|
+
# watch(%r{^lib/(.+)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
|
21
|
+
# watch(%r{^test/.+_test\.rb})
|
22
|
+
# watch(%r{^test/test_helper\.rb}) { 'test' }
|
23
|
+
|
24
|
+
# Rails < 4
|
25
|
+
# watch(%r{^app/controllers/(.*)\.rb}) { |m| "test/functional/#{m[1]}_test.rb" }
|
26
|
+
# watch(%r{^app/helpers/(.*)\.rb}) { |m| "test/helpers/#{m[1]}_test.rb" }
|
27
|
+
# watch(%r{^app/models/(.*)\.rb}) { |m| "test/unit/#{m[1]}_test.rb" }
|
28
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Jacob Stetser
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Yambol
|
2
|
+
|
3
|
+
[](http://allthebadges.io/wideopenspaces/yambol/badge_fury)
|
4
|
+
[](http://allthebadges.io/wideopenspaces/yambol/gemnasium)
|
5
|
+
[](http://allthebadges.io/wideopenspaces/yambol/travis)
|
6
|
+
[](http://allthebadges.io/wideopenspaces/yambol/coveralls)
|
7
|
+
[](http://allthebadges.io/wideopenspaces/yambol/code_climate)
|
8
|
+
|
9
|
+
Load YAML files with symbolized keys. Simple. Easy.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'yambol'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install yambol
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
TODO: Write usage instructions here
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/yambol.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'yambol/version'
|
2
|
+
|
3
|
+
module Yambol
|
4
|
+
def self.load_file(file)
|
5
|
+
symbolize_keys(::YAML.load_file(file))
|
6
|
+
end
|
7
|
+
|
8
|
+
# owes a debt to http://devblog.avdi.org/2009/07/14/recursively-symbolize-keys/
|
9
|
+
def self.symbolize_keys(hash)
|
10
|
+
hash.inject({}){ |result, (key, value)|
|
11
|
+
result.store converted_key(key), converted_value(value)
|
12
|
+
result
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.converted_key(key)
|
17
|
+
key.is_a?(String) ? key.to_sym : key
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.converted_value(value)
|
21
|
+
value.is_a?(Hash) ? symbolize_keys(value) : value
|
22
|
+
end
|
23
|
+
end
|
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
if ENV['CI']
|
2
|
+
require 'coveralls'
|
3
|
+
Coveralls.wear! do
|
4
|
+
add_filter "/spec"
|
5
|
+
end
|
6
|
+
else
|
7
|
+
require 'simplecov'
|
8
|
+
SimpleCov.start do
|
9
|
+
add_filter "/spec"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'yambol'
|
14
|
+
require 'minitest'
|
15
|
+
require 'minitest/autorun'
|
16
|
+
require 'minitest/spec'
|
17
|
+
require 'minitest/pride'
|
18
|
+
require 'minitest/hell'
|
19
|
+
|
20
|
+
require 'minitest-spec-context'
|
21
|
+
|
data/spec/yambol_spec.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Yambol do
|
4
|
+
context 'when loading a file' do
|
5
|
+
subject { Yambol.load_file('./spec/yambol_test.yml') }
|
6
|
+
|
7
|
+
it 'has a key called :test' do
|
8
|
+
subject.has_key?(:test).must_equal true
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'does not have a key called "test"' do
|
12
|
+
subject.has_key?('test').wont_equal true
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'correctly loads list items' do
|
16
|
+
subject[:test][:one][:items].must_equal %w(first second third)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'correctly loads numeric items' do
|
20
|
+
subject[:test][:one][:number].must_equal 1
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'does not modify pre-existing symbols' do
|
24
|
+
subject[:test][:two][:symbol].must_equal 'cymbal'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'does not modify values that are symbols' do
|
28
|
+
subject[:test][:two][:cymbal].must_equal :symbol
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/yambol.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'yambol/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "yambol"
|
8
|
+
spec.version = Yambol::VERSION
|
9
|
+
spec.authors = ['Jacob Stetser']
|
10
|
+
spec.email = ['jake@wideopenspac.es']
|
11
|
+
spec.description = %q{Load YAML files with symbolized keys. Simple. Easy}
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = 'https://github.com/wideopenspaces/yambol'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'guard'
|
24
|
+
spec.add_development_dependency 'guard-minitest'
|
25
|
+
spec.add_development_dependency 'minitest', '~> 5.0.0'
|
26
|
+
spec.add_development_dependency 'minitest-spec-context'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yambol
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jacob Stetser
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-12 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.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
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'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 5.0.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 5.0.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: minitest-spec-context
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Load YAML files with symbolized keys. Simple. Easy
|
98
|
+
email:
|
99
|
+
- jake@wideopenspac.es
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- .coveralls.yml
|
105
|
+
- .gitignore
|
106
|
+
- .travis.yml
|
107
|
+
- Gemfile
|
108
|
+
- Guardfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- lib/yambol.rb
|
113
|
+
- lib/yambol/version.rb
|
114
|
+
- lib/yambol/yambol.rb
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
- spec/yambol_spec.rb
|
117
|
+
- spec/yambol_test.yml
|
118
|
+
- yambol.gemspec
|
119
|
+
homepage: https://github.com/wideopenspaces/yambol
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.0.3
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: Load YAML files with symbolized keys. Simple. Easy
|
143
|
+
test_files:
|
144
|
+
- spec/spec_helper.rb
|
145
|
+
- spec/yambol_spec.rb
|
146
|
+
- spec/yambol_test.yml
|
147
|
+
has_rdoc:
|