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/03/29 01:14:48 UTC
svn commit: r642447 - in /incubator/buildr/trunk: Rakefile buildfile
lib/buildr.rb rakelib/doc.rake rakelib/package.rake rakelib/rspec.rake
Author: assaf
Date: Fri Mar 28 17:14:45 2008
New Revision: 642447
URL: http://svn.apache.org/viewvc?rev=642447&view=rev
Log:
Added which method to emulate which on Windows
Modified:
incubator/buildr/trunk/Rakefile
incubator/buildr/trunk/buildfile
incubator/buildr/trunk/lib/buildr.rb
incubator/buildr/trunk/rakelib/doc.rake
incubator/buildr/trunk/rakelib/package.rake
incubator/buildr/trunk/rakelib/rspec.rake
Modified: incubator/buildr/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/Rakefile?rev=642447&r1=642446&r2=642447&view=diff
==============================================================================
--- incubator/buildr/trunk/Rakefile (original)
+++ incubator/buildr/trunk/Rakefile Fri Mar 28 17:14:45 2008
@@ -58,9 +58,24 @@
$license_excluded = ['lib/core/progressbar.rb', 'spec/spec.opts', 'doc/css/syntax.css', '.textile', '.haml']
+# Finds and returns path to executable. Consults PATH environment variable.
+# Returns nil if executable not found.
+def which(name)
+ if Gem.win_platform?
+ path = ENV['PATH'].split(File::PATH_SEPARATOR).map { |path| path.gsub('\\', '/') }.map { |path| "#{path}/#{name}.{exe,bat,com}" }
+ else
+ path = ENV['PATH'].split(File::PATH_SEPARATOR).map { |path| "#{path}/#{name}" }
+ end
+ FileList[path].existing.first
+end
+
+# Runs Ruby with these command line arguments. The last argument may be a hash,
+# supporting the following keys:
+# :script -- Runs the specified script (e.g., :script=>'gem')
+# :sudo -- Run as sudo on operating systems that require it.
+# :verbose -- Override Rake's verbose flag.
def ruby(*args)
options = Hash === args.last ? args.pop : {}
- #options[:verbose] ||= false
cmd = []
cmd << 'sudo' if options.delete(:sudo) && !Gem.win_platform?
cmd << Config::CONFIG['ruby_install_name']
@@ -68,6 +83,13 @@
sh *cmd.push(*args.flatten).push(options)
end
+
+begin
+ require 'highline/import'
+rescue LoadError
+ puts 'HighLine required, please run rake setup first'
+end
+
# Setup environment for running this Rakefile (RSpec, Docter, etc).
desc "If you're building from sources, run this task one to setup the necessary dependencies."
task 'setup' do
@@ -79,16 +101,6 @@
end
end
-
-begin
- require 'highline/import'
-rescue LoadError
- puts 'HighLine required, please run rake setup first'
-end
-
-
-desc 'Clean up all temporary directories used for running tests, creating documentation, packaging, etc.'
-task 'clobber'
namespace 'release' do
Modified: incubator/buildr/trunk/buildfile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/buildfile?rev=642447&r1=642446&r2=642447&view=diff
==============================================================================
--- incubator/buildr/trunk/buildfile (original)
+++ incubator/buildr/trunk/buildfile Fri Mar 28 17:14:45 2008
@@ -32,7 +32,6 @@
# Legals included in source code and show in RDoc.
legal = 'LICENSE', 'DISCLAIMER', 'NOTICE'
package(:gem).include(legal).path('lib').include('lib/buildr')
- p package(:gem)
package(:gem).spec do |spec|
spec.author = 'Apache Buildr'
spec.email = 'buildr-user@incubator.apache.org'
Modified: incubator/buildr/trunk/lib/buildr.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr.rb?rev=642447&r1=642446&r2=642447&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr.rb (original)
+++ incubator/buildr/trunk/lib/buildr.rb Fri Mar 28 17:14:45 2008
@@ -14,6 +14,7 @@
# the License.
+$KCODE = 'utf8'
# in order to work around a bug in jruby (1.0.1 and trunk as of oct11, 2007)
# needle and net/ssh need to be loaded before -anything- else. please see
# http://jira.codehaus.org/browse/JRUBY-1188 for more info.
Modified: incubator/buildr/trunk/rakelib/doc.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/doc.rake?rev=642447&r1=642446&r2=642447&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/doc.rake (original)
+++ incubator/buildr/trunk/rakelib/doc.rake Fri Mar 28 17:14:45 2008
@@ -75,7 +75,7 @@
end
-if `prince --version` && $?.exitstatus == 0
+if which('prince')
Docter::Rake.generate 'print',
Docter.collection($spec.name).using('doc/print.toc.yaml').include('doc/pages', 'LICENSE'),
Modified: incubator/buildr/trunk/rakelib/package.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/package.rake?rev=642447&r1=642446&r2=642447&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/package.rake (original)
+++ incubator/buildr/trunk/rakelib/package.rake Fri Mar 28 17:14:45 2008
@@ -15,7 +15,10 @@
require 'rake/gempackagetask'
-require 'yaml'
+
+
+desc 'Clean up all temporary directories used for running tests, creating documentation, packaging, etc.'
+task 'clobber'
desc 'Compile Java libraries used by Buildr'
task 'compile' do
Modified: incubator/buildr/trunk/rakelib/rspec.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/rspec.rake?rev=642447&r1=642446&r2=642447&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/rspec.rake (original)
+++ incubator/buildr/trunk/rakelib/rspec.rake Fri Mar 28 17:14:45 2008
@@ -76,9 +76,9 @@
# Full test suite depends on having JRuby, Scala and Groovy installed.
task 'check' do
say 'Checking that we have JRuby, Scala and Groovy available ... '
- fail 'Full testing requires JRuby!' unless `jruby --version` && $?.exitstatus == 0
- fail 'Full testing requires Scala!' unless `scala --version` && $?.exitstatus == 0
- fail 'Full testing requires Groovy!' unless `groovy --version` && $?.exitstatus == 0
+ fail 'Full testing requires JRuby!' unless which('jruby')
+ fail 'Full testing requires Scala!' unless which('scala')
+ fail 'Full testing requires Groovy!' unless which('groovy')
say 'OK'
end