quandl-config 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a3cca55c40f62a3eca8df8738f83c8b6ead5ce0
4
- data.tar.gz: 63430d6469186f7d55b3ee506a8ad1d57348bfa3
3
+ metadata.gz: 403c3cbaabc16054de24a43fc59bffc6e3a3c13c
4
+ data.tar.gz: c88b13a483cd007997e25a4c40c861f9333911ff
5
5
  SHA512:
6
- metadata.gz: 208100692c3dca50c45a3c65e216c35b7fd90674f7dd24370329879c123d8504bf3c55d260a66430c9ef9ea5463d0c7c92b562fb7fb0cd69d36724b4839cb97d
7
- data.tar.gz: ecf124e2b1c73f190a84473ad27d1156f9f90a0a37409f5bb7c1e2ad2125aca67eca703ac9fb3dc32deeec2d67db1e97c52ddf913c8e30b9467db42698225a3e
6
+ metadata.gz: 09ae2b94937905c73ecd90c05acb8bdd2987cac21faa7b612b5dc0422bdcff800ad6cccdb243ebdc08f44b6a03ba985a7a8a2c4ac37df9bd866d9829352c0a9f
7
+ data.tar.gz: 8abac3e2cd3051478a54d6c78ee1e7231e6961869f0f2ce26c301505554e3750495594458c78d4b2f061175a9381dc8c0b27e6c092943233f6d8a2370b6ea1cf
data/lib/quandl/config.rb CHANGED
@@ -4,13 +4,16 @@ require 'quandl/project_root'
4
4
 
5
5
  module Quandl
6
6
  class Config < ::OpenStruct
7
- VERSION = '0.0.3'
7
+ VERSION = '0.0.4'
8
8
 
9
- def initialize(file_name)
9
+ def initialize(file_name, options = {})
10
10
  raw_config = File.read(project_root.join('config', "#{file_name}.yml"))
11
11
  erb_config = ERB.new(raw_config).result
12
12
  config = YAML.load(erb_config)[project_environment]
13
13
 
14
+ @_root = options.delete(:root_path)
15
+ @_environment = options.delete(:environment)
16
+
14
17
  super(config)
15
18
  end
16
19
 
@@ -23,11 +26,11 @@ module Quandl
23
26
  private
24
27
 
25
28
  def project_root
26
- defined?(Rails) ? ::Rails.root : Pathname.new(ProjectRoot.root)
29
+ @_root ||= defined?(Rails) ? ::Rails.root : Pathname.new(ProjectRoot.root)
27
30
  end
28
31
 
29
32
  def project_environment
30
- defined?(Rails) ? ::Rails.env : (ENV['RAILS_ENV'] || ENV['RAKE_ENV'] || ENV['QUANDL_ENV'] || 'default')
33
+ @_environment ||= defined?(Rails) ? ::Rails.env : (ENV['RAILS_ENV'] || ENV['RAKE_ENV'] || ENV['QUANDL_ENV'] || 'default')
31
34
  end
32
35
  end
33
36
  end
@@ -3,7 +3,7 @@ require 'active_support/inflector'
3
3
  module Quandl
4
4
  module Configurable
5
5
  def configuration
6
- @configuration ||= Config.new(file_name)
6
+ @configuration ||= Config.new(file_name, configuration_options)
7
7
  end
8
8
 
9
9
  private
@@ -11,5 +11,9 @@ module Quandl
11
11
  def file_name
12
12
  defined?(name) ? name.underscore : self.class.name.underscore
13
13
  end
14
+
15
+ def configuration_options
16
+ {}
17
+ end
14
18
  end
15
19
  end
@@ -17,15 +17,15 @@ module Quandl
17
17
  def self.ascend_until
18
18
  fs = File::SEPARATOR
19
19
  escaped_slash = "\\#{fs}"
20
- special = "_ESCAPED_SLASH_"
21
- project_path = File.expand_path(".")
20
+ special = '_ESCAPED_SLASH_'
21
+ project_path = File.expand_path('.')
22
22
  parts = project_path.gsub(escaped_slash, special).squeeze(fs).split(fs).map do |x|
23
23
  x.gsub(special, escaped_slash)
24
24
  end
25
25
 
26
26
  until parts.empty?
27
27
  path = parts.join(fs)
28
- path = fs if path == ""
28
+ path = fs if path == ''
29
29
  return path if yield(path)
30
30
  parts.pop
31
31
  end
@@ -1,5 +1,5 @@
1
1
  Rails = Class.new do
