acclimate 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afef825e7d4cfbca7f8904fa47a080fd83180df6
4
- data.tar.gz: e3ded2d6fb6abcf8ee0f1f452f9ce75666bb8dd7
3
+ metadata.gz: 973b34f7b1806ac68c6404ab0fc36dc9a06c5f91
4
+ data.tar.gz: 7e5fbb219ec3f766c02b3d3fba09fe0bfd82ea6b
5
5
  SHA512:
6
- metadata.gz: 266b1c62853e24fef875cd348ed9721948b613b4766edb2857b20c85b4f219b882521e0b6126429d2cd6e7cd4c48c19b9dbb0be1047d57ad804e033c3ca9eef9
7
- data.tar.gz: 419bd4a87a130f610cd03793b276ce91b18f773a460313dd4da80b1e8ae4604f1bf72ccbf494d53b502d9cf2546702da0bd9a9d451259ade74f1712a1f41a936
6
+ metadata.gz: 31177a678d428c75ce5d92a31b90321a245feb5e946b5b490de85dfab9a6ca42180fc6ded7de7ac521472d3588c70ce7406ed0f29580785a20e59fae0ff32390
7
+ data.tar.gz: 70dd76895bf56d3a7fe63d383e1b32e48eb1bcd6d8ccbef8561249ae4e461df94df766f84bc1edc451448fb636687def48349906f06ea176e5b3a55d18e085b9
@@ -17,12 +17,16 @@ module Acclimate
17
17
 
18
18
  attr_reader :options
19
19
 
20
+ def base_path
21
+ Pathname.new( Dir.pwd )
22
+ end
23
+
20
24
  def config
21
- @config = config_klass.new( options )
25
+ @config = config_klass.load( options )
22
26
  end
23
27
 
24
- def base_path
25
- Pathname.new( Dir.pwd )
28
+ def config_filepath
29
+ config_klass.config_filepath
26
30
  end
27
31
 
28
32
  def config_klass
@@ -1,18 +1,44 @@
1
1
  require 'hashie'
2
+ require 'pathname'
3
+ require 'yaml'
2
4
 
3
5
  module Acclimate
4
6
  class Configuration < Hashie::Mash
5
7
 
6
- def initialize( options={} )
7
- super( options )
8
+ def self.load( options={} )
9
+ new( file_options.merge( options ))
10
+ end
11
+
12
+ def self.config_filepath
13
+ end
14
+
15
+ def config_filepath
16
+ Pathname.new( self.class.config_filepath )
8
17
  end
9
18
 
10
19
  def slice( *keys )
11
20
  klass.new( select { |k,v| keys.map( &:to_s ).include?( k ) } )
12
21
  end
13
22
 
23
+ def for_env
24
+ return Hashie::Mash.new({}) unless env
25
+ self[env]
26
+ end
27
+
14
28
  protected
15
29
 
30
+ def self.file_options
31
+ return {} unless config_filepath
32
+
33
+ File.exists?( config_filepath ) ?
34
+ load_file_options :
35
+ {}
36
+ end
37
+
38
+ def self.load_file_options
39
+ YAML::load( File.read( config_filepath ))
40
+ end
41
+
16
42
  def klass
17
43
  self.class
18
44
  end
@@ -1,3 +1,3 @@
1
1
  module Acclimate
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/acclimate.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require "acclimate/version"
2
- require 'pry-debugger'
3
2
  require 'rainbow'
4
3
  require 'thor'
5
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acclimate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - C. Jason Harrelson (midas )
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-09 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler