buildrizpack 0.2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,122 @@
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
+ desc "Create JRuby all-in-one distribution"
17
+ task "all-in-one" => 'all-in-one:all-in-one'
18
+
19
+ namespace :'all-in-one' do
20
+
21
+ version = "1.6.4"
22
+ jruby_distro = "jruby-bin-#{version}.tar.gz"
23
+ url = "http://jruby.org.s3.amazonaws.com/downloads/#{version}/#{jruby_distro}"
24
+ dir = "jruby-#{version}"
25
+
26
+ task "all-in-one" => [:gem,
27
+ # Prepare to run
28
+ :prepare,
29
+ # Download and extract JRuby
30
+ :download_and_extract,
31
+ # Cleanup JRuby distribution
32
+ :clean_dist,
33
+ # Install Buildr gem and dependencies
34
+ :install_dependencies,
35
+ # Add Buildr executables/scripts
36
+ :add_execs,
37
+ # Package distribution
38
+ :package
39
+ ]
40
+
41
+ desc 'Prepare to run'
42
+ task :prepare do
43
+ mkpath '_all-in-one'
44
+ cd '_all-in-one'
45
+ end
46
+
47
+ desc 'Download and extract JRuby'
48
+ task :download_and_extract do
49
+ unless File.exist? jruby_distro
50
+ puts "Downloading JRuby from #{url} ..."
51
+ sh 'wget', url
52
+ puts "[X] Downloaded JRuby"
53
+ end
54
+
55
+ rm_rf dir if File.exist? dir
56
+
57
+ puts "Extracting JRuby to #{dir} ..."
58
+ sh 'tar', 'xzf', jruby_distro
59
+ puts "[X] Extracted JRuby"
60
+ cd dir
61
+ end
62
+
63
+ desc 'Cleanup JRuby distribution'
64
+ task :clean_dist do
65
+ puts 'Cleaning...'
66
+ rm_rf 'docs'
67
+ mkpath 'jruby-docs'
68
+ mv Dir["COPYING*"], 'jruby-docs'
69
+ mv Dir["LICENSE*"], 'jruby-docs'
70
+ mv 'README', 'jruby-docs'
71
+ rm_rf 'lib/ruby/1.9'
72
+ rm_rf 'lib/ruby/gems/1.8/doc'
73
+ rm_rf 'samples'
74
+ rm_rf 'share'
75
+ end
76
+
77
+ desc 'Install Buildr gem and dependencies'
78
+ task :install_dependencies do
79
+ puts "Install rubygems-update"
80
+ sh "bin/jruby -S gem install rubygems-update"
81
+
82
+ puts "Upgrade Rubygems"
83
+ sh "bin/jruby -S gem update --system"
84
+
85
+ puts "Install ffi-ncurses"
86
+ sh "bin/jruby -S gem install ffi-ncurses"
87
+
88
+ puts "Install Buildr gem ..."
89
+ sh "bin/jruby", '-S', 'gem', 'install', FileList['../../pkg/*-java.gem'].first,
90
+ '--no-rdoc', '--no-ri'
91
+ puts "[X] Install Buildr gem"
92
+ end
93
+
94
+ desc 'Add Buildr executables/scripts'
95
+ task :add_execs do
96
+ cp 'bin/jruby.exe', 'bin/_buildr.exe'
97
+ cp Dir["../../all-in-one/*"], 'bin'
98
+ end
99
+
100
+ desc 'Package distribution'
101
+ task :package do
102
+ puts "Zipping distribution ..."
103
+ cd '..'
104
+ new_dir = "#{spec.name}-all-in-one-#{spec.version}"
105
+ mv dir, new_dir
106
+ zip = "#{new_dir}.zip"
107
+ rm zip if File.exist? zip
108
+ sh 'zip', '-q', '-r', zip, new_dir
109
+ puts "[X] Zipped distribution"
110
+
111
+ puts "Tarring distribution ..."
112
+ tar = "#{new_dir}.tar.gz"
113
+ rm tar if File.exist? tar
114
+ sh 'tar', 'czf', tar, new_dir
115
+ puts "[X] Tarred distribution"
116
+
117
+ rm_rf new_dir
118
+ end
119
+
120
+ end
121
+
122
+ task(:clobber) { rm_rf '_all-in-one' }
@@ -0,0 +1,28 @@
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,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
@@ -0,0 +1,28 @@
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
data/rakelib/doc.rake ADDED
@@ -0,0 +1,45 @@
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
+ gem 'rdoc'
17
+ require 'rdoc/task'
18
+ desc "Creates a symlink to rake's lib directory to support combined rdoc generation"
19
+ file "rake/lib" do
20
+ rake_path = $LOAD_PATH.find { |p| File.exist? File.join(p, "rake.rb") }
21
+ mkdir_p "rake"
22
+ File.symlink(rake_path, "rake/lib")
23
+ end
24
+
25
+ desc "Generate RDoc documentation in rdoc/"
26
+ RDoc::Task.new :rdoc do |rdoc|
27
+ rdoc.rdoc_dir = 'rdoc'
28
+ rdoc.title = spec.name
29
+ rdoc.options = spec.rdoc_options.clone
30
+ rdoc.rdoc_files.include('lib/**/*.rb')
31
+ rdoc.rdoc_files.include spec.extra_rdoc_files
32
+
33
+ # include rake source for better inheritance rdoc
34
+ rdoc.rdoc_files.include('rake/lib/**.rb')
35
+ end
36
+ task :rdoc => ["rake/lib"]
37
+
38
+ if `pygmentize -V`.empty?
39
+ puts "Buildr uses the Pygments python library. You can install it by running 'sudo easy_install Pygments'"
40
+ end
41
+
42
+
43
+ task :clobber do
44
+ rm_rf 'rdoc'
45
+ end
data/rakelib/doc.rake~ ADDED
@@ -0,0 +1,121 @@
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
+ gem 'rdoc'
17
+ require 'rdoc/task'
18
+ desc "Creates a symlink to rake's lib directory to support combined rdoc generation"
19
+ file "rake/lib" do
20
+ rake_path = $LOAD_PATH.find { |p| File.exist? File.join(p, "rake.rb") }
21
+ mkdir_p "rake"
22
+ File.symlink(rake_path, "rake/lib")
23
+ end
24
+
25
+ desc "Generate RDoc documentation in rdoc/"
26
+ RDoc::Task.new :rdoc do |rdoc|
27
+ rdoc.rdoc_dir = 'rdoc'
28
+ rdoc.title = spec.name
29
+ rdoc.options = spec.rdoc_options.clone
30
+ rdoc.rdoc_files.include('lib/**/*.rb')
31
+ rdoc.rdoc_files.include spec.extra_rdoc_files
32
+
33
+ # include rake source for better inheritance rdoc
34
+ rdoc.rdoc_files.include('rake/lib/**.rb')
35
+ end
36
+ task :rdoc => ["rake/lib"]
37
+
38
+ begin
39
+ require 'jekylltask'
40
+ module TocFilter
41
+ def toc(input)
42
+ output = "<ol class=\"toc\">"
43
+ input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).each do |entry|
44
+ id = (entry[1][/^id=(['"])(.*)\1$/, 2] rescue nil)
45
+ title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
46
+ if id
47
+ output << %{<li><a href="##{id}">#{title}</a></li>}
48
+ else
49
+ output << %{<li>#{title}</li>}
50
+ end
51
+ end
52
+ output << "</ol>"
53
+ output
54
+ end
55
+ end
56
+ Liquid::Template.register_filter(TocFilter)
57
+
58
+ desc "Generate Buildr documentation in _site/"
59
+ JekyllTask.new :jekyll do |task|
60
+ task.source = 'doc'
61
+ task.target = '_site'
62
+ end
63
+
64
+ rescue LoadError
65
+ puts "Buildr uses the jekyll gem to generate the Web site. You can install it by running bundler"
66
+ end
67
+
68
+ if `pygmentize -V`.empty?
69
+ puts "Buildr uses the Pygments python library. You can install it by running 'sudo easy_install Pygments'"
70
+ end
71
+
72
+ desc "Generate Buildr documentation as buildr.pdf"
73
+ file 'buildr.pdf'=>'_site' do |task|
74
+ pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map { |f| "_site/#{f}" }
75
+ sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}", '_site/preface.html', *pages
76
+ end
77
+
78
+ desc "Build a copy of the Web site in the ./_site"
79
+ task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr.pdf'] do
80
+ cp_r 'rdoc', '_site'
81
+ fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/lib/buildr_rb.html')
82
+ cp '_reports/specs.html', '_site'
83
+ cp_r '_reports/coverage', '_site'
84
+ fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
85
+ cp 'CHANGELOG', '_site'
86
+ open("_site/.htaccess", "w") do |htaccess|
87
+ htaccess << %Q{
88
+ <FilesMatch "CHANGELOG">
89
+ ForceType 'text/plain; charset=UTF-8'
90
+ </FilesMatch>
91
+ }
92
+ end
93
+ cp 'buildr.pdf', '_site'
94
+ fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
95
+ puts 'OK'
96
+ end
97
+
98
+ # Publish prerequisites to Web site.
99
+ task 'publish'=>:site do
100
+ target = "people.apache.org:/www/#{spec.name}.apache.org/"
101
+ puts "Uploading new site to #{target} ..."
102
+ sh 'rsync', '--progress', '--recursive', '--delete', '_site/', target
103
+ sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
104
+ puts "Done"
105
+ end
106
+
107
+ # Update HTML + PDF documentation (but not entire site; no specs, coverage, etc.)
108
+ task 'publish-doc' => ['buildr.pdf', '_site'] do
109
+ cp 'buildr.pdf', '_site'
110
+ target = "people.apache.org:/www/#{spec.name}.apache.org/"
111
+ puts "Uploading new site to #{target} ..."
112
+ sh 'rsync', '--progress', '--recursive', '_site/', target # Note: no --delete
113
+ sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
114
+ puts "Done"
115
+ end
116
+
117
+ task :clobber do
118
+ rm_rf '_site'
119
+ rm_f 'buildr.pdf'
120
+ rm_f 'prince_errors.log'
121
+ end
@@ -0,0 +1,39 @@
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
+ namespace :metrics do
17
+ desc 'run Saikuro reports'
18
+ task :saikuro do
19
+ gem 'atoulme-Saikuro'
20
+ require 'saikuro'
21
+ output_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "_reports", "saikuro"))
22
+ base_dir = Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), "..")))
23
+ rb_files = ["lib", "addon"].collect { |folder|
24
+ FileList[File.expand_path(File.join(File.dirname(__FILE__), "..", folder, "**", "*.rb"))]
25
+ }.flatten.collect {|path|
26
+ Pathname.new(path).relative_path_from(base_dir).to_s
27
+ }
28
+ SaikuroRunner.new.run(rb_files, output_dir)
29
+ end
30
+
31
+ desc 'generate ccn treemap'
32
+ task :ccn_treemap do
33
+ require 'saikuro_treemap'
34
+ SaikuroTreemap.generate_treemap :code_dirs => ['lib', 'addon'], :output_file => "_reports/saikuro_treemap.html"
35
+ end
36
+ end
37
+
38
+ desc 'Run all metrics tools'
39
+ task :metrics => ["metrics:saikuro", "metrics:ccn_treemap"]
@@ -0,0 +1,48 @@
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 'rubygems/package_task'
18
+
19
+
20
+ package = Gem::PackageTask.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_spec.file_name}"] do |task|
27
+ print "Installing #{spec.name} ... "
28
+ args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{package.package_dir}/#{package.gem_spec.file_name}"
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
+ # We also need the other packages (JRuby if building on Ruby, and vice versa)
45
+ # Must call new with block, even if block does nothing, otherwise bad things happen.
46
+ @specs.values.each do |s|
47
+ Gem::PackageTask.new(s) { |task| }
48
+ end
@@ -0,0 +1,63 @@
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 'rubygems/package_task'
18
+
19
+
20
+ package = Gem::PackageTask.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_spec.file_name}"] do |task|
27
+ print "Installing #{spec.name} ... "
28
+ args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{package.package_dir}/#{package.gem_spec.file_name}"
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
+ # We also need the other packages (JRuby if building on Ruby, and vice versa)
45
+ # Must call new with block, even if block does nothing, otherwise bad things happen.
46
+ @specs.values.each do |s|
47
+ Gem::PackageTask.new(s) { |task| }
48
+ end
49
+
50
+
51
+ desc "Upload snapshot packages over to people.apache.org"
52
+ task :snapshot=>[:package] do
53
+ rm_rf '_snapshot' # Always start with empty directory
54
+ puts "Copying existing gems from Apache"
55
+ sh 'rsync', '--progress', '--recursive', 'people.apache.org:public_html/buildr/snapshot/', '_snapshot/'
56
+ puts "Copying new gems over"
57
+ cp FileList['pkg/{*.gem,*.tgz,*.zip}'], '_snapshot/gems'
58
+ puts "Generating gem index ..."
59
+ sh 'gem', 'generate_index', '--directory', '_snapshot'
60
+ puts "Copying gem and index back to Apache"
61
+ sh 'rsync', '--progress', '--recursive', '_snapshot/', 'people.apache.org:public_html/buildr/snapshot/'
62
+ end
63
+ task(:clobber) { rm_rf '_snapshot' }