This repository has been archived by the owner on Jul 10, 2018. It is now read-only.
forked from jenkinsci/jenkins.rb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
128 lines (111 loc) · 3.58 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
require 'rubygems'
require 'bundler/setup'
$:.unshift('lib')
require 'hudson'
Gem::Specification.new do |s|
$gemspec = s
s.name = s.rubyforge_project = "hudson"
s.version = Hudson::VERSION
s.summary = "Painless Continuous Integration with Hudson Server"
s.description = "A suite of utilities for bringing continous integration to your projects (not the other way around) with hudson CI"
s.email = ["cowboyd@thefrontside.net", "drnicwilliams@gmail.com"]
s.homepage = "http://github.com/cowboyd/hudson.rb"
s.authors = ["Charles Lowell", "Dr Nic Williams"]
s.executables = ["hudson"]
s.require_paths = ["lib"]
s.files = Rake::FileList.new("**/*").tap do |manifest|
manifest.exclude "tmp", "**/*.gem"
end.to_a
s.add_dependency("term-ansicolor", [">= 1.0.4"])
s.add_dependency("yajl-ruby", [">= 0.7.6"])
s.add_dependency("httparty", ["~> 0.5.2"])
s.add_dependency("builder", ["~> 2.1.2"])
s.add_dependency("thor", ["= 0.14.2"])
s.add_dependency("activesupport", ["~> 3.0.0"])
s.add_dependency("hpricot")
s.add_development_dependency("rake", ["~> 0.8.7"])
s.add_development_dependency("cucumber", ["~> 0.9.0"])
s.add_development_dependency("rspec", ["~> 2.0.0.beta"])
s.add_development_dependency("json", ["~>1.4.0"])
s.add_development_dependency("awesome_print")
end
desc "Build gem"
task :gem => :gemspec do
Gem::Builder.new($gemspec).build
end
desc "Build gemspec"
task :gemspec => :clean do
File.open("#{$gemspec.name}.gemspec", "w") do |f|
f.write($gemspec.to_ruby)
end
end
desc "Clean up"
task :clean do
sh "rm -rf *.gem"
end
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
namespace :cucumber do
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:wip, 'Run features that are being worked on') do |t|
t.cucumber_opts = "--tags @wip"
end
Cucumber::Rake::Task.new(:ok, 'Run features that should be working') do |t|
t.cucumber_opts = "--tags ~@wip"
end
task :all => [:ok, :wip]
end
desc 'Alias for cucumber:ok'
task :cucumber => 'cucumber:ok'
desc "Start test server; Run cucumber:ok; Kill Test Server;"
task :default => ["hudson:server:killtest", "hudson:server:test"] do
require 'socket'
print "waiting for at most 30 seconds for the server to start"
tries = 1
begin
print "."; $stdout.flush
tries += 1
Net::HTTP.start("localhost", "3010") { |http| http.get('/') }
sleep(10)
puts ""
Rake::Task["cucumber:ok"].invoke
rescue Exception => e
if tries <= 15
sleep 2
retry
end
raise
ensure
Rake::Task["hudson:server:killtest"].tap do |task|
task.reenable
task.invoke
end
end
end
namespace :hudson do
namespace :server do
require 'fileutils'
desc "Run a server for tests"
task :test do
port = 3010
control = 3011
FileUtils.chdir(File.dirname(__FILE__)) do
logfile = File.join("/tmp", "test_hudson.log")
puts "Launching hudson test server at http://localhost:#{port}..."
puts " output will be logged to #{logfile}"
`ruby bin/hudson server --home /tmp/test_hudson --port #{port} --control #{control} --daemon --logfile #{logfile}`
end
end
desc "Kill hudson test server if it is running."
task :killtest do
FileUtils.chdir(File.dirname(__FILE__)) do
puts "Killing any running server processes..."
`ruby bin/hudson server --control 3011 --kill 2>/dev/null`
end
end
desc "Grab the latest hudson.war from hudson-ci.org"
task :getwar do
sh "cd lib/hudson && rm hudson.war && wget http://hudson-ci.org/latest/hudson.war"
end
end
end