ridgepole 0.5.3.beta → 0.5.3.beta2

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: d6f3221edd3f0db3334b481616217bc488b28cb4
4
- data.tar.gz: fa689ed8f59a113eb1541de008812b441e191ae5
3
+ metadata.gz: 7eb2da59b698d8028a88d187e3bdb51d9a2e1947
4
+ data.tar.gz: a9f3355b8dac1b03970dfa414d53936813507b0c
5
5
  SHA512:
6
- metadata.gz: 9c6925b000bb61e97563d33f434e6c14905abbdf51262e61e1e3eaddcb5e9f18b76683a799c8e487ee185f02ce49e306926f66cfc6a83db327e86d936bad6f54
7
- data.tar.gz: 3e3c2b1a5e0a034842e7cda882c55b90773e89910a489c7077558df4e050063622b808b6c6c0e253cfdb4d8feb65a1c0fa5e5cf72dbd89e0b438bafb812bd4e2
6
+ metadata.gz: 73eacc99ba04fd98a0feaf3b648b15dd36ab526792fea0bdada1b1eed7a6406b1adf46e97bdadbfcae159ff2d80ffe45da72b3d37b2b05da198ca1db836ed50e
7
+ data.tar.gz: d14691d0c2ed17afb698eaa0d5f746316f6d8145ae6c2a65cfda27c440feededc625890af10bc837fdee89568030f11f3635f9c05d7b25395d05031929ccd364
@@ -2,18 +2,31 @@ require 'erb'
2
2
  require 'yaml'
3
3
 
4
4
  class Ridgepole::Config
5
- def self.load(config, env = 'development')
6
- config = if File.exist?(config)
7
- yaml = ERB.new(File.read(config)).result
8
- YAML.load(yaml)
9
- else
10
- YAML.load(ERB.new(config).result)
11
- end
5
+ class << self
6
+ def load(config, env = 'development')
7
+ parsed_config = if File.exist?(config)
8
+ parse_config_file(config)
9
+ else
10
+ YAML.load(ERB.new(config).result)
11
+ end
12
12
 
13
- if config.has_key?(env.to_s)
14
- config.fetch(env.to_s)
15
- else
16
- config
13
+ unless parsed_config.kind_of?(Hash)
14
+ config = File.expand_path(config)
15
+ parse_config = parse_config_file(config)
16
+ end
17
+
18
+ if parsed_config.has_key?(env.to_s)
19
+ parsed_config.fetch(env.to_s)
20
+ else
21
+ parsed_config
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def parse_config_file(path)
28
+ yaml = ERB.new(File.read(path)).result
29
+ YAML.load(yaml)
17
30
  end
18
- end
31
+ end # of class methods
19
32
  end
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.5.3.beta'
2
+ VERSION = '0.5.3.beta2'
3
3
  end
data/ridgepole.gemspec CHANGED
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'foreigner', '<= 1.7.1'
30
30
  spec.add_development_dependency 'activerecord-mysql-pkdump', '>= 0.1.0'
31
31
  spec.add_development_dependency 'migration_comments'
32
- spec.add_development_dependency 'activerecord-mysql-awesome', '>= 0.0.3'
32
+ spec.add_development_dependency 'activerecord-mysql-awesome', '<= 0.0.4'
33
33
  end
@@ -70,4 +70,18 @@ describe Ridgepole::Config do
70
70
  }
71
71
  end
72
72
  end
73
+
74
+ context 'when passed unexisting yaml' do
75
+ let(:config) {
76
+ 'database.yml'
77
+ }
78
+
79
+ let(:env) { 'development' }
80
+
81
+ it {
82
+ expect {
83
+ subject
84
+ }.to raise_error(%r|o such file or directory - .*/database.yml|)
85
+ }
86
+ end
73
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridgepole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3.beta
4
+ version: 0.5.3.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-15 00:00:00.000000000 Z
11
+ date: 2015-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -168,16 +168,16 @@ dependencies:
168
168
  name: activerecord-mysql-awesome
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '>='
171
+ - - <=
172
172
  - !ruby/object:Gem::Version
173
- version: 0.0.3
173
+ version: 0.0.4
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - '>='
178
+ - - <=
179
179
  - !ruby/object:Gem::Version
180
- version: 0.0.3
180
+ version: 0.0.4
181
181
  description: Ridgepole is a tool to manage DB schema. It defines DB schema using Rails
182
182
  DSL, and updates DB schema according to DSL.
183
183
  email: