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 +4 -4
- data/lib/ridgepole/cli/config.rb +25 -12
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +1 -1
- data/spec/cli/config_spec.rb +14 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7eb2da59b698d8028a88d187e3bdb51d9a2e1947
|
4
|
+
data.tar.gz: a9f3355b8dac1b03970dfa414d53936813507b0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73eacc99ba04fd98a0feaf3b648b15dd36ab526792fea0bdada1b1eed7a6406b1adf46e97bdadbfcae159ff2d80ffe45da72b3d37b2b05da198ca1db836ed50e
|
7
|
+
data.tar.gz: d14691d0c2ed17afb698eaa0d5f746316f6d8145ae6c2a65cfda27c440feededc625890af10bc837fdee89568030f11f3635f9c05d7b25395d05031929ccd364
|
data/lib/ridgepole/cli/config.rb
CHANGED
@@ -2,18 +2,31 @@ require 'erb'
|
|
2
2
|
require 'yaml'
|
3
3
|
|
4
4
|
class Ridgepole::Config
|
5
|
-
|
6
|
-
config =
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
data/lib/ridgepole/version.rb
CHANGED
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', '
|
32
|
+
spec.add_development_dependency 'activerecord-mysql-awesome', '<= 0.0.4'
|
33
33
|
end
|
data/spec/cli/config_spec.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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.
|
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:
|