buildr 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +35 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/buildr.buildfile +6 -1
- data/buildr.gemspec +10 -9
- data/doc/_config.yml +1 -0
- data/doc/_layouts/default.html +25 -19
- data/doc/artifacts.textile +0 -36
- data/doc/building.textile +0 -38
- data/doc/contributing.textile +51 -15
- data/doc/css/default.css +11 -4
- data/doc/css/print.css +32 -24
- data/doc/download.textile +2 -1
- data/doc/extending.textile +10 -20
- data/doc/images/1442160941-frontcover.jpg +0 -0
- data/doc/images/asf-logo.png +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.png +0 -0
- data/doc/index.textile +39 -17
- data/doc/{getting_started.textile → installing.textile} +2 -67
- data/doc/languages.textile +50 -52
- data/doc/more_stuff.textile +154 -62
- data/doc/packaging.textile +0 -82
- data/doc/preface.textile +41 -15
- data/doc/projects.textile +0 -18
- data/doc/quick_start.textile +210 -0
- data/doc/scripts/install-linux.sh +10 -2
- data/doc/settings_profiles.textile +1 -33
- data/doc/testing.textile +6 -32
- data/lib/buildr.rb +2 -1
- data/lib/buildr/core.rb +6 -0
- data/lib/buildr/core/application.rb +2 -5
- data/lib/buildr/core/build.rb +29 -19
- data/lib/buildr/core/compile.rb +22 -4
- data/lib/buildr/core/filter.rb +2 -4
- data/lib/buildr/core/project.rb +5 -4
- data/lib/buildr/core/shell.rb +198 -0
- data/lib/buildr/core/test.rb +2 -0
- data/lib/buildr/core/transports.rb +18 -19
- data/lib/buildr/core/util.rb +178 -9
- data/lib/buildr/groovy.rb +1 -0
- data/lib/buildr/groovy/bdd.rb +5 -5
- data/lib/buildr/groovy/shell.rb +48 -0
- data/lib/buildr/ide/eclipse.rb +148 -36
- data/lib/buildr/ide/eclipse/java.rb +53 -0
- data/lib/buildr/ide/eclipse/plugin.rb +68 -0
- data/lib/buildr/ide/eclipse/scala.rb +66 -0
- data/lib/buildr/java/bdd.rb +16 -8
- data/lib/buildr/java/cobertura.rb +44 -13
- data/lib/buildr/java/commands.rb +5 -3
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +18 -0
- data/lib/buildr/java/packaging.rb +2 -2
- data/lib/buildr/java/rjb.rb +1 -1
- data/lib/buildr/java/test_result.rb +48 -1
- data/lib/buildr/java/tests.rb +8 -5
- data/lib/buildr/packaging/artifact_namespace.rb +1 -1
- data/lib/buildr/packaging/package.rb +6 -2
- data/lib/buildr/packaging/zip.rb +10 -1
- data/lib/buildr/packaging/ziptask.rb +5 -2
- data/lib/buildr/scala.rb +1 -0
- data/lib/buildr/scala/bdd.rb +17 -8
- data/lib/buildr/scala/compiler.rb +66 -21
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
- data/lib/buildr/scala/shell.rb +55 -0
- data/lib/buildr/scala/tests.rb +6 -5
- data/lib/buildr/shell.rb +180 -0
- data/rakelib/doc.rake +2 -3
- data/rakelib/jekylltask.rb +42 -32
- data/rakelib/package.rake +4 -2
- data/rakelib/rspec.rake +3 -3
- data/rakelib/setup.rake +7 -1
- data/rakelib/stage.rake +9 -2
- data/rakelib/stage.rake~ +213 -0
- data/spec/core/application_spec.rb +84 -1
- data/spec/core/build_spec.rb +54 -2
- data/spec/core/common_spec.rb +1 -1
- data/spec/core/compile_spec.rb +2 -1
- data/spec/core/extension_spec.rb +93 -0
- data/spec/core/test_spec.rb +2 -2
- data/spec/core/transport_spec.rb +1 -1
- data/spec/groovy/bdd_spec.rb +6 -6
- data/spec/groovy/compiler_spec.rb +1 -0
- data/spec/ide/eclipse_spec.rb +262 -72
- data/spec/java/{ant.rb → ant_spec.rb} +0 -0
- data/spec/java/bdd_spec.rb +15 -0
- data/spec/java/cobertura_spec.rb +9 -1
- data/spec/java/emma_spec.rb +1 -1
- data/spec/java/java_spec.rb +26 -0
- data/spec/java/packaging_spec.rb +9 -7
- data/spec/java/{test_coverage_spec.rb → test_coverage_helper.rb} +6 -4
- data/spec/java/tests_spec.rb +22 -0
- data/spec/packaging/archive_spec.rb +14 -0
- data/spec/packaging/artifact_spec.rb +2 -2
- data/spec/packaging/packaging_spec.rb +97 -2
- data/spec/sandbox.rb +3 -1
- data/spec/scala/bdd_spec.rb +17 -48
- data/spec/scala/compiler_spec.rb +31 -2
- data/spec/scala/tests_spec.rb +1 -0
- data/spec/spec_helpers.rb +12 -0
- metadata +145 -148
data/lib/buildr/scala/tests.rb
CHANGED
@@ -31,7 +31,7 @@ module Buildr::Scala
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def dependencies
|
34
|
-
["org.
|
34
|
+
["org.scala-tools.testing:scalacheck:jar:#{version}"]
|
35
35
|
end
|
36
36
|
|
37
37
|
private
|
@@ -109,8 +109,9 @@ module Buildr::Scala
|
|
109
109
|
ant.suite :classname=>suite
|
110
110
|
ant.reporter :type=>'stdout', :config=>reporter_options
|
111
111
|
ant.reporter :type=>'file', :filename=> reportFile, :config=>reporter_options
|
112
|
-
|
113
|
-
ant.
|
112
|
+
# TODO: This should be name=>value pairs!
|
113
|
+
#ant.includes group_includes.join(" ") if group_includes
|
114
|
+
#ant.excludes group_excludes.join(" ") if group_excludes
|
114
115
|
(options[:properties] || []).each { |name, value| ant.property :name=>name, :value=>value }
|
115
116
|
end
|
116
117
|
end
|
@@ -125,9 +126,9 @@ module Buildr::Scala
|
|
125
126
|
while (!completed) do
|
126
127
|
File.open(reportFile, "r") do |input|
|
127
128
|
while (line = input.gets) do
|
128
|
-
failed = (line =~ /(
|
129
|
+
failed = (line =~ /(TESTS? FAILED -)|(RUN STOPPED)|(RUN ABORTED)/) unless failed
|
129
130
|
completed |= (line =~ /Run completed\./)
|
130
|
-
break if (failed
|
131
|
+
break if (failed)
|
131
132
|
end
|
132
133
|
end
|
133
134
|
wait += 1
|
data/lib/buildr/shell.rb
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
|
17
|
+
module Buildr
|
18
|
+
module ShellProviders
|
19
|
+
class << self
|
20
|
+
def add(p)
|
21
|
+
@providers ||= {}
|
22
|
+
|
23
|
+
if p.lang == :none
|
24
|
+
@providers[:none] ||= []
|
25
|
+
@providers[:none] << p
|
26
|
+
else
|
27
|
+
@providers[p.lang] = p
|
28
|
+
end
|
29
|
+
end
|
30
|
+
alias :<< :add
|
31
|
+
|
32
|
+
def providers
|
33
|
+
@providers ||= {}
|
34
|
+
end
|
35
|
+
|
36
|
+
def each
|
37
|
+
providers.each do |lang, p|
|
38
|
+
if lang == :none
|
39
|
+
p.each do |x|
|
40
|
+
yield x
|
41
|
+
end
|
42
|
+
else
|
43
|
+
yield p
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
module Shell
|
51
|
+
class Base
|
52
|
+
attr_reader :project
|
53
|
+
|
54
|
+
class << self
|
55
|
+
def lang
|
56
|
+
:none
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_sym
|
60
|
+
@symbol ||= name.split('::').last.downcase.to_sym
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def initialize(project)
|
65
|
+
@project = project
|
66
|
+
end
|
67
|
+
|
68
|
+
def build?
|
69
|
+
true
|
70
|
+
end
|
71
|
+
|
72
|
+
def launch
|
73
|
+
fail 'Not implemented'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
module JavaRebel
|
78
|
+
def rebel_home
|
79
|
+
unless @rebel_home
|
80
|
+
@rebel_home = ENV['REBEL_HOME'] or ENV['JAVA_REBEL'] or ENV['JAVAREBEL'] or ENV['JAVAREBEL_HOME']
|
81
|
+
|
82
|
+
if @rebel_home and File.directory? @rebel_home
|
83
|
+
@rebel_home += File::SEPARATOR + 'javarebel.jar'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
if @rebel_home and File.exists? @rebel_home
|
88
|
+
@rebel_home
|
89
|
+
else
|
90
|
+
nil
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def rebel_args
|
95
|
+
if rebel_home
|
96
|
+
[
|
97
|
+
'-noverify',
|
98
|
+
"-javaagent:#{rebel_home}"
|
99
|
+
]
|
100
|
+
else
|
101
|
+
[]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def rebel_props(project)
|
106
|
+
{}
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
module ShellExtension
|
112
|
+
include Extension
|
113
|
+
|
114
|
+
first_time do
|
115
|
+
Project.local_task 'shell'
|
116
|
+
|
117
|
+
ShellProviders.each { |p| Project.local_task "shell:#{p.to_sym}" } # TODO not working
|
118
|
+
end
|
119
|
+
|
120
|
+
before_define do |project|
|
121
|
+
ShellProviders.each do |p|
|
122
|
+
name = p.to_sym
|
123
|
+
|
124
|
+
trace "Defining task #{project.name}:shell:#{name}"
|
125
|
+
|
126
|
+
p_inst = p.new project
|
127
|
+
deps = if p_inst.build? then [:compile] else [] end
|
128
|
+
|
129
|
+
project.task "shell:#{name}" => deps do
|
130
|
+
trace "Launching #{name} shell"
|
131
|
+
p_inst.launch
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
after_define do |project|
|
137
|
+
default_shell = project.shell.using
|
138
|
+
|
139
|
+
if default_shell
|
140
|
+
dep = "shell:#{default_shell.to_sym}"
|
141
|
+
|
142
|
+
trace "Defining task shell based on #{dep}"
|
143
|
+
project.task :shell => dep
|
144
|
+
else
|
145
|
+
project.task :shell do
|
146
|
+
fail "No shell provider defined for language '#{project.compile.language}'"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
class ShellConfig
|
152
|
+
def initialize(project)
|
153
|
+
@project = project
|
154
|
+
end
|
155
|
+
|
156
|
+
def using(*args)
|
157
|
+
if args.size > 0
|
158
|
+
@using ||= args.first
|
159
|
+
else
|
160
|
+
@using ||= find_shell_task
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
private
|
165
|
+
def find_shell_task
|
166
|
+
lang = @project.compile.language
|
167
|
+
ShellProviders.providers[lang]
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# TODO temporary hack
|
172
|
+
def shell
|
173
|
+
@shell ||= ShellConfig.new self
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
class Project
|
178
|
+
include ShellExtension
|
179
|
+
end
|
180
|
+
end
|
data/rakelib/doc.rake
CHANGED
@@ -42,13 +42,12 @@ begin
|
|
42
42
|
JekyllTask.new :jekyll do |task|
|
43
43
|
task.source = 'doc'
|
44
44
|
task.target = '_site'
|
45
|
-
task.pygments = true
|
46
45
|
end
|
47
46
|
|
48
47
|
rescue LoadError
|
49
48
|
puts "Buildr uses the mojombo-jekyll to generate the Web site. You can install it by running rake doc:setup"
|
50
49
|
task 'doc:setup' do
|
51
|
-
install_gem 'mojombo-jekyll', :source=>'http://gems.github.com', :version=>'0.4
|
50
|
+
install_gem 'mojombo-jekyll', :source=>'http://gems.github.com', :version=>'0.5.4'
|
52
51
|
if `pygmentize -V`.empty?
|
53
52
|
args = %w{easy_install Pygments}
|
54
53
|
args.unshift 'sudo' unless Config::CONFIG['host_os'] =~ /windows/
|
@@ -60,7 +59,7 @@ end
|
|
60
59
|
|
61
60
|
desc "Generate Buildr documentation as buildr.pdf"
|
62
61
|
file 'buildr.pdf'=>'_site' do |task|
|
63
|
-
pages = File.read('
|
62
|
+
pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map { |f| "_site/#{f}" }
|
64
63
|
sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}", '_site/preface.html', *pages
|
65
64
|
end
|
66
65
|
|
data/rakelib/jekylltask.rb
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
# the License.
|
15
15
|
|
16
16
|
|
17
|
+
gem 'mojombo-jekyll', '~> 0.5.2' # skip past some buggy versions
|
17
18
|
require 'rake/tasklib'
|
18
19
|
require 'jekyll'
|
19
20
|
|
@@ -39,14 +40,11 @@ class JekyllTask < Rake::TaskLib
|
|
39
40
|
|
40
41
|
attr_accessor :source
|
41
42
|
attr_accessor :target
|
42
|
-
attr_accessor :pygments
|
43
43
|
|
44
44
|
def generate(auto = false)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
touch target
|
49
|
-
end
|
45
|
+
options = { 'source'=>source, 'destination'=>target }
|
46
|
+
options = Jekyll.configuration(options)
|
47
|
+
site = Jekyll::Site.new(options)
|
50
48
|
|
51
49
|
if auto
|
52
50
|
require 'directory_watcher'
|
@@ -63,44 +61,22 @@ class JekyllTask < Rake::TaskLib
|
|
63
61
|
dw.add_observer do |*args|
|
64
62
|
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
65
63
|
puts "[#{t}] regeneration: #{args.size} files changed"
|
66
|
-
process
|
64
|
+
site.process
|
67
65
|
puts "Done"
|
68
66
|
end
|
69
67
|
loop { sleep 1 }
|
70
68
|
else
|
71
69
|
puts "Generating documentation in #{target}"
|
72
|
-
process
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
# TODO: Worked around bug in Jekyll 0.4.1. Removed when 0.4.2 is out.
|
79
|
-
# http://github.com/mojombo/jekyll/commit/c180bc47bf2f63db1bff9f6600cccbe5ad69077e#diff-0
|
80
|
-
class Albino
|
81
|
-
def execute(command)
|
82
|
-
output = ''
|
83
|
-
Open4.popen4(command) do |pid, stdin, stdout, stderr|
|
84
|
-
stdin.puts @target
|
85
|
-
stdin.close
|
86
|
-
output = stdout.read.strip
|
87
|
-
[stdout, stderr].each { |io| io.close }
|
70
|
+
site.process
|
71
|
+
touch target
|
88
72
|
end
|
89
|
-
output
|
90
73
|
end
|
91
74
|
end
|
92
75
|
|
93
|
-
class Jekyll::Page
|
94
|
-
def render(layouts, site_payload)
|
95
|
-
puts "... #{@name}"
|
96
|
-
payload = {"page" => self.data}.deep_merge(site_payload)
|
97
|
-
do_layout(payload, layouts)
|
98
|
-
end
|
99
|
-
end
|
100
76
|
|
101
77
|
module TocFilter
|
102
78
|
def toc(input)
|
103
|
-
input.scan(/<(h2)(?:>|\s+(.*?)>)(
|
79
|
+
input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).inject(%{<ol class="toc">}) { |toc, entry|
|
104
80
|
id = entry[1][/^id=(['"])(.*)\1$/, 2]
|
105
81
|
title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
|
106
82
|
toc << %{<li><a href="##{id}">#{title}</a></li>}
|
@@ -108,3 +84,37 @@ module TocFilter
|
|
108
84
|
end
|
109
85
|
end
|
110
86
|
Liquid::Template.register_filter(TocFilter)
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
# Under Ruby 1.9 [a,b,c].to_s doesn't join the array first. (Jekyll 0.5.2 requires this)
|
91
|
+
module Jekyll
|
92
|
+
class HighlightBlock < Liquid::Block
|
93
|
+
def render(context)
|
94
|
+
if context.registers[:site].pygments
|
95
|
+
render_pygments(context, super.join)
|
96
|
+
else
|
97
|
+
render_codehighlighter(context, super.join)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# Ruby 1.9 has sane closure scoping which manages to mess Liquid filters. (Liquid 2.0.0 requires this)
|
104
|
+
module Liquid
|
105
|
+
class Variable
|
106
|
+
def render(context)
|
107
|
+
return '' if @name.nil?
|
108
|
+
@filters.inject(context[@name]) do |output, filter|
|
109
|
+
filterargs = filter[1].to_a.collect do |a|
|
110
|
+
context[a]
|
111
|
+
end
|
112
|
+
begin
|
113
|
+
context.invoke(filter[0], output, *filterargs)
|
114
|
+
rescue FilterNotFound
|
115
|
+
raise FilterNotFound, "Error - filter '#{filter[0]}' in '#{@markup.strip}' could not be found."
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
data/rakelib/package.rake
CHANGED
@@ -51,9 +51,11 @@ end
|
|
51
51
|
file Rake::GemPackageTask.new(spec).package_dir=>:compile
|
52
52
|
file Rake::GemPackageTask.new(spec).package_dir_path=>:compile
|
53
53
|
|
54
|
-
# We also need the other
|
54
|
+
# We also need the other packages (JRuby if building on Ruby, and vice versa)
|
55
55
|
# Must call new with block, even if block does nothing, otherwise bad things happen.
|
56
|
-
|
56
|
+
@specs.values.each do |s|
|
57
|
+
Rake::GemPackageTask.new(s) { |task| }
|
58
|
+
end
|
57
59
|
|
58
60
|
|
59
61
|
desc "Upload snapshot packages over to people.apache.org"
|
data/rakelib/rspec.rake
CHANGED
@@ -19,10 +19,10 @@ begin
|
|
19
19
|
directory '_reports'
|
20
20
|
|
21
21
|
desc "Run all specs"
|
22
|
-
Spec::Rake::SpecTask.new :spec=>'_reports' do |task|
|
22
|
+
Spec::Rake::SpecTask.new :spec=>['_reports', :compile] do |task|
|
23
23
|
task.spec_files = FileList['spec/**/*_spec.rb']
|
24
24
|
task.spec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
|
25
|
-
task.spec_opts = %w{--format specdoc --format failing_examples:failed --format html:_reports/specs.html --
|
25
|
+
task.spec_opts = %w{--format specdoc --format failing_examples:failed --format html:_reports/specs.html --backtrace}
|
26
26
|
task.spec_opts << '--colour' if $stdout.isatty
|
27
27
|
end
|
28
28
|
file('_reports/specs.html') { task(:spec).invoke }
|
@@ -35,7 +35,7 @@ begin
|
|
35
35
|
end
|
36
36
|
|
37
37
|
desc 'Run RSpec and generate Spec and coverage reports (slow)'
|
38
|
-
Spec::Rake::SpecTask.new :coverage=>'_reports' do |task|
|
38
|
+
Spec::Rake::SpecTask.new :coverage=>['_reports', :compile] do |task|
|
39
39
|
task.spec_files = FileList['spec/**/*_spec.rb']
|
40
40
|
task.spec_opts = %W{--format progress --format failing_examples:failed --format html:_reports/specs.html --backtrace}
|
41
41
|
task.spec_opts << '--colour' if $stdout.isatty
|
data/rakelib/setup.rake
CHANGED
@@ -17,6 +17,12 @@
|
|
17
17
|
require 'jruby' if RUBY_PLATFORM[/java/]
|
18
18
|
require 'rubygems/source_info_cache'
|
19
19
|
|
20
|
+
RAKE_SUDO = case (ENV['RAKE_SUDO'] or 'yes').strip.downcase
|
21
|
+
when 'yes', 'true'
|
22
|
+
true
|
23
|
+
else
|
24
|
+
false
|
25
|
+
end
|
20
26
|
|
21
27
|
# Install the specified gem. Options include:
|
22
28
|
# - :version -- Version requirement, e.g. '1.2' or '~> 1.2'
|
@@ -27,7 +33,7 @@ def install_gem(name, options = {})
|
|
27
33
|
puts "Installing #{name} ..."
|
28
34
|
rb_bin = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
29
35
|
args = []
|
30
|
-
args << 'sudo' << 'env' << "JAVA_HOME=#{ENV['JAVA_HOME']}" if sudo_needed?
|
36
|
+
args << 'sudo' << 'env' << "JAVA_HOME=#{ENV['JAVA_HOME']}" if sudo_needed? and RAKE_SUDO
|
31
37
|
args << rb_bin << '-S' << 'gem' << 'install' << name
|
32
38
|
args << '--version' << dep.version_requirements.to_s
|
33
39
|
args << '--source' << options[:source] if options[:source]
|
data/rakelib/stage.rake
CHANGED
@@ -29,7 +29,7 @@ task :prepare do |task, args|
|
|
29
29
|
lambda do
|
30
30
|
puts "Checking there are no local changes ... "
|
31
31
|
svn = `svn status`
|
32
|
-
fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
|
32
|
+
#fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
|
33
33
|
git = `git status`
|
34
34
|
fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^#\t/]
|
35
35
|
puts "[X] There are no local changes, everything is in source control"
|
@@ -40,7 +40,7 @@ task :prepare do |task, args|
|
|
40
40
|
puts "Checking that CHANGELOG indicates most recent version and today's date ... "
|
41
41
|
expecting = "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
|
42
42
|
header = File.readlines('CHANGELOG').first.chomp
|
43
|
-
fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
|
43
|
+
#fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
|
44
44
|
puts "[x] CHANGELOG indicates most recent version and today's date"
|
45
45
|
end.call
|
46
46
|
|
@@ -62,6 +62,13 @@ task :prepare do |task, args|
|
|
62
62
|
puts "[X] We have JRuby, Scala and Groovy"
|
63
63
|
end.call
|
64
64
|
|
65
|
+
# Need Prince to generate PDF
|
66
|
+
lambda do
|
67
|
+
puts "Checking that we have prince available ... "
|
68
|
+
sh 'prince --version'
|
69
|
+
puts "[X] We have prince available"
|
70
|
+
end.call
|
71
|
+
|
65
72
|
# Need RubyForge to upload new release files.
|
66
73
|
lambda do
|
67
74
|
puts "[!] Make sure you have admin privileges to make a release on RubyForge"
|
data/rakelib/stage.rake~
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
|
17
|
+
require 'digest/md5'
|
18
|
+
require 'digest/sha1'
|
19
|
+
|
20
|
+
begin # Releases upload Gems to RubyForge.
|
21
|
+
require 'rubyforge'
|
22
|
+
rescue LoadError
|
23
|
+
task(:setup) { install_gem 'rubyforge' }
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
task :prepare do |task, args|
|
28
|
+
# Make sure we're doing a release from checked code.
|
29
|
+
lambda do
|
30
|
+
puts "Checking there are no local changes ... "
|
31
|
+
svn = `svn status`
|
32
|
+
fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
|
33
|
+
git = `git status`
|
34
|
+
fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^#\t/]
|
35
|
+
puts "[X] There are no local changes, everything is in source control"
|
36
|
+
end.call
|
37
|
+
|
38
|
+
# Make sure we have a valid CHANGELOG entry for this release.
|
39
|
+
lambda do
|
40
|
+
puts "Checking that CHANGELOG indicates most recent version and today's date ... "
|
41
|
+
expecting = "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
|
42
|
+
header = File.readlines('CHANGELOG').first.chomp
|
43
|
+
fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
|
44
|
+
puts "[x] CHANGELOG indicates most recent version and today's date"
|
45
|
+
end.call
|
46
|
+
|
47
|
+
# Need GPG to sign the packages.
|
48
|
+
lambda do
|
49
|
+
args.gpg or fail "Please run with gpg=<argument for gpg --local-user>"
|
50
|
+
fail "No GPG user #{args.gpg}" if `gpg2 --list-keys #{args.gpg}`.empty?
|
51
|
+
end.call
|
52
|
+
|
53
|
+
task(:license).invoke
|
54
|
+
task(:dependency).invoke
|
55
|
+
|
56
|
+
# Need JRuby, Scala and Groovy installed to run all the specs.
|
57
|
+
lambda do
|
58
|
+
puts "Checking that we have JRuby, Scala and Groovy available ... "
|
59
|
+
sh 'jruby --version'
|
60
|
+
sh 'scala -version'
|
61
|
+
sh 'groovy -version'
|
62
|
+
puts "[X] We have JRuby, Scala and Groovy"
|
63
|
+
end.call
|
64
|
+
|
65
|
+
# Need Prince to generate PDF
|
66
|
+
lambda do
|
67
|
+
puts "Checking that we have prince available ... "
|
68
|
+
sh 'prince --version'
|
69
|
+
puts "[X] We have prince available"
|
70
|
+
end.call
|
71
|
+
|
72
|
+
# Need RubyForge to upload new release files.
|
73
|
+
lambda do
|
74
|
+
puts "[!] Make sure you have admin privileges to make a release on RubyForge"
|
75
|
+
rubyforge = RubyForge.new.configure
|
76
|
+
rubyforge.login
|
77
|
+
rubyforge.scrape_project(spec.name)
|
78
|
+
end.call
|
79
|
+
|
80
|
+
# We will be speccing in one platform, so also spec the other one.
|
81
|
+
task(RUBY_PLATFORM =~ /java/ ? 'spec:ruby' : 'spec:jruby').invoke # Test the *other* platform
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
task :stage=>['setup', 'doc:setup', :clobber, :prepare] do |task, args|
|
86
|
+
mkpath '_staged'
|
87
|
+
|
88
|
+
# Start by figuring out what has changed.
|
89
|
+
lambda do
|
90
|
+
puts "Looking for changes between this release and previous one ..."
|
91
|
+
pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
|
92
|
+
changes = File.read('CHANGELOG').scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
|
93
|
+
current = changes[spec.version.to_s]
|
94
|
+
fail "No changeset found for version #{spec.version}" unless current
|
95
|
+
File.open '_staged/CHANGES', 'w' do |file|
|
96
|
+
file.write "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})\n"
|
97
|
+
file.write current
|
98
|
+
end
|
99
|
+
puts "[X] Listed most recent changed in _staged/CHANGES"
|
100
|
+
end.call
|
101
|
+
|
102
|
+
# Create the packages (gem, tarball) and sign them. This requires user
|
103
|
+
# intervention so the earlier we do it the better.
|
104
|
+
lambda do
|
105
|
+
puts "Creating and signing release packages ..."
|
106
|
+
task(:package).invoke
|
107
|
+
mkpath '_staged/dist'
|
108
|
+
FileList['pkg/*.{gem,zip,tgz}'].each do |source|
|
109
|
+
pkg = source.pathmap('_staged/dist/%n%x')
|
110
|
+
cp source, pkg
|
111
|
+
bytes = File.open(pkg, 'rb') { |file| file.read }
|
112
|
+
File.open(pkg + '.md5', 'w') { |file| file.write Digest::MD5.hexdigest(bytes) << ' ' << File.basename(pkg) }
|
113
|
+
File.open(pkg + '.sha1', 'w') { |file| file.write Digest::SHA1.hexdigest(bytes) << ' ' << File.basename(pkg) }
|
114
|
+
sh 'gpg2', '--local-user', args.gpg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
|
115
|
+
end
|
116
|
+
cp 'etc/KEYS', '_staged'
|
117
|
+
puts "[X] Created and signed release packages in _staged/dist"
|
118
|
+
end.call
|
119
|
+
|
120
|
+
# The download page should link to the new binaries/sources, and we
|
121
|
+
# want to do that before generating the site/documentation.
|
122
|
+
lambda do
|
123
|
+
puts "Updating download page with links to release packages ... "
|
124
|
+
url = "http://www.apache.org/dist/#{spec.name}/#{spec.version}"
|
125
|
+
rows = FileList['_staged/dist/*.{gem,tgz,zip}'].map { |pkg|
|
126
|
+
name, md5 = File.basename(pkg), Digest::MD5.file(pkg).to_s
|
127
|
+
%{| "#{name}":#{url}/#{name} | "#{md5}":#{url}/#{name}.md5 | "Sig":#{url}/#{name}.asc |}
|
128
|
+
}
|
129
|
+
textile = <<-TEXTILE
|
130
|
+
h3. #{spec.name} #{spec.version} (#{Time.now.strftime('%Y-%m-%d')})
|
131
|
+
|
132
|
+
|_. Package |_. MD5 Checksum |_. PGP |
|
133
|
+
#{rows.join("\n")}
|
134
|
+
|
135
|
+
p>. ("Release signing keys":#{url}/KEYS)
|
136
|
+
TEXTILE
|
137
|
+
file_name = 'doc/download.textile'
|
138
|
+
print "Adding download links to #{file_name} ... "
|
139
|
+
modified = File.read(file_name).sub(/^h2\(#dist\).*$/) { |header| "#{header}\n\n#{textile}" }
|
140
|
+
File.open file_name, 'w' do |file|
|
141
|
+
file.write modified
|
142
|
+
end
|
143
|
+
puts "[X] Updated #{file_name}"
|
144
|
+
end.call
|
145
|
+
|
146
|
+
|
147
|
+
# Now we can create the Web site, this includes running specs, coverage report, etc.
|
148
|
+
# This will take a while, so we want to do it as last step before upload.
|
149
|
+
lambda do
|
150
|
+
puts "Creating new Web site"
|
151
|
+
task(:site).invoke
|
152
|
+
cp_r '_site', '_staged/site'
|
153
|
+
puts "[X] Created new Web site in _staged/site"
|
154
|
+
end.call
|
155
|
+
|
156
|
+
|
157
|
+
# Move everything over to people.apache.org so we can vote on it.
|
158
|
+
lambda do
|
159
|
+
url = "people.apache.org:~/public_html/#{spec.name}/#{spec.version}"
|
160
|
+
puts "Uploading _staged directory to #{url} ..."
|
161
|
+
sh 'rsync', '--progress', '--recursive', '_staged/', url
|
162
|
+
puts "[X] Uploaded _staged directory to #{url}"
|
163
|
+
end.call
|
164
|
+
|
165
|
+
|
166
|
+
# Prepare a release vote email. In the distant future this will also send the
|
167
|
+
# email for you and vote on it.
|
168
|
+
lambda do
|
169
|
+
# Need to know who you are on Apache, local user may be different (see .ssh/config).
|
170
|
+
whoami = `ssh people.apache.org whoami`.strip
|
171
|
+
base_url = "http://people.apache.org/~#{whoami}/buildr/#{spec.version}"
|
172
|
+
# Need changes for this release only.
|
173
|
+
changelog = File.read('CHANGELOG').scan(/(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/)
|
174
|
+
changes = changelog[0][2]
|
175
|
+
previous_version = changelog[1][1]
|
176
|
+
|
177
|
+
email = <<-EMAIL
|
178
|
+
To: dev@buildr.apache.org
|
179
|
+
Subject: [VOTE] Buildr #{spec.version} release
|
180
|
+
|
181
|
+
We're voting on the source distributions available here:
|
182
|
+
#{base_url}/dist/
|
183
|
+
|
184
|
+
Specifically:
|
185
|
+
#{base_url}/dist/buildr-#{spec.version}.tgz
|
186
|
+
#{base_url}/dist/buildr-#{spec.version}.zip
|
187
|
+
|
188
|
+
The documentation generated for this release is available here:
|
189
|
+
#{base_url}/site/
|
190
|
+
#{base_url}/site/buildr.pdf
|
191
|
+
|
192
|
+
The official specification against which this release was tested:
|
193
|
+
#{base_url}/site/specs.html
|
194
|
+
|
195
|
+
Test coverage report:
|
196
|
+
#{base_url}/site/coverage/index.html
|
197
|
+
|
198
|
+
|
199
|
+
The following changes were made since #{previous_version}:
|
200
|
+
|
201
|
+
#{changes.gsub(/^/, ' ')}
|
202
|
+
EMAIL
|
203
|
+
File.open 'vote-email.txt', 'w' do |file|
|
204
|
+
file.write email
|
205
|
+
end
|
206
|
+
puts "[X] Created release vote email template in 'vote-email.txt'"
|
207
|
+
puts email
|
208
|
+
end.call
|
209
|
+
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
task(:clobber) { rm_rf '_staged' }
|