ittayd-buildr 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. data/CHANGELOG +915 -0
  2. data/DISCLAIMER +7 -0
  3. data/LICENSE +176 -0
  4. data/NOTICE +26 -0
  5. data/README.rdoc +146 -0
  6. data/Rakefile +64 -0
  7. data/_buildr +28 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +22 -0
  10. data/addon/buildr/drb.rb +281 -0
  11. data/addon/buildr/emma.rb +22 -0
  12. data/addon/buildr/hibernate.rb +142 -0
  13. data/addon/buildr/javacc.rb +85 -0
  14. data/addon/buildr/jdepend.rb +60 -0
  15. data/addon/buildr/jetty.rb +248 -0
  16. data/addon/buildr/jibx.rb +86 -0
  17. data/addon/buildr/nailgun.rb +221 -0
  18. data/addon/buildr/openjpa.rb +90 -0
  19. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  20. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  22. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  26. data/addon/buildr/path.rb +136 -0
  27. data/addon/buildr/xmlbeans.rb +93 -0
  28. data/bin/buildr +19 -0
  29. data/buildr.buildfile +53 -0
  30. data/buildr.gemspec +58 -0
  31. data/doc/css/default.css +228 -0
  32. data/doc/css/print.css +100 -0
  33. data/doc/css/syntax.css +52 -0
  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 +207 -0
  44. data/doc/pages/building.textile +240 -0
  45. data/doc/pages/contributing.textile +208 -0
  46. data/doc/pages/download.textile +62 -0
  47. data/doc/pages/extending.textile +175 -0
  48. data/doc/pages/getting_started.textile +273 -0
  49. data/doc/pages/index.textile +42 -0
  50. data/doc/pages/languages.textile +407 -0
  51. data/doc/pages/mailing_lists.textile +17 -0
  52. data/doc/pages/more_stuff.textile +314 -0
  53. data/doc/pages/packaging.textile +427 -0
  54. data/doc/pages/projects.textile +274 -0
  55. data/doc/pages/recipes.textile +103 -0
  56. data/doc/pages/settings_profiles.textile +274 -0
  57. data/doc/pages/testing.textile +212 -0
  58. data/doc/pages/troubleshooting.textile +103 -0
  59. data/doc/pages/whats_new.textile +323 -0
  60. data/doc/print.haml +51 -0
  61. data/doc/print.toc.yaml +29 -0
  62. data/doc/scripts/buildr-git.rb +412 -0
  63. data/doc/scripts/install-jruby.sh +44 -0
  64. data/doc/scripts/install-linux.sh +64 -0
  65. data/doc/scripts/install-osx.sh +52 -0
  66. data/doc/site.haml +56 -0
  67. data/doc/site.toc.yaml +47 -0
  68. data/etc/KEYS +151 -0
  69. data/etc/git-svn-authors +16 -0
  70. data/lib/buildr/core/application.rb +665 -0
  71. data/lib/buildr/core/build.rb +311 -0
  72. data/lib/buildr/core/checks.rb +254 -0
  73. data/lib/buildr/core/common.rb +150 -0
  74. data/lib/buildr/core/compile.rb +590 -0
  75. data/lib/buildr/core/environment.rb +117 -0
  76. data/lib/buildr/core/filter.rb +366 -0
  77. data/lib/buildr/core/generate.rb +195 -0
  78. data/lib/buildr/core/help.rb +119 -0
  79. data/lib/buildr/core/osx.rb +49 -0
  80. data/lib/buildr/core/progressbar.rb +156 -0
  81. data/lib/buildr/core/project.rb +923 -0
  82. data/lib/buildr/core/test.rb +715 -0
  83. data/lib/buildr/core/transports.rb +560 -0
  84. data/lib/buildr/core/util.rb +294 -0
  85. data/lib/buildr/core.rb +29 -0
  86. data/lib/buildr/groovy/bdd.rb +106 -0
  87. data/lib/buildr/groovy/compiler.rb +138 -0
  88. data/lib/buildr/groovy.rb +18 -0
  89. data/lib/buildr/ide/eclipse.rb +222 -0
  90. data/lib/buildr/ide/idea.ipr.template +300 -0
  91. data/lib/buildr/ide/idea.rb +190 -0
  92. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  93. data/lib/buildr/ide/idea7x.rb +212 -0
  94. data/lib/buildr/ide.rb +19 -0
  95. data/lib/buildr/java/ant.rb +92 -0
  96. data/lib/buildr/java/bdd.rb +451 -0
  97. data/lib/buildr/java/cobertura.rb +236 -0
  98. data/lib/buildr/java/commands.rb +211 -0
  99. data/lib/buildr/java/compiler.rb +348 -0
  100. data/lib/buildr/java/deprecated.rb +141 -0
  101. data/lib/buildr/java/emma.rb +238 -0
  102. data/lib/buildr/java/jruby.rb +117 -0
  103. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  104. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  105. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +119 -0
  106. data/lib/buildr/java/packaging.rb +717 -0
  107. data/lib/buildr/java/pom.rb +174 -0
  108. data/lib/buildr/java/rjb.rb +155 -0
  109. data/lib/buildr/java/test_result.rb +307 -0
  110. data/lib/buildr/java/tests.rb +329 -0
  111. data/lib/buildr/java/version_requirement.rb +172 -0
  112. data/lib/buildr/java.rb +23 -0
  113. data/lib/buildr/packaging/archive.rb +488 -0
  114. data/lib/buildr/packaging/artifact.rb +759 -0
  115. data/lib/buildr/packaging/artifact_namespace.rb +972 -0
  116. data/lib/buildr/packaging/artifact_search.rb +140 -0
  117. data/lib/buildr/packaging/gems.rb +102 -0
  118. data/lib/buildr/packaging/package.rb +233 -0
  119. data/lib/buildr/packaging/tar.rb +186 -0
  120. data/lib/buildr/packaging/version_requirement.rb +172 -0
  121. data/lib/buildr/packaging/zip.rb +64 -0
  122. data/lib/buildr/packaging/ziptask.rb +313 -0
  123. data/lib/buildr/packaging.rb +24 -0
  124. data/lib/buildr/resources/buildr.icns +0 -0
  125. data/lib/buildr/scala/compiler.rb +109 -0
  126. data/lib/buildr/scala/tests.rb +203 -0
  127. data/lib/buildr/scala.rb +19 -0
  128. data/lib/buildr.rb +33 -0
  129. data/rakelib/apache.rake +191 -0
  130. data/rakelib/changelog.rake +57 -0
  131. data/rakelib/doc.rake +103 -0
  132. data/rakelib/package.rake +76 -0
  133. data/rakelib/release.rake +65 -0
  134. data/rakelib/rspec.rake +83 -0
  135. data/rakelib/rubyforge.rake +56 -0
  136. data/rakelib/scm.rake +49 -0
  137. data/rakelib/setup.rake +81 -0
  138. data/rakelib/stage.rake +48 -0
  139. data/spec/addon/drb_spec.rb +328 -0
  140. data/spec/core/application_spec.rb +419 -0
  141. data/spec/core/build_spec.rb +423 -0
  142. data/spec/core/checks_spec.rb +519 -0
  143. data/spec/core/common_spec.rb +670 -0
  144. data/spec/core/compile_spec.rb +582 -0
  145. data/spec/core/generate_spec.rb +33 -0
  146. data/spec/core/project_spec.rb +776 -0
  147. data/spec/core/test_spec.rb +1098 -0
  148. data/spec/core/transport_spec.rb +500 -0
  149. data/spec/groovy/bdd_spec.rb +80 -0
  150. data/spec/groovy/compiler_spec.rb +239 -0
  151. data/spec/ide/eclipse_spec.rb +311 -0
  152. data/spec/java/ant.rb +33 -0
  153. data/spec/java/bdd_spec.rb +358 -0
  154. data/spec/java/cobertura_spec.rb +77 -0
  155. data/spec/java/compiler_spec.rb +446 -0
  156. data/spec/java/emma_spec.rb +120 -0
  157. data/spec/java/java_spec.rb +96 -0
  158. data/spec/java/packaging_spec.rb +1120 -0
  159. data/spec/java/test_coverage_spec.rb +255 -0
  160. data/spec/java/tests_spec.rb +471 -0
  161. data/spec/packaging/archive_spec.rb +503 -0
  162. data/spec/packaging/artifact_namespace_spec.rb +646 -0
  163. data/spec/packaging/artifact_spec.rb +795 -0
  164. data/spec/packaging/packaging_helper.rb +63 -0
  165. data/spec/packaging/packaging_spec.rb +589 -0
  166. data/spec/sandbox.rb +139 -0
  167. data/spec/scala/compiler_spec.rb +228 -0
  168. data/spec/scala/tests_spec.rb +215 -0
  169. data/spec/spec_helpers.rb +327 -0
  170. data/spec/version_requirement_spec.rb +123 -0
  171. metadata +377 -0
