bard 0.22.2 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/bard.rb +39 -23
- data/lib/bard/capistrano.rb +1 -1
- data/lib/bard/error.rb +1 -1
- data/lib/bard/git.rb +5 -2
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc1c6c9dceac8bcf010f8f0fbcbdf9b6678d21f1
|
4
|
+
data.tar.gz: 2d4b58d4760e2c1c22fc4a1d74cb0c24bacbd567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5437ee43af1d313b7712c4e86def8311dd67bae1a90082d6170645030a62d7f6a133f55da4d321f01360c86fd04601aa61c49198b40ff5e38d64f3a40a429c0
|
7
|
+
data.tar.gz: edb8cdb7ce7b8d60eff67b6f4d5fe57a0d1e80e78da93ef8f8bcaa91df4aadc5c043af243097f3ffee3009300d8204891b1a39c86fd9fc1ab4f79b36abee7bdb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.23.0
|
data/lib/bard.rb
CHANGED
@@ -35,8 +35,7 @@ class Bard::CLI < Thor
|
|
35
35
|
method_options %w( verbose -v ) => :boolean
|
36
36
|
desc "push", "push local changes out to the remote"
|
37
37
|
def push
|
38
|
-
|
39
|
-
run_crucial "git push origin #{current_branch}", true
|
38
|
+
run_crucial "git push -u origin #{current_branch}", true
|
40
39
|
end
|
41
40
|
|
42
41
|
method_options %w( verbose -v ) => :boolean
|
@@ -50,23 +49,32 @@ class Bard::CLI < Thor
|
|
50
49
|
end
|
51
50
|
|
52
51
|
method_options %w( verbose -v ) => :boolean
|
53
|
-
desc "deploy", "
|
52
|
+
desc "deploy", "checks that branch is a ff with master, checks with ci, and then merges into master and deploys to production, and deletes branch."
|
54
53
|
def deploy
|
55
|
-
|
54
|
+
branch = current_branch
|
55
|
+
|
56
|
+
run_crucial "git fetch origin"
|
57
|
+
raise MasterNonFastForwardError if not fast_forward_merge? "origin/master", "master"
|
58
|
+
|
59
|
+
if branch == "master"
|
60
|
+
run_crucial "git push origin master"
|
61
|
+
invoke :ci
|
56
62
|
|
57
|
-
|
58
|
-
run_crucial "git fetch origin"
|
63
|
+
else
|
59
64
|
run_crucial "git checkout master"
|
60
|
-
run_crucial "git
|
61
|
-
|
65
|
+
run_crucial "git merge origin/master"
|
66
|
+
run_crucial "git checkout #{branch}"
|
67
|
+
raise MasterNonFastForwardError if not fast_forward_merge? "master", branch
|
68
|
+
|
69
|
+
run_crucial "git push -f origin #{branch}"
|
62
70
|
|
63
|
-
|
71
|
+
invoke :ci, current_sha
|
72
|
+
|
73
|
+
run_crucial "git checkout master"
|
74
|
+
run_crucial "git merge #{branch}"
|
64
75
|
run_crucial "git push origin master"
|
65
|
-
run_crucial "git checkout integration"
|
66
76
|
end
|
67
77
|
|
68
|
-
invoke :ci
|
69
|
-
|
70
78
|
if heroku?
|
71
79
|
run_crucial "git push production master", options.verbose?
|
72
80
|
run_crucial "heroku run rake bootstrap:production:post", options.verbose?
|
@@ -75,17 +83,23 @@ class Bard::CLI < Thor
|
|
75
83
|
end
|
76
84
|
|
77
85
|
puts green("Deploy Succeeded")
|
86
|
+
|
87
|
+
if branch != "master"
|
88
|
+
puts "Deleting branch: #{branch}"
|
89
|
+
run_crucial "git push --delete origin #{branch}"
|
90
|
+
run_crucial "git branch -d #{branch}"
|
91
|
+
end
|
78
92
|
end
|
79
93
|
|
80
94
|
method_options %w( verbose -v ) => :boolean
|
81
|
-
desc "ci", "runs ci against
|
82
|
-
def ci
|
95
|
+
desc "ci", "runs ci against current HEAD"
|
96
|
+
def ci sha=current_sha
|
83
97
|
return unless has_ci?
|
84
98
|
|
85
|
-
puts "Continuous integration: starting build..."
|
99
|
+
puts "Continuous integration: starting build on #{sha}..."
|
86
100
|
last_build_number = get_last_build_number
|
87
101
|
last_time_elapsed = get_last_time_elapsed
|
88
|
-
start_ci
|
102
|
+
start_ci sha
|
89
103
|
sleep(2) while last_build_number == get_last_build_number
|
90
104
|
|
91
105
|
start_time = Time.new.to_i
|
@@ -117,16 +131,12 @@ class Bard::CLI < Thor
|
|
117
131
|
when /<result>SUCCESS<\/result>/ then
|
118
132
|
puts "Continuous integration: success! deploying to production"
|
119
133
|
|
120
|
-
else raise "Unknown response from CI server
|
134
|
+
else raise "Unknown response from CI server: #{response}"
|
121
135
|
end
|
122
136
|
end
|
123
137
|
|
124
138
|
private
|
125
139
|
|
126
|
-
def has_integration_branch?
|
127
|
-
system 'git show-ref --verify --quiet "refs/heads/integration"'
|
128
|
-
end
|
129
|
-
|
130
140
|
def heroku?
|
131
141
|
`git remote -v`.include? "production\tgit@heroku.com:"
|
132
142
|
end
|
@@ -139,8 +149,14 @@ class Bard::CLI < Thor
|
|
139
149
|
`curl -s -I #{ci_host}/?token=botandrose` =~ /\b200 OK\b/
|
140
150
|
end
|
141
151
|
|
142
|
-
def start_ci
|
143
|
-
|
152
|
+
def start_ci sha=nil
|
153
|
+
if sha
|
154
|
+
command = "curl -s -I -X POST '#{ci_host}/buildWithParameters?token=botandrose&GIT_REF=#{sha}'"
|
155
|
+
else
|
156
|
+
command = "curl -s -I -X POST '#{ci_host}/build?token=botandrose'"
|
157
|
+
end
|
158
|
+
puts command if options.verbose?
|
159
|
+
`#{command}`
|
144
160
|
end
|
145
161
|
|
146
162
|
def get_last_build_number
|
data/lib/bard/capistrano.rb
CHANGED
@@ -67,7 +67,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
67
67
|
|
68
68
|
desc "push app to staging"
|
69
69
|
task :stage, :roles => :staging do
|
70
|
-
branch = ENV.
|
70
|
+
branch = ENV.fetch("BRANCH")
|
71
71
|
run "cd #{application} && git fetch && git checkout -f origin/#{branch} && bundle && bundle exec rake bootstrap:production"
|
72
72
|
end
|
73
73
|
end
|
data/lib/bard/error.rb
CHANGED
@@ -7,7 +7,7 @@ class Bard::CLI < Thor
|
|
7
7
|
|
8
8
|
class MasterNonFastForwardError < Bard::CLI::Error
|
9
9
|
def message
|
10
|
-
"The master branch has advanced since last deploy, probably due to a bugfix.\n Rebase your
|
10
|
+
"The master branch has advanced since last deploy, probably due to a bugfix.\n Rebase your branch on top of it, and check for breakage."
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
data/lib/bard/git.rb
CHANGED
@@ -7,8 +7,11 @@ module Bard::CLI::Git
|
|
7
7
|
ref.sub(/refs\/heads\//, '') # refs/heads/master ... we want "master"
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def current_sha
|
11
|
+
`git rev-parse HEAD`.chomp
|
12
|
+
end
|
13
|
+
|
14
|
+
def fast_forward_merge?(root, branch)
|
12
15
|
root_head = run_crucial "git rev-parse #{root}"
|
13
16
|
branch_head = run_crucial "git rev-parse #{branch}"
|
14
17
|
@common_ancestor = find_common_ancestor root_head, branch_head
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -43,84 +43,84 @@ dependencies:
|
|
43
43
|
name: rvm-capistrano
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: systemu
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 1.2.0
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 1.2.0
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: term-ansicolor
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 1.0.3
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: 1.0.3
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: bard-rake
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 0.1.1
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 0.1.1
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: rspec
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- - ~>
|
102
|
+
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: 1.3.0
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- - ~>
|
109
|
+
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: 1.3.0
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: cucumber
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - ~>
|
116
|
+
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: 0.9.0
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- - ~>
|
123
|
+
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: 0.9.0
|
126
126
|
description: This immaculate work of engineering genius allows mere mortals to collaborate
|
@@ -132,9 +132,9 @@ executables:
|
|
132
132
|
extensions: []
|
133
133
|
extra_rdoc_files: []
|
134
134
|
files:
|
135
|
-
- .document
|
136
|
-
- .gitignore
|
137
|
-
- .gitmodules
|
135
|
+
- ".document"
|
136
|
+
- ".gitignore"
|
137
|
+
- ".gitmodules"
|
138
138
|
- Gemfile
|
139
139
|
- Gemfile.lock
|
140
140
|
- LICENSE
|
@@ -171,12 +171,12 @@ require_paths:
|
|
171
171
|
- lib
|
172
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
|
-
- -
|
174
|
+
- - ">="
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- -
|
179
|
+
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|