chorizo 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/chorizo +3 -10
- data/lib/chorizo.rb +38 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8122032f6217f64bddafebe677c267649a4189bb351a712ffb02ef7f7ea09a0b
|
4
|
+
data.tar.gz: a28d67954f10dc25566e59f5bf4bf39066d91ccce03aa147937a36cdb83c4dc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a236652bf178508833473bb442d867cbcc1b71c5ef0278ea97d803ff085575889f8d4e772860a40c1806835351ca9ac3b99370bfb9e229246d525cc60e941d99
|
7
|
+
data.tar.gz: 0d4c56cc2348cfede81a7620574172dca751555ccdee2824b7e161975d218568d170a020690ac63603b3dd9791b6a0fde86cd27ff696449d16044385ef6f776f
|
data/bin/chorizo
CHANGED
@@ -24,13 +24,6 @@ if opts[:target] == 'heroku' && !opts[:app]
|
|
24
24
|
exit 1
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
when 'heroku'
|
31
|
-
Chorizo.new.heroku(opts[:environment], opts[:app])
|
32
|
-
else
|
33
|
-
STDERR.puts "please specify a valid target".red
|
34
|
-
puts opts
|
35
|
-
exit 1
|
36
|
-
end
|
27
|
+
Chorizo.new.run(
|
28
|
+
opts[:environment], opts, target: opts[:target], app: opts[:app]
|
29
|
+
)
|
data/lib/chorizo.rb
CHANGED
@@ -5,6 +5,9 @@ class Chorizo
|
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@host_names = %w(cloud66 heroku)
|
8
|
+
|
9
|
+
config_file = './config/chorizo.yml'
|
10
|
+
@config = YAML.load_file(config_file) if File.exist?(config_file)
|
8
11
|
end
|
9
12
|
|
10
13
|
def load_config
|
@@ -16,7 +19,7 @@ class Chorizo
|
|
16
19
|
@host_names.each do |host|
|
17
20
|
hosts[host] = hashes.delete(host) if hashes[host]
|
18
21
|
end
|
19
|
-
{ base: base, hosts: hosts, envs: hashes }
|
22
|
+
{ base: base, hosts: hosts, envs: hashes }
|
20
23
|
end
|
21
24
|
|
22
25
|
def build_output(env, host)
|
@@ -47,6 +50,40 @@ class Chorizo
|
|
47
50
|
output
|
48
51
|
end
|
49
52
|
|
53
|
+
def run(env, opts, target: nil, app: nil)
|
54
|
+
if @config
|
55
|
+
if target && target != @config[env]['target']
|
56
|
+
STDERR.puts 'WARNING: target differs from configuration'.red
|
57
|
+
end
|
58
|
+
target ||= @config[env]['target']
|
59
|
+
|
60
|
+
if app && app != @config[env]['app']
|
61
|
+
STDERR.puts 'WARNING: app differs from configuration'.red
|
62
|
+
end
|
63
|
+
app ||= @config[env]['app']
|
64
|
+
end
|
65
|
+
|
66
|
+
unless target && @host_names.include?(target)
|
67
|
+
error = "please specify a valid target [#{@host_names.join(', ')}]"
|
68
|
+
STDERR.puts(error.red)
|
69
|
+
puts opts
|
70
|
+
exit 1
|
71
|
+
end
|
72
|
+
|
73
|
+
case target
|
74
|
+
when 'cloud66'
|
75
|
+
cloud66(env)
|
76
|
+
when 'heroku'
|
77
|
+
unless app
|
78
|
+
STDERR.puts 'please specify an app for heroku'.red
|
79
|
+
puts opts
|
80
|
+
exit 1
|
81
|
+
end
|
82
|
+
|
83
|
+
heroku(env, app)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
50
87
|
def cloud66(env)
|
51
88
|
output = build_output(env, 'cloud66')
|
52
89
|
output.each do |k,v|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chorizo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Arnold
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
84
|
+
rubygems_version: 2.7.3
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: Parse and set environment variables on hosting providers
|