buildmeister 2.0.6 → 3.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.
- checksums.yaml +15 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +115 -0
- data/Guardfile +25 -0
- data/Rakefile +8 -8
- data/VERSION +1 -1
- data/bin/buildmeister +1 -1
- data/lib/buildmeister.rb +7 -3
- data/lib/buildmeister/base.rb +39 -24
- data/lib/buildmeister/bin.rb +6 -3
- data/lib/buildmeister/finder.rb +10 -2
- data/lib/buildmeister/json_tools.rb +9 -0
- data/lib/buildmeister/json_utils.rb +9 -0
- data/lib/buildmeister/project.rb +2 -2
- data/lib/lighthouse/account.rb +45 -0
- data/lib/lighthouse/bin.rb +22 -0
- data/lib/lighthouse/project.rb +93 -0
- data/lib/lighthouse/ticket.rb +15 -0
- data/spec/buildmeister/base_spec.rb +43 -47
- data/spec/buildmeister/bin_spec.rb +9 -9
- data/spec/lighthouse/account_spec.rb +39 -0
- data/spec/lighthouse/bin_spec.rb +28 -0
- data/spec/lighthouse/project_spec.rb +66 -0
- data/spec/lighthouse/ticket_spec.rb +5 -0
- data/spec/spec_helper.rb +7 -3
- data/spec/support/bins.json +1 -0
- data/spec/support/projects.json +1 -0
- data/spec/support/tickets.json +1 -0
- metadata +93 -56
- data/spec/buildmeister/project_spec.rb +0 -84
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MGUwNjM1Y2RiNWY2Y2FjNmMzMDQwYzgxYWM5ZDhmOGQ2NmE4ZDg2Mg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTM4ZDU5ZGU5MjM0ZjI2MTZjMGU4OTFmODQwYmJjYzZiZWRjOTJlMw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZWZmMzM1ZTY5OGMxNzQwNjhmOWZiM2I1YTZmZTZkM2QwYjYwN2NkNTA3MDNk
|
10
|
+
NTUyYmYyYmI2MTc4NjA5NjI4OGQ5ODg4ZDRkNzMwOTM5MTM2NGIzNzBjN2Ez
|
11
|
+
NmVhNDVmYzA4NDU3Y2FiNTI4NGEwZTBlMDg2ZTAzYTJlZWIyNjM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDJjMjE3YmY3NmI5NTEwODZkODhhOWY2MDJiMWE1ZTUwOGVkYmRjOGYxMzU4
|
14
|
+
OWU5ZDM2MzNkN2RlYWZmYmM4NjJiNTNkMTNhMWE3YzkwMGQ2NmZmZDg1YTQ2
|
15
|
+
Y2RiMGUwOGIwYjU5MDNhNmIyM2MxNzFkNDZiMTVjNzY0ZGViNWY=
|
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'jeweler'
|
6
|
+
gem 'rake'
|
7
|
+
|
8
|
+
group :test do
|
9
|
+
gem 'rspec', '~> 2'
|
10
|
+
gem 'mocha', require: false
|
11
|
+
gem 'fakeweb'
|
12
|
+
gem 'timecop'
|
13
|
+
gem 'rb-fsevent', require: false if RUBY_PLATFORM =~ /darwin/i
|
14
|
+
gem 'guard-rspec', '~> 4.0', require: false
|
15
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
buildmeister (3.0.0)
|
5
|
+
buildmeister
|
6
|
+
jeweler
|
7
|
+
rake
|
8
|
+
rest-client (~> 1.6.7)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
addressable (2.3.5)
|
14
|
+
builder (3.2.2)
|
15
|
+
celluloid (0.15.2)
|
16
|
+
timers (~> 1.1.0)
|
17
|
+
coderay (1.0.9)
|
18
|
+
diff-lcs (1.2.4)
|
19
|
+
fakeweb (1.2.6)
|
20
|
+
faraday (0.8.8)
|
21
|
+
multipart-post (~> 1.2.0)
|
22
|
+
ffi (1.9.0)
|
23
|
+
formatador (0.2.4)
|
24
|
+
git (1.2.6)
|
25
|
+
github_api (0.10.1)
|
26
|
+
addressable
|
27
|
+
faraday (~> 0.8.1)
|
28
|
+
hashie (>= 1.2)
|
29
|
+
multi_json (~> 1.4)
|
30
|
+
nokogiri (~> 1.5.2)
|
31
|
+
oauth2
|
32
|
+
guard (2.0.5)
|
33
|
+
formatador (>= 0.2.4)
|
34
|
+
listen (~> 2.0)
|
35
|
+
lumberjack (~> 1.0)
|
36
|
+
pry (>= 0.9.12)
|
37
|
+
thor (>= 0.18.1)
|
38
|
+
guard-rspec (4.0.0)
|
39
|
+
guard (~> 2.0)
|
40
|
+
rspec (~> 2.14)
|
41
|
+
hashie (2.0.5)
|
42
|
+
highline (1.6.19)
|
43
|
+
httpauth (0.2.0)
|
44
|
+
jeweler (1.8.7)
|
45
|
+
builder
|
46
|
+
bundler (~> 1.0)
|
47
|
+
git (>= 1.2.5)
|
48
|
+
github_api (= 0.10.1)
|
49
|
+
highline (>= 1.6.15)
|
50
|
+
nokogiri (= 1.5.10)
|
51
|
+
rake
|
52
|
+
rdoc
|
53
|
+
json (1.8.0)
|
54
|
+
jwt (0.1.8)
|
55
|
+
multi_json (>= 1.5)
|
56
|
+
listen (2.0.4)
|
57
|
+
celluloid (>= 0.15.2)
|
58
|
+
rb-fsevent (>= 0.9.3)
|
59
|
+
rb-inotify (>= 0.9)
|
60
|
+
lumberjack (1.0.4)
|
61
|
+
metaclass (0.0.1)
|
62
|
+
method_source (0.8.2)
|
63
|
+
mime-types (1.25)
|
64
|
+
mocha (0.13.2)
|
65
|
+
metaclass (~> 0.0.1)
|
66
|
+
multi_json (1.7.9)
|
67
|
+
multi_xml (0.5.5)
|
68
|
+
multipart-post (1.2.0)
|
69
|
+
nokogiri (1.5.10)
|
70
|
+
oauth2 (0.9.2)
|
71
|
+
faraday (~> 0.8)
|
72
|
+
httpauth (~> 0.2)
|
73
|
+
jwt (~> 0.1.4)
|
74
|
+
multi_json (~> 1.0)
|
75
|
+
multi_xml (~> 0.5)
|
76
|
+
rack (~> 1.2)
|
77
|
+
pry (0.9.12.2)
|
78
|
+
coderay (~> 1.0.5)
|
79
|
+
method_source (~> 0.8)
|
80
|
+
slop (~> 3.4)
|
81
|
+
rack (1.5.2)
|
82
|
+
rake (10.1.0)
|
83
|
+
rb-fsevent (0.9.3)
|
84
|
+
rb-inotify (0.9.2)
|
85
|
+
ffi (>= 0.5.0)
|
86
|
+
rdoc (4.0.1)
|
87
|
+
json (~> 1.4)
|
88
|
+
rest-client (1.6.7)
|
89
|
+
mime-types (>= 1.16)
|
90
|
+
rspec (2.14.1)
|
91
|
+
rspec-core (~> 2.14.0)
|
92
|
+
rspec-expectations (~> 2.14.0)
|
93
|
+
rspec-mocks (~> 2.14.0)
|
94
|
+
rspec-core (2.14.5)
|
95
|
+
rspec-expectations (2.14.3)
|
96
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
97
|
+
rspec-mocks (2.14.3)
|
98
|
+
slop (3.4.6)
|
99
|
+
thor (0.18.1)
|
100
|
+
timecop (0.3.1)
|
101
|
+
timers (1.1.0)
|
102
|
+
|
103
|
+
PLATFORMS
|
104
|
+
ruby
|
105
|
+
|
106
|
+
DEPENDENCIES
|
107
|
+
buildmeister!
|
108
|
+
fakeweb
|
109
|
+
guard-rspec (~> 4.0)
|
110
|
+
jeweler
|
111
|
+
mocha
|
112
|
+
rake
|
113
|
+
rb-fsevent
|
114
|
+
rspec (~> 2)
|
115
|
+
timecop
|
data/Guardfile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :rspec do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch(%r{^lib/lighthouse/(.+)\.rb$}) { |m| "spec/lib/lighthouse/#{m[1]}_spec.rb" }
|
8
|
+
watch('spec/spec_helper.rb') { "spec" }
|
9
|
+
|
10
|
+
# Rails example
|
11
|
+
# watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
12
|
+
# watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
13
|
+
# watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
14
|
+
# watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
15
|
+
# watch('config/routes.rb') { "spec/routing" }
|
16
|
+
# watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
17
|
+
|
18
|
+
# Capybara features specs
|
19
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
20
|
+
|
21
|
+
# Turnip features and steps
|
22
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
23
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
24
|
+
end
|
25
|
+
|
data/Rakefile
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
-
require 'hoe'
|
5
4
|
require './lib/buildmeister.rb'
|
6
5
|
|
7
6
|
begin
|
8
7
|
require 'jeweler'
|
9
8
|
Jeweler::Tasks.new do |s|
|
10
|
-
s.name
|
9
|
+
s.name = "buildmeister"
|
11
10
|
s.executables = ["buildmeister", "git_cleanup"]
|
12
|
-
s.summary
|
13
|
-
s.email
|
14
|
-
s.homepage
|
11
|
+
s.summary = "Dead simple tools for managing Lighthouse and Git deployment workflow"
|
12
|
+
s.email = "lcaplan@onehub.com"
|
13
|
+
s.homepage = "http://github.com/onehub/buildmeister"
|
15
14
|
s.description = "Dead simple tools for managing Lighthouse and Git deployment workflow"
|
16
|
-
s.authors
|
17
|
-
s.
|
18
|
-
|
15
|
+
s.authors = ["Leigh Caplan"]
|
16
|
+
s.files = FileList["[A-Z]*", "{bin,generators,lib,spec}/**/*"]
|
17
|
+
|
18
|
+
s.add_dependency 'rest-client', '~> 1.6.7'
|
19
19
|
end
|
20
20
|
rescue LoadError
|
21
21
|
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/bin/buildmeister
CHANGED
data/lib/buildmeister.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
3
|
-
require 'active_support'
|
2
|
+
require 'rest-client'
|
4
3
|
|
5
4
|
$: << File.dirname(__FILE__)
|
6
5
|
|
7
6
|
require 'buildmeister/core_ext'
|
7
|
+
require 'buildmeister/json_utils'
|
8
8
|
require 'buildmeister/string_utils'
|
9
9
|
require 'buildmeister/git_utils'
|
10
10
|
require 'buildmeister/finder'
|
11
11
|
require 'buildmeister/base'
|
12
|
-
require 'buildmeister/notifier'
|
13
12
|
require 'buildmeister/project'
|
13
|
+
require 'buildmeister/notifier'
|
14
14
|
require 'buildmeister/bin'
|
15
|
+
require 'lighthouse/account'
|
16
|
+
require 'lighthouse/project'
|
17
|
+
require 'lighthouse/bin'
|
18
|
+
require 'lighthouse/ticket'
|
data/lib/buildmeister/base.rb
CHANGED
@@ -1,18 +1,10 @@
|
|
1
1
|
require 'optparse'
|
2
|
+
require 'yaml'
|
2
3
|
|
3
4
|
module Buildmeister
|
4
|
-
class
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
RETRY_COUNT = 5
|
9
|
-
|
10
|
-
attr_accessor :projects, :notification_interval, :command, :args
|
11
|
-
|
12
|
-
def initialize(*args)
|
13
|
-
self.args = args
|
14
|
-
|
15
|
-
@options = {:mode => :verbose}
|
5
|
+
class Launcher
|
6
|
+
def self.launch(*args)
|
7
|
+
@options = {:mode => :verbose}
|
16
8
|
|
17
9
|
OptionParser.new do |opts|
|
18
10
|
opts.banner = "Usage: buildmeister notify"
|
@@ -37,22 +29,45 @@ module Buildmeister
|
|
37
29
|
@options[:bin_name] = p
|
38
30
|
end
|
39
31
|
|
32
|
+
opts.on('-c', '--compare-branch BRANCH', 'Compare From Branch') do |c|
|
33
|
+
@options[:compare_branch] = c || 'master'
|
34
|
+
end
|
35
|
+
|
40
36
|
opts.on_tail("-h", "--help", "Show this message") do
|
41
37
|
puts opts
|
42
|
-
|
38
|
+
exit_app
|
43
39
|
end
|
44
40
|
|
45
41
|
if args.empty?
|
46
42
|
puts opts
|
47
|
-
|
43
|
+
exit_app
|
48
44
|
end
|
49
45
|
end.parse!(args)
|
50
46
|
|
47
|
+
@options[:command] = args.shift
|
48
|
+
|
49
|
+
Base.new(@options)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.exit_app
|
53
|
+
exit
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class Base
|
58
|
+
include StringUtils
|
59
|
+
include GitUtils
|
60
|
+
|
61
|
+
RETRY_COUNT = 5
|
62
|
+
|
63
|
+
attr_accessor :projects, :notification_interval, :command, :args
|
64
|
+
|
65
|
+
def initialize(options = {})
|
66
|
+
@options = options
|
67
|
+
|
51
68
|
# Lighthouse setup
|
52
|
-
@config
|
53
|
-
|
54
|
-
Lighthouse.account = @config['account']
|
55
|
-
Lighthouse.token = @config['token']
|
69
|
+
@config = Buildmeister::Base.load_config
|
70
|
+
@account = Lighthouse::Account.new(@config['account'], @config['token'])
|
56
71
|
|
57
72
|
self.projects = []
|
58
73
|
|
@@ -60,17 +75,17 @@ module Buildmeister
|
|
60
75
|
|
61
76
|
if @options[:project]
|
62
77
|
@config['projects'] = @config['projects'].select { |p| p['name'] == @options[:project] }
|
63
|
-
raise "#{@options[:project]} did not match any projects in the config file" if @config['projects'].
|
78
|
+
raise "#{@options[:project]} did not match any projects in the config file" if (@config['projects'] || []).empty?
|
64
79
|
end
|
65
80
|
|
66
|
-
@config['projects'].each do |
|
67
|
-
self.projects << Buildmeister::Project.new(
|
81
|
+
@config['projects'].each do |project_name|
|
82
|
+
self.projects << Buildmeister::Project.new(project_name, @account, @options)
|
68
83
|
end
|
69
84
|
|
70
85
|
self.notification_interval = @config['notification_interval']
|
71
86
|
|
72
87
|
# Did we pass in a command?
|
73
|
-
self.command =
|
88
|
+
self.command = options[:command]
|
74
89
|
end
|
75
90
|
|
76
91
|
def go!
|
@@ -105,7 +120,7 @@ module Buildmeister
|
|
105
120
|
@force = false
|
106
121
|
end
|
107
122
|
|
108
|
-
sleep notification_interval
|
123
|
+
sleep notification_interval * 60
|
109
124
|
|
110
125
|
refresh!
|
111
126
|
|
@@ -168,7 +183,7 @@ module Buildmeister
|
|
168
183
|
def list_staged_tickets
|
169
184
|
# First, fetch origin to make sure we have all the necessary information
|
170
185
|
system('git fetch origin')
|
171
|
-
shas = `git log origin
|
186
|
+
shas = `git log origin/#{@options[:compare_branch]}..HEAD --pretty=format:%H`.split
|
172
187
|
|
173
188
|
# Generate an array of arrays - the inner array lists all branches that contain
|
174
189
|
# each of the SHAs listed above
|
data/lib/buildmeister/bin.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
# Wraps Lighthouse::Bin and keeps track of state
|
2
|
+
require 'forwardable'
|
2
3
|
|
3
4
|
module Buildmeister
|
4
5
|
class Bin
|
5
6
|
attr_accessor :bin, :mode, :value, :last_value, :annotations
|
7
|
+
|
8
|
+
extend Forwardable
|
6
9
|
|
7
|
-
delegate :name, :tickets
|
10
|
+
delegate [:name, :tickets] => :bin
|
8
11
|
|
9
12
|
def initialize(lighthouse_bin, mode = :verbose, options = {})
|
10
13
|
self.bin = lighthouse_bin
|
@@ -20,7 +23,7 @@ module Buildmeister
|
|
20
23
|
case mode
|
21
24
|
when :verbose
|
22
25
|
self.value = bin.tickets.map do |tkt|
|
23
|
-
str =
|
26
|
+
str = "#{tkt.id}"
|
24
27
|
annotations.each do |tag_name, identifier|
|
25
28
|
str << identifier if tkt.tags.include?(tag_name)
|
26
29
|
end
|
@@ -39,4 +42,4 @@ module Buildmeister
|
|
39
42
|
value != last_value
|
40
43
|
end
|
41
44
|
end
|
42
|
-
end
|
45
|
+
end
|
data/lib/buildmeister/finder.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
module Buildmeister
|
2
2
|
module Finder
|
3
3
|
def named(name)
|
4
|
-
|
4
|
+
find_where(name: name)
|
5
|
+
end
|
6
|
+
|
7
|
+
def find_where(attrs)
|
8
|
+
find do |o|
|
9
|
+
attrs.all? do |name, value|
|
10
|
+
o.send(name) == value
|
11
|
+
end
|
12
|
+
end
|
5
13
|
end
|
6
14
|
end
|
7
|
-
end
|
15
|
+
end
|
data/lib/buildmeister/project.rb
CHANGED
@@ -4,13 +4,13 @@ module Buildmeister
|
|
4
4
|
|
5
5
|
attr_accessor :project, :name, :bins
|
6
6
|
|
7
|
-
def initialize(config, options = {})
|
7
|
+
def initialize(config, lighthouse_account, options = {})
|
8
8
|
self.name = config['name']
|
9
9
|
self.bins = []
|
10
10
|
|
11
11
|
bins.extend Finder
|
12
12
|
|
13
|
-
self.project =
|
13
|
+
self.project = lighthouse_account.projects.named(name)
|
14
14
|
|
15
15
|
project_bins = project.bins
|
16
16
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Lighthouse
|
4
|
+
class Account
|
5
|
+
include Buildmeister::JSONUtils
|
6
|
+
|
7
|
+
attr_accessor :name, :token, :resource
|
8
|
+
|
9
|
+
def initialize(name, token)
|
10
|
+
@name = name
|
11
|
+
@token = token
|
12
|
+
|
13
|
+
@url = "https://#{name}.lighthouseapp.com"
|
14
|
+
|
15
|
+
@resource = create_resource(@url, @token)
|
16
|
+
end
|
17
|
+
|
18
|
+
def projects
|
19
|
+
with_json_response( projects_resource.get(accept: 'json') ) do |response|
|
20
|
+
response['projects'].map do |p|
|
21
|
+
attrs = p['project']
|
22
|
+
id = attrs['id']
|
23
|
+
|
24
|
+
Lighthouse::Project.new(resource["projects/#{id}"], attrs)
|
25
|
+
end.tap { |p| p.extend Buildmeister::Finder }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def find_projects(*names)
|
30
|
+
projects.select { |p| names.include?(p.name) }
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def projects_resource
|
36
|
+
@projects_resource ||= resource['projects']
|
37
|
+
end
|
38
|
+
|
39
|
+
def create_resource(url, token)
|
40
|
+
headers = {'X-LighthouseToken' => token}
|
41
|
+
|
42
|
+
RestClient::Resource.new(url, headers: headers)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Lighthouse
|
2
|
+
class Bin
|
3
|
+
include Buildmeister::JSONUtils
|
4
|
+
|
5
|
+
attr_reader :id, :name, :query, :tickets_count
|
6
|
+
|
7
|
+
def initialize(project, attrs)
|
8
|
+
@project = project
|
9
|
+
|
10
|
+
@name = attrs['name']
|
11
|
+
@id = attrs['id']
|
12
|
+
@query = attrs['query']
|
13
|
+
|
14
|
+
@tickets_count = attrs['tickets_count']
|
15
|
+
end
|
16
|
+
|
17
|
+
def tickets
|
18
|
+
@project.tickets(@query)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,93 @@
|
|
1
|
+
module Lighthouse
|
2
|
+
class Project
|
3
|
+
include Buildmeister::StringUtils
|
4
|
+
include Buildmeister::JSONUtils
|
5
|
+
|
6
|
+
attr_accessor :id, :name, :resource
|
7
|
+
|
8
|
+
def initialize(resource, attributes)
|
9
|
+
@id = attributes['id']
|
10
|
+
@name = attributes['name']
|
11
|
+
|
12
|
+
@resource = resource
|
13
|
+
|
14
|
+
# self.bins = []
|
15
|
+
|
16
|
+
# bins.extend Finder
|
17
|
+
|
18
|
+
# project_bins = bins
|
19
|
+
|
20
|
+
# config['bins'].each do |bin_name|
|
21
|
+
# bin = project_bins.find { |b| b.name == bin_name }
|
22
|
+
# raise "No bin named #{bin_name}" unless bin
|
23
|
+
|
24
|
+
# bins << Buildmeister::Bin.new(bin, options[:mode], :annotations => config['annotations'])
|
25
|
+
# end
|
26
|
+
|
27
|
+
# config['personal_bins'].each do |bin_name|
|
28
|
+
# bin = project_bins.find { |b| !b.shared && (b.name == bin_name) }
|
29
|
+
# raise "No bin named #{bin_name}" unless bin
|
30
|
+
|
31
|
+
# bins << Buildmeister::Bin.new(bin, options[:mode], :annotations => config['annotations'])
|
32
|
+
# end if config['personal_bins']
|
33
|
+
end
|
34
|
+
|
35
|
+
def bins
|
36
|
+
with_json_response( bins_resource.get(accept: 'json') ) do |r|
|
37
|
+
r['ticket_bins'].map do |b|
|
38
|
+
attrs = b['ticket_bin']
|
39
|
+
|
40
|
+
Lighthouse::Bin.new(self, attrs)
|
41
|
+
end
|
42
|
+
end.tap { |a| a.extend(Buildmeister::Finder) }
|
43
|
+
end
|
44
|
+
|
45
|
+
def tickets(query = "")
|
46
|
+
with_json_response( tickets_resource.get(params: {q: query}, accept: 'json') ) do |r|
|
47
|
+
(r['tickets'] || []).map do |t|
|
48
|
+
attrs = t['ticket']
|
49
|
+
|
50
|
+
Lighthouse::Ticket.new(attrs)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# There's no good way to do this in the Lighthouse API. This is slow, but at least it's
|
56
|
+
# easy to write.
|
57
|
+
def find_tickets(*ids)
|
58
|
+
ids.map do |id|
|
59
|
+
project.tickets(:q => id).first
|
60
|
+
end.compact
|
61
|
+
end
|
62
|
+
|
63
|
+
def display
|
64
|
+
out = ''
|
65
|
+
out << name + "\n"
|
66
|
+
out << "#{divider}\n"
|
67
|
+
|
68
|
+
bins.each do |bin|
|
69
|
+
out << bin.display + "\n"
|
70
|
+
end
|
71
|
+
|
72
|
+
out
|
73
|
+
end
|
74
|
+
|
75
|
+
def refresh!
|
76
|
+
bins.each(&:refresh!)
|
77
|
+
end
|
78
|
+
|
79
|
+
def changed?
|
80
|
+
bins.any?(&:changed?)
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def bins_resource
|
86
|
+
@bins_resource ||= resource['bins']
|
87
|
+
end
|
88
|
+
|
89
|
+
def tickets_resource
|
90
|
+
@tickets_resource ||= resource['tickets']
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -1,67 +1,66 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
|
4
|
+
describe Buildmeister::Launcher do
|
5
|
+
it "should set quiet mode if passed -q" do
|
6
|
+
pending
|
7
|
+
b = Buildmeister::Launcher.new('-q')
|
8
|
+
b.instance_variable_get(:@options)[:mode].should == :quiet
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should set move_from if passed -f" do
|
12
|
+
pending
|
13
|
+
b = Buildmeister::Launcher.new('-f', 'Cool Bin')
|
14
|
+
b.instance_variable_get(:@options)[:move_from].should == 'Cool Bin'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should set to_state if passed -t" do
|
18
|
+
pending
|
19
|
+
b = Buildmeister::Launcher.new('-t', 'staged')
|
20
|
+
b.instance_variable_get(:@options)[:to_state].should == 'staged'
|
21
|
+
end
|
22
|
+
|
23
|
+
context "passed the -p flag" do
|
24
|
+
let(:b) { Buildmeister::Launcher.new('-p', 'Macchiato') }
|
25
|
+
|
26
|
+
it "should set the project" do
|
27
|
+
pending
|
28
|
+
b.instance_variable_get(:@options)[:project].should == 'Macchiato'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should only load the specified project" do
|
32
|
+
pending
|
33
|
+
b.projects.size.should == 1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
3
38
|
describe Buildmeister::Base do
|
4
39
|
before(:each) do
|
5
40
|
Buildmeister::Base.stubs(:load_config).returns(load_test_config)
|
6
41
|
@project_stub = stub(:name => 'Project', :bins => [stub(), stub()])
|
7
42
|
Buildmeister::Project.stubs(:new).returns(@project_stub)
|
8
43
|
end
|
44
|
+
|
45
|
+
let(:b) { Buildmeister::Base.new }
|
9
46
|
|
10
47
|
describe '#new' do
|
11
|
-
|
12
|
-
b = Buildmeister::Base.new
|
13
|
-
b.should be_an_instance_of(Buildmeister::Base)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should set quiet mode if passed -q" do
|
17
|
-
b = Buildmeister::Base.new('-q')
|
18
|
-
b.instance_variable_get(:@options)[:mode].should == :quiet
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should set move_from if passed -f" do
|
22
|
-
b = Buildmeister::Base.new('-f', 'Cool Bin')
|
23
|
-
b.instance_variable_get(:@options)[:move_from].should == 'Cool Bin'
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should set to_state if passed -t" do
|
27
|
-
b = Buildmeister::Base.new('-t', 'staged')
|
28
|
-
b.instance_variable_get(:@options)[:to_state].should == 'staged'
|
29
|
-
end
|
30
|
-
|
31
|
-
context "passed the -p flag" do
|
32
|
-
before(:each) do
|
33
|
-
@b = Buildmeister::Base.new('-p', 'Macchiato')
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should set the project" do
|
37
|
-
@b.instance_variable_get(:@options)[:project].should == 'Macchiato'
|
38
|
-
end
|
39
|
-
|
48
|
+
context "passing in a project" do
|
40
49
|
it "should only load the specified project" do
|
41
|
-
|
50
|
+
b = Buildmeister::Base.new(project: 'Macchiato')
|
51
|
+
b.projects.size.should == 1
|
42
52
|
end
|
43
53
|
end
|
44
54
|
|
45
|
-
|
46
|
-
|
47
|
-
config = load_test_config
|
48
|
-
b = Buildmeister::Base.new
|
49
|
-
Lighthouse.account.should == config['account']
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should set the Lighthouse token from config" do
|
53
|
-
config = load_test_config
|
54
|
-
b = Buildmeister::Base.new
|
55
|
-
Lighthouse.token.should == config['token']
|
55
|
+
it "should create a new instance" do
|
56
|
+
b.should be_an_instance_of(Buildmeister::Base)
|
56
57
|
end
|
57
58
|
|
58
59
|
it "should set up the projects" do
|
59
|
-
b = Buildmeister::Base.new
|
60
60
|
b.projects.should == [@project_stub, @project_stub]
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should set the notification interval" do
|
64
|
-
b = Buildmeister::Base.new
|
65
64
|
b.notification_interval.should == 3
|
66
65
|
end
|
67
66
|
end
|
@@ -74,7 +73,6 @@ describe Buildmeister::Base do
|
|
74
73
|
end
|
75
74
|
|
76
75
|
it "should be true" do
|
77
|
-
b = Buildmeister::Base.new
|
78
76
|
b.changed?.should be_true
|
79
77
|
end
|
80
78
|
end
|
@@ -94,7 +92,7 @@ describe Buildmeister::Base do
|
|
94
92
|
|
95
93
|
describe "title" do
|
96
94
|
it "should look like this" do
|
97
|
-
Timecop.freeze(Time.
|
95
|
+
Timecop.freeze(Time.new(2010, 1, 1, 9)) do
|
98
96
|
b = Buildmeister::Base.new
|
99
97
|
b.title.should == 'Buildmeister: 01/01 09:00 AM'
|
100
98
|
end
|
@@ -114,6 +112,4 @@ describe Buildmeister::Base do
|
|
114
112
|
@b.divider("=", 5).should == '====='
|
115
113
|
end
|
116
114
|
end
|
117
|
-
|
118
|
-
|
119
115
|
end
|
@@ -1,33 +1,33 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Buildmeister::Bin do
|
4
|
-
|
4
|
+
let(:ticket_stubs) do
|
5
5
|
[stub('ticket_1', :id => 1), stub('ticket_2', :id => 2)]
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
let(:bin_stub) do
|
9
|
+
stub(:tickets => ticket_stubs)
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "#new" do
|
13
13
|
it "should create a new instance" do
|
14
|
-
b = Buildmeister::Bin.new(
|
14
|
+
b = Buildmeister::Bin.new(bin_stub)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should default to verbose mode" do
|
18
|
-
b = Buildmeister::Bin.new(
|
18
|
+
b = Buildmeister::Bin.new(bin_stub)
|
19
19
|
b.mode.should == :verbose
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should refresh" do
|
23
23
|
Buildmeister::Bin.any_instance.expects(:refresh!).once
|
24
|
-
b = Buildmeister::Bin.new(
|
24
|
+
b = Buildmeister::Bin.new(bin_stub)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "#refresh!" do
|
29
29
|
before(:each) do
|
30
|
-
@b = Buildmeister::Bin.new(
|
30
|
+
@b = Buildmeister::Bin.new(bin_stub)
|
31
31
|
end
|
32
32
|
|
33
33
|
context "in verbose mode" do
|
@@ -67,7 +67,7 @@ describe Buildmeister::Bin do
|
|
67
67
|
|
68
68
|
describe "#changed?" do
|
69
69
|
before(:each) do
|
70
|
-
@b = Buildmeister::Bin.new(Lighthouse::Bin.new)
|
70
|
+
@b = Buildmeister::Bin.new(Lighthouse::Bin.new(stub(get: []), {}))
|
71
71
|
end
|
72
72
|
|
73
73
|
context "with identical values" do
|
@@ -102,4 +102,4 @@ describe Buildmeister::Bin do
|
|
102
102
|
@b.display.should == 'The Bin: 1, 2'
|
103
103
|
end
|
104
104
|
end
|
105
|
-
end
|
105
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
describe Lighthouse::Account do
|
5
|
+
let(:name) { 'onehub' }
|
6
|
+
let(:token) { '12345' }
|
7
|
+
let(:account) { Lighthouse::Account.new(name, token) }
|
8
|
+
|
9
|
+
it "should have a resource" do
|
10
|
+
account.resource.should_not be_nil
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#projects" do
|
14
|
+
let(:projects_response) { File.read('spec/support/projects.json') }
|
15
|
+
|
16
|
+
before do
|
17
|
+
account.resource.stubs(:[]).returns(
|
18
|
+
stub(:get => projects_response)
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should succeed" do
|
23
|
+
account.projects
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#find_projects" do
|
28
|
+
let(:projects) do
|
29
|
+
[stub(:name => 'Project1'), stub(:name => 'Project2'), stub(:name => 'Project3')]
|
30
|
+
end
|
31
|
+
|
32
|
+
before { account.stubs(:projects).returns(projects) }
|
33
|
+
|
34
|
+
it "should find the correct projects" do
|
35
|
+
result = account.find_projects('Project1', 'Project3')
|
36
|
+
result.length.should == 2
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lighthouse::Bin do
|
4
|
+
let(:resource) { stub() }
|
5
|
+
let(:bin) do
|
6
|
+
Lighthouse::Bin.new(resource, 'name' => 'Bin', 'id' => 1234, 'query' => 'state: resolved', 'tickets_count' => 4)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should have a name" do
|
10
|
+
bin.name.should == 'Bin'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have an id" do
|
14
|
+
bin.id.should == 1234
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should have a query" do
|
18
|
+
bin.query.should == 'state: resolved'
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should have tickets_count" do
|
22
|
+
bin.tickets_count.should == 4
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#tickets" do
|
26
|
+
it "should be implemented"
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lighthouse::Project do
|
4
|
+
let(:resource) { stub(:[] => stub) }
|
5
|
+
let(:attributes) do
|
6
|
+
{'id' => '123', 'name' => 'Project'}
|
7
|
+
end
|
8
|
+
let(:project) do
|
9
|
+
Lighthouse::Project.new(resource, attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#new" do
|
13
|
+
it "should create new given a valid config" do
|
14
|
+
project.should be_an_instance_of(Lighthouse::Project)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should set the name" do
|
18
|
+
project.name.should == attributes['name']
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should set the id" do
|
22
|
+
project.id.should == attributes['id']
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should set the resource" do
|
26
|
+
project.resource.should == resource
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#bins" do
|
31
|
+
let(:bins_response) do
|
32
|
+
File.read('spec/support/bins.json')
|
33
|
+
end
|
34
|
+
|
35
|
+
before { project.stubs(:bins_resource).returns(stub(:get => bins_response)) }
|
36
|
+
|
37
|
+
it "should succeed" do
|
38
|
+
project.bins
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should list the bins" do
|
42
|
+
bin = project.bins.first
|
43
|
+
bin.class.should == Lighthouse::Bin
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "#tickets" do
|
48
|
+
let(:tickets_response) do
|
49
|
+
File.read('spec/support/tickets.json')
|
50
|
+
end
|
51
|
+
|
52
|
+
before { project.stubs(:tickets_resource).returns(stub(:get => tickets_response)) }
|
53
|
+
|
54
|
+
it "should succeed" do
|
55
|
+
project.tickets
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should list the tickets" do
|
59
|
+
project.tickets.all? { |t| t.is_a?(Lighthouse::Ticket) }.should be_true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "#find_tickets" do
|
64
|
+
it "should be implemented"
|
65
|
+
end
|
66
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
-
require
|
1
|
+
Bundler.require(:default, :test)
|
2
|
+
require 'rspec/autorun'
|
2
3
|
require 'buildmeister'
|
3
4
|
require 'fakeweb'
|
4
5
|
require 'timecop'
|
6
|
+
require 'mocha/api'
|
5
7
|
|
6
8
|
FakeWeb.allow_net_connect = false
|
7
9
|
|
8
|
-
|
10
|
+
RSpec.configure do |config|
|
9
11
|
config.mock_with :mocha
|
12
|
+
config.filter_run :focus => true
|
13
|
+
config.run_all_when_everything_filtered = true
|
10
14
|
end
|
11
15
|
|
12
16
|
def load_test_config
|
13
17
|
@test_config ||= YAML.load_file(File.dirname(__FILE__) + '/../config/buildmeister_config.sample.yml')
|
14
|
-
end
|
18
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"ticket_bins":[{"ticket_bin":{"default":false,"id":308918,"name":"Current","position":1,"project_id":64437,"query":"state:open not-milestone:'Someday'","shared":true,"tickets_count":105,"updated_at":"2013-10-15T14:40:42-07:00","user_id":15047,"global":false}},{"ticket_bin":{"default":false,"id":252177,"name":"Active","position":2,"project_id":64437,"query":"state:active sort:responsible","shared":true,"tickets_count":13,"updated_at":"2013-10-15T14:40:42-07:00","user_id":16400,"global":false}},{"ticket_bin":{"default":false,"id":252178,"name":"Hold","position":3,"project_id":64437,"query":"state:hold sort:responsible","shared":true,"tickets_count":6,"updated_at":"2013-10-15T14:40:42-07:00","user_id":16400,"global":false}},{"ticket_bin":{"default":false,"id":252180,"name":"Staged","position":4,"project_id":64437,"query":"state:staged sort:responsible","shared":true,"tickets_count":32,"updated_at":"2013-10-15T14:40:42-07:00","user_id":16400,"global":false}},{"ticket_bin":{"default":false,"id":252181,"name":"Verified","position":5,"project_id":64437,"query":"state:verified sort:responsible","shared":true,"tickets_count":0,"updated_at":"2013-10-15T14:40:42-07:00","user_id":16400,"global":false}},{"ticket_bin":{"default":false,"id":252182,"name":"Resolved (Recently)","position":6,"project_id":64437,"query":"state:resolved updated:\"since yesterday\" sort:milestone","shared":true,"tickets_count":2,"updated_at":"2013-10-15T14:40:42-07:00","user_id":16400,"global":false}}]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"projects":[{"project":{"archived":false,"closed_states":"resolved/66973b # You can customize colors\r\nhold/fc0 # with 3 or 6 character hex codes\r\ninvalid/c00 # 'A30' expands to 'AA3300'","created_at":"2009-02-11T16:56:39-08:00","default_assigned_user_id":null,"default_milestone_id":0,"default_ticket_text":"","description":"Bugs associated with the Airstrip / Landing pages app.","description_html":"<div><p>Bugs associated with the Airstrip / Landing pages app.</p></div>","enable_points":false,"hidden":false,"id":25331,"license":null,"name":"Airstrip","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nstaged/58b28d # Staged and being reviewed\r\nverified/66973b # Staged and verified\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":3,"oss_readonly":false,"permalink":"airstrip","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"tickets":true},"updated_at":"2013-08-29T16:56:15-07:00","open_states_list":"new,open,active,staged,verified,hold","closed_states_list":"resolved,hold,invalid"}},{"project":{"archived":false,"closed_states":"resolved/66973b\r\ninvalid/c00","created_at":"2013-10-09T11:43:37-07:00","default_assigned_user_id":16400,"default_milestone_id":0,"default_ticket_text":"","description":"Onehub.com \u2014 All grown up.","description_html":"<div><p>Onehub.com — All grown up.</p></div>","enable_points":false,"hidden":false,"id":113854,"license":null,"name":"Americano","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nstaged/58b28d # Staged and being reviewed\r\nverified/66973b # Staged and verified\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":7,"oss_readonly":false,"permalink":"americano","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"projects":true,"milestones":true,"tickets":true},"updated_at":"2013-10-14T16:46:29-07:00","open_states_list":"new,open,active,staged,verified,hold","closed_states_list":"resolved,invalid"}},{"project":{"archived":false,"closed_states":"resolved/66973b # You can customize colors\r\ninvalid/c00 # 'A30' expands to 'AA3300'","created_at":"2012-08-31T16:54:27-07:00","default_assigned_user_id":220805,"default_milestone_id":0,"default_ticket_text":"","description":"Onehub Android app.","description_html":"<div><p>Onehub Android app.</p></div>","enable_points":false,"hidden":false,"id":99396,"license":null,"name":"Android","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nready/f60 # Work is ready for review\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":12,"oss_readonly":false,"permalink":"android","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"tickets":true,"milestones":true,"projects":true},"updated_at":"2013-10-15T08:34:29-07:00","open_states_list":"new,open,active,ready,hold","closed_states_list":"resolved,invalid"}},{"project":{"archived":false,"closed_states":"resolved/66973b # Deployed to production\r\ninvalid/c00 # Unable to repro or is a duplicate","created_at":"2011-10-10T16:16:04-07:00","default_assigned_user_id":null,"default_milestone_id":null,"default_ticket_text":"","description":"A trusted name in sign-ins.","description_html":"<div><p>A trusted name in sign-ins.</p></div>","enable_points":false,"hidden":false,"id":84347,"license":null,"name":"Aperture","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nstaged/58b28d # Staged and being reviewed\r\nverified/66973b # Staged and verified\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":5,"oss_readonly":false,"permalink":"aperture","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"milestones":true,"tickets":true},"updated_at":"2013-10-11T09:53:56-07:00","open_states_list":"new,open,active,staged,verified,hold","closed_states_list":"resolved,invalid"}},{"project":{"archived":false,"closed_states":"resolved/66973b # You can customize colors\r\ninvalid/c00 # 'A30' expands to 'AA3300'","created_at":"2009-01-16T15:47:28-08:00","default_assigned_user_id":15047,"default_milestone_id":0,"default_ticket_text":"","description":"","description_html":"","enable_points":false,"hidden":false,"id":23646,"license":null,"name":"Barista","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nstaged/58b28d # Staged and being reviewed\r\nverified/66973b # Staged and verified\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":36,"oss_readonly":false,"permalink":"barista","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"tickets":true,"milestones":true},"updated_at":"2013-10-10T17:34:36-07:00","open_states_list":"new,open,active,staged,verified,hold","closed_states_list":"resolved,invalid"}},{"project":{"archived":true,"closed_states":"resolved/66973b # You can customize colors\r\ninvalid/c00 # 'A30' expands to 'AA3300'","created_at":"2008-10-13T16:10:27-07:00","default_assigned_user_id":16400,"default_milestone_id":29084,"default_ticket_text":"","description":"Onehub.com, company-wide efforts, and Marketing.","description_html":"<div><p>Onehub.com, company-wide efforts, and Marketing.</p></div>","enable_points":false,"hidden":false,"id":18236,"license":null,"name":"Cappuccino","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nstaged/58b28d # Staged and being reviewed\r\nverified/66973b # Staged and verified\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":13,"oss_readonly":false,"permalink":"cappuccino","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"tickets":true,"projects":true},"updated_at":"2013-10-14T11:09:55-07:00","open_states_list":"new,open,active,staged,verified,hold","closed_states_list":"resolved,invalid"}},{"project":{"archived":false,"closed_states":"resolved/66973b # Deployed to production\r\ninvalid/c00 # Unable to repro or is a duplicate","created_at":"2012-07-19T10:28:03-07:00","default_assigned_user_id":null,"default_milestone_id":0,"default_ticket_text":"","description":"\"Tailor Onehub Enterprise to suit your environment.\"","description_html":"<div><p>\"Tailor Onehub Enterprise to suit your environment.\"</p></div>","enable_points":false,"hidden":false,"id":97563,"license":null,"name":"Configurator","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nstaged/58b28d # Staged and being reviewed\r\nverified/66973b # Staged and verified\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":12,"oss_readonly":false,"permalink":"configurator","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"tickets":true},"updated_at":"2013-06-27T11:37:48-07:00","open_states_list":"new,open,active,staged,verified,hold","closed_states_list":"resolved,invalid"}},{"project":{"archived":false,"closed_states":"resolved/66973b # Deployed to production\r\ninvalid/c00 # Unable to repro or is a duplicate","created_at":"2010-11-18T14:22:57-08:00","default_assigned_user_id":null,"default_milestone_id":142029,"default_ticket_text":"","description":"2 Shots of Workspaces","description_html":"<div><p>2 Shots of Workspaces</p></div>","enable_points":false,"hidden":false,"id":64437,"license":null,"name":"Doppio","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently being worked on\r\nstaged/58b28d # Staged and being reviewed\r\nverified/66973b # Verified and ready to deploy\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":514,"oss_readonly":false,"permalink":"doppio","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"tickets":true,"milestones":true},"updated_at":"2013-10-15T10:28:26-07:00","open_states_list":"new,open,active,staged,verified,hold","closed_states_list":"resolved,invalid"}},{"project":{"archived":false,"closed_states":"resolved/66973b # You can customize colors\r\ninvalid/c00 # 'A30' expands to 'AA3300'","created_at":"2009-09-21T16:10:43-07:00","default_assigned_user_id":null,"default_milestone_id":0,"default_ticket_text":"","description":"A managed file transfer service by Onehub\r\naka TRANSFERS","description_html":"<div><p>A managed file transfer service by Onehub<br>\naka TRANSFERS</p></div>","enable_points":false,"hidden":false,"id":37906,"license":null,"name":"Espresso","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nstaged/58b28d # Staged and being reviewed\r\nverified/66973b # Staged and verified\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":67,"oss_readonly":false,"permalink":"espresso","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"tickets":true,"milestones":true},"updated_at":"2013-10-10T16:53:06-07:00","open_states_list":"new,open,active,staged,verified,hold","closed_states_list":"resolved,invalid"}},{"project":{"archived":false,"closed_states":"resolved/66973b # You can customize colors\r\ninvalid/c00 # 'A30' expands to 'AA3300'","created_at":"2011-12-21T10:31:38-08:00","default_assigned_user_id":220805,"default_milestone_id":0,"default_ticket_text":"","description":"iOS Applications for Onehub","description_html":"<div><p>iOS Applications for Onehub</p></div>","enable_points":false,"hidden":false,"id":88129,"license":null,"name":"iOS","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nready/f60 # Work is ready for review\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":10,"oss_readonly":false,"permalink":"ios","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"tickets":true,"projects":true,"milestones":true},"updated_at":"2013-10-15T08:25:09-07:00","open_states_list":"new,open,active,ready,hold","closed_states_list":"resolved,invalid"}},{"project":{"archived":false,"closed_states":"resolved/66973b # Deployed to production\r\ninvalid/c00 # Unable to repro or is a duplicate","created_at":"2008-04-20T14:57:27-07:00","default_assigned_user_id":null,"default_milestone_id":28596,"default_ticket_text":"","description":"An online collaboration service by Onehub\r\naka WORKSPACES","description_html":"<div><p>An online collaboration service by Onehub<br>\naka WORKSPACES</p></div>","enable_points":false,"hidden":false,"id":10239,"license":null,"name":"Macchiato","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nstaged/58b28d # Staged and being reviewed\r\nverified/66973b # Staged and verified\r\nhold/fc0 # Punting on or awaiting feedback","open_tickets_count":398,"oss_readonly":false,"permalink":"macchiato","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":{"tickets":true,"milestones":true,"projects":true},"updated_at":"2013-10-11T14:34:00-07:00","open_states_list":"new,open,active,staged,verified,hold","closed_states_list":"resolved,invalid"}},{"project":{"archived":true,"closed_states":"resolved/66973b # You can customize colors\r\nhold/fc0 # with 3 or 6 character hex codes\r\ninvalid/c00 # 'A30' expands to 'AA3300'","created_at":"2009-09-13T13:37:01-07:00","default_assigned_user_id":null,"default_milestone_id":null,"default_ticket_text":"","description":"All issues related to the production and maintenance of the Workspace.me website.","description_html":"<div><p>All issues related to the production and maintenance of the\nWorkspace.me website.</p></div>","enable_points":false,"hidden":false,"id":37374,"license":null,"name":"Workspace.me","open_states":"new/f17\r\nopen/828282\r\nactive/09f # Currently bring worked on\r\nready/f60 # Fixed and ready to be staged\r\nstaged/58b28d # Staged and being reviewed\r\nverified/66973b # Staged and verified","open_tickets_count":2,"oss_readonly":false,"permalink":"workspaceme","points_scale":null,"public":false,"send_changesets_to_events":true,"todos_completed":null,"updated_at":"2012-11-19T12:29:54-08:00","open_states_list":"new,open,active,ready,staged,verified","closed_states_list":"resolved,hold,invalid"}}]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"tickets":[{"ticket":{"assigned_user_id":34520,"attachments_count":0,"closed":false,"created_at":"2013-10-14T10:32:20-07:00","creator_id":34520,"importance":0,"milestone_due_on":null,"milestone_id":142029,"milestone_order":9999,"number":3779,"permalink":"users-cant-update-their-address","project_id":64437,"raw_data":null,"spam":false,"state":"verified","tag":null,"title":"Users can't update their address","updated_at":"2013-10-15T16:23:14-07:00","user_id":34520,"version":10,"watchers_ids":[34520],"user_name":"Brandon Caplan","creator_name":"Brandon Caplan","assigned_user_name":"Brandon Caplan","url":"http://onehub.lighthouseapp.com/projects/64437/tickets/3779","milestone_title":"Someday","priority":9999,"original_body":"They can add one, but cannot change it.","latest_body":"They can add one, but cannot change it.","original_body_html":"<div><p>They can add one, but cannot change it.</p></div>","state_color":"66973b"}},{"ticket":{"assigned_user_id":17763,"attachments_count":0,"closed":false,"created_at":"2013-10-15T13:36:20-07:00","creator_id":17763,"importance":0,"milestone_due_on":"2013-01-01T00:00:00-08:00","milestone_id":168932,"milestone_order":9999,"number":3782,"permalink":"ip_address-is-not-correct-when-checking-if-assets-are-dangling","project_id":64437,"raw_data":null,"spam":false,"state":"new","tag":null,"title":"IP_ADDRESS is not correct when checking if assets are dangling","updated_at":"2013-10-15T13:36:22-07:00","user_id":17763,"version":1,"watchers_ids":[34520,17763],"user_name":"Brian Moran","creator_name":"Brian Moran","assigned_user_name":"Brian Moran","url":"http://onehub.lighthouseapp.com/projects/64437/tickets/3782","milestone_title":"Maintenance","priority":9999,"original_body":"Bug Description.","latest_body":"Bug Description.","original_body_html":"<div><p>Bug Description.</p></div>","state_color":"ff1177"}},{"ticket":{"assigned_user_id":16400,"attachments_count":0,"closed":false,"created_at":"2013-10-15T12:44:21-07:00","creator_id":16400,"importance":0,"milestone_due_on":"2013-11-01T00:00:00-07:00","milestone_id":186450,"milestone_order":9999,"number":13,"permalink":"improve-the-grid-settings","project_id":113854,"raw_data":null,"spam":false,"state":"active","tag":null,"title":"Improve the grid settings","updated_at":"2013-10-15T12:44:25-07:00","user_id":16400,"version":1,"watchers_ids":[16400],"user_name":"Matthew Anderson","creator_name":"Matthew Anderson","assigned_user_name":"Matthew Anderson","url":"http://onehub.lighthouseapp.com/projects/113854/tickets/13","milestone_title":"Launch","priority":9999,"original_body":"Defaults at each breakpoint?","latest_body":"Defaults at each breakpoint?","original_body_html":"<div><p>Defaults at each breakpoint?</p></div>","state_color":"09f"}}]}
|
metadata
CHANGED
@@ -1,47 +1,83 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildmeister
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 6
|
10
|
-
version: 2.0.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Leigh Caplan
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
segments:
|
28
|
-
- 2
|
29
|
-
- 1
|
30
|
-
version: "2.1"
|
31
|
-
requirement: *id001
|
11
|
+
date: 2013-10-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: buildmeister
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
32
21
|
prerelease: false
|
33
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jeweler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.6.7
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.6.7
|
35
69
|
description: Dead simple tools for managing Lighthouse and Git deployment workflow
|
36
70
|
email: lcaplan@onehub.com
|
37
|
-
executables:
|
71
|
+
executables:
|
38
72
|
- buildmeister
|
39
73
|
- git_cleanup
|
40
74
|
extensions: []
|
41
|
-
|
42
|
-
extra_rdoc_files:
|
75
|
+
extra_rdoc_files:
|
43
76
|
- README.rdoc
|
44
|
-
files:
|
77
|
+
files:
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- Guardfile
|
45
81
|
- History.txt
|
46
82
|
- README.rdoc
|
47
83
|
- Rakefile
|
@@ -54,47 +90,48 @@ files:
|
|
54
90
|
- lib/buildmeister/core_ext.rb
|
55
91
|
- lib/buildmeister/finder.rb
|
56
92
|
- lib/buildmeister/git_utils.rb
|
93
|
+
- lib/buildmeister/json_tools.rb
|
94
|
+
- lib/buildmeister/json_utils.rb
|
57
95
|
- lib/buildmeister/notifier.rb
|
58
96
|
- lib/buildmeister/project.rb
|
59
97
|
- lib/buildmeister/string_utils.rb
|
60
98
|
- lib/git_cleanup.rb
|
99
|
+
- lib/lighthouse/account.rb
|
100
|
+
- lib/lighthouse/bin.rb
|
101
|
+
- lib/lighthouse/project.rb
|
102
|
+
- lib/lighthouse/ticket.rb
|
61
103
|
- spec/buildmeister/base_spec.rb
|
62
104
|
- spec/buildmeister/bin_spec.rb
|
63
|
-
- spec/
|
105
|
+
- spec/lighthouse/account_spec.rb
|
106
|
+
- spec/lighthouse/bin_spec.rb
|
107
|
+
- spec/lighthouse/project_spec.rb
|
108
|
+
- spec/lighthouse/ticket_spec.rb
|
64
109
|
- spec/spec.opts
|
65
110
|
- spec/spec_helper.rb
|
111
|
+
- spec/support/bins.json
|
112
|
+
- spec/support/projects.json
|
113
|
+
- spec/support/tickets.json
|
66
114
|
homepage: http://github.com/onehub/buildmeister
|
67
115
|
licenses: []
|
68
|
-
|
116
|
+
metadata: {}
|
69
117
|
post_install_message:
|
70
118
|
rdoc_options: []
|
71
|
-
|
72
|
-
require_paths:
|
119
|
+
require_paths:
|
73
120
|
- lib
|
74
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
none: false
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
hash: 3
|
89
|
-
segments:
|
90
|
-
- 0
|
91
|
-
version: "0"
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
92
131
|
requirements: []
|
93
|
-
|
94
132
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.8
|
133
|
+
rubygems_version: 2.1.8
|
96
134
|
signing_key:
|
97
|
-
specification_version:
|
135
|
+
specification_version: 4
|
98
136
|
summary: Dead simple tools for managing Lighthouse and Git deployment workflow
|
99
137
|
test_files: []
|
100
|
-
|
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Buildmeister::Project' do
|
4
|
-
def valid_config
|
5
|
-
@valid_config ||= load_test_config['projects'].first
|
6
|
-
end
|
7
|
-
|
8
|
-
def project_stub
|
9
|
-
stub(:name => valid_config['name'], :bins => valid_config['bins'].map { |b| stub({:name => b}) })
|
10
|
-
end
|
11
|
-
|
12
|
-
before(:each) do
|
13
|
-
Lighthouse::Project.stubs(:find).returns([project_stub])
|
14
|
-
@p = Buildmeister::Project.new(valid_config)
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "#new" do
|
18
|
-
it "should create new given a valid config" do
|
19
|
-
@p.should be_an_instance_of(Buildmeister::Project)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should set the name" do
|
23
|
-
@p.name.should == valid_config['name']
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should set the project" do
|
27
|
-
@p.project
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should set up the appropriate number of bins" do
|
31
|
-
@p.should have(valid_config['bins'].size).bins
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should set up Buildmeister::Bin objects" do
|
35
|
-
@p.bins.all? { |b| b.is_a?(Buildmeister::Bin) }.should be_true
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should keep bins in order" do
|
39
|
-
@p.bins.map(&:name).should == ['Ready', 'Staged', 'Verified', 'Ready (Experimental)', 'Staged (Experimental)']
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "#changed?" do
|
44
|
-
context "with changed bins" do
|
45
|
-
before(:each) do
|
46
|
-
@p.bins.each { |b| b.stubs(:changed?).returns(true) }
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should be true" do
|
50
|
-
@p.changed?.should be_true
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context "with no changed bins" do
|
55
|
-
before(:each) do
|
56
|
-
@p.bins.each { |b| b.stubs(:changed?).returns(false) }
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should be false" do
|
60
|
-
@p.changed?.should be_false
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "#bins" do
|
66
|
-
it "should search using named" do
|
67
|
-
@p.bins.named('Ready').should be_an_instance_of(Buildmeister::Bin)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe "#display" do
|
72
|
-
it "should display the bins" do
|
73
|
-
@p.display.should == <<-STRING_CHEESE
|
74
|
-
Macchiato
|
75
|
-
----------
|
76
|
-
Ready:
|
77
|
-
Staged:
|
78
|
-
Verified:
|
79
|
-
Ready (Experimental):
|
80
|
-
Staged (Experimental):
|
81
|
-
STRING_CHEESE
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|