buildr 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/CHANGELOG +76 -0
  2. data/NOTICE +1 -1
  3. data/README.rdoc +9 -21
  4. data/Rakefile +20 -37
  5. data/_buildr +3 -12
  6. data/{doc/print.toc.yaml → _jbuildr} +14 -14
  7. data/addon/buildr/cobertura.rb +5 -219
  8. data/addon/buildr/drb.rb +281 -0
  9. data/addon/buildr/emma.rb +5 -221
  10. data/addon/buildr/nailgun.rb +93 -689
  11. data/bin/buildr +0 -9
  12. data/buildr.buildfile +4 -4
  13. data/buildr.gemspec +27 -21
  14. data/doc/_layouts/default.html +82 -0
  15. data/doc/_layouts/preface.html +22 -0
  16. data/doc/{pages/artifacts.textile → artifacts.textile} +82 -42
  17. data/doc/{pages/building.textile → building.textile} +89 -47
  18. data/doc/{pages/contributing.textile → contributing.textile} +53 -45
  19. data/doc/css/default.css +6 -5
  20. data/doc/css/print.css +17 -24
  21. data/doc/css/syntax.css +7 -36
  22. data/doc/download.textile +78 -0
  23. data/doc/{pages/extending.textile → extending.textile} +45 -24
  24. data/doc/{pages/getting_started.textile → getting_started.textile} +146 -88
  25. data/doc/images/asf-logo.gif +0 -0
  26. data/doc/images/note.png +0 -0
  27. data/doc/index.textile +47 -0
  28. data/doc/{pages/languages.textile → languages.textile} +108 -54
  29. data/doc/mailing_lists.textile +25 -0
  30. data/doc/{pages/more_stuff.textile → more_stuff.textile} +152 -73
  31. data/doc/{pages/packaging.textile → packaging.textile} +181 -96
  32. data/doc/preface.textile +28 -0
  33. data/doc/{pages/projects.textile → projects.textile} +55 -40
  34. data/doc/scripts/buildr-git.rb +364 -264
  35. data/doc/scripts/gitflow.rb +296 -0
  36. data/doc/scripts/install-jruby.sh +2 -2
  37. data/doc/scripts/install-linux.sh +6 -6
  38. data/doc/scripts/install-osx.sh +2 -2
  39. data/doc/{pages/settings_profiles.textile → settings_profiles.textile} +83 -45
  40. data/doc/{pages/testing.textile → testing.textile} +77 -41
  41. data/lib/buildr.rb +5 -5
  42. data/lib/buildr/core.rb +2 -0
  43. data/lib/buildr/core/application.rb +321 -151
  44. data/lib/buildr/core/build.rb +298 -167
  45. data/lib/buildr/core/checks.rb +4 -132
  46. data/lib/buildr/core/common.rb +1 -5
  47. data/lib/buildr/core/compile.rb +3 -9
  48. data/lib/buildr/core/environment.rb +12 -3
  49. data/lib/buildr/core/filter.rb +20 -18
  50. data/lib/buildr/core/generate.rb +36 -36
  51. data/lib/buildr/core/help.rb +2 -1
  52. data/lib/buildr/core/osx.rb +46 -0
  53. data/lib/buildr/core/progressbar.rb +1 -1
  54. data/lib/buildr/core/project.rb +7 -34
  55. data/lib/buildr/core/test.rb +12 -6
  56. data/lib/buildr/core/transports.rb +13 -11
  57. data/lib/buildr/core/util.rb +14 -23
  58. data/lib/buildr/groovy/bdd.rb +3 -2
  59. data/lib/buildr/groovy/compiler.rb +1 -1
  60. data/lib/buildr/ide/eclipse.rb +31 -21
  61. data/lib/buildr/ide/idea.rb +3 -2
  62. data/lib/buildr/ide/idea7x.rb +6 -4
  63. data/lib/buildr/java/ant.rb +3 -1
  64. data/lib/buildr/java/bdd.rb +9 -7
  65. data/lib/buildr/java/cobertura.rb +243 -0
  66. data/lib/buildr/java/compiler.rb +5 -4
  67. data/lib/buildr/java/emma.rb +244 -0
  68. data/lib/buildr/java/packaging.rb +11 -8
  69. data/lib/buildr/java/pom.rb +0 -4
  70. data/lib/buildr/java/rjb.rb +1 -1
  71. data/lib/buildr/java/test_result.rb +5 -7
  72. data/lib/buildr/java/tests.rb +17 -11
  73. data/lib/buildr/packaging.rb +5 -2
  74. data/lib/buildr/packaging/archive.rb +488 -0
  75. data/lib/buildr/packaging/artifact.rb +48 -29
  76. data/lib/buildr/packaging/artifact_namespace.rb +6 -6
  77. data/lib/buildr/packaging/gems.rb +4 -4
  78. data/lib/buildr/packaging/package.rb +3 -2
  79. data/lib/buildr/packaging/tar.rb +85 -3
  80. data/lib/buildr/packaging/version_requirement.rb +172 -0
  81. data/lib/buildr/packaging/zip.rb +24 -682
  82. data/lib/buildr/packaging/ziptask.rb +313 -0
  83. data/lib/buildr/scala.rb +5 -0
  84. data/lib/buildr/scala/bdd.rb +100 -0
  85. data/lib/buildr/scala/compiler.rb +45 -4
  86. data/lib/buildr/scala/tests.rb +12 -59
  87. data/rakelib/checks.rake +57 -0
  88. data/rakelib/doc.rake +58 -68
  89. data/rakelib/jekylltask.rb +110 -0
  90. data/rakelib/package.rake +35 -37
  91. data/rakelib/release.rake +119 -35
  92. data/rakelib/rspec.rake +29 -39
  93. data/rakelib/setup.rake +21 -59
  94. data/rakelib/stage.rake +184 -26
  95. data/spec/addon/drb_spec.rb +328 -0
  96. data/spec/core/application_spec.rb +32 -25
  97. data/spec/core/build_spec.rb +336 -126
  98. data/spec/core/checks_spec.rb +292 -310
  99. data/spec/core/common_spec.rb +8 -2
  100. data/spec/core/compile_spec.rb +17 -1
  101. data/spec/core/generate_spec.rb +3 -3
  102. data/spec/core/project_spec.rb +18 -10
  103. data/spec/core/test_spec.rb +8 -1
  104. data/spec/core/transport_spec.rb +40 -3
  105. data/spec/core/util_spec.rb +67 -0
  106. data/spec/ide/eclipse_spec.rb +96 -28
  107. data/spec/ide/idea7x_spec.rb +84 -0
  108. data/spec/java/ant.rb +5 -0
  109. data/spec/java/bdd_spec.rb +12 -3
  110. data/spec/{addon → java}/cobertura_spec.rb +6 -6
  111. data/spec/{addon → java}/emma_spec.rb +5 -6
  112. data/spec/java/java_spec.rb +12 -2
  113. data/spec/java/packaging_spec.rb +31 -2
  114. data/spec/{addon → java}/test_coverage_spec.rb +3 -3
  115. data/spec/java/tests_spec.rb +5 -0
  116. data/spec/packaging/archive_spec.rb +11 -1
  117. data/spec/{core → packaging}/artifact_namespace_spec.rb +10 -2
  118. data/spec/packaging/artifact_spec.rb +44 -3
  119. data/spec/packaging/packaging_spec.rb +1 -1
  120. data/spec/sandbox.rb +17 -14
  121. data/spec/scala/bdd_spec.rb +150 -0
  122. data/spec/scala/compiler_spec.rb +27 -0
  123. data/spec/scala/scala.rb +38 -0
  124. data/spec/scala/tests_spec.rb +78 -33
  125. data/spec/spec_helpers.rb +29 -5
  126. data/spec/version_requirement_spec.rb +6 -0
  127. metadata +175 -171
  128. data/DISCLAIMER +0 -7
  129. data/doc/images/apache-incubator-logo.png +0 -0
  130. data/doc/pages/download.textile +0 -51
  131. data/doc/pages/index.textile +0 -42
  132. data/doc/pages/mailing_lists.textile +0 -17
  133. data/doc/pages/recipes.textile +0 -103
  134. data/doc/pages/troubleshooting.textile +0 -103
  135. data/doc/pages/whats_new.textile +0 -323
  136. data/doc/print.haml +0 -51
  137. data/doc/site.haml +0 -56
  138. data/doc/site.toc.yaml +0 -47
  139. data/etc/git-svn-authors +0 -16
  140. data/lib/buildr/core/application_cli.rb +0 -139
  141. data/rakelib/apache.rake +0 -191
  142. data/rakelib/changelog.rake +0 -57
  143. data/rakelib/rubyforge.rake +0 -53
  144. data/rakelib/scm.rake +0 -49
