-
Notifications
You must be signed in to change notification settings - Fork 0
/
rakefile
60 lines (53 loc) · 2.13 KB
/
rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/lib')
require 'cruise_face'
require 'logger'
ActiveResource::Base.logger = Logger.new(STDOUT)
ActiveResource::Base.logger.level = Logger::INFO
namespace :dump do
task :pipeline_status do
CruiseFace.site('https://cruise01.thoughtworks.com/cruise').login('xli', Base64.decode64(ENV['LDAP_CODE']))
ps = CruiseFace::Resource.find_pipeline_status
File.open "./tast/data/ps.xml", 'w' do |f|
f.write ps.to_xml
end
end
task :pipeline_history do
CruiseFace.site('https://cruise01.thoughtworks.com/cruise').login('xli', Base64.decode64(ENV['LDAP_CODE']))
pipeline = CruiseFace.get(ENV['PN'])
File.open "./tast/data/#{pipeline.name}.xml", 'w' do |f|
f.write pipeline.resource.to_xml
end
pipeline.history.each do |history_pipeline|
history_pipeline.stages.each do |stage_name, stage|
begin
stage_status = history_pipeline.find_stage_status(stage)
File.open "./tast/data/#{history_pipeline.name}-#{history_pipeline.label}-#{stage.name}-#{stage.counter}.xml", 'w' do |f|
f.write stage_status.to_xml
end
rescue => e
#ignore cruise stage not exist problem when the pipeline is building
end
end
end
puts 'done'
end
task :stage_status do
CruiseFace.site('https://cruise01.thoughtworks.com/cruise').login('xli', Base64.decode64(ENV['LDAP_CODE']))
pipeline = CruiseFace::Resource.find_stage_status(ENV['PN'])
File.open "./tast/data/#{pipeline.name}.xml", 'w' do |f|
f.write pipeline.resource.to_xml
end
puts 'done'
end
end
require 'echoe'
Echoe.new('cruiseface', '1.0.2') do |p|
p.description = "CruiseFace arms to give a friendly Cruise Pipeline dashboard info for developers."
p.url = "https://github.com/xli/cruiseface"
p.author = "Li Xiao"
p.email = "swing1979@gmail.com"
p.ignore_pattern = "*.gemspec"
p.dependencies = ["activeresource", "highline"]
p.ignore_pattern = ['tast/*.rb', 'tast/**/*']
p.rdoc_options = %w(--main README.rdoc --inline-source --line-numbers --charset UTF-8)
end