@@ -0,0 +1,203 @@
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
@@ -0,0 +1,19 @@
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
data/lib/buildr.rb ADDED
@@ -0,0 +1,33 @@
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
+ module Buildr
17
+ VERSION = '1.3.4'.freeze
18
+ end
19
+
20
+ require 'buildr/core'
21
+ require 'buildr/packaging'
22
+ require 'buildr/java'
23
+ require 'buildr/scala'
24
+ require 'buildr/ide'
25
+
26
+ # Methods defined in Buildr are both instance methods (e.g. when included in Project)
27
+ # and class methods when invoked like Buildr.artifacts().
28
+ module Buildr ; extend self ; end
29
+ # The Buildfile object (self) has access to all the Buildr methods and constants.
30
+ class << self ; include Buildr ; end
31
+ class Object #:nodoc:
32
+ Buildr.constants.each { |c| const_set c, Buildr.const_get(c) unless const_defined?(c) }
33
+ end
@@ -0,0 +1,191 @@
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']
@@ -0,0 +1,57 @@
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
+ # Handling of CHANGELOG.
18
+ namespace 'changelog' do
19
+
20
+ task 'check'=>'CHANGELOG' do
21
+ print 'Checking that CHANGELOG indicates most recent version and today\'s date ... '
22
+ expecting = "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
23
+ header = File.readlines('CHANGELOG').first.chomp
24
+ fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
25
+ puts 'OK'
26
+ end
27
+
28
+ file 'staged/CHANGES'=>'CHANGELOG' do |task|
29
+ # Read the changes for this release.
30
+ print 'Looking for changes between this release and previous one ... '
31
+ pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
32
+ changes = File.read('CHANGELOG').scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
33
+ current = changes[spec.version.to_s]
34
+ fail "No changeset found for version #{spec.version}" unless current
35
+ File.open task.name, 'w' do |file|
36
+ file.write "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})\n"
37
+ file.write current
38
+ end
39
+ puts 'OK'
40
+ end
41
+
42
+ task 'wrapup'=>'CHANGELOG' do
43
+ next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
44
+ zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
45
+ print 'Adding new entry to CHANGELOG ... '
46
+ modified = "#{next_version} (Pending)\n\n" + File.read('CHANGELOG')
47
+ File.open 'CHANGELOG', 'w' do |file|
48
+ file.write modified
49
+ end
50
+ puts 'Done'
51
+ end
52
+
53
+ end
54
+
55
+ task 'stage:check'=>'changelog:check'
56
+ task 'stage:prepare'=>'staged/CHANGES'
57
+ task 'release:wrapup'=>'changelog:wrapup'
data/rakelib/doc.rake ADDED
@@ -0,0 +1,103 @@
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 'rake/rdoctask'
18
+
19
+ desc 'Generate RDoc documentation'
20
+ rdoc = Rake::RDocTask.new('rdoc') do |rdoc|
21
+ rdoc.rdoc_dir = 'rdoc'
22
+ rdoc.title = spec.name
23
+ rdoc.options = spec.rdoc_options + ['--promiscuous']
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ rdoc.rdoc_files.include spec.extra_rdoc_files
26
+ end
27
+
28
+
29
+ begin
30
+ gem 'allison'
31
+ rdoc.template = File.expand_path('lib/allison.rb', Gem.loaded_specs['allison'].full_gem_path)
32
+ rescue LoadError
33
+ puts 'Please run rake setup to install the Allison RDoc template'
34
+ task 'setup' do
35
+ install_gem 'allison'
36
+ end
37
+ task 'stage:check' do
38
+ fail 'Please run rake setup to install the Allison RDoc template'
39
+ end
40
+ end
41
+
42
+
43
+ begin
44
+ require 'docter'
45
+ require 'docter/server'
46
+
47
+ #Docter.filter_for(:footnote) do |html|
48
+ # html.gsub(/<p id="fn(\d+)">(.*?)<\/p>/, %{<p id="fn\\1" class="footnote">\\2</p>})
49
+ #end
50
+
51
+ collection = Docter.collection(spec.name).using('doc/site.toc.yaml').include('doc/pages', 'LICENSE', 'CHANGELOG')
52
+ # TODO: Add coverage reports when we get them to run.
53
+ template = Docter.template('doc/site.haml').
54
+ include('doc/css', 'doc/images', 'doc/scripts', 'reports/coverage', 'reports/specs.html', 'rdoc', 'print/buildr.pdf')
55
+
56
+ desc 'Run Docter server on port 3000'
57
+ Docter::Rake.serve 'docter', collection, template, :port=>3000
58
+
59
+ desc 'Generate Web site in directory site'
60
+ Docter::Rake.generate 'site', collection, template
61
+
62
+ Docter::Rake.generate 'print',
63
+ Docter.collection(spec.name).using('doc/print.toc.yaml').include('doc/pages'),
64
+ Docter.template('doc/print.haml').include('doc/css', 'doc/images'), :one_page
65
+
66
+ file('print/buildr.pdf'=>'print') do |task|
67
+ mkpath 'site'
68
+ sh 'prince', 'print/index.html', '-o', task.name, '--media=print' do |ok, res|
69
+ fail 'Failed to create PDF, see errors above' unless ok
70
+ end
71
+ end
72
+ task 'site'=>'print/buildr.pdf' do
73
+ cp 'print/buildr.pdf', 'site'
74
+ end
75
+
76
+ task 'site' do
77
+ print 'Checking that we have site documentation, RDoc and PDF ... '
78
+ fail 'No PDF generated, you need to install PrinceXML!' unless File.exist?('site/buildr.pdf')
79
+ fail 'No RDocs in site directory' unless File.exist?('site/rdoc/files/lib/buildr_rb.html')
80
+ fail 'No site documentation in site directory' unless File.exist?('site/index.html')
81
+ fail 'No specifications site directory' unless File.exist?('site/specs.html')
82
+ puts 'OK'
83
+ end
84
+
85
+ desc 'Produce PDF'
86
+ task 'pdf'=>'print/buildr.pdf' do |task|
87
+ sh 'open', 'print/buildr.pdf'
88
+ end
89
+
90
+ task 'clobber' do
91
+ rm_rf 'print'
92
+ rm_rf 'site'
93
+ end
94
+
95
+ rescue LoadError
96
+ puts 'Please run rake setup to install the Docter document generation library'
97
+ task 'setup' do
98
+ install_gem 'docter', '~>1.1.3'
99
+ end
100
+ task 'stage:check' do
101
+ fail 'Please run rake setup to install the Docter document generation library'
102
+ end
103
+ end
@@ -0,0 +1,76 @@
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 'rake/gempackagetask'
18
+
19
+
20
+ desc 'Clean up all temporary directories used for running tests, creating documentation, packaging, etc.'
21
+ task 'clobber'
22
+
23
+ package = Rake::GemPackageTask.new(spec) do |pkg|
24
+ pkg.need_tar = true
25
+ pkg.need_zip = true
26
+ end
27
+
28
+ desc 'Install the package locally'
29
+ task 'install'=>['setup', "#{package.package_dir}/#{package.gem_file}"] do |task|
30
+ print "Installing #{spec.name} ... "
31
+ args = [Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{package.package_dir}/#{package.gem_file}"]
32
+ args.unshift('sudo') if sudo_needed?
33
+ sh *args
34
+ puts 'Done'
35
+ end
36
+
37
+ desc 'Uninstall previously installed packaged'
38
+ task 'uninstall' do |task|
39
+ print "Uninstalling #{spec.name} ... "
40
+ args = [Config::CONFIG['ruby_install_name'], '-S', 'gem', 'uninstall', spec.name, '--version', spec.version.to_s]
41
+ args.unshift('sudo') if sudo_needed?
42
+ sh *args
43
+ puts 'Done'
44
+ end
45
+
46
+
47
+ desc 'Look for new dependencies, check transitive dependencies'
48
+ task 'dependency' do
49
+ puts "Checking that all dependencies are up to date ..."
50
+ =begin
51
+ # Find if anything has a more recent dependency. These are not errors, just reports.
52
+ for dep in spec.dependencies
53
+ current = Gem::SourceInfoCache.search(dep, true, true).last
54
+ latest = Gem::SourceInfoCache.search(Gem::Dependency.new(dep.name, '>0'), true, true).last
55
+ puts "A new version of #{dep.name} is available, #{latest.version} replaces #{current.version}" if latest.version > current.version
56
+ end
57
+ =end
58
+
59
+ # Returns orderd list of transitive dependencies for the given dependency.
60
+ transitive = lambda { |depend|
61
+ dep_spec = Gem::SourceIndex.from_installed_gems.search(depend).last
62
+ fail "No specification for dependency #{depend}" unless dep_spec
63
+ dep_spec.runtime_dependencies.map { |trans| transitive[trans].push(trans) }.flatten.uniq }
64
+ # For each dependency, make sure *all* its transitive dependencies are listed
65
+ # as a Buildr dependency, and order is preserved.
66
+ spec.dependencies.each_with_index do |dep, index|
67
+ puts "checking #{dep.name}"
68
+ for trans in transitive[dep]
69
+ matching = spec.dependencies.find { |existing| trans =~ existing }
70
+ fail "#{trans} required by #{dep} and missing from spec" unless matching
71
+ fail "#{trans} must come before #{dep} in dependency list" unless spec.dependencies.index(matching) < index
72
+ end
73
+ end
74
+ end
75
+
76
+ task 'stage:check'=>'dependency'