kibo 0.3.3 → 0.3.4
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.
- data/bin/kibo +2 -1
- data/lib/kibo/commandline.rb +0 -1
- data/lib/kibo/commands/deploy.rb +56 -38
- data/lib/kibo/config.rb +24 -0
- data/lib/kibo/version.rb +1 -1
- data/lib/kibo.rb +1 -0
- data/man/kibo.1 +1 -1
- data/man/kibo.1.html +1 -1
- metadata +3 -3
data/bin/kibo
CHANGED
data/lib/kibo/commandline.rb
CHANGED
data/lib/kibo/commands/deploy.rb
CHANGED
@@ -10,47 +10,74 @@ module Kibo::Commands
|
|
10
10
|
h.check_missing_remotes(:error)
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ENV["ENVIRONMENT"] = Kibo.environment
|
14
|
+
|
16
15
|
#
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
# Run source commands
|
17
|
+
with_commands :source do
|
18
|
+
|
19
|
+
# create a deployment branch, if there is none yet.
|
20
|
+
in_branch "kibo.#{Kibo.environment}" do
|
21
|
+
git "merge", "master"
|
22
|
+
|
23
|
+
with_commands :deployment do
|
24
|
+
h.configured_remotes.each do |remote|
|
25
|
+
deploy_remote! remote
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
26
29
|
end
|
27
|
-
|
28
|
-
W "Deployment succeeded."
|
29
|
-
run_commands Kibo.config.deployment["post"]
|
30
30
|
rescue StandardError
|
31
31
|
W $!
|
32
32
|
raise
|
33
|
-
ensure
|
34
|
-
unless current_branch == "master"
|
35
|
-
git "reset", "--hard"
|
36
|
-
git "checkout", "master"
|
37
|
-
end
|
38
33
|
end
|
39
34
|
|
40
35
|
private
|
36
|
+
|
37
|
+
def with_commands(sym, &block)
|
38
|
+
commands_hash = Kibo.config.send(sym) || {}
|
39
|
+
|
40
|
+
run = lambda { |key|
|
41
|
+
next unless commands = commands_hash[key]
|
42
|
+
|
43
|
+
W "Running #{sym}.#{key} commands"
|
44
|
+
[ *commands ].each do |command|
|
45
|
+
Kibo::System.sh! command
|
46
|
+
end
|
47
|
+
}
|
48
|
+
|
49
|
+
run.call("pre")
|
50
|
+
|
51
|
+
yield
|
52
|
+
|
53
|
+
run.call("success")
|
54
|
+
ensure
|
55
|
+
run.call("final")
|
56
|
+
end
|
41
57
|
|
42
|
-
|
43
|
-
|
44
|
-
|
58
|
+
#
|
59
|
+
# checkout the branch +name+, create it if necessary.
|
60
|
+
def in_branch(name, &block)
|
61
|
+
previous_branch = current_branch
|
62
|
+
|
63
|
+
if name != previous_branch
|
64
|
+
git "branch", name unless branches.include?(name)
|
65
|
+
git "checkout", name
|
45
66
|
end
|
46
67
|
|
47
|
-
|
68
|
+
yield
|
69
|
+
rescue StandardError
|
70
|
+
STDERR.puts $!
|
71
|
+
raise
|
72
|
+
ensure
|
73
|
+
unless current_branch == previous_branch
|
74
|
+
git "reset", "--hard"
|
75
|
+
git "checkout", previous_branch
|
76
|
+
end
|
48
77
|
end
|
49
|
-
|
78
|
+
|
50
79
|
def current_branch
|
51
|
-
`git
|
52
|
-
line =~ /^* /
|
53
|
-
end.sub(/^\* /, "")
|
80
|
+
`git rev-parse --abbrev-ref HEAD`.chomp
|
54
81
|
end
|
55
82
|
|
56
83
|
def branches
|
@@ -59,15 +86,6 @@ module Kibo::Commands
|
|
59
86
|
end
|
60
87
|
|
61
88
|
def deploy_remote!(remote)
|
62
|
-
git "push", remote, "HEAD:master"
|
63
|
-
end
|
64
|
-
|
65
|
-
def run_commands(commands)
|
66
|
-
return unless commands
|
67
|
-
commands = [ commands ] if commands.is_a?(String)
|
68
|
-
|
69
|
-
commands.each do |command|
|
70
|
-
Kibo::System.sh! command
|
71
|
-
end
|
89
|
+
git "push", "--force", remote, "HEAD:master"
|
72
90
|
end
|
73
91
|
end
|
data/lib/kibo/config.rb
CHANGED
@@ -55,6 +55,8 @@ class Kibo::Config
|
|
55
55
|
W "No such file", path
|
56
56
|
end
|
57
57
|
|
58
|
+
verify_version!
|
59
|
+
|
58
60
|
@procfile = Kibo::Configfile.new(self["procfile"])
|
59
61
|
end
|
60
62
|
|
@@ -66,6 +68,23 @@ class Kibo::Config
|
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
71
|
+
def verify_version!
|
72
|
+
return unless self["version"]
|
73
|
+
|
74
|
+
files_version = self["version"].split(".").map(&:to_i)
|
75
|
+
kibos_version = Kibo::VERSION.split(".").map(&:to_i)
|
76
|
+
|
77
|
+
files_version.zip(kibos_version).each do |files, kibos|
|
78
|
+
next if kibos == files
|
79
|
+
if kibos > files
|
80
|
+
W "The Kibofile requires kibo version #{self["version"]}. You have #{Kibo::VERSION}... this might work."
|
81
|
+
return
|
82
|
+
end
|
83
|
+
|
84
|
+
E "The Kibofile requires kibo version #{self["version"]}. You have #{Kibo::VERSION}."
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
69
88
|
#
|
70
89
|
# we need namespace-ENVIRONMENT-process<1>
|
71
90
|
|
@@ -78,6 +97,11 @@ class Kibo::Config
|
|
78
97
|
def deployment
|
79
98
|
self["deployment"] || {}
|
80
99
|
end
|
100
|
+
|
101
|
+
# returns source specific configuration
|
102
|
+
def source
|
103
|
+
self["source"] || {}
|
104
|
+
end
|
81
105
|
|
82
106
|
# returns the heroku namespace
|
83
107
|
def namespace
|
data/lib/kibo/version.rb
CHANGED
data/lib/kibo.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.3.
|
4
|
+
version: 0.3.4
|
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-09-
|
12
|
+
date: 2012-09-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: trollop
|
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
segments:
|
129
129
|
- 0
|
130
|
-
hash:
|
130
|
+
hash: -3856345431074645108
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
none: false
|
133
133
|
requirements:
|