@@ -1,51 +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
- !!! 1.1
17
- %html
18
- %head
19
- %meta{ 'http-equiv'=>'Content-Type', :content=>'text/html;charset=UTF-8' }/
20
- %title= collection.title
21
- %style{ :type=>'text/css' }
22
- @import 'css/default.css';
23
- @import 'css/syntax.css';
24
- @import 'css/print.css' print;
25
- %meta{ :name=>'subject', :content=>'Official Buildr documentation from the people in the know' }
26
- %meta{ :name=>'author', :content=>'http://incubator.apache.org/buildr' }
27
- %body
28
- #wrap
29
- #header
30
- %img{ :src=>'images/buildr-hires.png', :alt=>collection.title, :style=>'width:20em' }
31
- .tagline= ''
32
- #content
33
- = collection.toc.to_html(:nested, :class=>'toc')
34
- #license
35
- %p Copyright 2007-2008 Apache Buildr
36
- %p
37
- Licensed under the Apache License, Version 2.0 (the "License"); you
38
- may not use this file except in compliance with the License. You
39
- may obtain a copy of the License at
40
- %p{ :style=>'margin-left: 2em' }
41
- %a{ :href=>'http://www.apache.org/licenses/LICENSE-2.0' } http://www.apache.org/licenses/LICENSE-2.0
42
- %p
43
- Unless required by applicable law or agreed to in writing, software
44
- distributed under the License is distributed on an "AS IS" BASIS,
45
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
46
- implied. See the License for the specific language governing
47
- permissions and limitations under the License.
48
- - pages.each do |page|
49
- %h1{ :id=>page.id }= page.title
50
- = page.toc.to_html(:nested, :class=>'toc')
51
- ~ collect_links(renumber_footnotes(page.content))
@@ -1,56 +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
- !!! 1.1
17
- %html
18
- %head
19
- %meta{ 'http-equiv'=>'Content-Type', :content=>'text/html;charset=UTF-8' }/
20
- %title= "#{collection.title} — #{page.title}"
21
- %style{ :type=>'text/css' }
22
- @import 'css/default.css';
23
- @import 'css/syntax.css';
24
- %style{ :type=>'text/css', :media=>'print' }
25
- @import 'css/print.css';
26
- \#header { display: none }
27
- %meta{ :name=>'subject', :content=>'Official Buildr documentation from the people in the know' }
28
- %link{ :rel=>'shortcut icon', :href=>'images/favicon.png'}
29
- %body
30
- #wrap
31
- #header
32
- %a{ :href=>'http://incubator.apache.org/', :style=>'float:right' }
33
- %img{ :src=>'images/apache-incubator-logo.png', :alt=>'Apache Incubator' }
34
- %a{ :href=>'http://incubator.apache.org/buildr/' }
35
- %img{ :src=>'images/buildr.png', :alt=>collection.title }
36
- .tagline= ''
37
- #pages
38
- = collection.toc.to_html(:nested=>1, :class=>'toc')
39
- %form{ :id=>'searchbox_003673095760649043902:ogcgrzu0l2y', :action=>'http://www.google.com/cse' }
40
- %input{ :type=>'hidden', :name=>'cx', :value=>'003673095760649043902:ogcgrzu0l2y' }
41
- %input{ :type=>'hidden', :name=>'cof', :value=>'FORID:0' }
42
- %input{ :name=>'q', :type=>'text', :size=>'20' }
43
- %input{ :type=>'submit', :name=>'sa', :value=>'Search' }
44
- %img{ :src=>'http://www.google.com/coop/images/google_custom_search_smnar.gif', :alt=>'Google Custom Search' }
45
-
46
- #content
47
- %h1= page.title
48
- = page.toc.to_html(:nested, :class=>'toc')
49
- ~ page.content
50
- #navigation
51
- - if prev_page = collection.prev(page)
52
- %a{ :href=>prev_page.path, :class=>'prev' }= '« ' + prev_page.title
53
- - if next_page = collection.next(page)
54
- %a{ :href=>next_page.path, :class=>'next' }= next_page.title + ' »'
55
- #footer
56
- Copyright © 2007-2008 The Apache Software Foundation
@@ -1,47 +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
- - Start Here:
17
- - Welcome: index.html
18
- - Download and Installation: download.html
19
- - User Guide (PDF): buildr.pdf
20
- - What's New: whats_new.html
21
- - Community Wiki: http://cwiki.apache.org/confluence/display/BUILDR/Index
22
- - Using Buildr:
23
- - Getting Started: getting_started.html
24
- - Projects: projects.html
25
- - Building: building.html
26
- - Artifcats: artifacts.html
27
- - Packaging: packaging.html
28
- - Testing: testing.html
29
- - Settings/Profiles: settings_profiles.html
30
- - Languages: languages.html
31
- - More Stuff: more_stuff.html
32
- - Extending: extending.html
33
- - Recipes: recipes.html
34
- - Reference:
35
- - API: rdoc
36
- - Rake: http://docs.rubyrake.org
37
- - Antwrap: http://antwrap.rubyforge.org
38
- - Troubleshooting: troubleshooting.html
39
- - Get Involved:
40
- - Mailing Lists: mailing_lists.html
41
- - Issues/Bugs: http://issues.apache.org/jira/browse/Buildr
42
- - Contributing: contributing.html
43
- - Project Status:
44
- - License: license.html
45
- - Change Log: changelog.html
46
- - Specs: specs.html
47
- - Coverage: coverage/index.html
@@ -1,16 +0,0 @@
1
- # This file is used by git-svn
2
- #
3
- # Format is
4
- # <apache svn login> = John Doe <john.doe@hacker.mail>
5
- #
6
- # If you are a committer and want to use git-svn to hack on
7
- # buildr, please add yourself here and commit this file via svn.
8
- # Then run the buildr-git.rb script to obtain and configure
9
- # a local buildr-git copy.
10
- #
11
-
12
- assaf = Assaf Arkin <assaf@apache.org>
13
- boisvert = Alex Boisvert <alex.boisvert@gmail.com>
14
- lacton = Lacton <lacton@apache.org>
15
- mriou = Matthieu Riou <mriou@apache.org>
16
- vborja = Victor Hugo Borja <vic.borja@gmail.com>
@@ -1,139 +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
- # Portion of this file derived from Rake.
17
- # Copyright (c) 2003, 2004 Jim Weirich
18
- #
19
- # Permission is hereby granted, free of charge, to any person obtaining a copy
20
- # of this software and associated documentation files (the "Software"), to deal
21
- # in the Software without restriction, including without limitation the rights
22
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
- # copies of the Software, and to permit persons to whom the Software is
24
- # furnished to do so, subject to the following conditions:
25
- #
26
- # The above copyright notice and this permission notice shall be included in
27
- # all copies or substantial portions of the Software.
28
- #
29
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
- # SOFTWARE.
36
-
37
-
38
- require 'getoptlong'
39
-
40
-
41
- module Buildr
42
- module CommandLineInterface
43
-
44
- OPTIONS = [ # :nodoc:
45
- ['--help', '-h', GetoptLong::NO_ARGUMENT,
46
- 'Display this help message.'],
47
- ['--nosearch', '-n', GetoptLong::NO_ARGUMENT,
48
- 'Do not search parent directories for the buildfile.'],
49
- ['--quiet', '-q', GetoptLong::NO_ARGUMENT,
50
- 'Do not log messages to standard output.'],
51
- ['--buildfile', '-f', GetoptLong::REQUIRED_ARGUMENT,
52
- 'Use FILE as the buildfile.'],
53
- ['--require', '-r', GetoptLong::REQUIRED_ARGUMENT,
54
- 'Require MODULE before executing buildfile.'],
55
- ['--trace', '-t', GetoptLong::NO_ARGUMENT,
56
- 'Turn on invoke/execute tracing, enable full backtrace.'],
57
- ['--prereqs', '-P', GetoptLong::OPTIONAL_ARGUMENT,
58
- 'Display tasks and dependencies, then exit.'],
59
- ['--version', '-v', GetoptLong::NO_ARGUMENT,
60
- 'Display the program version.'],
61
- ['--environment', '-e', GetoptLong::REQUIRED_ARGUMENT,
62
- 'Environment name (e.g. development, test, production).']
63
- ]
64
-
65
- def collect_tasks
66
- top_level_tasks.clear
67
- ARGV.each do |arg|
68
- if arg =~ /^(\w+)=(.*)$/
69
- ENV[$1.upcase] = $2
70
- else
71
- top_level_tasks << arg
72
- end
73
- end
74
- top_level_tasks.push("default") if top_level_tasks.size == 0
75
- end
76
-
77
- def parse_options
78
- opts = GetoptLong.new(*command_line_options)
79
- opts.each { |opt, value| do_option(opt, value) }
80
- end
81
-
82
- def do_option(opt, value)
83
- case opt
84
- when '--help'
85
- help
86
- exit
87
- when '--buildfile'
88
- rakefiles.clear
89
- rakefiles << value
90
- when '--version'
91
- puts version
92
- exit
93
- when '--environment'
94
- ENV['BUILDR_ENV'] = value
95
- when '--require'
96
- requires << value
97
- when '--prereqs'
98
- options.show_prereqs = true
99
- options.show_task_pattern = Regexp.new(value || '.')
100
- when '--nosearch', '--quiet', '--trace'
101
- super
102
- end
103
- end
104
-
105
- def command_line_options
106
- OPTIONS.collect { |lst| lst[0..-2] }
107
- end
108
-
109
- def version
110
- "Buildr #{Buildr::VERSION} #{RUBY_PLATFORM[/java/] && '(JRuby '+JRUBY_VERSION+')'}"
111
- end
112
-
113
- def usage
114
- puts version
115
- puts
116
- puts 'Usage:'
117
- puts ' buildr [options] [tasks] [name=value]'
118
- end
119
-
120
- def help
121
- usage
122
- puts
123
- puts 'Options:'
124
- OPTIONS.sort.each do |long, short, mode, desc|
125
- if mode == GetoptLong::REQUIRED_ARGUMENT
126
- if desc =~ /\b([A-Z]{2,})\b/
127
- long = long + "=#{$1}"
128
- end
129
- end
130
- printf " %-20s (%s)\n", long, short
131
- printf " %s\n", desc
132
- end
133
- puts
134
- puts 'For help with your buildfile:'
135
- puts ' buildr help'
136
- end
137
-
138
- end
139
- end
@@ -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']