ittayd-buildr 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. data/CHANGELOG +62 -9
  2. data/NOTICE +1 -1
  3. data/README.rdoc +9 -21
  4. data/Rakefile +20 -39
  5. data/_buildr +1 -0
  6. data/{spec/java/ant.rb → _jbuildr} +11 -15
  7. metadata +30 -210
  8. data/DISCLAIMER +0 -7
  9. data/addon/buildr/antlr.rb +0 -65
  10. data/addon/buildr/cobertura.rb +0 -22
  11. data/addon/buildr/drb.rb +0 -281
  12. data/addon/buildr/emma.rb +0 -22
  13. data/addon/buildr/hibernate.rb +0 -142
  14. data/addon/buildr/javacc.rb +0 -85
  15. data/addon/buildr/jdepend.rb +0 -60
  16. data/addon/buildr/jetty.rb +0 -248
  17. data/addon/buildr/jibx.rb +0 -86
  18. data/addon/buildr/nailgun.rb +0 -221
  19. data/addon/buildr/openjpa.rb +0 -90
  20. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  22. data/addon/buildr/org/apache/buildr/BuildrNail.java +0 -41
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  26. data/addon/buildr/org/apache/buildr/JettyWrapper.java +0 -144
  27. data/addon/buildr/path.rb +0 -136
  28. data/addon/buildr/xmlbeans.rb +0 -93
  29. data/buildr.buildfile +0 -53
  30. data/buildr.gemspec +0 -58
  31. data/doc/css/default.css +0 -228
  32. data/doc/css/print.css +0 -100
  33. data/doc/css/syntax.css +0 -52
  34. data/doc/images/apache-incubator-logo.png +0 -0
  35. data/doc/images/buildr-hires.png +0 -0
  36. data/doc/images/buildr.png +0 -0
  37. data/doc/images/favicon.png +0 -0
  38. data/doc/images/growl-icon.tiff +0 -0
  39. data/doc/images/note.png +0 -0
  40. data/doc/images/project-structure.png +0 -0
  41. data/doc/images/tip.png +0 -0
  42. data/doc/images/zbuildr.tif +0 -0
  43. data/doc/pages/artifacts.textile +0 -207
  44. data/doc/pages/building.textile +0 -240
  45. data/doc/pages/contributing.textile +0 -208
  46. data/doc/pages/download.textile +0 -62
  47. data/doc/pages/extending.textile +0 -175
  48. data/doc/pages/getting_started.textile +0 -273
  49. data/doc/pages/index.textile +0 -42
  50. data/doc/pages/languages.textile +0 -407
  51. data/doc/pages/mailing_lists.textile +0 -17
  52. data/doc/pages/more_stuff.textile +0 -314
  53. data/doc/pages/packaging.textile +0 -427
  54. data/doc/pages/projects.textile +0 -274
  55. data/doc/pages/recipes.textile +0 -103
  56. data/doc/pages/settings_profiles.textile +0 -274
  57. data/doc/pages/testing.textile +0 -212
  58. data/doc/pages/troubleshooting.textile +0 -103
  59. data/doc/pages/whats_new.textile +0 -323
  60. data/doc/print.haml +0 -51
  61. data/doc/print.toc.yaml +0 -29
  62. data/doc/scripts/buildr-git.rb +0 -412
  63. data/doc/scripts/install-jruby.sh +0 -44
  64. data/doc/scripts/install-linux.sh +0 -64
  65. data/doc/scripts/install-osx.sh +0 -52
  66. data/doc/site.haml +0 -56
  67. data/doc/site.toc.yaml +0 -47
  68. data/etc/KEYS +0 -151
  69. data/etc/git-svn-authors +0 -16
  70. data/lib/buildr.rb +0 -33
  71. data/lib/buildr/core.rb +0 -29
  72. data/lib/buildr/core/application.rb +0 -665
  73. data/lib/buildr/core/build.rb +0 -311
  74. data/lib/buildr/core/checks.rb +0 -254
  75. data/lib/buildr/core/common.rb +0 -150
  76. data/lib/buildr/core/compile.rb +0 -590
  77. data/lib/buildr/core/environment.rb +0 -117
  78. data/lib/buildr/core/filter.rb +0 -366
  79. data/lib/buildr/core/generate.rb +0 -195
  80. data/lib/buildr/core/help.rb +0 -119
  81. data/lib/buildr/core/osx.rb +0 -49
  82. data/lib/buildr/core/progressbar.rb +0 -156
  83. data/lib/buildr/core/project.rb +0 -923
  84. data/lib/buildr/core/test.rb +0 -715
  85. data/lib/buildr/core/transports.rb +0 -560
  86. data/lib/buildr/core/util.rb +0 -294
  87. data/lib/buildr/groovy.rb +0 -18
  88. data/lib/buildr/groovy/bdd.rb +0 -106
  89. data/lib/buildr/groovy/compiler.rb +0 -138
  90. data/lib/buildr/ide.rb +0 -19
  91. data/lib/buildr/ide/eclipse.rb +0 -222
  92. data/lib/buildr/ide/idea.ipr.template +0 -300
  93. data/lib/buildr/ide/idea.rb +0 -190
  94. data/lib/buildr/ide/idea7x.ipr.template +0 -290
  95. data/lib/buildr/ide/idea7x.rb +0 -212
  96. data/lib/buildr/java.rb +0 -23
  97. data/lib/buildr/java/ant.rb +0 -92
  98. data/lib/buildr/java/bdd.rb +0 -451
  99. data/lib/buildr/java/cobertura.rb +0 -236
  100. data/lib/buildr/java/commands.rb +0 -211
  101. data/lib/buildr/java/compiler.rb +0 -348
  102. data/lib/buildr/java/deprecated.rb +0 -141
  103. data/lib/buildr/java/emma.rb +0 -238
  104. data/lib/buildr/java/jruby.rb +0 -117
  105. data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
  106. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  107. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +0 -119
  108. data/lib/buildr/java/packaging.rb +0 -717
  109. data/lib/buildr/java/pom.rb +0 -174
  110. data/lib/buildr/java/rjb.rb +0 -155
  111. data/lib/buildr/java/test_result.rb +0 -307
  112. data/lib/buildr/java/tests.rb +0 -329
  113. data/lib/buildr/java/version_requirement.rb +0 -172
  114. data/lib/buildr/packaging.rb +0 -24
  115. data/lib/buildr/packaging/archive.rb +0 -488
  116. data/lib/buildr/packaging/artifact.rb +0 -759
  117. data/lib/buildr/packaging/artifact_namespace.rb +0 -972
  118. data/lib/buildr/packaging/artifact_search.rb +0 -140
  119. data/lib/buildr/packaging/gems.rb +0 -102
  120. data/lib/buildr/packaging/package.rb +0 -233
  121. data/lib/buildr/packaging/tar.rb +0 -186
  122. data/lib/buildr/packaging/version_requirement.rb +0 -172
  123. data/lib/buildr/packaging/zip.rb +0 -64
  124. data/lib/buildr/packaging/ziptask.rb +0 -313
  125. data/lib/buildr/resources/buildr.icns +0 -0
  126. data/lib/buildr/scala.rb +0 -19
  127. data/lib/buildr/scala/compiler.rb +0 -109
  128. data/lib/buildr/scala/tests.rb +0 -203
  129. data/rakelib/apache.rake +0 -191
  130. data/rakelib/changelog.rake +0 -57
  131. data/rakelib/doc.rake +0 -103
  132. data/rakelib/package.rake +0 -76
  133. data/rakelib/release.rake +0 -65
  134. data/rakelib/rspec.rake +0 -83
  135. data/rakelib/rubyforge.rake +0 -56
  136. data/rakelib/scm.rake +0 -49
  137. data/rakelib/setup.rake +0 -81
  138. data/rakelib/stage.rake +0 -48
  139. data/spec/addon/drb_spec.rb +0 -328
  140. data/spec/core/application_spec.rb +0 -419
  141. data/spec/core/build_spec.rb +0 -423
  142. data/spec/core/checks_spec.rb +0 -519
  143. data/spec/core/common_spec.rb +0 -670
  144. data/spec/core/compile_spec.rb +0 -582
  145. data/spec/core/generate_spec.rb +0 -33
  146. data/spec/core/project_spec.rb +0 -776
  147. data/spec/core/test_spec.rb +0 -1098
  148. data/spec/core/transport_spec.rb +0 -500
  149. data/spec/groovy/bdd_spec.rb +0 -80
  150. data/spec/groovy/compiler_spec.rb +0 -239
  151. data/spec/ide/eclipse_spec.rb +0 -311
  152. data/spec/java/bdd_spec.rb +0 -358
  153. data/spec/java/cobertura_spec.rb +0 -77
  154. data/spec/java/compiler_spec.rb +0 -446
  155. data/spec/java/emma_spec.rb +0 -120
  156. data/spec/java/java_spec.rb +0 -96
  157. data/spec/java/packaging_spec.rb +0 -1120
  158. data/spec/java/test_coverage_spec.rb +0 -255
  159. data/spec/java/tests_spec.rb +0 -471
  160. data/spec/packaging/archive_spec.rb +0 -503
  161. data/spec/packaging/artifact_namespace_spec.rb +0 -646
  162. data/spec/packaging/artifact_spec.rb +0 -795
  163. data/spec/packaging/packaging_helper.rb +0 -63
  164. data/spec/packaging/packaging_spec.rb +0 -589
  165. data/spec/sandbox.rb +0 -139
  166. data/spec/scala/compiler_spec.rb +0 -228
  167. data/spec/scala/tests_spec.rb +0 -215
  168. data/spec/spec_helpers.rb +0 -327
  169. data/spec/version_requirement_spec.rb +0 -123