2
- require "#{File.dirname(__FILE__)}/dummy_app/fake"
2
+ require_relative 'fake'
3
3
 
4
4
  def self.root
5
5
  Pathname.new(File.dirname(__FILE__))
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Najwa Azer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-23 00:00:00.000000000 Z
11
+ date: 2015-07-15 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -136,45 +150,25 @@ dependencies:
136
150
  - - ">="
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: activesupport
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :runtime
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- description: Openstruct-based per-class configuration.
153
+ description: Load ERB-based YML files into open OpenStruct objects for ease of use.
154
154
  email:
155
155
  - najwa.azer@gmail.com
156
156
  executables: []
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
- - ".gitignore"
161
- - ".rubocop.yml"
162
- - Gemfile
163
- - Guardfile
164
160
  - LICENSE.txt
165
161
  - README.md
166
- - Rakefile
167
162
  - lib/quandl/config.rb
168
163
  - lib/quandl/configurable.rb
169
164
  - lib/quandl/project_root.rb
170
- - quandl-config.gemspec
171
165
  - spec/fixtures/dummy_rails_app/application.rb
172
166
  - spec/fixtures/dummy_rails_app/config/fake.yml
173
167
  - spec/fixtures/dummy_rails_app/fake.rb
174
168
  - spec/quandl/quandl-config_spec.rb
175
169
  - spec/quandl/quandl-configurable_spec.rb
176
170
  - spec/spec_helper.rb
177
- homepage: ''
171
+ homepage: https://github.com/quandl/quandl-config
178
172
  licenses:
179
173
  - MIT
180
174
  metadata: {}
@@ -194,10 +188,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
188
  version: '0'
195
189
  requirements: []
196
190
  rubyforge_project:
197
- rubygems_version: 2.4.5
191
+ rubygems_version: 2.4.8
198
192
  signing_key:
199
193
  specification_version: 4
200
- summary: Openstruct-based per-class configuration.
194
+ summary: OpenStruct-based per-class configuration.
201
195
  test_files:
202
196
  - spec/fixtures/dummy_rails_app/application.rb
203
197
  - spec/fixtures/dummy_rails_app/config/fake.yml
@@ -205,3 +199,4 @@ test_files:
205
199
  - spec/quandl/quandl-config_spec.rb
206
200
  - spec/quandl/quandl-configurable_spec.rb
207
201
  - spec/spec_helper.rb
202
+ has_rdoc:
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
data/.rubocop.yml DELETED
@@ -1,6 +0,0 @@
1
- LineLength:
2
- Max: 150
3
- Documentation:
4
- Enabled: false
5
- FileName:
6
- Enabled: false
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in quandl-config.gemspec
4
- gemspec
data/Guardfile DELETED
@@ -1,11 +0,0 @@
1
- guard 'rspec' do
2
- # watch /lib/ files
3
- watch(%r{^lib/(.+).rb$}) do |m|
4
- "spec/#{m[1]}_spec.rb"
5
- end
6
-
7
- # watch /spec/ files
8
- watch(%r{^spec/(.+).rb$}) do |m|
9
- "spec/#{m[1]}.rb"
10
- end
11
- end
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require 'rspec/core/rake_task'
2
- require 'bundler/gem_tasks'
3
-
4
- # Default directory to look in is `/specs`
5
- # Run with `rake spec`
6
- RSpec::Core::RakeTask.new(:spec) do |task|
7
- task.rspec_opts = ['--color', '--format', 'documentation']
8
- end
9
-
10
- task default: :spec
@@ -1,31 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'quandl/config'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'quandl-config'
8
- spec.version = Quandl::Config::VERSION
9
- spec.authors = ['Najwa Azer']
10
- spec.email = ['najwa.azer@gmail.com']
11
- spec.summary = 'Openstruct-based per-class configuration.'
12
- spec.description = 'Openstruct-based per-class configuration.'
13
- spec.homepage = ''
14
- spec.license = 'MIT'
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(/^(test|spec|features)\//)
19
- spec.require_paths = ['lib']
20
-
21
- spec.add_development_dependency 'bundler', '~> 1.6'
22
- spec.add_development_dependency 'rake'
23
- spec.add_development_dependency 'rspec'
24
- spec.add_development_dependency 'rspec-nc'
25
- spec.add_development_dependency 'guard'
26
- spec.add_development_dependency 'guard-rspec'
27
- spec.add_development_dependency 'pry'
28
- spec.add_development_dependency 'pry-remote'
29
- spec.add_development_dependency 'pry-nav'
30
- spec.add_runtime_dependency 'activesupport'
31
- end