collapsium-config 0.1.0

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: 741381d93d430ecc5543a6078668afa243e37411
4
+ data.tar.gz: 95ede2d38dfa692e8fd280b588af56abd50038e3
5
+ SHA512:
6
+ metadata.gz: 3395ffe0c860a7b1a87c3ea302aedec670c2c59b0267c7dc2dba223a3a18e29b6c5f36b78ed28696de3000c6af7cee38493d7f7168373d09b3d4ccb5283e7451
7
+ data.tar.gz: 321173292d3886f27a0686e6286441b2d8ae104cef74a6737bf2639261cd31830870f9b6e393c71365a17cb07548501987f53a56f8a1b75001162f619261621f
data/.codeclimate.yml ADDED
@@ -0,0 +1,34 @@
1
+ ---
2
+ engines:
3
+ bundler-audit:
4
+ enabled: true
5
+ duplication:
6
+ enabled: true
7
+ exclude_fingerprints:
8
+ - d85d6f12c93d79ccd43868b8315d8816
9
+ - a8e2b4ccb258f16eda697c5f98e21823
10
+ - 442a316695836b4f4693fe3786cd3396
11
+ - 1c24bb5da72323796b645814cc006684
12
+ - 4ff1112a73f7be30ecefa7bd90fdbf5a
13
+ config:
14
+ languages:
15
+ - ruby
16
+ - javascript
17
+ - python
18
+ - php
19
+ fixme:
20
+ enabled: true
21
+ rubocop:
22
+ enabled: true
23
+ ratings:
24
+ paths:
25
+ - Gemfile.lock
26
+ - "**.inc"
27
+ - "**.js"
28
+ - "**.jsx"
29
+ - "**.module"
30
+ - "**.php"
31
+ - "**.py"
32
+ - "**.rb"
33
+ exclude_paths:
34
+ - spec/
data/.gitignore ADDED
@@ -0,0 +1,39 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalization:
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ # Gemfile.lock
32
+ # .ruby-version
33
+ # .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
37
+
38
+ # Editor files
39
+ .*.sw*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,75 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.2
3
+
4
+ # Metrics
5
+
6
+ Metrics/LineLength:
7
+ Max: 83
8
+ Details: >-
9
+ Line length of 80 is ideal for readability and compatibility; we'll accept
10
+ an extra 3 for minor edge cases.
11
+
12
+ Metrics/MethodLength:
13
+ Max: 35
14
+
15
+ Metrics/BlockNesting:
16
+ Max: 5
17
+
18
+ Metrics/AbcSize:
19
+ Max: 50
20
+
21
+ Metrics/PerceivedComplexity:
22
+ Max: 15
23
+
24
+ Metrics/CyclomaticComplexity:
25
+ Max: 15
26
+
27
+ Metrics/ClassLength:
28
+ Max: 300
29
+
30
+ Metrics/ModuleLength:
31
+ Max: 300
32
+
33
+ # Style
34
+
35
+ Style/StringLiterals:
36
+ Enabled: false
37
+
38
+ Style/ConditionalAssignment:
39
+ Enabled: false
40
+
41
+ Style/EmptyLinesAroundModuleBody:
42
+ Enabled: false
43
+
44
+ Style/AndOr:
45
+ Enabled: false
46
+
47
+ Style/Not:
48
+ Enabled: false
49
+
50
+ Style/NegatedIf:
51
+ Enabled: false
52
+
53
+ Style/RedundantReturn:
54
+ Enabled: false
55
+
56
+ Style/IfUnlessModifier:
57
+ Enabled: false
58
+
59
+ Style/TrailingCommaInLiteral:
60
+ Enabled: false
61
+
62
+ Style/FirstParameterIndentation:
63
+ Enabled: false
64
+
65
+ Style/TrailingUnderscoreVariable:
66
+ Enabled: false
67
+
68
+ Style/NumericLiterals:
69
+ Enabled: false
70
+
71
+ Style/FileName:
72
+ Enabled: false
73
+
74
+ Style/SpaceAfterNot:
75
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0
4
+ - 2.1
5
+ - 2.2
6
+ addons:
7
+ code_climate:
8
+ repo_token: 3cca4d10a51839bc5d115d41a0c12b98cbdb27a21e9c86544324fa028b799b84
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in collapsium-config.gemspec
4
+ gemspec
5
+
6
+ gem "codeclimate-test-reporter", group: :test, require: nil
data/Gemfile.lock ADDED
@@ -0,0 +1,64 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ collapsium-config (0.1.0)
5
+ collapsium (~> 0.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.2.0)
11
+ codeclimate-test-reporter (0.5.0)
12
+ simplecov (>= 0.7.1, < 1.0.0)
13
+ collapsium (0.1.0)
14
+ diff-lcs (1.2.5)
15
+ docile (1.1.5)
16
+ json (1.8.3)
17
+ parser (2.3.1.0)
18
+ ast (~> 2.2)
19
+ powerpack (0.1.1)
20
+ rainbow (2.1.0)
21
+ rake (11.1.2)
22
+ rspec (3.4.0)
23
+ rspec-core (~> 3.4.0)
24
+ rspec-expectations (~> 3.4.0)
25
+ rspec-mocks (~> 3.4.0)
26
+ rspec-core (3.4.4)
27
+ rspec-support (~> 3.4.0)
28
+ rspec-expectations (3.4.0)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.4.0)
31
+ rspec-mocks (3.4.1)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.4.0)
34
+ rspec-support (3.4.1)
35
+ rubocop (0.40.0)
36
+ parser (>= 2.3.1.0, < 3.0)
37
+ powerpack (~> 0.1)
38
+ rainbow (>= 1.99.1, < 3.0)
39
+ ruby-progressbar (~> 1.7)
40
+ unicode-display_width (~> 1.0, >= 1.0.1)
41
+ ruby-progressbar (1.8.0)
42
+ simplecov (0.11.2)
43
+ docile (~> 1.1.0)
44
+ json (~> 1.8)
45
+ simplecov-html (~> 0.10.0)
46
+ simplecov-html (0.10.0)
47
+ unicode-display_width (1.0.5)
48
+ yard (0.8.7.6)
49
+
50
+ PLATFORMS
51
+ ruby
52
+
53
+ DEPENDENCIES
54
+ bundler (~> 1.12)
55
+ codeclimate-test-reporter
56
+ collapsium-config!
57
+ rake (~> 11.1)
58
+ rspec (~> 3.4)
59
+ rubocop (~> 0.40)
60
+ simplecov (~> 0.11)
61
+ yard (~> 0.8)
62
+
63
+ BUNDLED WITH
64
+ 1.12.3
data/LICENSE ADDED
@@ -0,0 +1,30 @@
1
+ Copyright (c) Jens Finkhaeuser (http://finkhaeuser.de/) and other collapsium-config
2
+ contributors. All rights not covered below are reserved.
3
+
4
+ The MIT +no-false-attribs License (MITNFA)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to
8
+ deal in the Software without restriction, including without limitation the
9
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
+ sell copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ Distributions of all or part of the Software intended to be used by the
17
+ recipients as they would use the unmodified Software, containing modifications
18
+ that substantially alter, remove, or disable functionality of the Software,
19
+ outside of the documented configuration mechanisms provided by the Software,
20
+ shall be modified such that the Original Author's bug reporting email addresses
21
+ and urls are either replaced with the contact information of the parties
22
+ responsible for the changes, or removed entirely.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30
+ IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # collapsium-config
2
+
3
+ Using [collapsium](https://github.com/jfinkhaeuser/collapsium)'s `UberHash`
4
+ class for easy access to configuration values, this gem reads and merges
5
+ various configuration sources into one configuration object.
6
+
7
+
8
+ [![Gem Version](https://badge.fury.io/rb/collapsium-config.svg)](https://badge.fury.io/rb/collapsium-config)
9
+ [![Build status](https://travis-ci.org/jfinkhaeuser/collapsium-config.svg?branch=master)](https://travis-ci.org/jfinkhaeuser/collapsium-config)
10
+ [![Code Climate](https://codeclimate.com/github/jfinkhaeuser/collapsium-config/badges/gpa.svg)](https://codeclimate.com/github/jfinkhaeuser/collapsium-config)
11
+ [![Test Coverage](https://codeclimate.com/github/jfinkhaeuser/collapsium-config/badges/coverage.svg)](https://codeclimate.com/github/jfinkhaeuser/collapsium-config/coverage)
12
+
13
+ # Functionality
14
+
15
+ - Supports [JSON](http://www.json.org/) and [YAML](http://yaml.org/) file
16
+ formats.
17
+ - Given a main configuration file `foo.yml` to load, also loads `foo-local.yml`
18
+ if that exists, and merges it's contents recursively into the main
19
+ configuration.
20
+ - Using the special `extends` configuration key, allows a configuration Hash
21
+ to include all values from another configuration Hash.
22
+ - Using the special, top-level `include` configuration key, allows a
23
+ configuration file to be split into multiple included files.
24
+
25
+ # Usage
26
+
27
+ While you can use the `Configuration` class yourself, the simplest usage is to
28
+ access a global configuration object:
29
+
30
+ ```ruby
31
+ require 'collapsium-config'
32
+ include Collapsium::Config
33
+
34
+ puts config["foo"] # loaded automatically from config.yml
35
+ ```
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ # Rubocop
2
+ require 'rubocop/rake_task'
3
+ RuboCop::RakeTask.new(:rubocop)
4
+
5
+ # Rspec
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new(:rspec)
8
+
9
+ # Documentation
10
+ require 'yard'
11
+ YARD::Rake::YardocTask.new do |t|
12
+ t.files = ['lib/**/*.rb']
13
+ t.options = ['-m', 'markdown']
14
+ t.stats_options = ['--list-undoc']
15
+ end
16
+
17
+ # Combined test task
18
+ desc "Test all the things!"
19
+ task :test do
20
+ Rake::Task[:rubocop].invoke
21
+ Rake::Task[:rspec].invoke
22
+ end
23
+
24
+ # Default is the test task
25
+ task default: :test
@@ -0,0 +1,49 @@
1
+ # coding: utf-8
2
+ #
3
+ # collapsium-config
4
+ # https://github.com/jfinkhaeuser/collapsium-config
5
+ #
6
+ # Copyright (c) 2016 Jens Finkhaeuser and other collapsium-config contributors.
7
+ # All rights reserved.
8
+ #
9
+
10
+ lib = File.expand_path('../lib', __FILE__)
11
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
12
+ require 'collapsium-config/version'
13
+
14
+ # rubocop:disable Style/UnneededPercentQ, Style/ExtraSpacing
15
+ # rubocop:disable Style/SpaceAroundOperators
16
+ Gem::Specification.new do |spec|
17
+ spec.name = "collapsium-config"
18
+ spec.version = Collapsium::Config::VERSION
19
+ spec.authors = ["Jens Finkhaeuser"]
20
+ spec.email = ["jens@finkhaeuser.de"]
21
+ spec.description = %q(
22
+ Using collapsium's UberHash class for easy access to configuration values,
23
+ this gem reads and merges various configuration sources into one
24
+ configuration object.
25
+ )
26
+ spec.summary = %q(
27
+ Collapse multiple configuration sources into one collapsium UberHash.
28
+ )
29
+ spec.homepage = "https://github.com/jfinkhaeuser/collapsium-config"
30
+ spec.license = "MITNFA"
31
+
32
+ spec.files = `git ls-files -z`.split("\x0")
33
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
34
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
35
+ spec.require_paths = ["lib"]
36
+
37
+ spec.required_ruby_version = '>= 2.0'
38
+
39
+ spec.add_development_dependency "bundler", "~> 1.12"
40
+ spec.add_development_dependency "rubocop", "~> 0.40"
41
+ spec.add_development_dependency "rake", "~> 11.1"
42
+ spec.add_development_dependency "rspec", "~> 3.4"
43
+ spec.add_development_dependency "simplecov", "~> 0.11"
44
+ spec.add_development_dependency "yard", "~> 0.8"
45
+
46
+ spec.add_dependency 'collapsium', '~> 0.1'
47
+ end
48
+ # rubocop:enable Style/SpaceAroundOperators
49
+ # rubocop:enable Style/UnneededPercentQ, Style/ExtraSpacing
@@ -0,0 +1,51 @@
1
+ # coding: utf-8
2
+ #
3
+ # collapsium-config
4
+ # https://github.com/jfinkhaeuser/collapsium-config
5
+ #
6
+ # Copyright (c) 2016 Jens Finkhaeuser and other collapsium-config contributors.
7
+ # All rights reserved.
8
+ #
9
+
10
+ require 'collapsium-config/version'
11
+
12
+ require 'collapsium-config/configuration'
13
+
14
+ module Collapsium
15
+ # Include the Config module to get access to a #config function that provides
16
+ # access to a global configuration object.
17
+ module Config
18
+ # The default configuration file path
19
+ DEFAULT_CONFIG_PATH = 'config.yml'.freeze
20
+
21
+ ##
22
+ # Modules can have class methods, too, but it's a little more verbose to
23
+ # provide them.
24
+ module ClassMethods
25
+ # Set the configuration file
26
+ def config_file=(name)
27
+ @config_file = name
28
+ end
29
+
30
+ # @return [String] the config file path, defaulting to 'config/config.yml'
31
+ def config_file
32
+ return @config_file || DEFAULT_CONFIG_PATH
33
+ end
34
+ end # module ClassMethods
35
+ extend ClassMethods
36
+
37
+ ##
38
+ # Access the global configuration
39
+ def config
40
+ if @config.nil?
41
+ begin
42
+ @config = Configuration.load_config(Config.config_file)
43
+ rescue Errno::ENOENT
44
+ @config = {}
45
+ end
46
+ end
47
+
48
+ return @config
49
+ end
50
+ end # module Config
51
+ end # module Collapsium