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 2009/02/27 09:59:01 UTC
svn commit: r748443 - in /buildr/trunk: ./ lib/buildr/core/
lib/buildr/groovy/ lib/buildr/java/ lib/buildr/packaging/
Author: assaf
Date: Fri Feb 27 08:59:00 2009
New Revision: 748443
URL: http://svn.apache.org/viewvc?rev=748443&view=rev
Log:
Hopefully this fixes Rake's verbal diarrhea.
Modified:
buildr/trunk/Rakefile
buildr/trunk/lib/buildr/core/application.rb
buildr/trunk/lib/buildr/core/build.rb
buildr/trunk/lib/buildr/core/checks.rb
buildr/trunk/lib/buildr/core/common.rb
buildr/trunk/lib/buildr/core/compile.rb
buildr/trunk/lib/buildr/core/filter.rb
buildr/trunk/lib/buildr/core/test.rb
buildr/trunk/lib/buildr/core/transports.rb
buildr/trunk/lib/buildr/groovy/bdd.rb
buildr/trunk/lib/buildr/java/bdd.rb
buildr/trunk/lib/buildr/java/cobertura.rb
buildr/trunk/lib/buildr/java/compiler.rb
buildr/trunk/lib/buildr/java/emma.rb
buildr/trunk/lib/buildr/java/packaging.rb
buildr/trunk/lib/buildr/java/test_result.rb
buildr/trunk/lib/buildr/packaging/archive.rb
buildr/trunk/lib/buildr/packaging/artifact.rb
buildr/trunk/lib/buildr/packaging/package.rb
buildr/trunk/lib/buildr/packaging/ziptask.rb
Modified: buildr/trunk/Rakefile
URL: http://svn.apache.org/viewvc/buildr/trunk/Rakefile?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/Rakefile (original)
+++ buildr/trunk/Rakefile Fri Feb 27 08:59:00 2009
@@ -14,9 +14,6 @@
# the License.
-RakeFileUtils.verbose_flag = Rake.application.options.trace # Rake 0.8.3 is too chatty!
-
-
# We need JAVA_HOME for most things (setup, spec, etc).
unless ENV['JAVA_HOME']
if RUBY_PLATFORM[/java/]
Modified: buildr/trunk/lib/buildr/core/application.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/application.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/application.rb (original)
+++ buildr/trunk/lib/buildr/core/application.rb Fri Feb 27 08:59:00 2009
@@ -125,7 +125,7 @@
@rakefiles = DEFAULT_BUILDFILES.dup
@top_level_tasks = []
@home_dir = File.expand_path('.buildr', ENV['HOME'])
- mkpath @home_dir, :verbose=>false unless File.exist?(@home_dir)
+ mkpath @home_dir unless File.exist?(@home_dir)
@settings = Settings.new(self)
@on_completion = []
@on_failure = []
@@ -260,10 +260,9 @@
puts opts
exit
end
-
+
standard_buildr_options.each { |args| opts.on(*args) }
parsed_argv = opts.parse(ARGV)
- RakeFileUtils.verbose_flag = options.trace
parsed_argv
end
@@ -643,3 +642,22 @@
end
end
end
+
+
+module RakeFileUtils
+ FileUtils::OPT_TABLE.each do |name, opts|
+ default_options = []
+ if opts.include?(:verbose) || opts.include?("verbose")
+ default_options << ':verbose => RakeFileUtils.verbose_flag == true'
+ end
+ next if default_options.empty?
+ module_eval(<<-EOS, __FILE__, __LINE__ + 1)
+ def #{name}( *args, &block )
+ super(
+ *rake_merge_option(args,
+ #{default_options.join(', ')}
+ ), &block)
+ end
+ EOS
+ end
+end
Modified: buildr/trunk/lib/buildr/core/build.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/build.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/build.rb (original)
+++ buildr/trunk/lib/buildr/core/build.rb Fri Feb 27 08:59:00 2009
@@ -56,10 +56,8 @@
project.recursive_task 'build'
project.recursive_task 'clean'
project.clean do
- verbose(true) do
- rm_rf project.path_to(:target)
- rm_rf project.path_to(:reports)
- end
+ rm_rf project.path_to(:target)
+ rm_rf project.path_to(:reports)
end
end
Modified: buildr/trunk/lib/buildr/core/checks.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/checks.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/checks.rb (original)
+++ buildr/trunk/lib/buildr/core/checks.rb Fri Feb 27 08:59:00 2009
@@ -90,7 +90,7 @@
@description = args.pop if String === args.last
@subject = args.shift
raise ArgumentError, "Expecting subject followed by description, and either one is optional. Not quite sure what to do with this list of arguments." unless args.empty?
- @block = block || lambda { puts "Pending: #{description}" if verbose }
+ @block = block || lambda { info "Pending: #{description}" }
end
# :call-seq:
Modified: buildr/trunk/lib/buildr/core/common.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/common.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/common.rb (original)
+++ buildr/trunk/lib/buildr/core/common.rb Fri Feb 27 08:59:00 2009
@@ -51,7 +51,7 @@
# For example:
# write('README') { read('README').sub("${build}", Time.now) }
def write(name, content = nil)
- mkpath File.dirname(name), :verbose=>false
+ mkpath File.dirname(name)
content = yield if block_given?
File.open(name.to_s, 'wb') { |file| file.write content.to_s }
content.to_s
Modified: buildr/trunk/lib/buildr/core/compile.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/compile.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/compile.rb (original)
+++ buildr/trunk/lib/buildr/core/compile.rb Fri Feb 27 08:59:00 2009
@@ -224,12 +224,12 @@
unless sources.empty?
raise 'No compiler selected and can\'t determine which compiler to use' unless compiler
raise 'No target directory specified' unless target
- mkpath target.to_s, :verbose=>false
+ mkpath target.to_s
info "Compiling #{task.name.gsub(/:[^:]*$/, '')} into #{target.to_s}"
@compiler.compile(sources.map(&:to_s), target.to_s, dependencies.map(&:to_s))
# By touching the target we let other tasks know we did something,
# and also prevent recompiling again for dependencies.
- touch target.to_s, :verbose=>false
+ touch target.to_s
end
end
end
Modified: buildr/trunk/lib/buildr/core/filter.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/filter.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/filter.rb (original)
+++ buildr/trunk/lib/buildr/core/filter.rb Fri Feb 27 08:59:00 2009
@@ -174,27 +174,25 @@
map
end
- mkpath target.to_s, :verbose=>Buildr.application.options.trace
+ mkpath target.to_s
return false if copy_map.empty?
- verbose(Buildr.application.options.trace || false) do
- copy_map.each do |path, source|
- dest = File.expand_path(path, target.to_s)
- if File.directory?(source)
- mkpath dest, :verbose=>false
- else
- mkpath File.dirname(dest)
- if @mapper.mapper_type
- mapped = @mapper.transform(File.open(source, 'rb') { |file| file.read }, path)
- File.open(dest, 'wb') { |file| file.write mapped }
- else # no mapping
- cp source, dest
- File.chmod(0664, dest)
- end
+ copy_map.each do |path, source|
+ dest = File.expand_path(path, target.to_s)
+ if File.directory?(source)
+ mkpath dest
+ else
+ mkpath File.dirname(dest)
+ if @mapper.mapper_type
+ mapped = @mapper.transform(File.open(source, 'rb') { |file| file.read }, path)
+ File.open(dest, 'wb') { |file| file.write mapped }
+ else # no mapping
+ cp source, dest
+ File.chmod(0664, dest)
end
end
- touch target.to_s
end
+ touch target.to_s
true
end
Modified: buildr/trunk/lib/buildr/core/test.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/test.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/test.rb (original)
+++ buildr/trunk/lib/buildr/core/test.rb Fri Feb 27 08:59:00 2009
@@ -598,8 +598,8 @@
project.build test unless test.options[:integration]
project.clean do
- rm_rf test.compile.target.to_s, :verbose=>false if test.compile.target
- rm_rf test.report_to.to_s, :verbose=>false
+ rm_rf test.compile.target.to_s if test.compile.target
+ rm_rf test.report_to.to_s
end
end
Modified: buildr/trunk/lib/buildr/core/transports.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/transports.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/transports.rb (original)
+++ buildr/trunk/lib/buildr/core/transports.rb Fri Feb 27 08:59:00 2009
@@ -156,7 +156,7 @@
read({:progress=>verbose}.merge(options || {}).merge(:modified=>modified)) { |chunk| temp.write chunk }
end
mkpath File.dirname(target)
- FileUtils.mv temp.path, target
+ mv temp.path, target
when File
read({:progress=>verbose}.merge(options || {}).merge(:modified=>target.mtime)) { |chunk| target.write chunk }
target.flush
@@ -549,7 +549,7 @@
end
real_path.tap do |path|
mkpath File.dirname(path)
- FileUtils.mv temp.path, path
+ mv temp.path, path
end
end
Modified: buildr/trunk/lib/buildr/groovy/bdd.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/groovy/bdd.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/groovy/bdd.rb (original)
+++ buildr/trunk/lib/buildr/groovy/bdd.rb Fri Feb 27 08:59:00 2009
@@ -86,7 +86,7 @@
tests.inject([]) do |passed, test|
name = test.sub(/.*?groovy[\/\\]/, '').pathmap('%X')
report = File.join(task.report_to.to_s, name + ext)
- mkpath report.pathmap('%d'), :verbose => false
+ mkpath report.pathmap('%d')
begin
Java::Commands.java cmd_args,
"-#{easyb_format}", report,
@@ -103,4 +103,4 @@
end
-Buildr::TestFramework << Buildr::Groovy::EasyB
\ No newline at end of file
+Buildr::TestFramework << Buildr::Groovy::EasyB
Modified: buildr/trunk/lib/buildr/java/bdd.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/bdd.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/bdd.rb (original)
+++ buildr/trunk/lib/buildr/java/bdd.rb Fri Feb 27 08:59:00 2009
@@ -85,15 +85,15 @@
spec_dir = task.project.path_to(:source, :spec, :ruby)
report_dir = task.report_to.to_s
- FileUtils.rm_rf report_dir
- FileUtils.mkdir_p report_dir
+ rm_rf report_dir
+ mkdir_p report_dir
ENV['CI_REPORTS'] = report_dir
runner = runner_config
runner.content = runner_content(binding)
Buildr.write(runner.file, runner.content)
- FileUtils.rm_f runner.result
+ rm_f runner.result
if RUBY_PLATFORM[/java/] && !options.fork
runtime = new_runtime
Modified: buildr/trunk/lib/buildr/java/cobertura.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/cobertura.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/cobertura.rb (original)
+++ buildr/trunk/lib/buildr/java/cobertura.rb Fri Feb 27 08:59:00 2009
@@ -129,7 +129,7 @@
# Instrumented bytecode goes in a different directory. This task creates before running the test
# cases and monitors for changes in the generate bytecode.
instrumented = project.file(cobertura.instrumented_dir => project.compile.target) do |task|
- mkdir_p task.to_s, :verbose => false
+ mkdir_p task.to_s
unless project.compile.sources.empty?
info "Instrumenting classes with cobertura data file #{cobertura.data_file}"
Buildr.ant "cobertura" do |ant|
@@ -154,7 +154,7 @@
end
end
end
- touch task.to_s, :verbose=>false
+ touch task.to_s
end
task 'instrument' => instrumented
@@ -185,7 +185,7 @@
end
project.clean do
- rm_rf [cobertura.report_to, cobertura.data_file, cobertura.instrumented_dir], :verbose=>false
+ rm_rf [cobertura.report_to, cobertura.data_file, cobertura.instrumented_dir]
end
end
@@ -224,7 +224,7 @@
end
task "clean" do
- rm_rf [report_to, data_file], :verbose=>false
+ rm_rf [report_to, data_file]
end
end
Modified: buildr/trunk/lib/buildr/java/compiler.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/compiler.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/compiler.rb (original)
+++ buildr/trunk/lib/buildr/java/compiler.rb Fri Feb 27 08:59:00 2009
@@ -117,9 +117,9 @@
@sourcepath = []
@files = FileList[]
enhance do |task|
- rm_rf target.to_s, :verbose=>false
+ rm_rf target.to_s
generate source_files, File.expand_path(target.to_s), options.merge(:classpath=>classpath, :sourcepath=>sourcepath)
- touch target.to_s, :verbose=>false
+ touch target.to_s
end
end
Modified: buildr/trunk/lib/buildr/java/emma.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/emma.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/emma.rb (original)
+++ buildr/trunk/lib/buildr/java/emma.rb Fri Feb 27 08:59:00 2009
@@ -146,7 +146,7 @@
ant.filter :excludes=>emma.excludes.join(', ') unless emma.excludes.empty?
end
end
- touch task.to_s, :verbose=>false
+ touch task.to_s
end
end
@@ -162,7 +162,7 @@
missing_required_files = [emma.metadata_file, emma.coverage_file].reject { |f| File.exist?(f) }
if missing_required_files.empty?
info "Creating test coverage reports in #{emma.report_dir}"
- mkdir_p emma.report_dir, :verbose=>false
+ mkdir_p emma.report_dir
Emma.ant do |ant|
ant.report do
ant.infileset :file=>emma.metadata_file
@@ -184,7 +184,7 @@
end
project.clean do
- rm_rf [emma.report_dir, emma.coverage_file, emma.metadata_file, emma.instrumented_dir], :verbose=>false
+ rm_rf [emma.report_dir, emma.coverage_file, emma.metadata_file, emma.instrumented_dir]
end
end
@@ -203,7 +203,7 @@
desc "Run the test cases and produce code coverage reports in #{format}"
task format => ['instrument', 'test'] do
info "Creating test coverage reports in #{format}"
- mkdir_p report_to(format), :verbose=>false
+ mkdir_p report_to(format)
Emma.ant do |ant|
ant.merge :outfile=>data_file do
Buildr.projects.each do |project|
@@ -226,7 +226,7 @@
end
task :clean do
- rm_rf [report_to, data_file], :verbose=>false
+ rm_rf [report_to, data_file]
end
end
Modified: buildr/trunk/lib/buildr/java/packaging.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/packaging.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ buildr/trunk/lib/buildr/java/packaging.rb Fri Feb 27 08:59:00 2009
@@ -457,8 +457,8 @@
def component_clone(component)
file(path_to(component[:path], component[:artifact].to_s.pathmap('%f')) => component[:artifact]) do |task|
- mkpath task.to_s.pathmap('%d'), :verbose => false
- cp component[:artifact].to_s, task.to_s, :verbose => false
+ mkpath task.to_s.pathmap('%d')
+ cp component[:artifact].to_s, task.to_s
Manifest.update_manifest(task) do |manifest|
class_path = manifest.main['Class-Path'].to_s.split
included_libs = class_path.map { |fn| fn.pathmap('%f') }
@@ -551,7 +551,7 @@
descriptor_path = path_to('META-INF/application.xml')
@descriptor = file(descriptor_path) do |task|
trace "Creating EAR Descriptor: #{task.to_s}"
- mkpath File.dirname(task.name), :verbose=>false
+ mkpath File.dirname(task.name)
File.open(task.name, 'w') { |file| file.print task.xml }
end
class << @descriptor
Modified: buildr/trunk/lib/buildr/java/test_result.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/test_result.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/test_result.rb (original)
+++ buildr/trunk/lib/buildr/java/test_result.rb Fri Feb 27 08:59:00 2009
@@ -30,8 +30,7 @@
end
def self.dump_yaml(file, e)
- require 'fileutils'
- FileUtils.mkdir_p(File.dirname(file))
+ mkdir_p File.dirname(file)
File.open(file, 'w') { |f| f.puts(YAML.dump(Error.new(e.message, e.backtrace))) }
end
@@ -106,7 +105,7 @@
files = options.files
result.succeeded = files - result.failed
- FileUtils.mkdir_p(File.dirname(where))
+ mkdir_p File.dirname(where)
File.open(where, 'w') { |f| f.puts YAML.dump(result) }
end
end # YamlFormatter
Modified: buildr/trunk/lib/buildr/packaging/archive.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/archive.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/archive.rb (original)
+++ buildr/trunk/lib/buildr/packaging/archive.rb Fri Feb 27 08:59:00 2009
@@ -281,8 +281,8 @@
# We're here because the archive file does not exist, or one of the files is newer than the archive contents;
# we need to make sure the archive doesn't exist (e.g. opening an existing Zip will add instead of create).
# We also want to protect against partial updates.
- rm name, :verbose=>false rescue nil
- mkpath File.dirname(name), :verbose=>false
+ rm name rescue nil
+ mkpath File.dirname(name)
begin
@paths.each do |name, object|
@file_map[name] = nil unless name.empty?
@@ -290,7 +290,7 @@
end
create_from @file_map
rescue
- rm name, :verbose=>false rescue nil
+ rm name rescue nil
raise
end
end
Modified: buildr/trunk/lib/buildr/packaging/artifact.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/artifact.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/artifact.rb (original)
+++ buildr/trunk/lib/buildr/packaging/artifact.rb Fri Feb 27 08:59:00 2009
@@ -129,20 +129,16 @@
invoke
installed = Buildr.repositories.locate(self)
unless installed == name # If not already in local repository.
- verbose(Buildr.application.options.trace || false) do
- mkpath File.dirname(installed)
- cp name, installed
- end
+ mkpath File.dirname(installed)
+ cp name, installed
info "Installed #{installed}"
end
end
def uninstall
- verbose(Buildr.application.options.trace || false) do
- installed = Buildr.repositories.locate(self)
- rm installed if File.exist?(installed)
- pom.uninstall if pom && pom != self
- end
+ installed = Buildr.repositories.locate(self)
+ rm installed if File.exist?(installed)
+ pom.uninstall if pom && pom != self
end
# :call-seq:
@@ -329,19 +325,15 @@
def from(path)
path = File.expand_path(path.to_s)
enhance [path] do
- verbose false do
- mkpath File.dirname(name)
- pom.invoke unless type == :pom
- cp path, name
- info "Installed #{path} as #{to_spec}"
- end
+ mkpath File.dirname(name)
+ pom.invoke unless type == :pom
+ cp path, name
+ info "Installed #{path} as #{to_spec}"
end
unless type == :pom
pom.enhance do
- verbose false do
- mkpath File.dirname(pom.name)
- File.open(pom.name, 'w') { |file| file.write pom.pom_xml }
- end
+ mkpath File.dirname(pom.name)
+ File.open(pom.name, 'w') { |file| file.write pom.pom_xml }
end
end
self
@@ -730,9 +722,7 @@
task('install').tap do |task|
task.enhance all, &block
task 'uninstall' do
- verbose false do
- all.map(&:to_s ).each { |file| rm file if File.exist?(file) }
- end
+ all.map(&:to_s ).each { |file| rm file if File.exist?(file) }
end
end
end
Modified: buildr/trunk/lib/buildr/packaging/package.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/package.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/package.rb (original)
+++ buildr/trunk/lib/buildr/packaging/package.rb Fri Feb 27 08:59:00 2009
@@ -170,7 +170,7 @@
# Another task to create the POM file.
pom = package.pom
pom.enhance do
- mkpath File.dirname(pom.name), :verbose=>false
+ mkpath File.dirname(pom.name)
File.open(pom.name, 'w') { |file| file.write pom.pom_xml }
end
file(Buildr.repositories.locate(package)=>package) { package.install }
Modified: buildr/trunk/lib/buildr/packaging/ziptask.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/ziptask.rb?rev=748443&r1=748442&r2=748443&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/ziptask.rb (original)
+++ buildr/trunk/lib/buildr/packaging/ziptask.rb Fri Feb 27 08:59:00 2009
@@ -145,7 +145,7 @@
end
# Otherwise, empty unzip creates target as a file when touching.
- mkpath target.to_s, :verbose=>false
+ mkpath target.to_s
Zip::ZipFile.open(zip_file.to_s) do |zip|
entries = zip.collect
@paths.each do |path, patterns|
@@ -153,13 +153,13 @@
next if entry.directory?
dest = File.expand_path(dest, target.to_s)
trace "Extracting #{dest}"
- mkpath File.dirname(dest), :verbose=>false rescue nil
+ mkpath File.dirname(dest) rescue nil
entry.extract(dest) { true }
end
end
end
# Let other tasks know we updated the target directory.
- touch target.to_s, :verbose=>false
+ touch target.to_s
end
# :call-seq: