kibo 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kibo/commands/runner.rb +35 -0
- data/lib/kibo/commands/setup.rb +13 -9
- data/lib/kibo/version.rb +1 -1
- data/man/kibo.1 +1 -1
- data/man/kibo.1.html +1 -1
- metadata +4 -4
- data/lib/kibo/commands/heroku_runner.rb +0 -16
@@ -0,0 +1,35 @@
|
|
1
|
+
# --spin up/spin down remotes
|
2
|
+
module Kibo::Commands
|
3
|
+
subcommand :per_instance, "run a command once on each heroku instances"
|
4
|
+
subcommand :per_role, "run a command once on each heroku role"
|
5
|
+
|
6
|
+
def per_instance
|
7
|
+
if configured_instances.empty?
|
8
|
+
E "No configured_instances in '#{Kibo.environment}' environment."
|
9
|
+
end
|
10
|
+
|
11
|
+
configured_instances.each do |instance|
|
12
|
+
cmd = [ "heroku", *ARGV, "--app", instance ]
|
13
|
+
W cmd.join(" ")
|
14
|
+
system *cmd
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def per_role
|
19
|
+
if configured_instances.empty?
|
20
|
+
E "No configured_instances in '#{Kibo.environment}' environment."
|
21
|
+
end
|
22
|
+
|
23
|
+
configured_roles = configured_instances.group_by do |name|
|
24
|
+
name.split("-").last.sub(/\d+$/, "")
|
25
|
+
end
|
26
|
+
|
27
|
+
instances = configured_roles.values.first
|
28
|
+
|
29
|
+
instances.each do |instance|
|
30
|
+
cmd = [ "heroku", *ARGV, "--app", instance ]
|
31
|
+
W cmd.join(" ")
|
32
|
+
system *cmd
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/kibo/commands/setup.rb
CHANGED
@@ -50,8 +50,18 @@ module Kibo::Commands
|
|
50
50
|
|
51
51
|
true
|
52
52
|
end
|
53
|
+
|
54
|
+
def list_heroku(what, instance)
|
55
|
+
heroku!(what, "--app", instance, :quiet).
|
56
|
+
split("\n").
|
57
|
+
reject { |line| line =~ /^=== / }.
|
58
|
+
map { |line| line.split(/\s+/).first }
|
59
|
+
end
|
53
60
|
|
54
61
|
def share_instance(instance)
|
62
|
+
existing_sharings = list_heroku("sharing", instance)
|
63
|
+
|
64
|
+
missing_sharings = Kibo.config.sharing - existing_sharings
|
55
65
|
Kibo.config.sharing.each do |email|
|
56
66
|
heroku! "sharing:add", email, "--app", instance
|
57
67
|
end
|
@@ -60,16 +70,10 @@ module Kibo::Commands
|
|
60
70
|
def provide_instance(instance)
|
61
71
|
partial_instance_name = instance.split("-").last # e.g. "web1"
|
62
72
|
|
63
|
-
|
64
|
-
|
65
|
-
existing_instance_addons =
|
66
|
-
heroku("addons", "--app", instance, :quiet).
|
67
|
-
split("\n").
|
68
|
-
map do |line|
|
69
|
-
next if line =~ /^=== /
|
70
|
-
line.split(/\s+/).first
|
71
|
-
end.compact
|
73
|
+
instance_addons = Kibo.config.addons[partial_instance_name] || []
|
74
|
+
return if instance_addons.empty?
|
72
75
|
|
76
|
+
existing_instance_addons = list_heroku("addons", instance)
|
73
77
|
W "[#{instance}] addons", *existing_instance_addons
|
74
78
|
|
75
79
|
missing = instance_addons - existing_instance_addons
|
data/lib/kibo/version.rb
CHANGED
data/man/kibo.1
CHANGED
data/man/kibo.1.html
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kibo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: trollop
|
@@ -147,9 +147,9 @@ files:
|
|
147
147
|
- lib/kibo/commands/deploy.rb
|
148
148
|
- lib/kibo/commands/generate.rb
|
149
149
|
- lib/kibo/commands/helpers.rb
|
150
|
-
- lib/kibo/commands/heroku_runner.rb
|
151
150
|
- lib/kibo/commands/info.rb
|
152
151
|
- lib/kibo/commands/logs.rb
|
152
|
+
- lib/kibo/commands/runner.rb
|
153
153
|
- lib/kibo/commands/setup.rb
|
154
154
|
- lib/kibo/commands/spin.rb
|
155
155
|
- lib/kibo/config.rb
|
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
segments:
|
183
183
|
- 0
|
184
|
-
hash:
|
184
|
+
hash: 2596876848082864488
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
186
|
none: false
|
187
187
|
requirements:
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# --spin up/spin down remotes
|
2
|
-
module Kibo::Commands
|
3
|
-
subcommand :heroku, "run a command on all heroku instances"
|
4
|
-
|
5
|
-
def heroku
|
6
|
-
if configured_instances.empty?
|
7
|
-
E "No configured_instances in '#{Kibo.environment}' environment."
|
8
|
-
end
|
9
|
-
|
10
|
-
configured_instances.each do |instance|
|
11
|
-
cmd = [ "heroku", *ARGV, "--app", instance ]
|
12
|
-
W cmd.join(" ")
|
13
|
-
system *cmd
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|