buildr4osgi 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +176 -0
- data/NOTICE +6 -0
- data/README.rdoc +50 -0
- data/Rakefile +45 -0
- data/buildr4osgi.gemspec +40 -0
- data/lib/buildr4osgi/compile/compiler.rb +54 -0
- data/lib/buildr4osgi/compile/ecj-3.4.1.jar +0 -0
- data/lib/buildr4osgi/compile.rb +16 -0
- data/lib/buildr4osgi/eclipse/feature.rb +271 -0
- data/lib/buildr4osgi/eclipse/plugin.rb +22 -0
- data/lib/buildr4osgi/eclipse.rb +17 -0
- data/lib/buildr4osgi/nature/eclipse.rb +80 -0
- data/lib/buildr4osgi/nature/java.rb +32 -0
- data/lib/buildr4osgi/nature/nature.rb +156 -0
- data/lib/buildr4osgi/nature/osgi.rb +32 -0
- data/lib/buildr4osgi/nature/scala.rb +32 -0
- data/lib/buildr4osgi/nature.rb +23 -0
- data/lib/buildr4osgi/osgi/bundle.rb +275 -0
- data/lib/buildr4osgi/osgi/bundle_package.rb +80 -0
- data/lib/buildr4osgi/osgi/container.rb +140 -0
- data/lib/buildr4osgi/osgi/library_extension.rb +174 -0
- data/lib/buildr4osgi/osgi/packaging.rb +129 -0
- data/lib/buildr4osgi/osgi/project_extension.rb +324 -0
- data/lib/buildr4osgi/osgi/registry.rb +61 -0
- data/lib/buildr4osgi/osgi/resolving_strategies.rb +104 -0
- data/lib/buildr4osgi/osgi/version.rb +131 -0
- data/lib/buildr4osgi/osgi.rb +24 -0
- data/lib/buildr4osgi.rb +37 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +92 -0
- data/rakelib/jekylltask.rb +120 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +149 -0
- data/rakelib/rspec.rake +73 -0
- data/rakelib/setup.rake +54 -0
- data/rakelib/stage.rake +206 -0
- data/spec/compile/compiler_spec.rb +30 -0
- data/spec/eclipse/feature_spec.rb +295 -0
- data/spec/nature/eclipse_spec.rb +46 -0
- data/spec/nature/java_spec.rb +45 -0
- data/spec/nature/osgi_spec.rb +63 -0
- data/spec/nature/scala_spec.rb +45 -0
- data/spec/nature_spec.rb +144 -0
- data/spec/osgi/bundle_package_spec.rb +32 -0
- data/spec/osgi/bundle_spec.rb +202 -0
- data/spec/osgi/container_spec.rb +93 -0
- data/spec/osgi/library_extension_spec.rb +142 -0
- data/spec/osgi/packaging_spec.rb +340 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/META-INF/ECLIPSEF.RSA +0 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/META-INF/ECLIPSEF.SF +20 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/META-INF/MANIFEST.MF +28 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/META-INF/eclipse.inf +3 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/about.html +28 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/fragment.properties +12 -0
- data/spec/osgi/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/runtime_registry_compatibility.jar +0 -0
- data/spec/osgi/project_extension_spec.rb +662 -0
- data/spec/osgi/registry_spec.rb +50 -0
- data/spec/osgi/version_spec.rb +127 -0
- data/spec/spec_helpers.rb +85 -0
- data/spec/tmp/remote/eclipse/org.eclipse.debug.ui/3.4.1.v20080811_r341/org.eclipse.debug.ui-3.4.1.v20080811_r341.jar +0 -0
- data/spec/tmp/remote/eclipse/org.eclipse.debug.ui/3.4.1.v20080811_r341/org.eclipse.debug.ui-3.4.1.v20080811_r341.pom +82 -0
- data/spec/tmp/remote/org/slf4j/jcl104-over-slf4j/1.5.8/jcl104-over-slf4j-1.5.8-sources.jar +0 -0
- data/spec/tmp/remote/org/slf4j/jcl104-over-slf4j/1.5.8/jcl104-over-slf4j-1.5.8.jar +0 -0
- data/spec/tmp/remote/org/slf4j/jcl104-over-slf4j/1.5.8/jcl104-over-slf4j-1.5.8.pom +30 -0
- data/spec/tmp/remote/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8-sources.jar +0 -0
- data/spec/tmp/remote/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar +0 -0
- data/spec/tmp/remote/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.pom +101 -0
- data/spec/tmp/remote/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8-sources.jar +0 -0
- data/spec/tmp/remote/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar +0 -0
- data/spec/tmp/remote/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.pom +56 -0
- metadata +142 -0
data/rakelib/checks.rake
ADDED
@@ -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
|
+
desc "Check that source files contain the Apache license"
|
18
|
+
task :license=>FileList["**/*.{rb,rake,java,gemspec,buildfile}", 'Rakefile'] do |task|
|
19
|
+
puts "Checking that files contain the Apache license ... "
|
20
|
+
required = task.prerequisites.select { |fn| File.file?(fn) }
|
21
|
+
missing = required.reject { |fn|
|
22
|
+
comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|<!--(.*?)-->/m).
|
23
|
+
map { |match| match.compact }.flatten.join("\n")
|
24
|
+
comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
|
25
|
+
}
|
26
|
+
fail "#{missing.join(', ')} missing Apache License, please add it before making a release!" unless missing.empty?
|
27
|
+
puts "[x] Source files contain the Apache license"
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
desc "Look for new dependencies, check transitive dependencies"
|
32
|
+
task :dependency do
|
33
|
+
puts "Checking that all dependencies are up to date ..."
|
34
|
+
# Find if anything has a more recent dependency. These are not errors, just reports.
|
35
|
+
spec.dependencies.each do |dep|
|
36
|
+
current = Gem::SourceInfoCache.search(dep).last
|
37
|
+
latest = Gem::SourceInfoCache.search(Gem::Dependency.new(dep.name, '>0')).last
|
38
|
+
puts "A new version of #{dep.name} is available, #{latest.version} replaces #{current.version}" if (current && latest && latest.version > current.version)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns orderd list of transitive dependencies for the given dependency.
|
42
|
+
transitive = lambda { |depend|
|
43
|
+
dep_spec = Gem::SourceIndex.from_installed_gems.search(depend).last
|
44
|
+
fail "No specification for dependency #{depend}" unless dep_spec
|
45
|
+
dep_spec.runtime_dependencies.map { |trans| transitive[trans].push(trans) }.flatten.uniq }
|
46
|
+
# For each dependency, make sure *all* its transitive dependencies are listed
|
47
|
+
# as a Buildr dependency, and order is preserved.
|
48
|
+
spec.dependencies.each_with_index do |dep, index|
|
49
|
+
puts "checking #{dep.name}"
|
50
|
+
transitive[dep].each do |trans|
|
51
|
+
matching = spec.dependencies.find { |existing| trans =~ existing }
|
52
|
+
fail "#{trans} required by #{dep} and missing from spec" unless matching
|
53
|
+
fail "#{trans} must come before #{dep} in dependency list" unless spec.dependencies.index(matching) < index
|
54
|
+
end
|
55
|
+
end
|
56
|
+
puts "[X] Checked all dependencies are up to date and transitive dependencies are correctly ordered"
|
57
|
+
end
|
data/rakelib/doc.rake
ADDED
@@ -0,0 +1,92 @@
|
|
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
|
+
task 'doc:setup'
|
18
|
+
begin # For the Web site, we use the SDoc RDoc generator/theme (http://github.com/voloko/sdoc/)
|
19
|
+
require 'sdoc'
|
20
|
+
rescue LoadError
|
21
|
+
puts "Buildr uses the SDoc RDoc generator/theme. You can install it by running rake doc:setup"
|
22
|
+
task('doc:setup') { install_gem 'voloko-sdoc', :source=>'http://gems.github.com' }
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
require 'rake/rdoctask'
|
27
|
+
|
28
|
+
desc "Generate RDoc documentation in rdoc/"
|
29
|
+
Rake::RDocTask.new :rdoc do |rdoc|
|
30
|
+
rdoc.rdoc_dir = 'rdoc'
|
31
|
+
rdoc.title = spec.name
|
32
|
+
rdoc.options = spec.rdoc_options.clone
|
33
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
34
|
+
rdoc.rdoc_files.include spec.extra_rdoc_files
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
begin
|
39
|
+
require 'rakelib/jekylltask'
|
40
|
+
|
41
|
+
desc "Generate Buildr documentation in _site/"
|
42
|
+
JekyllTask.new :jekyll do |task|
|
43
|
+
task.source = 'doc'
|
44
|
+
task.target = '_site'
|
45
|
+
end
|
46
|
+
|
47
|
+
rescue LoadError
|
48
|
+
puts "Buildr uses the mojombo-jekyll to generate the Web site. You can install it by running rake doc:setup"
|
49
|
+
task 'doc:setup' do
|
50
|
+
install_gem 'mojombo-jekyll', :source=>'http://gems.github.com', :version=>'0.5.4'
|
51
|
+
if `pygmentize -V`.empty?
|
52
|
+
args = %w{easy_install Pygments}
|
53
|
+
args.unshift 'sudo' unless Config::CONFIG['host_os'] =~ /windows/
|
54
|
+
sh *args
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
desc "Generate Buildr documentation as buildr.pdf"
|
61
|
+
file 'buildr.pdf'=>'_site' do |task|
|
62
|
+
pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map { |f| "_site/#{f}" }
|
63
|
+
sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}", '_site/preface.html', *pages
|
64
|
+
end
|
65
|
+
|
66
|
+
desc "Build a copy of the Web site in the ./_site"
|
67
|
+
task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr.pdf'] do
|
68
|
+
cp_r 'rdoc', '_site'
|
69
|
+
fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/files/lib/buildr_rb.html')
|
70
|
+
cp '_reports/specs.html', '_site'
|
71
|
+
cp_r '_reports/coverage', '_site'
|
72
|
+
fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
|
73
|
+
cp 'CHANGELOG', '_site'
|
74
|
+
cp 'buildr.pdf', '_site'
|
75
|
+
fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
|
76
|
+
puts 'OK'
|
77
|
+
end
|
78
|
+
|
79
|
+
# Publish prerequisites to Web site.
|
80
|
+
task 'publish'=>:site do
|
81
|
+
target = "people.apache.org:/www/#{spec.name}.apache.org/"
|
82
|
+
puts "Uploading new site to #{target} ..."
|
83
|
+
sh 'rsync', '--progress', '--recursive', '--delete', '_site/', target
|
84
|
+
sh 'ssh', 'people.apache.org', 'chmod', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
|
85
|
+
puts "Done"
|
86
|
+
end
|
87
|
+
|
88
|
+
task :clobber do
|
89
|
+
rm_rf '_site'
|
90
|
+
rm_f 'buildr.pdf'
|
91
|
+
rm_f 'prince_errors.log'
|
92
|
+
end
|
@@ -0,0 +1,120 @@
|
|
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
|
+
gem 'mojombo-jekyll', '~> 0.5.2' # skip past some buggy versions
|
18
|
+
require 'rake/tasklib'
|
19
|
+
require 'jekyll'
|
20
|
+
|
21
|
+
|
22
|
+
class JekyllTask < Rake::TaskLib
|
23
|
+
def initialize(name=:jekyll) # :yield: self
|
24
|
+
@name = name
|
25
|
+
@source = name
|
26
|
+
@target = name
|
27
|
+
yield self if block_given?
|
28
|
+
task name, :auto, :needs=>[@source] do |task, args|
|
29
|
+
generate args.auto
|
30
|
+
end
|
31
|
+
if @source != @target
|
32
|
+
file @target=>FileList["#{@source}/**/*"] do
|
33
|
+
generate
|
34
|
+
end
|
35
|
+
task 'clobber' do
|
36
|
+
rm_rf @target
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_accessor :source
|
42
|
+
attr_accessor :target
|
43
|
+
|
44
|
+
def generate(auto = false)
|
45
|
+
options = { 'source'=>source, 'destination'=>target }
|
46
|
+
options = Jekyll.configuration(options)
|
47
|
+
site = Jekyll::Site.new(options)
|
48
|
+
|
49
|
+
if auto
|
50
|
+
require 'directory_watcher'
|
51
|
+
puts "Auto generating: just edit a page and save, watch the console to see when we're done regenerating pages"
|
52
|
+
dw = DirectoryWatcher.new(source)
|
53
|
+
dw.interval = 1
|
54
|
+
dw.glob = Dir.chdir(source) do
|
55
|
+
dirs = Dir['*'].select { |x| File.directory?(x) }
|
56
|
+
dirs -= [target]
|
57
|
+
dirs = dirs.map { |x| "#{x}/**/*" }
|
58
|
+
dirs += ['*']
|
59
|
+
end
|
60
|
+
dw.start
|
61
|
+
dw.add_observer do |*args|
|
62
|
+
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
63
|
+
puts "[#{t}] regeneration: #{args.size} files changed"
|
64
|
+
site.process
|
65
|
+
puts "Done"
|
66
|
+
end
|
67
|
+
loop { sleep 1 }
|
68
|
+
else
|
69
|
+
puts "Generating documentation in #{target}"
|
70
|
+
site.process
|
71
|
+
touch target
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
module TocFilter
|
78
|
+
def toc(input)
|
79
|
+
input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).inject(%{<ol class="toc">}) { |toc, entry|
|
80
|
+
id = entry[1][/^id=(['"])(.*)\1$/, 2]
|
81
|
+
title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
|
82
|
+
toc << %{<li><a href="##{id}">#{title}</a></li>}
|
83
|
+
} << "</ol>"
|
84
|
+
end
|
85
|
+
end
|
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
|
@@ -0,0 +1,73 @@
|
|
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
|
+
package = Rake::GemPackageTask.new(spec) do |pkg|
|
21
|
+
pkg.need_tar = true
|
22
|
+
pkg.need_zip = true
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Install Buildr from source"
|
26
|
+
task :install=>["#{package.package_dir}/#{package.gem_file}"] do |task|
|
27
|
+
print "Installing #{spec.name} ... "
|
28
|
+
args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{package.package_dir}/#{package.gem_file}"
|
29
|
+
args.unshift('sudo') if sudo_needed?
|
30
|
+
sh *args
|
31
|
+
puts "[x] Installed Buildr #{spec.version}"
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Uninstall previous rake install"
|
35
|
+
task :uninstall do |task|
|
36
|
+
puts "Uninstalling #{spec.name} ... "
|
37
|
+
args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'uninstall', spec.name, '--version', spec.version.to_s
|
38
|
+
args.unshift('sudo') if sudo_needed?
|
39
|
+
sh *args
|
40
|
+
puts "[x] Uninstalled Buildr #{spec.version}"
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
desc "Compile Java libraries used by Buildr"
|
45
|
+
task :compile do
|
46
|
+
puts "Compiling Java libraries ..."
|
47
|
+
args = Config::CONFIG['ruby_install_name'], File.expand_path(RUBY_PLATFORM[/java/] ? '_jbuildr' : '_buildr'), '--buildfile', 'buildr.buildfile', 'compile'
|
48
|
+
args << '--trace' if Rake.application.options.trace
|
49
|
+
sh *args
|
50
|
+
end
|
51
|
+
file Rake::GemPackageTask.new(spec).package_dir=>:compile
|
52
|
+
file Rake::GemPackageTask.new(spec).package_dir_path=>:compile
|
53
|
+
|
54
|
+
# We also need the other packages (JRuby if building on Ruby, and vice versa)
|
55
|
+
# Must call new with block, even if block does nothing, otherwise bad things happen.
|
56
|
+
@specs.values.each do |s|
|
57
|
+
Rake::GemPackageTask.new(s) { |task| }
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
desc "Upload snapshot packages over to people.apache.org"
|
62
|
+
task :snapshot=>[:package] do
|
63
|
+
rm_rf '_snapshot' # Always start with empty directory
|
64
|
+
puts "Copying existing gems from Apache"
|
65
|
+
sh 'rsync', '--progress', '--recursive', 'people.apache.org:public_html/buildr/snapshot/', '_snapshot/'
|
66
|
+
puts "Copying new gems over"
|
67
|
+
cp FileList['pkg/{*.gem,*.tgz,*.zip}'], '_snapshot/gems'
|
68
|
+
puts "Generating gem index ..."
|
69
|
+
sh 'gem', 'generate_index', '--directory', '_snapshot'
|
70
|
+
puts "Copying gem and index back to Apache"
|
71
|
+
sh 'rsync', '--progress', '--recursive', '_snapshot/', 'people.apache.org:public_html/buildr/snapshot/'
|
72
|
+
end
|
73
|
+
task(:clobber) { rm_rf '_snapshot' }
|
@@ -0,0 +1,149 @@
|
|
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
|
+
task :release do
|
18
|
+
# First, we need to get all the staged files from Apache to _release.
|
19
|
+
mkpath '_release'
|
20
|
+
lambda do
|
21
|
+
url = "people.apache.org:~/public_html/#{spec.name}/#{spec.version}"
|
22
|
+
puts "Populating _release directory from #{url} ..."
|
23
|
+
sh 'rsync', '--progress', '--recursive', url, '_release'
|
24
|
+
puts "[X] Staged files are now in _release"
|
25
|
+
end.call
|
26
|
+
|
27
|
+
|
28
|
+
# Upload binary and source packages and new Web site
|
29
|
+
lambda do
|
30
|
+
target = "people.apache.org:/www/www.apache.org/dist/#{spec.name}/#{spec.version}"
|
31
|
+
puts "Uploading packages to www.apache.org/dist ..."
|
32
|
+
host, remote_dir = target.split(':')
|
33
|
+
sh 'ssh', host, 'rm', '-rf', remote_dir rescue nil
|
34
|
+
sh 'ssh', host, 'mkdir', remote_dir
|
35
|
+
sh 'rsync', '--progress', '--recursive', "_release/#{spec.version}/dist/", target
|
36
|
+
puts "[X] Uploaded packages to www.apache.org/dist"
|
37
|
+
|
38
|
+
target = "people.apache.org:/www/#{spec.name}.apache.org/"
|
39
|
+
puts "Uploading new site to #{spec.name}.apache.org ..."
|
40
|
+
sh 'rsync', '--progress', '--recursive', '--delete', "_release/#{spec.version}/site/", target
|
41
|
+
sh 'ssh', 'people.apache.org', 'chmod', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
|
42
|
+
puts "[X] Uploaded new site to #{spec.name}.apache.org"
|
43
|
+
end.call
|
44
|
+
|
45
|
+
|
46
|
+
# Upload binary and source packages to RubyForge.
|
47
|
+
lambda do
|
48
|
+
files = FileList["_release/#{spec.version}/dist/*.{gem,tgz,zip}"]
|
49
|
+
puts "Uploading #{spec.version} to RubyForge ... "
|
50
|
+
rubyforge = RubyForge.new.configure
|
51
|
+
rubyforge.login
|
52
|
+
rubyforge.userconfig.merge!('release_changes'=>"_release/#{spec.version}/CHANGES", 'preformatted' => true)
|
53
|
+
rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version.to_s, *files
|
54
|
+
|
55
|
+
puts "Posting news to RubyForge ... "
|
56
|
+
changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
|
57
|
+
rubyforge.post_news spec.rubyforge_project.downcase, "Buildr #{spec.version} released",
|
58
|
+
"#{spec.description}\n\nNew in Buildr #{spec.version}:\n#{changes.gsub(/^/, ' ')}\n"
|
59
|
+
puts "[X] Uploaded gems and source files to #{spec.name}.rubyforge.org"
|
60
|
+
end.call
|
61
|
+
|
62
|
+
|
63
|
+
# Create an SVN tag for this release.
|
64
|
+
lambda do
|
65
|
+
info = `svn info` + `git svn info` # Using either svn or git-svn
|
66
|
+
if url = info[/^URL:/] && info.scan(/^URL: (.*)/)[0][0]
|
67
|
+
new_url = url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{spec.version}")
|
68
|
+
unless url == new_url
|
69
|
+
sh 'svn', 'copy', url, new_url, '-m', "Release #{spec.version}" do |ok, res|
|
70
|
+
if ok
|
71
|
+
puts "[X] Tagged this release as tags/#{spec.version} ... "
|
72
|
+
else
|
73
|
+
puts "Could not create tag, please do it yourself!"
|
74
|
+
puts %{ svn copy #{url} #{new_url} -m "Release #{spec.version}"}
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end.call
|
80
|
+
|
81
|
+
|
82
|
+
# Update CHANGELOG to next release number.
|
83
|
+
lambda do
|
84
|
+
next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
|
85
|
+
zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
|
86
|
+
modified = "#{next_version} (Pending)\n\n" + File.read('CHANGELOG')
|
87
|
+
File.open 'CHANGELOG', 'w' do |file|
|
88
|
+
file.write modified
|
89
|
+
end
|
90
|
+
puts "[X] Updated CHANGELOG and added entry for next release"
|
91
|
+
end.call
|
92
|
+
|
93
|
+
|
94
|
+
# Update source files to next release number.
|
95
|
+
lambda do
|
96
|
+
next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
|
97
|
+
zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
|
98
|
+
|
99
|
+
ver_file = "lib/#{spec.name}.rb"
|
100
|
+
if File.exist?(ver_file)
|
101
|
+
modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
|
102
|
+
File.open ver_file, 'w' do |file|
|
103
|
+
file.write modified
|
104
|
+
end
|
105
|
+
puts "[X] Updated #{ver_file} to next release"
|
106
|
+
end
|
107
|
+
|
108
|
+
spec_file = "#{spec.name}.gemspec"
|
109
|
+
if File.exist?(spec_file)
|
110
|
+
modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
|
111
|
+
File.open spec_file, 'w' do |file|
|
112
|
+
file.write modified
|
113
|
+
end
|
114
|
+
puts "[X] Updated #{spec_file} to next release"
|
115
|
+
end
|
116
|
+
end.call
|
117
|
+
|
118
|
+
|
119
|
+
# Prepare release announcement email.
|
120
|
+
lambda do
|
121
|
+
changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
|
122
|
+
email = <<-EMAIL
|
123
|
+
To: users@buildr.apache.org, announce@apache.org
|
124
|
+
Subject: [ANNOUNCE] Apache Buildr #{spec.version} released
|
125
|
+
|
126
|
+
#{spec.description}
|
127
|
+
|
128
|
+
New in this release:
|
129
|
+
|
130
|
+
#{changes.gsub(/^/, ' ')}
|
131
|
+
|
132
|
+
To learn more about Buildr and get started:
|
133
|
+
http://buildr.apache.org/
|
134
|
+
|
135
|
+
Thanks!
|
136
|
+
The Apache Buildr Team
|
137
|
+
|
138
|
+
EMAIL
|
139
|
+
File.open 'announce-email.txt', 'w' do |file|
|
140
|
+
file.write email
|
141
|
+
end
|
142
|
+
puts "[X] Created release announce email template in 'announce-email.txt'"
|
143
|
+
puts email
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
|
149
|
+
task(:clobber) { rm_rf '_release' }
|
data/rakelib/rspec.rake
ADDED
@@ -0,0 +1,73 @@
|
|
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
|
+
begin
|
18
|
+
require 'spec/rake/spectask'
|
19
|
+
directory '_reports'
|
20
|
+
|
21
|
+
desc "Run all specs"
|
22
|
+
Spec::Rake::SpecTask.new :spec=>'_reports' do |task|
|
23
|
+
task.spec_files = FileList['spec/**/*_spec.rb']
|
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 --loadby mtime --backtrace}
|
26
|
+
task.spec_opts << '--colour' if $stdout.isatty
|
27
|
+
end
|
28
|
+
file('_reports/specs.html') { task(:spec).invoke }
|
29
|
+
|
30
|
+
desc 'Run all failed examples from previous run'
|
31
|
+
Spec::Rake::SpecTask.new :failed do |task|
|
32
|
+
task.spec_files = FileList['spec/**/*_spec.rb']
|
33
|
+
task.spec_opts = %w{--format specdoc --format failing_examples:failed --example failed --backtrace}
|
34
|
+
task.spec_opts << '--colour' if $stdout.isatty
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Run RSpec and generate Spec and coverage reports (slow)'
|
38
|
+
Spec::Rake::SpecTask.new :coverage=>'_reports' do |task|
|
39
|
+
task.spec_files = FileList['spec/**/*_spec.rb']
|
40
|
+
task.spec_opts = %W{--format progress --format failing_examples:failed --format html:_reports/specs.html --backtrace}
|
41
|
+
task.spec_opts << '--colour' if $stdout.isatty
|
42
|
+
task.rcov = true
|
43
|
+
task.rcov_dir = '_reports/coverage'
|
44
|
+
task.rcov_opts = %w{--exclude / --include-file ^lib --text-summary}
|
45
|
+
end
|
46
|
+
file('_reports/coverage') { task(:coverage).invoke }
|
47
|
+
|
48
|
+
|
49
|
+
# Useful for testing with JRuby when using Ruby and vice versa.
|
50
|
+
namespace :spec do
|
51
|
+
desc "Run all specs specifically with Ruby"
|
52
|
+
task :ruby do
|
53
|
+
puts "Running test suite using Ruby ..."
|
54
|
+
sh 'ruby -S rake spec'
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Run all specs specifically with JRuby"
|
58
|
+
task :jruby do
|
59
|
+
puts "Running test suite using JRuby ..."
|
60
|
+
sh 'jruby -S rake spec'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
task :clobber do
|
65
|
+
rm_f 'failed'
|
66
|
+
rm_rf '_reports'
|
67
|
+
end
|
68
|
+
|
69
|
+
rescue LoadError
|
70
|
+
puts "Buildr uses RSpec. You can install it by running rake setup"
|
71
|
+
task(:setup) { install_gem 'rcov', :version=>'~>0.8' }
|
72
|
+
task(:setup) { install_gem 'win32console' if RUBY_PLATFORM[/win32/] } # Colors for RSpec, only on Windows platform.
|
73
|
+
end
|
data/rakelib/setup.rake
ADDED
@@ -0,0 +1,54 @@
|
|
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 'jruby' if RUBY_PLATFORM[/java/]
|
18
|
+
require 'rubygems/source_info_cache'
|
19
|
+
|
20
|
+
RAKE_SUDO = case (ENV['RAKE_SUDO'] or 'yes').strip.downcase
|
21
|
+
when 'yes', 'true'
|
22
|
+
true
|
23
|
+
else
|
24
|
+
false
|
25
|
+
end
|
26
|
+
|
27
|
+
# Install the specified gem. Options include:
|
28
|
+
# - :version -- Version requirement, e.g. '1.2' or '~> 1.2'
|
29
|
+
# - :source -- Gem repository, e.g. 'http://gems.github.com'
|
30
|
+
def install_gem(name, options = {})
|
31
|
+
dep = Gem::Dependency.new(name, options[:version] || '>0')
|
32
|
+
if Gem::SourceIndex.from_installed_gems.search(dep).empty?
|
33
|
+
puts "Installing #{name} ..."
|
34
|
+
rb_bin = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
35
|
+
args = []
|
36
|
+
args << 'sudo' << 'env' << "JAVA_HOME=#{ENV['JAVA_HOME']}" if sudo_needed? and RAKE_SUDO
|
37
|
+
args << rb_bin << '-S' << 'gem' << 'install' << name
|
38
|
+
args << '--version' << dep.version_requirements.to_s
|
39
|
+
args << '--source' << options[:source] if options[:source]
|
40
|
+
args << '--source' << 'http://gems.rubyforge.org'
|
41
|
+
args << '--install-dir' << ENV['GEM_HOME'] if ENV['GEM_HOME']
|
42
|
+
sh *args
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
# Setup environment for running this Rakefile (RSpec, Jekyll, etc).
|
48
|
+
desc "If you're building from sources, run this task first to setup the necessary dependencies."
|
49
|
+
task :setup do
|
50
|
+
missing = spec.dependencies.select { |dep| Gem::SourceIndex.from_installed_gems.search(dep).empty? }
|
51
|
+
missing.each do |dep|
|
52
|
+
install_gem dep.name, :version=>dep.version_requirements
|
53
|
+
end
|
54
|
+
end
|