Author: assaf
Date: Mon Apr 7 23:20:45 2008
New Revision: 645772
URL: http://svn.apache.org/viewvc?rev=645772&view=rev
Log:
Mostly changed Rake.application to Buildr.application.
Modified:
incubator/buildr/trunk/bin/buildr
incubator/buildr/trunk/lib/buildr/core/application.rb
incubator/buildr/trunk/lib/buildr/core/build.rb
incubator/buildr/trunk/lib/buildr/core/checks.rb
incubator/buildr/trunk/lib/buildr/core/filter.rb
incubator/buildr/trunk/lib/buildr/core/generate.rb
incubator/buildr/trunk/lib/buildr/core/help.rb
incubator/buildr/trunk/lib/buildr/core/package.rb
incubator/buildr/trunk/lib/buildr/core/project.rb
incubator/buildr/trunk/lib/buildr/core/transports.rb
incubator/buildr/trunk/lib/buildr/core/util.rb
incubator/buildr/trunk/lib/buildr/ide/eclipse.rb
incubator/buildr/trunk/lib/buildr/ide/idea.rb
incubator/buildr/trunk/lib/buildr/ide/idea7x.rb
incubator/buildr/trunk/lib/buildr/java/ant.rb
incubator/buildr/trunk/lib/buildr/java/artifact.rb
incubator/buildr/trunk/lib/buildr/java/artifact_namespace.rb
incubator/buildr/trunk/lib/buildr/java/commands.rb
incubator/buildr/trunk/lib/buildr/java/compilers.rb
incubator/buildr/trunk/lib/buildr/java/groovyc.rb
incubator/buildr/trunk/lib/buildr/java/packaging.rb
incubator/buildr/trunk/lib/buildr/java/pom.rb
incubator/buildr/trunk/lib/buildr/tasks/concat.rb
incubator/buildr/trunk/lib/buildr/tasks/zip.rb
incubator/buildr/trunk/spec/addon_spec.rb
incubator/buildr/trunk/spec/application_spec.rb
incubator/buildr/trunk/spec/project_spec.rb
incubator/buildr/trunk/spec/sandbox.rb
Modified: incubator/buildr/trunk/bin/buildr
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/bin/buildr?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/bin/buildr (original)
+++ incubator/buildr/trunk/bin/buildr Mon Apr 7 23:20:45 2008
@@ -18,4 +18,4 @@
require 'rubygems'
require 'buildr'
-Rake.application.run
+Buildr.application.run
Modified: incubator/buildr/trunk/lib/buildr/core/application.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/application.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/application.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/application.rb Mon Apr 7 23:20:45
2008
@@ -39,6 +39,7 @@
require 'rake'
require 'rubygems/source_info_cache'
require 'buildr/core/application_cli'
+require 'buildr/core/util'
# Gem::user_home is nice, but ENV['HOME'] lets you override from the
environment.
@@ -195,7 +196,7 @@
# FileList[spec.require_paths.map { |path|
File.expand_path("#{path}/*.rb", spec.full_gem_path) }].
# map { |path| File.basename(path) }.each { |file| require file }
# FileList[File.expand_path('tasks/*.rake', spec.full_gem_path)].each
do |file|
- # Rake.application.add_import file
+ # Buildr.application.add_import file
# end
end
end
@@ -264,6 +265,16 @@
end
end
+ # Not for external consumption.
+ def switch_to_namespace(names) #:nodoc:
+ current, @scope = @scope, names
+ begin
+ yield
+ ensure
+ @scope = current
+ end
+ end
+
end
@@ -282,11 +293,17 @@
end
# Returns the Buildr::Application object.
- attr_accessor :application
+ def application
+ Rake.application
+ end
+
+ def application=(app)
+ Rake.application = app
+ end
end
- Buildr.application = Rake.application = Buildr::Application.new
+ Buildr.application = Buildr::Application.new
end
@@ -305,6 +322,34 @@
alias :warn_without_color :warn
def warn(message)
warn_without_color $terminal.color(message.to_s, :red)
+ end
+ end
+end
+
+
+module Rake #:nodoc
+ class Task #:nodoc:
+ def invoke(*args)
+ task_args = TaskArguments.new(arg_names, args)
+ invoke_with_call_chain(task_args, Thread.current[:rake_chain] ||
InvocationChain::EMPTY)
+ end
+
+ def invoke_with_call_chain(task_args, invocation_chain)
+ new_chain = InvocationChain.append(self, invocation_chain)
+ @lock.synchronize do
+ if application.options.trace
+ puts "** Invoke #{name} #{format_trace_flags}"
+ end
+ return if @already_invoked
+ @already_invoked = true
+ invoke_prerequisites(task_args, new_chain)
+ begin
+ old_chain, Thread.current[:rake_chain] =
Thread.current[:rake_chain], new_chain
+ execute(task_args) if needed?
+ ensure
+ Thread.current[:rake_chain] = nil
+ end
+ end
end
end
end
Modified: incubator/buildr/trunk/lib/buildr/core/build.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/build.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/build.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/build.rb Mon Apr 7 23:20:45 2008
@@ -170,7 +170,7 @@
# NEXT_VERSION = 1.2.1
# and the method will return 1.2.0.
def with_next_version()
- new_filename = Rake.application.rakefile + '.next'
+ new_filename = Buildr.application.buildfile + '.next'
modified = change_version do |this_version, next_version|
one_after = next_version.split('.')
one_after[-1] = one_after[-1].to_i + 1
@@ -179,11 +179,11 @@
File.open(new_filename, 'w') { |file| file.write modified }
begin
yield new_filename
- mv new_filename, Rake.application.rakefile
+ mv new_filename, Buildr.application.buildfile
ensure
rm new_filename rescue nil
end
- File.read(Rake.application.rakefile).scan(THIS_VERSION_PATTERN)[0][1]
+
File.read(Buildr.application.buildfile).scan(THIS_VERSION_PATTERN)[0][1]
end
# :call-seq:
@@ -195,10 +195,10 @@
# This method yields to the block with the current (this) and next
version numbers and expects
# an array with the new this and next version numbers.
def change_version()
- rakefile = File.read(Rake.application.rakefile)
- this_version = rakefile.scan(THIS_VERSION_PATTERN)[0][1] or
+ buildfile = File.read(Buildr.application.buildfile)
+ this_version = buildfile.scan(THIS_VERSION_PATTERN)[0][1] or
fail "Looking for THIS_VERSION = \"...\" in your Buildfile, none
found"
- next_version = rakefile.scan(NEXT_VERSION_PATTERN)[0][1] or
+ next_version = buildfile.scan(NEXT_VERSION_PATTERN)[0][1] or
fail "Looking for NEXT_VERSION = \"...\" in your Buildfile, none
found"
this_version, next_version = yield(this_version, next_version)
if verbose
@@ -206,7 +206,7 @@
puts " This: #{this_version}"
puts " Next: #{next_version}"
end
- rakefile.gsub(THIS_VERSION_PATTERN) { |ver| ver.sub(/(["']).*\1/,
%Q{"#{this_version}"}) }.
+ buildfile.gsub(THIS_VERSION_PATTERN) { |ver| ver.sub(/(["']).*\1/,
%Q{"#{this_version}"}) }.
gsub(NEXT_VERSION_PATTERN) { |ver| ver.sub(/(["']).*\1/,
%Q{"#{next_version}"}) }
end
@@ -225,10 +225,10 @@
#
# Last, we commit what we currently have in the working copy.
def commit(version)
- rakefile = File.read(Rake.application.rakefile).
+ buildfile = File.read(Buildr.application.buildfile).
gsub(THIS_VERSION_PATTERN) { |ver| ver.sub(/(["']).*\1/,
%Q{"#{version}"}) }
- File.open(Rake.application.rakefile, 'w') { |file| file.write rakefile
}
- svn 'commit', '-m', "Changed version number to #{version}",
Rake.application.rakefile
+ File.open(Buildr.application.buildfile, 'w') { |file| file.write
buildfile }
+ svn 'commit', '-m', "Changed version number to #{version}",
Buildr.application.buildfile
end
# :call-seq:
Modified: incubator/buildr/trunk/lib/buildr/core/checks.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/checks.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/checks.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/checks.rb Mon Apr 7 23:20:45 2008
@@ -130,7 +130,7 @@
# Run the expectation. We only print the expectation name when tracing
(to know they all ran),
# or when we get a failure.
begin
- puts description if Rake.application.options.trace
+ puts description if Buildr.application.options.trace
klass.new.instance_eval &@block
rescue Exception=>error
raise error.exception("#{description}\n#{error}").tap { |wrapped|
wrapped.set_backtrace(error.backtrace) }
@@ -151,7 +151,7 @@
passed
rescue Exception=>error
if verbose
- puts error.backtrace.detect { |line| line =~
/#{Rake.application.rakefile}/ } || ""
+ puts error.backtrace.detect { |line| line =~
/#{Buildr.application.buildfile}/ } || ""
puts error
end
false
Modified: incubator/buildr/trunk/lib/buildr/core/filter.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/filter.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/filter.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/filter.rb Mon Apr 7 23:20:45 2008
@@ -178,7 +178,7 @@
return false if copy_map.empty?
- verbose(Rake.application.options.trace || false) do
+ verbose(Buildr.application.options.trace || false) do
mkpath target.to_s
copy_map.each do |path, source|
dest = File.expand_path(path, target.to_s)
Modified: incubator/buildr/trunk/lib/buildr/core/generate.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/generate.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/generate.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/generate.rb Mon Apr 7 23:20:45 2008
@@ -31,7 +31,7 @@
end
if script
- buildfile =
File.expand_path(Rake.application.instance_variable_get(:@rakefiles).first)
+ buildfile =
File.expand_path(Buildr::Application::DEFAULT_BUILDFILES.first)
File.open(buildfile, "w") { |file| file.write script }
puts "Created #{buildfile}"
end
Modified: incubator/buildr/trunk/lib/buildr/core/help.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/help.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/help.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/help.rb Mon Apr 7 23:20:45 2008
@@ -55,7 +55,7 @@
task 'help' do
# Greeater.
- Rake.application.usage
+ Buildr.application.usage
puts
# Show only the top-level projects.
@@ -106,7 +106,7 @@
desc 'List all tasks available from this buildfile'
task 'tasks' do
- Rake.application.tasks.select(&:comment).reject { |task| Project === task
}.tap do |tasks|
+ Buildr.application.tasks.select(&:comment).reject { |task| Project ===
task }.tap do |tasks|
width = [tasks.map(&:name).map(&:size), 20].flatten.max
tasks.each do |task|
printf " %-#{width}s # %s\n", task.name, task.comment
Modified: incubator/buildr/trunk/lib/buildr/core/package.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/package.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/package.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/package.rb Mon Apr 7 23:20:45 2008
@@ -39,7 +39,7 @@
# which do not conflict with integration invoking the project's own
packaging (package=>
# integration=>foo:package is not circular, just confusing to debug.)
task 'package' do
- task('integration').invoke if Buildr.options.test &&
Rake.application.original_dir == Dir.pwd
+ task('integration').invoke if Buildr.options.test &&
Buildr.application.original_dir == Dir.pwd
end
end
Modified: incubator/buildr/trunk/lib/buildr/core/project.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/project.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/project.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/project.rb Mon Apr 7 23:20:45 2008
@@ -14,7 +14,7 @@
# the License.
-require 'buildr/core/common'
+require 'buildr/core/util'
module Buildr
@@ -195,7 +195,7 @@
# Make sure a sub-project is only defined within the parent project,
# to prevent silly mistakes that lead to inconsistencies (e.g.
# namespaces will be all out of whack).
- Rake.application.current_scope == name.split(':')[0...-1] or
+ Buildr.application.current_scope == name.split(':')[0...-1] or
raise "You can only define a sub project (#{name}) within the
definition of its parent project"
@projects ||= {}
@@ -331,13 +331,13 @@
end
def local_projects(dir = nil, &block) #:nodoc:
- dir = File.expand_path(dir || Rake.application.original_dir)
+ dir = File.expand_path(dir || Buildr.application.original_dir)
projects = Project.projects.select { |project| project.base_dir == dir
}
if projects.empty? && dir != Dir.pwd && File.dirname(dir) != dir
local_projects(File.dirname(dir), &block)
elsif block
if projects.empty?
- warn "No projects defined for directory
#{Rake.application.original_dir}" if verbose
+ warn "No projects defined for directory
#{Buildr.application.original_dir}" if verbose
else
projects.each { |project| block[project] }
end
@@ -355,7 +355,7 @@
namespace = task_name.split(':')
last_name = namespace.pop
namespace.pop
- Rake.application.lookup((namespace + [last_name]).join(':'), [])
unless namespace.empty?
+ Buildr.application.lookup((namespace + [last_name]).join(':'), [])
unless namespace.empty?
end
# :call-seq:
@@ -363,7 +363,7 @@
#
# Figure out project associated to this task and return it.
def project_from_task(task) #:nodoc:
- project = Rake.application.lookup('rake:' + task.to_s.gsub(/:[^:]*$/,
''))
+ project = Buildr.application.lookup('rake:' +
task.to_s.gsub(/:[^:]*$/, ''))
project if Project === project
end
@@ -477,7 +477,7 @@
# puts project('foo:bar').file('src').to_s
# => '/home/foo/bar/src'
def file(*args, &block)
- task_name, arg_names, deps = Rake.application.resolve_args(args)
+ task_name, arg_names, deps = Buildr.application.resolve_args(args)
task = Rake::FileTask.define_task(path_to(task_name))
task.set_arg_names(arg_names) unless arg_names.empty?
task.enhance Array(deps), &block
@@ -507,20 +507,15 @@
# As with Rake's task method, calling this method enhances the task with
the
# prerequisites and optional block.
def task(*args, &block)
- task_name, arg_names, deps = Rake.application.resolve_args(args)
+ task_name, arg_names, deps = Buildr.application.resolve_args(args)
if task_name =~ /^:/
- Rake.application.instance_eval do
- scope, @scope = @scope, []
- begin
- task = Rake::Task.define_task(task_name[1..-1])
- ensure
- @scope = scope
- end
+ Buildr.application.switch_to_namespace [] do
+ task = Rake::Task.define_task(task_name[1..-1])
end
- elsif Rake.application.current_scope == name.split(':')
+ elsif Buildr.application.current_scope == name.split(':')
task = Rake::Task.define_task(task_name)
else
- unless task = Rake.application.lookup(task_name, name.split(':'))
+ unless task = Buildr.application.lookup(task_name, name.split(':'))
raise "You cannot define a project task outside the project
definition, and no task #{name}:#{task_name} defined in the project"
end
end
@@ -534,7 +529,7 @@
# Define a recursive task. A recursive task executes itself and the same
task
# in all the sub-projects.
def recursive_task(*args, &block)
- task_name, arg_names, deps = Rake.application.resolve_args(args)
+ task_name, arg_names, deps = Buildr.application.resolve_args(args)
task = Buildr.options.parallel ? multitask(task_name) : task(task_name)
parent.task(task_name).enhance [task] if parent
task.set_arg_names(arg_names) unless arg_names.empty?
@@ -618,13 +613,8 @@
end
def execute(args) #:nodoc:
- begin
- # Reset the namespace, so all tasks are automatically defined in the
project's namespace.
- scope = Rake.application.current_scope
- Rake.application.instance_variable_set :@scope, name.split(':')
+ Buildr.application.switch_to_namespace name.split(':') do
super
- ensure
- Rake.application.instance_variable_set :@scope, scope
end
end
@@ -875,20 +865,20 @@
desc "Freezes the Buildfile so it always uses Buildr version
#{Buildr::VERSION}"
task 'freeze' do
puts "Freezing the Buildfile so it always uses Buildr version
#{Buildr::VERSION}"
- original = File.read(Rake.application.rakefile)
+ original = File.read(Buildr.application.buildfile)
if original =~ /gem\s*(["'])buildr\1/
modified = original.sub(/gem\s*(["'])buildr\1\s*,\s*(["']).*\2/, %{gem
"buildr", "#{Buildr::VERSION}"})
else
modified = %{gem "buildr", "#{Buildr::VERSION}"\n} + original
end
- File.open(Rake.application.rakefile, "w") { |file| file.write modified }
+ File.open(Buildr.application.buildfile, "w") { |file| file.write
modified }
end
desc 'Unfreezes the Buildfile to use the latest version of Buildr'
task 'unfreeze' do
puts 'Unfreezing the Buildfile to use the latest version of Buildr from
your Gems repository.'
- modified =
File.read(Rake.application.rakefile).sub(/^\s*gem\s*(["'])buildr\1.*\n/, "")
- File.open(Rake.application.rakefile, "w") { |file| file.write modified }
+ modified =
File.read(Buildr.application.buildfile).sub(/^\s*gem\s*(["'])buildr\1.*\n/, "")
+ File.open(Buildr.application.buildfile, "w") { |file| file.write
modified }
end
end
Modified: incubator/buildr/trunk/lib/buildr/core/transports.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/transports.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/transports.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/transports.rb Mon Apr 7 23:20:45
2008
@@ -299,7 +299,7 @@
end
http.use_ssl = true if self.instance_of? URI::HTTPS
- puts "Requesting #{self}" if Rake.application.options.trace
+ puts "Requesting #{self}" if Buildr.application.options.trace
request = Net::HTTP::Get.new(path.empty? ? '/' : path, headers)
request.basic_auth self.user, self.password if self.user
http.request request do |response|
@@ -307,11 +307,11 @@
#case response = http.request(request)
when Net::HTTPNotModified
# No modification, nothing to do.
- puts 'Not modified since last download' if
Rake.application.options.trace
+ puts 'Not modified since last download' if
Buildr.application.options.trace
return nil
when Net::HTTPRedirection
# Try to download from the new URI, handle relative redirects.
- puts "Redirected to #{response['Location']}" if
Rake.application.options.trace
+ puts "Redirected to #{response['Location']}" if
Buildr.application.options.trace
return (self + URI.parse(response['location'])).read(options, &block)
when Net::HTTPOK
puts "Downloading #{self}" if verbose
@@ -358,7 +358,7 @@
ssh_options = { :port=>port, :username=>user
}.merge(options[:ssh_options] || {})
ssh_options[:password] ||= SFTP.passwords[host]
begin
- puts "Connecting to #{host}" if Rake.application.options.trace
+ puts "Connecting to #{host}" if Buildr.application.options.trace
session = Net::SSH.start(host, ssh_options)
SFTP.passwords[host] = ssh_options[:password]
rescue Net::SSH::AuthenticationFailed=>ex
@@ -372,11 +372,11 @@
end
session.sftp.connect do |sftp|
- puts 'connected' if Rake.application.options.trace
+ puts 'connected' if Buildr.application.options.trace
# To create a path, we need to create all its parent. We use realpath
to determine if
# the path already exists, otherwise mkdir fails.
- puts "Creating path #{path}" if Rake.application.options.trace
+ puts "Creating path #{path}" if Buildr.application.options.trace
File.dirname(path).split('/').inject('') do |base, part|
combined = base + part
sftp.realpath combined rescue sftp.mkdir combined, {}
@@ -384,7 +384,7 @@
end
with_progress_bar options[:progress] && options[:size],
path.split('/'), options[:size] || 0 do |progress|
- puts "Uploading to #{path}" if Rake.application.options.trace
+ puts "Uploading to #{path}" if Buildr.application.options.trace
sftp.open_handle(path, 'w') do |handle|
# Writing in chunks gives us the benefit of a progress bar,
# but also require that we maintain a position in the file,
Modified: incubator/buildr/trunk/lib/buildr/core/util.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/util.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/util.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/util.rb Mon Apr 7 23:20:45 2008
@@ -49,11 +49,11 @@
cmd = []
ruby_bin = File.expand_path(Config::CONFIG['ruby_install_name'],
Config::CONFIG['bindir'])
if options.delete(:sudo) && !(win_os? || Process.uid ==
File.stat(ruby_bin).uid)
- cmd << 'sudo' << '-u' << '##{File.stat(ruby_bin).uid}'
+ cmd << 'sudo' << '-u' << "##{File.stat(ruby_bin).uid}"
end
cmd << ruby_bin
cmd << '-S' << options.delete(:command) if options[:command]
- Rake.application.send :sh, *cmd.push(*args.flatten).push(options) do
|ok, status|
+ sh *cmd.push(*args.flatten).push(options) do |ok, status|
ok or fail "Command failed with status (#{status ? status.exitstatus :
'unknown'}): [#{cmd.join(" ")}]"
end
end
@@ -217,32 +217,4 @@
}.join("\n")
end
-end
-
-
-module Rake #:nodoc
- class Task #:nodoc:
- def invoke(*args)
- task_args = TaskArguments.new(arg_names, args)
- invoke_with_call_chain(task_args, Thread.current[:rake_chain] ||
InvocationChain::EMPTY)
- end
-
- def invoke_with_call_chain(task_args, invocation_chain)
- new_chain = InvocationChain.append(self, invocation_chain)
- @lock.synchronize do
- if application.options.trace
- puts "** Invoke #{name} #{format_trace_flags}"
- end
- return if @already_invoked
- @already_invoked = true
- invoke_prerequisites(task_args, new_chain)
- begin
- old_chain, Thread.current[:rake_chain] =
Thread.current[:rake_chain], new_chain
- execute(task_args) if needed?
- ensure
- Thread.current[:rake_chain] = nil
- end
- end
- end
- end
end
Modified: incubator/buildr/trunk/lib/buildr/ide/eclipse.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/ide/eclipse.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/ide/eclipse.rb (original)
+++ incubator/buildr/trunk/lib/buildr/ide/eclipse.rb Mon Apr 7 23:20:45 2008
@@ -43,7 +43,7 @@
# after the Buildfile. So which don't know where Buildr shows up
exactly, ignore files that show
# in $LOADED_FEATURES that we cannot resolve.
sources = Buildr.build_files.map { |file| File.expand_path(file)
}.select { |file| File.exist?(file) }
- sources << File.expand_path(Rake.application.rakefile, root_path) if
Rake.application.rakefile
+ sources << File.expand_path(Buildr.application.buildfile, root_path) if
Buildr.application.buildfile
# Check if project has scala facet
scala = project.compile.language == :scala
Modified: incubator/buildr/trunk/lib/buildr/ide/idea.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/ide/idea.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/ide/idea.rb (original)
+++ incubator/buildr/trunk/lib/buildr/ide/idea.rb Mon Apr 7 23:20:45 2008
@@ -44,7 +44,7 @@
# after the Buildfile. So which don't know where Buildr shows up
exactly, ignore files that show
# in $LOADED_FEATURES that we cannot resolve.
sources = Buildr.build_files.map { |file| File.expand_path(file)
}.select { |file| File.exist?(file) }
- sources << File.expand_path(Rake.application.rakefile, root_path) if
Rake.application.rakefile
+ sources << File.expand_path(Buildr.application.buildfile, root_path) if
Buildr.application.buildfile
# Find a path relative to the project's root directory.
relative = lambda { |path| Util.relative_path(path.to_s,
project.path_to) }
Modified: incubator/buildr/trunk/lib/buildr/ide/idea7x.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/ide/idea7x.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/ide/idea7x.rb (original)
+++ incubator/buildr/trunk/lib/buildr/ide/idea7x.rb Mon Apr 7 23:20:45 2008
@@ -50,7 +50,7 @@
root_path = lambda { |p| f = lambda { |p| p.parent ? f[p.parent] :
p.base_dir }; f[p] }[project]
sources = Buildr.build_files.map { |file| File.expand_path(file)
}.select { |file| File.exist?(file) }
- sources << File.expand_path(Rake.application.rakefile, root_path) if
Rake.application.rakefile
+ sources << File.expand_path(Buildr.application.buildfile, root_path) if
Buildr.application.buildfile
# Find a path relative to the project's root directory.
relative = lambda { |path|
Util.relative_path(File.expand_path(path.to_s), project.path_to) }
Modified: incubator/buildr/trunk/lib/buildr/java/ant.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/ant.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/ant.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/ant.rb Mon Apr 7 23:20:45 2008
@@ -46,12 +46,12 @@
# end
def ant(name, &block)
options = { :name=>name, :basedir=>Dir.pwd, :declarative=>true }
- options.merge!(:logger=> Logger.new(STDOUT), :loglevel=> Logger::DEBUG)
if Rake.application.options.trace
+ options.merge!(:logger=> Logger.new(STDOUT), :loglevel=> Logger::DEBUG)
if Buildr.application.options.trace
Java.load
Antwrap::AntProject.new(options).tap do |project|
# Set Ant logging level to debug (--trace), info (default) or error
only (--quiet).
project.project.getBuildListeners().get(0).
- setMessageOutputLevel((Rake.application.options.trace && 4) ||
(verbose && 2) || 0)
+ setMessageOutputLevel((Buildr.application.options.trace && 4) ||
(verbose && 2) || 0)
yield project if block_given?
end
end
Modified: incubator/buildr/trunk/lib/buildr/java/artifact.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/artifact.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/artifact.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/artifact.rb Mon Apr 7 23:20:45 2008
@@ -116,7 +116,7 @@
invoke
installed = Buildr.repositories.locate(self)
unless installed == name # If not already in local repository.
- verbose(Rake.application.options.trace || false) do
+ verbose(Buildr.application.options.trace || false) do
mkpath File.dirname(installed)
cp name, installed
end
@@ -125,7 +125,7 @@
end
def uninstall
- verbose(Rake.application.options.trace || false) do
+ verbose(Buildr.application.options.trace || false) do
installed = Buildr.repositories.locate(self)
rm installed if File.exist?(installed)
pom.uninstall if pom && pom != self
@@ -346,7 +346,7 @@
# This method attempts to download the artifact from each repository in
the order in
# which they are returned from #remote, until successful. It always
downloads the POM first.
def download
- puts "Downloading #{to_spec}" if Rake.application.options.trace
+ puts "Downloading #{to_spec}" if Buildr.application.options.trace
remote = Buildr.repositories.remote.map { |repo_url| URI === repo_url ?
repo_url : URI.parse(repo_url) }
remote = remote.each { |repo_url| repo_url.path += '/' unless
repo_url.path[-1] == '/' }
fail 'No remote repositories defined!' if remote.empty?
@@ -359,7 +359,7 @@
false
rescue Exception=>error
puts error if verbose
- puts error.backtrace.join("\n") if Rake.application.options.trace
+ puts error.backtrace.join("\n") if Buildr.application.options.trace
false
end
end
Modified: incubator/buildr/trunk/lib/buildr/java/artifact_namespace.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/artifact_namespace.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/artifact_namespace.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/artifact_namespace.rb Mon Apr 7
23:20:45 2008
@@ -270,7 +270,7 @@
name = case task
when Project then task.name
when Rake::Task then task.scope.join(':')
- when nil then Rake.application.current_scope.join(':')
+ when nil then Buildr.application.current_scope.join(':')
end
end
name = name.to_s
Modified: incubator/buildr/trunk/lib/buildr/java/commands.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/commands.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/commands.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/commands.rb Mon Apr 7 23:20:45 2008
@@ -36,7 +36,7 @@
# * :verbose -- If true, prints the command and all its argument.
def java(*args, &block)
options = Hash === args.last ? args.pop : {}
- options[:verbose] ||= Rake.application.options.trace || false
+ options[:verbose] ||= Buildr.application.options.trace || false
rake_check_options options, :classpath, :java_args, :properties,
:name, :verbose
name = options[:name] || "java #{args.first}"
@@ -46,10 +46,10 @@
options[:properties].each { |k, v| cmd_args << "-D#{k}=#{v}" } if
options[:properties]
cmd_args += (options[:java_args] || (ENV['JAVA_OPTS'] ||
ENV['JAVA_OPTIONS']).to_s.split).flatten
cmd_args += args.flatten.compact
- unless Rake.application.options.dryrun
+ unless Buildr.application.options.dryrun
puts "Running #{name}" if verbose
block = lambda { |ok, res| fail "Failed to execute #{name}, see
errors above" unless ok } unless block
- puts cmd_args.join(' ') if Rake.application.options.trace
+ puts cmd_args.join(' ') if Buildr.application.options.trace
system(*cmd_args).tap do |ok|
block.call ok, $?
end
@@ -74,7 +74,7 @@
files = args.flatten.map(&:to_s).
collect { |arg| File.directory?(arg) ? FileList["#{arg}/**/*.java"]
: arg }.flatten
- cmd_args = [ Rake.application.options.trace ? '-verbose' : '-nowarn' ]
+ cmd_args = [ Buildr.application.options.trace ? '-verbose' : '-nowarn'
]
if options[:compile]
cmd_args << '-d' << options[:output].to_s
else
@@ -86,9 +86,9 @@
classpath << tools if tools && File.exist?(tools)
cmd_args << '-classpath' << classpath.join(File::PATH_SEPARATOR)
unless classpath.empty?
cmd_args += files
- unless Rake.application.options.dryrun
+ unless Buildr.application.options.dryrun
puts 'Running apt' if verbose
- puts (['apt'] + cmd_args).join(' ') if Rake.application.options.trace
+ puts (['apt'] + cmd_args).join(' ') if
Buildr.application.options.trace
Java.load
Java.com.sun.tools.apt.Main.process(cmd_args.to_java(Java.java.lang.String)) ==
0 or
fail 'Failed to process annotations, see errors above'
@@ -122,9 +122,9 @@
cmd_args << '-d' << options[:output].to_s if options[:output]
cmd_args += options[:javac_args].flatten if options[:javac_args]
cmd_args += files
- unless Rake.application.options.dryrun
+ unless Buildr.application.options.dryrun
puts "Compiling #{files.size} source files in #{name}" if verbose
- puts (['javac'] + cmd_args).join(' ') if
Rake.application.options.trace
+ puts (['javac'] + cmd_args).join(' ') if
Buildr.application.options.trace
Java.load
Java.com.sun.tools.javac.Main.compile(cmd_args.to_java(Java.java.lang.String))
== 0 or
fail 'Failed to compile, see errors above'
@@ -150,7 +150,7 @@
def javadoc(*args)
options = Hash === args.last ? args.pop : {}
- cmd_args = [ '-d', options[:output], Rake.application.options.trace ?
'-verbose' : '-quiet' ]
+ cmd_args = [ '-d', options[:output], Buildr.application.options.trace
? '-verbose' : '-quiet' ]
options.reject { |key, value| [:output, :name, :sourcepath,
:classpath].include?(key) }.
each { |key, value| value.invoke if value.respond_to?(:invoke) }.
each do |key, value|
@@ -172,9 +172,9 @@
end
cmd_args += args.flatten.uniq
name = options[:name] || Dir.pwd
- unless Rake.application.options.dryrun
+ unless Buildr.application.options.dryrun
puts "Generating Javadoc for #{name}" if verbose
- puts (['javadoc'] + cmd_args).join(' ') if
Rake.application.options.trace
+ puts (['javadoc'] + cmd_args).join(' ') if
Buildr.application.options.trace
Java.load
Java.com.sun.tools.javadoc.Main.execute(cmd_args.to_java(Java.java.lang.String))
== 0 or
fail 'Failed to generate Javadocs, see errors above'
Modified: incubator/buildr/trunk/lib/buildr/java/compilers.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/compilers.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/compilers.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/compilers.rb Mon Apr 7 23:20:45 2008
@@ -62,8 +62,8 @@
cmd_args << '-d' << File.expand_path(target)
cmd_args += javac_args
cmd_args += files_from_sources(sources)
- unless Rake.application.options.dryrun
- puts (['javac'] + cmd_args).join(' ') if
Rake.application.options.trace
+ unless Buildr.application.options.dryrun
+ puts (['javac'] + cmd_args).join(' ') if
Buildr.application.options.trace
Java.load
Java.com.sun.tools.javac.Main.compile(cmd_args.to_java(Java.java.lang.String))
== 0 or
fail 'Failed to compile, see errors above'
@@ -75,7 +75,7 @@
def javac_args #:nodoc:
args = []
args << '-nowarn' unless options[:warnings]
- args << '-verbose' if Rake.application.options.trace
+ args << '-verbose' if Buildr.application.options.trace
args << '-g' if options[:debug]
args << '-deprecation' if options[:deprecation]
args << '-source' << options[:source].to_s if options[:source]
@@ -143,9 +143,9 @@
cmd_args += scalac_args
cmd_args += files_from_sources(sources)
- unless Rake.application.options.dryrun
+ unless Buildr.application.options.dryrun
Scalac.scala_home or fail 'Are we forgetting something? SCALA_HOME
not set.'
- puts (['scalac'] + cmd_args).join(' ') if
Rake.application.options.trace
+ puts (['scalac'] + cmd_args).join(' ') if
Buildr.application.options.trace
if Scalac.use_fsc
system(([File.expand_path('bin/fsc', Scalac.scala_home)] +
cmd_args).join(' ')) or
fail 'Failed to compile, see errors above'
@@ -163,7 +163,7 @@
def scalac_args #:nodoc:
args = []
args << "-nowarn" unless options[:warnings]
- args << "-verbose" if Rake.application.options.trace
+ args << "-verbose" if Buildr.application.options.trace
args << "-g" if options[:debug]
args << "-deprecation" if options[:deprecation]
args << "-optimise" if options[:optimise]
@@ -318,7 +318,7 @@
private
def generate(sources, target, options = {})
- cmd_args = [ '-d', target, Rake.application.options.trace ? '-verbose'
: '-quiet' ]
+ cmd_args = [ '-d', target, Buildr.application.options.trace ?
'-verbose' : '-quiet' ]
options.reject { |key, value| [:sourcepath, :classpath].include?(key)
}.
each { |key, value| value.invoke if value.respond_to?(:invoke) }.
each do |key, value|
@@ -339,9 +339,9 @@
end
end
cmd_args += sources.flatten.uniq
- unless Rake.application.options.dryrun
+ unless Buildr.application.options.dryrun
puts "Generating Javadoc for #{name}" if verbose
- puts (['javadoc'] + cmd_args).join(' ') if
Rake.application.options.trace
+ puts (['javadoc'] + cmd_args).join(' ') if
Buildr.application.options.trace
Java.load
Java.com.sun.tools.javadoc.Main.execute(cmd_args.to_java(Java.java.lang.String))
== 0 or
fail 'Failed to generate Javadocs, see errors above'
@@ -404,16 +404,16 @@
def apt(*sources)
sources = compile.sources if sources.empty?
file(path_to(:target, 'generated/apt')=>sources) do |task|
- cmd_args = [ Rake.application.options.trace ? '-verbose' : '-nowarn' ]
+ cmd_args = [ Buildr.application.options.trace ? '-verbose' : '-nowarn'
]
cmd_args << '-nocompile' << '-s' << task.name
cmd_args << '-source' << compile.options.source if
compile.options.source
classpath = Buildr.artifacts(compile.dependencies).map(&:to_s).each {
|t| task(t).invoke }
cmd_args << '-classpath' << classpath.join(File::PATH_SEPARATOR)
unless classpath.empty?
cmd_args += (sources.map(&:to_s) - [task.name]).
map { |file| File.directory?(file) ? FileList["#{file}/**/*.java"] :
file }.flatten
- unless Rake.application.options.dryrun
+ unless Buildr.application.options.dryrun
puts 'Running apt' if verbose
- puts (['apt'] + cmd_args).join(' ') if Rake.application.options.trace
+ puts (['apt'] + cmd_args).join(' ') if
Buildr.application.options.trace
Java.com.sun.tools.apt.Main.process(cmd_args.to_java(Java.java.lang.String)) ==
0 or
fail 'Failed to process annotations, see errors above'
end
Modified: incubator/buildr/trunk/lib/buildr/java/groovyc.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/groovyc.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/groovyc.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/groovyc.rb Mon Apr 7 23:20:45 2008
@@ -91,14 +91,14 @@
options[:debug] = Buildr.options.debug if options[:debug].nil?
options[:deprecation] ||= false
options[:optimise] ||= false
- options[:verbose] ||= Rake.application.options.trace if
options[:verbose].nil?
+ options[:verbose] ||= Buildr.application.options.trace if
options[:verbose].nil?
options[:warnings] = verbose if options[:warnings].nil?
options[:javac] = OpenObject.new if options[:javac].nil?
end
# http://groovy.codehaus.org/The+groovyc+Ant+Task
def compile(sources, target, dependencies) #:nodoc:
- return if Rake.application.options.dryrun
+ return if Buildr.application.options.dryrun
Buildr.ant 'groovyc' do |ant|
classpath = dependencies | self.class.dependencies.map(&:to_s)
ant.taskdef :name => 'groovyc', :classname => ANT_TASK, :classpath
=> classpath.join(File::PATH_SEPARATOR)
Modified: incubator/buildr/trunk/lib/buildr/java/packaging.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/packaging.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/packaging.rb Mon Apr 7 23:20:45 2008
@@ -500,7 +500,7 @@
return @descriptor if @descriptor
descriptor_path = path_to('META-INF/application.xml')
@descriptor = file(descriptor_path) do |task|
- puts "Creating EAR Descriptor: #{task.to_s}" if
Rake.application.options.trace
+ puts "Creating EAR Descriptor: #{task.to_s}" if
Buildr.application.options.trace
mkpath File.dirname(task.name), :verbose=>false
File.open(task.name, 'w') { |file| file.print task.xml }
end
Modified: incubator/buildr/trunk/lib/buildr/java/pom.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/pom.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/pom.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/pom.rb Mon Apr 7 23:20:45 2008
@@ -51,7 +51,7 @@
when String
filename = File.expand_path(source)
unless pom = cache[filename]
- puts "Loading m2 pom file from #{filename}" if
Rake.application.options.trace
+ puts "Loading m2 pom file from #{filename}" if
Buildr.application.options.trace
pom = POM.new(IO.read(filename))
cache[filename] = pom
end
Modified: incubator/buildr/trunk/lib/buildr/tasks/concat.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/tasks/concat.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/tasks/concat.rb (original)
+++ incubator/buildr/trunk/lib/buildr/tasks/concat.rb Mon Apr 7 23:20:45 2008
@@ -44,7 +44,7 @@
# For example:
# concat("master.sql"=>["users.sql", "orders.sql", reports.sql"]
def concat(args)
- file, arg_names, deps = Rake.application.resolve_args([args])
+ file, arg_names, deps = Buildr.application.resolve_args([args])
ConcatTask.define_task(File.expand_path(file)=>deps)
end
Modified: incubator/buildr/trunk/lib/buildr/tasks/zip.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/tasks/zip.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/tasks/zip.rb (original)
+++ incubator/buildr/trunk/lib/buildr/tasks/zip.rb Mon Apr 7 23:20:45 2008
@@ -45,11 +45,11 @@
if File.directory?(path)
in_directory path do |file, rel_path|
dest = "[EMAIL PROTECTED]"
- puts "Adding #{dest}" if Rake.application.options.trace
+ puts "Adding #{dest}" if Buildr.application.options.trace
file_map[dest] = file
end
else
- puts "Adding [EMAIL PROTECTED](path)}" if
Rake.application.options.trace
+ puts "Adding [EMAIL PROTECTED](path)}" if
Buildr.application.options.trace
file_map["[EMAIL PROTECTED](path)}"] = path
end
end
@@ -150,11 +150,11 @@
path = rel_path.split('/')[1..-1]
path.unshift as unless as == '.'
dest = "[EMAIL PROTECTED]('/')}"
- puts "Adding #{dest}" if Rake.application.options.trace
+ puts "Adding #{dest}" if Buildr.application.options.trace
file_map[dest] = file
end
else
- puts "Adding [EMAIL PROTECTED]" if Rake.application.options.trace
+ puts "Adding [EMAIL PROTECTED]" if
Buildr.application.options.trace
file_map["[EMAIL PROTECTED]"] = file
end
end
@@ -218,7 +218,7 @@
if @includes.any? { |pattern| File.fnmatch(pattern, entry.name,
File::FNM_PATHNAME) } &&
[EMAIL PROTECTED] { |pattern| File.fnmatch(pattern, entry.name,
File::FNM_PATHNAME) }
dest = Util.relative_path(path + "/" + entry.name)
- puts "Adding #{dest}" if Rake.application.options.trace
+ puts "Adding #{dest}" if Buildr.application.options.trace
file_map[dest] = lambda { |output| output.write
source.read(entry) }
end
end
@@ -516,7 +516,7 @@
# Initialize with hash argument of the form target=>zip_file.
def initialize(args)
- @target, arg_names, @zip_file = Rake.application.resolve_args([args])
+ @target, arg_names, @zip_file = Buildr.application.resolve_args([args])
@paths = {}
end
@@ -546,7 +546,7 @@
patterns.map(entries).each do |dest, entry|
next if entry.directory?
dest = File.expand_path(dest, target.to_s)
- puts "Extracting #{dest}" if Rake.application.options.trace
+ puts "Extracting #{dest}" if Buildr.application.options.trace
mkpath File.dirname(dest), :verbose=>false rescue nil
entry.extract(dest) { true }
end
@@ -695,7 +695,7 @@
# unzip('src'=>'test.zip').include('README', 'LICENSE')
# unzip('libs'=>'test.zip').from_path('libs')
def unzip(args)
- target, arg_names, zip_file = Rake.application.resolve_args([args])
+ target, arg_names, zip_file = Buildr.application.resolve_args([args])
task = file(File.expand_path(target.to_s)=>zip_file)
Unzip.new(task=>zip_file).tap do |setup|
task.enhance { setup.extract }
Modified: incubator/buildr/trunk/spec/addon_spec.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/addon_spec.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/addon_spec.rb (original)
+++ incubator/buildr/trunk/spec/addon_spec.rb Mon Apr 7 23:20:45 2008
@@ -165,7 +165,7 @@
available 'foobar', '1.0'
lambda do
addon 'foobar'
- Rake.application.load_imports
+ Buildr.application.load_imports
end.should change { $loaded }.to(true)
end
Modified: incubator/buildr/trunk/spec/application_spec.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/application_spec.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/application_spec.rb (original)
+++ incubator/buildr/trunk/spec/application_spec.rb Mon Apr 7 23:20:45 2008
@@ -181,7 +181,7 @@
it 'should install nothing if specified gems already installed' do
@app.should_receive(:listed_gems).and_return([Gem.loaded_specs['rspec']])
- @app.should_not_receive(:sh)
+ Util.should_not_receive(:ruby)
lambda { @app.load_gems }.should_not raise_error
end
@@ -216,8 +216,8 @@
@app.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo',
'>=1.1')])
Gem::SourceInfoCache.should_receive(:search).and_return([EMAIL
PROTECTED])
$terminal.should_receive(:agree).and_return(true)
- @app.should_receive(:sh) do |*args|
- args.should include('-S', 'gem', 'install', 'foo', '-v', '1.2')
+ Util.should_receive(:ruby) do |*args|
+ args.should include('install', 'foo', '-v', '1.2')
end
@app.should_receive(:gem).and_return(false)
@app.load_gems
@@ -227,7 +227,7 @@
@app.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo',
'>=1.1')])
Gem::SourceInfoCache.should_receive(:search).and_return([EMAIL
PROTECTED])
$terminal.should_receive(:agree).and_return(true)
- @app.should_receive(:sh)
+ Util.should_receive(:ruby)
Gem.source_index.should_receive(:load_gems_in).with(Gem::SourceIndex.installed_spec_directories)
@app.should_receive(:gem).and_return(false)
@app.load_gems
@@ -243,7 +243,7 @@
@app.should_receive(:listed_gems).and_return([Gem::Dependency.new('foo',
'>=1.1')])
Gem::SourceInfoCache.should_receive(:search).and_return([EMAIL
PROTECTED])
$terminal.should_receive(:agree).and_return(true)
- @app.should_receive(:sh)
+ Util.should_receive(:ruby)
@app.should_receive(:gem).with('foo', @spec.version.to_s)
@app.load_gems
end
Modified: incubator/buildr/trunk/spec/project_spec.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/project_spec.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/project_spec.rb (original)
+++ incubator/buildr/trunk/spec/project_spec.rb Mon Apr 7 23:20:45 2008
@@ -129,7 +129,7 @@
end
it 'should execute in namespace of project' do
- define('foo') { define('bar') { Rake.application.current_scope.should
eql(['foo', 'bar']) } }
+ define('foo') { define('bar') { Buildr.application.current_scope.should
eql(['foo', 'bar']) } }
end
end
@@ -320,7 +320,7 @@
it 'should execute in namespace of project' do
scopes = []
- Project.on_define { |project| scopes << Rake.application.current_scope }
+ Project.on_define { |project| scopes << Buildr.application.current_scope }
define('foo') { define 'bar' }
scopes.should eql([['foo'], ['foo', 'bar']])
end
@@ -346,7 +346,7 @@
it 'should execute enhancement in namespace of project' do
scopes = []
- Project.on_define { |project| project.enhance { scopes <<
Rake.application.current_scope } }
+ Project.on_define { |project| project.enhance { scopes <<
Buildr.application.current_scope } }
define('foo') { define 'bar' }
scopes.should eql([['foo'], ['foo', 'bar']])
end
@@ -609,7 +609,7 @@
describe Project, '#task' do
it 'should create a regular task' do
define('foo') { task('bar') }
- Rake.application.lookup('foo:bar').should_not be_nil
+ Buildr.application.lookup('foo:bar').should_not be_nil
end
it 'should return a task defined in the project' do
@@ -648,17 +648,17 @@
it 'should create a file task' do
define('foo') { file('bar') }
- Rake.application.lookup(File.expand_path('bar')).should_not be_nil
+ Buildr.application.lookup(File.expand_path('bar')).should_not be_nil
end
it 'should create file task with absolute path' do
define('foo') { file('/tmp') }
- Rake.application.lookup(File.expand_path('/tmp')).should_not be_nil
+ Buildr.application.lookup(File.expand_path('/tmp')).should_not be_nil
end
it 'should create file task relative to project base directory' do
define('foo', :base_dir=>'tmp') { file('bar') }
- Rake.application.lookup(File.expand_path('tmp/bar')).should_not be_nil
+ Buildr.application.lookup(File.expand_path('tmp/bar')).should_not be_nil
end
it 'should accept single dependency' do
@@ -705,7 +705,7 @@
# TODO: how do we test this?
describe Rake::Task, 'buildr:initialize' do
it 'should be ready to run as the first task' do
- Rake.application.top_level_tasks.first.should eql('buildr:initialize')
+ Buildr.application.top_level_tasks.first.should eql('buildr:initialize')
end
it 'should evaluate all project definitions' do
Modified: incubator/buildr/trunk/spec/sandbox.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/sandbox.rb?rev=645772&r1=645771&r2=645772&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/sandbox.rb (original)
+++ incubator/buildr/trunk/spec/sandbox.rb Mon Apr 7 23:20:45 2008
@@ -57,7 +57,7 @@
Dir.chdir temp
@_sandbox = {}
- Buildr.application = Rake.application = Buildr::Application.new
+ Buildr.application = Buildr::Application.new
Sandbox.tasks.each { |block| block.call }
Buildr.application.instance_variable_set :@rules, Sandbox.rules.clone
Buildr.application.instance_eval { @rakefile =
File.expand_path('buildfile') }