@@ -1,19 +0,0 @@
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 'buildr/scala/compiler'
18
- require 'buildr/scala/tests'
19
- Object::Scala = Buildr::Scala
@@ -1,109 +0,0 @@
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
- require 'buildr/core/project'
17
- require 'buildr/core/common'
18
- require 'buildr/core/compile'
19
- require 'buildr/packaging'
20
-
21
-
22
- module Buildr::Scala
23
-
24
- # Scalac compiler:
25
- # compile.using(:scalac)
26
- # Used by default if .scala files are found in the src/main/scala directory (or src/test/scala)
27
- # and sets the target directory to target/classes (or target/test/classes).
28
- #
29
- # Accepts the following options:
30
- # * :warnings -- Generate warnings if true (opposite of -nowarn).
31
- # * :deprecation -- Output source locations where deprecated APIs are used.
32
- # * :optimise -- Generates faster bytecode by applying optimisations to the program.
33
- # * :target -- Class file compatibility with specified release.
34
- # * :debug -- Generate debugging info.
35
- # * :other -- Array of options to pass to the Scalac compiler as is, e.g. -Xprint-types
36
- class Scalac < Buildr::Compiler::Base
37
- class << self
38
- def scala_home
39
- @home ||= ENV['SCALA_HOME']
40
- end
41
-
42
- def dependencies
43
- [ 'scala-library.jar', 'scala-compiler.jar'].map { |jar| File.expand_path("lib/#{jar}", scala_home) }
44
- end
45
-
46
- def use_fsc
47
- ENV["USE_FSC"] =~ /^(yes|on|true)$/i
48
- end
49
- end
50
-
51
- OPTIONS = [:warnings, :deprecation, :optimise, :target, :debug, :other]
52
- Java.classpath << dependencies
53
-
54
- specify :language=>:scala, :target=>'classes', :target_ext=>'class', :packaging=>:jar
55
-
56
- def initialize(project, options) #:nodoc:
57
- super
58
- options[:debug] = Buildr.options.debug if options[:debug].nil?
59
- options[:warnings] = verbose if options[:warnings].nil?
60
- options[:deprecation] ||= false
61
- options[:optimise] ||= false
62
- end
63
-
64
- def compile(sources, target, dependencies) #:nodoc:
65
- check_options options, OPTIONS
66
-
67
- cmd_args = []
68
- cmd_args << '-classpath' << (dependencies + Scalac.dependencies).join(File::PATH_SEPARATOR)
69
- source_paths = sources.select { |source| File.directory?(source) }
70
- cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty?
71
- cmd_args << '-d' << File.expand_path(target)
72
- cmd_args += scalac_args
73
- cmd_args += files_from_sources(sources)
74
-
75
- unless Buildr.application.options.dryrun
76
- Scalac.scala_home or fail 'Are we forgetting something? SCALA_HOME not set.'
77
- trace((['scalac'] + cmd_args).join(' '))
78
- if Scalac.use_fsc
79
- system(([File.expand_path('bin/fsc', Scalac.scala_home)] + cmd_args).join(' ')) or
80
- fail 'Failed to compile, see errors above'
81
- else
82
- Java.load
83
- Java.scala.tools.nsc.Main.process(cmd_args.to_java(Java.java.lang.String))
84
- fail 'Failed to compile, see errors above' if Java.scala.tools.nsc.Main.reporter.hasErrors
85
- end
86
- end
87
- end
88
-
89
- private
90
-
91
- # Returns Scalac command line arguments from the set of options.
92
- def scalac_args #:nodoc:
93
- args = []
94
- args << "-nowarn" unless options[:warnings]
95
- args << "-verbose" if Buildr.application.options.trace
96
- args << "-g" if options[:debug]
97
- args << "-deprecation" if options[:deprecation]
98
- args << "-optimise" if options[:optimise]
99
- args << "-target:jvm-" + options[:target].to_s if options[:target]
100
- args + Array(options[:other])
101
- end
102
-
103
- end
104
-
105
- end
106
-
107
- # Scala compiler comes first, ahead of Javac, this allows it to pick
108
- # projects that mix Scala and Java code by spotting Scala code first.
109
- Buildr::Compiler.compilers << Buildr::Scala::Scalac
@@ -1,203 +0,0 @@
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 'buildr/core/build'
18
- require 'buildr/core/compile'
19
- require 'buildr/java/ant'
20
- require 'buildr/java/tests'
21
-
22
-
23
- module Buildr::Scala
24
-
25
- # Scala::Specs is available when using Scala::Test
26
- module ScalaSpecs
27
- VERSION = '1.2.9'
28
-
29
- class << self
30
- def version
31
- Buildr.settings.build['scala.specs'] || VERSION
32
- end
33
-
34
- def dependencies
35
- ["org.specs:specs:jar:#{version}"]
36
- end
37
-
38
- private
39
- def const_missing(const)
40
- return super unless const == :REQUIRES # TODO: remove in 1.5
41
- Buildr.application.deprecated "Please use Scala::Specs.dependencies/.version instead of ScalaSpecs::REQUIRES/VERSION"
42
- dependencies
43
- end
44
- end
45
- end
46
-
47
-
48
- # Scala::Check is available when using Scala::Test
49
- module ScalaCheck
50
- VERSION = '1.3'
51
-
52
- class << self
53
- def version
54
- Buildr.settings.build['scala.check'] || VERSION
55
- end
56
-
57
- def dependencies
58
- ["org.scalacheck:scalacheck:jar:#{version}"]
59
- end
60
-
61
- private
62
- def const_missing(const)
63
- return super unless const == :REQUIRES # TODO: remove in 1.5
64
- Buildr.application.deprecated "Please use Scala::Check.dependencies/.version instead of ScalaCheck::REQUIRES/VERSION"
65
- dependencies
66
- end
67
- end
68
- end
69
-
70
-
71
- # ScalaTest framework, the default test framework for Scala tests.
72
- #
73
- # Support the following options:
74
- # * :properties -- Hash of system properties available to the test case.
75
- # * :environment -- Hash of environment variables available to the test case.
76
- # * :java_args -- Arguments passed as is to the JVM.
77
- class ScalaTest < Buildr::TestFramework::Java
78
-
79
- VERSION = '0.9.3'
80
-
81
- class << self
82
- def version
83
- Buildr.settings.build['scala.test'] || VERSION
84
- end
85
-
86
- def dependencies
87
- ["org.scalatest:scalatest:jar:#{version}"] + ScalaSpecs.dependencies +
88
- ScalaCheck.dependencies + JMock.dependencies
89
- end
90
-
91
- def applies_to?(project) #:nodoc:
92
- project.test.compile.language == :scala
93
- end
94
-
95
- private
96
- def const_missing(const)
97
- return super unless const == :REQUIRES # TODO: remove in 1.5
98
- Buildr.application.deprecated "Please use Scala::Test.dependencies/.version instead of ScalaTest::REQUIRES/VERSION"
99
- dependencies
100
- end
101
- end
102
-
103
- # annotation-based group inclusion
104
- attr_accessor :group_includes
105
-
106
- # annotation-based group exclusion
107
- attr_accessor :group_excludes
108
-
109
- def initialize(test_task, options)
110
- super
111
- @group_includes = []
112
- @group_excludes = []
113
- end
114
-
115
- def tests(dependencies) #:nodoc:
116
- suites = filter_classes(dependencies, :interfaces => %w{org.scalatest.Suite})
117
- # we should really filter using :class => %w{org.specs.Specification} instead of naming convention
118
- specs = filter_classes(dependencies, :class_names => [/Specs?$/])
119
- [suites, specs].flatten
120
- end
121
-
122
- def run(tests, dependencies) #:nodoc:
123
- mkpath task.report_to.to_s
124
- success = []
125
- scalatest = tests.select { |t| t !~ /Specs?$/ }
126
- specs = tests.select { |t| t =~ /Specs?$/ }
127
-
128
- # Specs
129
- nostacktrace = (options[:nostacktrace]) ? "-ns" : ""
130
- cmd_options = { :properties => options[:properties],
131
- :java_args => options[:java_args],
132
- :classpath => dependencies}
133
- specs.each do |spec|
134
- Java.load
135
- begin
136
- Java::Commands.java(spec, cmd_options)
137
- rescue => e
138
- print e.message
139
- else
140
- success << spec
141
- end
142
- end
143
-
144
- # ScalaTest
145
- reporter_options = 'TFGBSAR' # testSucceeded, testFailed, testIgnored, suiteAborted, runStopped, runAborted, runCompleted
146
- scalatest.each do |suite|
147
- info "ScalaTest #{suite.inspect}"
148
- # Use Ant to execute the ScalaTest task, gives us performance and reporting.
149
- reportFile = File.join(task.report_to.to_s, "TEST-#{suite}.txt")
150
- taskdef = Buildr.artifacts(self.class.dependencies).each(&:invoke).map(&:to_s)
151
- Buildr.ant('scalatest') do |ant|
152
- ant.taskdef :name=>'scalatest', :classname=>'org.scalatest.tools.ScalaTestTask',
153
- :classpath=>taskdef.join(File::PATH_SEPARATOR)
154
- ant.scalatest :runpath=>dependencies.join(File::PATH_SEPARATOR) do
155
- ant.suite :classname=>suite
156
- ant.reporter :type=>'stdout', :config=>reporter_options
157
- ant.reporter :type=>'file', :filename=> reportFile, :config=>reporter_options
158
- ant.includes group_includes.join(" ") if group_includes
159
- ant.excludes group_excludes.join(" ") if group_excludes
160
- (options[:properties] || []).each { |name, value| ant.property :name=>name, :value=>value }
161
- end
162
- end
163
-
164
- # Parse for failures, errors, etc.
165
- # This is a bit of a pain right now because ScalaTest doesn't flush its
166
- # output synchronously before the Ant test finishes so we have to loop
167
- # and wait for an indication that the test run was completed.
168
- failed = false
169
- completed = false
170
- wait = 0
171
- while (!completed) do
172
- File.open(reportFile, "r") do |input|
173
- while (line = input.gets) do
174
- failed = (line =~ /(TEST FAILED -)|(RUN STOPPED)|(RUN ABORTED)/) unless failed
175
- completed |= (line =~ /Run completed\./)
176
- break if (failed || completed)
177
- end
178
- end
179
- wait += 1
180
- break if (failed || wait > 10)
181
- unless completed
182
- sleep(1)
183
- end
184
- end
185
- success << suite if (completed && !failed)
186
- end
187
-
188
- success
189
- end # run
190
-
191
- end # ScalaTest
192
-
193
- end
194
-
195
-
196
- # Backwards compatibility stuff. Remove in 1.5.
197
- module Buildr
198
- ScalaSpecs = Scala::ScalaSpecs
199
- ScalaCheck = Scala::ScalaCheck
200
- ScalaTest = Scala::ScalaTest
201
- end
202
-
203
- Buildr::TestFramework << Buildr::Scala::ScalaTest
@@ -1,191 +0,0 @@
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
-
21
- # Tasks specific to Apache projects (license, release, etc).
22
- namespace 'apache' do
23
-
24
- desc 'Upload snapshot packages over to people.apache.org'
25
- task 'snapshot'=>['spec', 'package'] do
26
- rm_rf 'snapshot' # Always start with empty directory
27
- puts "Copying existing gems from Apache"
28
- sh 'rsync', '--progress', '--recursive', 'people.apache.org:public_html/buildr/snapshot', './'
29
- puts "Copying new gems over"
30
- cp FileList['pkg/{*.gem,*.tgz,*.zip}'], 'snapshot/gems'
31
- puts "Generating gem index ..."
32
- sh 'gem', 'generate_index', '--directory', 'snapshot'
33
- puts "Copying gem and index back to Apache"
34
- sh 'rsync', '--progress', '--recursive', 'snapshot', 'people.apache.org:public_html/buildr/'
35
- end
36
-
37
-
38
- desc 'Check that source files contain the Apache license'
39
- task 'license' do |task|
40
- print 'Checking that files contain the Apache license ... '
41
- required = task.prerequisites.select { |fn| File.file?(fn) }
42
- missing = required.reject { |fn|
43
- comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|<!--(.*?)-->/m).
44
- map { |match| match.compact }.flatten.join("\n")
45
- comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
46
- }
47
- fail "#{missing.join(', ')} missing Apache License, please add it before making a release!" unless missing.empty?
48
- puts 'OK'
49
- end
50
-
51
- # Staging checks specific for Apache.
52
- task 'check'=>'license' do |task, args|
53
- args.gpg_user or fail "Please run with gpg_user=<argument for gpg --local-user>"
54
- fail "No GPG user #{args.gpg_user}" if `gpg --list-keys #{args.gpg_user}`.empty?
55
- end
56
-
57
-
58
- file 'staged/distro'=>'package' do
59
- puts 'Copying and signing release files ...'
60
- mkpath 'staged/distro'
61
- FileList['pkg/*.{gem,zip,tgz}'].each do |pkg|
62
- cp pkg, pkg.pathmap('staged/distro/%n-incubating%x')
63
- end
64
- end
65
-
66
- task 'sign'=>['etc/KEYS', 'staged/distro'] do |task, args|
67
- gpg_user = args.gpg_user or fail "Please run with gpg_user=<argument for gpg --local-user>"
68
- puts "Signing packages in staged/distro as user #{gpg_user}"
69
- FileList['staged/distro/*.{gem,zip,tgz}'].each do |pkg|
70
- bytes = File.open(pkg, 'rb') { |file| file.read }
71
- File.open(pkg + '.md5', 'w') { |file| file.write Digest::MD5.hexdigest(bytes) << ' ' << File.basename(pkg) }
72
- File.open(pkg + '.sha1', 'w') { |file| file.write Digest::SHA1.hexdigest(bytes) << ' ' << File.basename(pkg) }
73
- sh 'gpg', '--local-user', gpg_user, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
74
- end
75
- cp 'etc/KEYS', 'staged/distro'
76
- end
77
-
78
- # Publish prerequisites to distro server.
79
- task 'publish:distro' do |task, args|
80
- target = args.incubating ? "people.apache.org:/www/www.apache.org/dist/incubator/#{spec.name}/#{spec.version}-incubating" :
81
- "people.apache.org:/www/www.apache.org/dist/#{spec.name}/#{spec.version}"
82
- puts 'Uploading packages to Apache distro ...'
83
- host, remote_dir = target.split(':')
84
- sh 'ssh', host, 'rm', '-rf', remote_dir rescue nil
85
- sh 'ssh', host, 'mkdir', remote_dir
86
- sh 'rsync', '--progress', '--recursive', 'published/distro/', target
87
- puts 'Done'
88
- end
89
-
90
- task 'distro-links'=>'staged/distro' do |task, args|
91
- url = args.incubating ? "http://www.apache.org/dist/incubator/#{spec.name}/#{spec.version}-incubating" :
92
- "http://www.apache.org/dist/#{spec.name}/#{spec.version}"
93
- rows = FileList['staged/distro/*.{gem,tgz,zip}'].map { |pkg|
94
- name, md5 = File.basename(pkg), Digest::MD5.file(pkg).to_s
95
- %{| "#{name}":#{url}/#{name} | "#{md5}":#{url}/#{name}.md5 | "Sig":#{url}/#{name}.asc |}
96
- }
97
- textile = <<-TEXTILE
98
- h3. #{spec.name} #{spec.version}#{args.incubating && "-incubating"} (#{Time.now.strftime('%Y-%m-%d')})
99
-
100
- |_. Package |_. MD5 Checksum |_. PGP |
101
- #{rows.join("\n")}
102
-
103
- p>. ("Release signing keys":#{url}/KEYS)
104
- TEXTILE
105
- file_name = 'doc/pages/download.textile'
106
- print "Adding download links to #{file_name} ... "
107
- modified = File.read(file_name).sub(/h2.*binaries.*source.*/i) { |header| "#{header}\n\n#{textile}" }
108
- File.open file_name, 'w' do |file|
109
- file.write modified
110
- end
111
- puts 'Done'
112
- end
113
-
114
- file 'staged/site'=>['distro-links', 'staged', 'site'] do
115
- rm_rf 'staged/site'
116
- cp_r 'site', 'staged'
117
- end
118
-
119
- # Publish prerequisites to Web site.
120
- task 'publish:site' do |task, args|
121
- target = args.incubating ? "people.apache.org:/www/incubator.apache.org/#{spec.name}" :
122
- "people.apache.org:/www/#{spec.name}.apache.org"
123
- puts 'Uploading Apache Web site ...'
124
- sh 'rsync', '--progress', '--recursive', '--delete', 'published/site/', target
125
- puts 'Done'
126
- end
127
-
128
-
129
- file 'release-vote-email.txt'=>'CHANGELOG' do |task|
130
- # Need to know who you are on Apache, local user may be different (see .ssh/config).
131
- whoami = `ssh people.apache.org whoami`.strip
132
- base_url = "http://people.apache.org/~#{whoami}/buildr/#{spec.version}"
133
- # Need changes for this release only.
134
- changelog = File.read('CHANGELOG').scan(/(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/)
135
- changes = changelog[0][2]
136
- previous_version = changelog[1][1]
137
-
138
- email = <<-EMAIL
139
- To: buildr-dev@incubator.apache.org
140
- Subject: [VOTE] Buildr #{spec.version} release
141
-
142
- We're voting on the source distributions available here:
143
- #{base_url}/distro/
144
-
145
- Specifically:
146
- #{base_url}/distro/buildr-#{spec.version}-incubating.tgz
147
- #{base_url}/distro/buildr-#{spec.version}-incubating.zip
148
-
149
- The documentation generated for this release is available here:
150
- #{base_url}/site/
151
- #{base_url}/site/buildr.pdf
152
-
153
- The official specification against which this release was tested:
154
- #{base_url}/site/specs.html
155
-
156
- Test coverage report:
157
- #{base_url}/site/coverage/index.html
158
-
159
-
160
- The following changes were made since #{previous_version}:
161
-
162
- #{changes}
163
- EMAIL
164
- File.open task.name, 'w' do |file|
165
- file.write email
166
- end
167
- puts "Created release vote email template in '#{task.name}':"
168
- puts email
169
- end
170
-
171
- end
172
-
173
- task 'clobber' do
174
- rm_rf 'snapshot'
175
- rm_f 'release-vote-email.txt'
176
- end
177
-
178
-
179
- task 'stage:check'=>['apache:check']
180
- task 'stage:prepare'=>['staged/distro', 'staged/site'] do |task|
181
- # Since this requires input (passphrase), do it at the very end.
182
- task.enhance do
183
- task('apache:sign').invoke
184
- end
185
- end
186
- task 'stage' do
187
- task('apache:snapshot').invoke
188
- end
189
- task 'stage:wrapup'=>'release-vote-email.txt'
190
-
191
- task 'release:publish'=>['apache:publish:distro', 'apache:publish:site']