buildmeister 1.2.1 → 2.0.0

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/README.rdoc CHANGED
@@ -25,6 +25,9 @@ using Lighthouse and Github.
25
25
 
26
26
  # Clean up git branches on origin
27
27
  $ git_cleanup remote
28
+
29
+ # Print a summary of tickets in a bin and copy it to the clipboard
30
+ $ buildmeister summary -b "Verified"
28
31
 
29
32
  == Requirements
30
33
 
data/Rakefile CHANGED
@@ -14,9 +14,7 @@ begin
14
14
  s.homepage = "http://github.com/onehub/buildmeister"
15
15
  s.description = "Dead simple tools for managing Lighthouse and Git deployment workflow"
16
16
  s.authors = ["Leigh Caplan"]
17
- s.add_dependency 'activesupport', '~> 2.3.9'
18
- s.add_dependency 'activeresource', '~> 2.3.9'
19
- s.add_dependency 'lighthouse-api', '~> 1.1.0'
17
+ s.add_dependency 'lighthouse-api', '~> 2.0'
20
18
  s.files = FileList["[A-Z]*", "{bin,generators,lib,spec}/**/*"]
21
19
  end
22
20
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 2.0.0
@@ -164,16 +164,64 @@ module Buildmeister
164
164
 
165
165
  puts "All tickets from bin #{@options[:move_from]} have been moved to #{@options[:to_state]}"
166
166
  end
167
+
168
+ def list_staged_tickets
169
+ # First, fetch origin to make sure we have all the necessary information
170
+ system('git fetch origin')
171
+ shas = `git log master..HEAD --pretty=format:%H`.split
172
+
173
+ # Generate an array of arrays - the inner array lists all branches that contain
174
+ # each of the SHAs listed above
175
+ contains_info = shas.map do |sha|
176
+ `git branch -a --contains #{sha}`.split
177
+ end
178
+
179
+ staged_branches = Set.new
180
+
181
+ contains_info.each do |branches|
182
+ branches.each do |branch|
183
+ # First, sanitize
184
+ branch.gsub!('remotes/origin/', '')
185
+
186
+ # Only match branch names that start with a digit (we're assuming
187
+ # that these all reference tickets)
188
+ staged_branches << branch if branch =~ /^\d+/
189
+ end
190
+ end
191
+
192
+ tickets = staged_branches.to_a.map(&:to_i)
193
+ puts "Staged: #{tickets.join(',')}"
194
+
195
+ tickets
196
+ end
197
+
198
+ def move_staged_tickets
199
+ unless projects.one?
200
+ puts "Please specify one project!"
201
+ return
202
+ end
203
+
204
+ # Grab the actual lighthouse project
205
+ project = projects.first
206
+
207
+ tickets = project.find_tickets(*list_staged_tickets)
208
+ tickets.each do |ticket|
209
+ unless ticket.state == 'verified'
210
+ ticket.state = @options[:to_state]
211
+ ticket.save
212
+ end
213
+ end
214
+ end
167
215
 
168
216
  def summary
169
217
  body = ''
170
218
 
171
219
  projects.each do |project|
172
- bin = project.bins.detect {|b| b.name =~ /^#{@options[:bin_name]}$/i}
220
+ bin = project.bins.detect {|b| b.name =~ /^#{Regexp.escape(@options[:bin_name])}$/i}
173
221
 
174
222
  unless bin
175
- puts "No ticket bin found matching \"#{@options[:bin_name]}\""
176
- return
223
+ puts "No ticket bin found matching \"#{@options[:bin_name]}\" in #{project.name}"
224
+ next
177
225
  end
178
226
 
179
227
  tickets = bin.tickets.sort_by(&:id)
@@ -28,6 +28,14 @@ module Buildmeister
28
28
  bins << Buildmeister::Bin.new(bin, options[:mode], :annotations => config['annotations'])
29
29
  end if config['personal_bins']
30
30
  end
31
+
32
+ # There's no good way to do this in the Lighthouse API. This is slow, but at least it's
33
+ # easy to write.
34
+ def find_tickets(*ids)
35
+ ids.map do |id|
36
+ project.tickets(:q => id).first
37
+ end.compact
38
+ end
31
39
 
32
40
  def display
33
41
  out = ''
@@ -49,4 +57,4 @@ module Buildmeister
49
57
  bins.any? &:changed?
50
58
  end
51
59
  end
52
- end
60
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildmeister
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
- - 1
8
7
  - 2
9
- - 1
10
- version: 1.2.1
8
+ - 0
9
+ - 0
10
+ version: 2.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Leigh Caplan
@@ -15,57 +15,23 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-25 00:00:00 -08:00
19
- default_executable:
18
+ date: 2012-07-06 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- name: activesupport
21
+ name: lighthouse-api
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 17
28
+ hash: 3
30
29
  segments:
31
30
  - 2
32
- - 3
33
- - 9
34
- version: 2.3.9
35
- type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: activeresource
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 17
46
- segments:
47
- - 2
48
- - 3
49
- - 9
50
- version: 2.3.9
51
- type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: lighthouse-api
55
- prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 19
62
- segments:
63
- - 1
64
- - 1
65
31
  - 0
66
- version: 1.1.0
32
+ version: "2.0"
67
33
  type: :runtime
68
- version_requirements: *id003
34
+ version_requirements: *id001
69
35
  description: Dead simple tools for managing Lighthouse and Git deployment workflow
70
36
  email: lcaplan@onehub.com
71
37
  executables:
@@ -96,7 +62,6 @@ files:
96
62
  - spec/buildmeister/project_spec.rb
97
63
  - spec/spec.opts
98
64
  - spec/spec_helper.rb
99
- has_rdoc: true
100
65
  homepage: http://github.com/onehub/buildmeister
101
66
  licenses: []
102
67
 
@@ -126,12 +91,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
91
  requirements: []
127
92
 
128
93
  rubyforge_project:
129
- rubygems_version: 1.5.2
94
+ rubygems_version: 1.8.6
130
95
  signing_key:
131
96
  specification_version: 3
132
97
  summary: Dead simple tools for managing Lighthouse and Git deployment workflow
133
- test_files:
134
- - spec/buildmeister/base_spec.rb
135
- - spec/buildmeister/bin_spec.rb
136
- - spec/buildmeister/project_spec.rb
137
- - spec/spec_helper.rb
98
+ test_files: []
99
+