You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/01/18 21:53:52 UTC
svn commit: r613264 - in /incubator/buildr/trunk: Rakefile
doc/pages/download.textile lib/java/ant.rb lib/java/artifact.rb
Author: assaf
Date: Fri Jan 18 12:53:50 2008
New Revision: 613264
URL: http://svn.apache.org/viewvc?rev=613264&view=rev
Log:
rake install now works with JRuby, documentation also covers installation for JRuby
Modified:
incubator/buildr/trunk/Rakefile
incubator/buildr/trunk/doc/pages/download.textile
incubator/buildr/trunk/lib/java/ant.rb
incubator/buildr/trunk/lib/java/artifact.rb
Modified: incubator/buildr/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/Rakefile?rev=613264&r1=613263&r2=613264&view=diff
==============================================================================
--- incubator/buildr/trunk/Rakefile (original)
+++ incubator/buildr/trunk/Rakefile Fri Jan 18 12:53:50 2008
@@ -41,29 +41,45 @@
spec.add_dependency 'archive-tar-minitar', '~> 0.5'
spec.platform = platform
-
- yield spec if block_given?
+ spec.add_dependency 'rjb', '~> 1.1' unless platform == 'java'
end
end
-spec = specify(Gem::Platform::RUBY) { |spec| spec.add_dependency 'rjb', '~> 1.1' }
+ruby_spec = specify(Gem::Platform::RUBY)
jruby_spec = specify('java')
-package = Rake::GemPackageTask.new(spec) do |pkg|
+ruby_package = Rake::GemPackageTask.new(ruby_spec) do |pkg|
pkg.need_tar = true
pkg.need_zip = true
end
-jruby_package = Rake::GemPackageTask.new(jruby_spec)
+jruby_package = Rake::GemPackageTask.new(jruby_spec) do |pkg|
+ pkg.need_tar = false
+ pkg.need_zip = false
+end
desc 'Install the package locally'
task :install=>:package do |task|
- install = RUBY_PLATFORM == 'java' ? jruby_package : package
- system 'gem', 'install', File.expand_path(install.gem_file, install.package_dir)
+ if RUBY_PLATFORM =~ /java/
+ cmd = %w(jruby -S gem install)
+ pkg = jruby_package
+ else
+ cmd = %w(gem install)
+ pkg = ruby_package
+ end
+ cmd << File.expand_path(pkg.gem_file, pkg.package_dir)
+ system *cmd
end
desc 'Uninstall previously installed packaged'
task :uninstall do |task|
- install = RUBY_PLATFORM == 'java' ? jruby_package : package
- system 'gem', 'uninstall', install.name, '-v', install.version.to_s
+ if RUBY_PLATFORM =~ /java/
+ cmd = %w(jruby -S gem uninstall)
+ pkg = jruby_package
+ else
+ cmd = %w(gem uninstall)
+ pkg = ruby_package
+ end
+ cmd << File.expand_path(pkg.gem_file, pkg.package_dir)
+ system *cmd
end
@@ -89,6 +105,10 @@
task.rcov_dir = 'html/coverage'
end
+task 'spec:jruby' do
+ system 'jruby -S rake spec'
+end
+
# Documentation.
begin
@@ -101,10 +121,10 @@
desc 'Generate RDoc documentation'
rdoc = Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'html/rdoc'
- rdoc.title = spec.name
- rdoc.options = spec.rdoc_options
+ rdoc.title = ruby_spec.name
+ rdoc.options = ruby_spec.rdoc_options
rdoc.rdoc_files.include('lib/**/*.rb')
- rdoc.rdoc_files.include spec.extra_rdoc_files
+ rdoc.rdoc_files.include ruby_spec.extra_rdoc_files
end
web_docs = {
@@ -156,15 +176,15 @@
task :tag do |task|
cur_url = `svn info`.scan(/URL: (.*)/)[0][0]
- new_url = cur_url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{spec.version.to_s}")
- system 'svn', 'copy', cur_url, new_url, '-m', "Release #{spec.version.to_s}"
+ new_url = cur_url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{ruby_spec.version.to_s}")
+ system 'svn', 'copy', cur_url, new_url, '-m', "Release #{ruby_spec.version.to_s}"
end
end
namespace :upload do
task :docs=>'rake:docs' do |task|
- sh %{rsync -r --del --progress html/* people.apache.org:/www/incubator.apache.org/#{spec.rubyforge_project.downcase}/}
+ sh %{rsync -r --del --progress html/* people.apache.org:/www/incubator.apache.org/#{ruby_spec.rubyforge_project.downcase}/}
end
task :packages=>['rake:docs', 'rake:package'] do |task|
@@ -174,21 +194,21 @@
pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
changelog = File.read(__FILE__.pathmap('%d/CHANGELOG'))
changes = changelog.scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
- current = changes[spec.version.to_s]
- if !current && spec.version.to_s =~ /\.0$/
- current = changes[spec.version.to_s.split('.')[0..-2].join('.')]
+ current = changes[ruby_spec.version.to_s]
+ if !current && ruby_spec.version.to_s =~ /\.0$/
+ current = changes[ruby_spec.version.to_s.split('.')[0..-2].join('.')]
end
- fail "No changeset found for version #{spec.version}" unless current
+ fail "No changeset found for version #{ruby_spec.version}" unless current
- puts "Uploading #{spec.name} #{spec.version}"
+ puts "Uploading #{ruby_spec.name} #{ruby_spec.version}"
files = Dir.glob('pkg/*.{gem,tgz,zip}')
rubyforge = RubyForge.new
rubyforge.login
File.open('.changes', 'w'){|f| f.write(current)}
rubyforge.userconfig.merge!('release_changes' => '.changes', 'preformatted' => true)
- rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version, *files
+ rubyforge.add_release ruby_spec.rubyforge_project.downcase, ruby_spec.name.downcase, ruby_spec.version, *files
rm '.changes'
- puts "Release #{spec.version} uploaded"
+ puts "Release #{ruby_spec.version} uploaded"
end
end
@@ -197,7 +217,7 @@
require 'highline'
require 'highline/import'
- puts "This version: #{spec.version}"
+ puts "This version: #{ruby_spec.version}"
puts
puts "Top 4 lines form CHANGELOG:'
puts File.readlines('CHANGELOG')[0..3].map { |l| " #{l}" }
@@ -207,8 +227,7 @@
end
task :post do
- # Practical example of functional read but not comprehend code:
- next_version = spec.version.to_ints.zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
+ next_version = ruby_spec.version.to_ints.zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
puts "Updating lib/buildr.rb to next version number: #{next_version}"
buildr_rb = File.read(__FILE__.pathmap('%d/lib/buildr.rb')).
sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
@@ -218,7 +237,7 @@
File.open(__FILE__.pathmap('%d/CHANGELOG'), 'w') { |file| file.write "#{next_version} (Pending)\n\n#{changelog}" }
end
- task :meat=>['clobber', 'svn:clean?', 'spec:report', 'upload:packages', 'upload:docs', 'svn:tag']
+ task :meat=>['clobber', 'svn:clean?', 'spec:jruby', 'spec:report', 'upload:packages', 'upload:docs', 'svn:tag']
end
desc 'Upload release to RubyForge including docs, tag SVN'
@@ -227,9 +246,9 @@
# Misc, may not survive so don't rely on these.
task :report do |task|
- puts "#{spec.name} #{spec.version}"
- puts spec.summary
- sources = (spec.files + FileList['spec/**/*.rb']).reject { |f| File.directory?(f) }
+ puts "#{ruby_spec.name} #{ruby_spec.version}"
+ puts ruby_spec.summary
+ sources = (ruby_spec.files + FileList['ruby_spec/**/*.rb']).reject { |f| File.directory?(f) }
sources.inject({}) do |lists, file|
File.readlines(file).each_with_index do |line, i|
if line =~ /(TODO|FIXME|NOTE):\s*(.*)/
Modified: incubator/buildr/trunk/doc/pages/download.textile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/pages/download.textile?rev=613264&r1=613263&r2=613264&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/pages/download.textile (original)
+++ incubator/buildr/trunk/doc/pages/download.textile Fri Jan 18 12:53:50 2008
@@ -1,38 +1,36 @@
h1. Download and Installation
-The current release of Buildr works with Ruby 1.8. We do not yet support Ruby 1.9 or JRuby.
+The current release of Buildr works with Ruby 1.8 and JRuby 1.1RC1. We do not yet support Ruby 1.9.
+
+h2. JRuby (Java)
-h2. Windows
+If you don't already have JRuby 1.1RC1 or later installed, you can download it
+from the "JRuby site":http://dist.codehaus.org/jruby/.
-If you don't already have Ruby installed, now is the time to do it. The
-easiest way to install Ruby is using the "one-click
-installer":http://rubyinstaller.rubyforge.org/.
-
-Before installing Buildr, please set the @JAVA_HOME@ environment variable to
-point to your JDK distribution. Next, use Ruby Gem to install Buildr:
+After uncompressing JRuby, make sure you set the @JAVA_HOME@ environment
+variable to point to your JDK distribution, and @JRUBY_HOME@ to point to the
+directory containing the uncompressed JRuby installation.
-{{{!sh
-> gem install buildr
-}}}
-
-Buildr uses several libraries that include native extensions. During
-installation it will ask you to pick a platform for these libraries. By
-selecting @mswin32@ it will download and install pre-compiled DLLs for these
-extensions.
+Finally update your @PATH@ to include both JRuby and Java executables, so you
+can run JRuby with the command @jruby@.
-To upgrade to a new version of Buildr:
+For Windows:
{{{!sh
-> gem update buildr
+> set PATH=%JRUBY_HOME%/bin;%JAVA_HOME%/bin;%PATH
+> jruby -S gem install buildr
}}}
-To install a specific version of Buildr:
+And for Unix:
{{{!sh
-> gem install buildr -v 1.3.0
+$ export PATH=$JRUBY_HOME/bin:$JAVA_HOME/bin:$PATH
+$ jruby -S gem install buildr
}}}
+Once installed, you will find the @buildr@ exectuable in the @JRUBY_HOME/bin@ directory.
+
h2. Linux, BSD, Cygwin
@@ -103,6 +101,37 @@
{{{!sh
$ sudo gem install buildr -v 1.3.0
+}}}
+
+
+h2. Windows
+
+If you don't already have Ruby installed, now is the time to do it. The
+easiest way to install Ruby is using the "one-click
+installer":http://rubyinstaller.rubyforge.org/.
+
+Before installing Buildr, please set the @JAVA_HOME@ environment variable to
+point to your JDK distribution. Next, use Ruby Gem to install Buildr:
+
+{{{!sh
+> gem install buildr
+}}}
+
+Buildr uses several libraries that include native extensions. During
+installation it will ask you to pick a platform for these libraries. By
+selecting @mswin32@ it will download and install pre-compiled DLLs for these
+extensions.
+
+To upgrade to a new version of Buildr:
+
+{{{!sh
+> gem update buildr
+}}}
+
+To install a specific version of Buildr:
+
+{{{!sh
+> gem install buildr -v 1.3.0
}}}
Modified: incubator/buildr/trunk/lib/java/ant.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/ant.rb?rev=613264&r1=613263&r2=613264&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/ant.rb (original)
+++ incubator/buildr/trunk/lib/java/ant.rb Fri Jan 18 12:53:50 2008
@@ -47,7 +47,7 @@
task('help') do
puts
- puts "Using Java #{Java.version}, Ant #{Ant::VERSION}."
+ puts "Using Java #{ENV_JAVA['java.version']}, Ant #{Ant::VERSION}."
end
end
Modified: incubator/buildr/trunk/lib/java/artifact.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/artifact.rb?rev=613264&r1=613263&r2=613264&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/artifact.rb (original)
+++ incubator/buildr/trunk/lib/java/artifact.rb Fri Jan 18 12:53:50 2008
@@ -213,7 +213,7 @@
unless rest.empty?
# Optional classifier comes before version.
classifier, version = version, rest.shift
- fail "Expecting <project:id:type:version> or <project:id:type:classifier:version>, found <#{spec}>" unless rest.empty?
+ fail "Expecting <group:id:type:version> or <group:id:type:classifier:version>, found <#{spec}>" unless rest.empty?
end
to_hash :group=>group, :id=>id, :type=>type, :version=>version, :classifier=>classifier
else