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/04/08 07:45:37 UTC
svn commit: r645768 - in /incubator/buildr/trunk: ./ lib/buildr/core/
lib/buildr/java/ lib/buildr/tasks/ rakelib/ spec/
Author: assaf
Date: Mon Apr 7 22:45:34 2008
New Revision: 645768
URL: http://svn.apache.org/viewvc?rev=645768&view=rev
Log:
A bit more reorgenizing, less spreading methods all over the place: warn_deprecated moved to Buildr::Application, recursive_with_dot_files now in Buildr::Util.
Removed gem-install from Util: we should only accommodate Gem installation through Buildr::Application.
warn coloring should work on Windows if win32console installed.
Buildr's Rakefile no longer requires Highline (nice idea, but really tricky to pull off, file under "what was I thinking?").
Modified:
incubator/buildr/trunk/buildfile
incubator/buildr/trunk/lib/buildr/core/application.rb
incubator/buildr/trunk/lib/buildr/core/build.rb
incubator/buildr/trunk/lib/buildr/core/common.rb
incubator/buildr/trunk/lib/buildr/core/compile.rb
incubator/buildr/trunk/lib/buildr/core/filter.rb
incubator/buildr/trunk/lib/buildr/core/package.rb
incubator/buildr/trunk/lib/buildr/core/project.rb
incubator/buildr/trunk/lib/buildr/core/test.rb
incubator/buildr/trunk/lib/buildr/core/util.rb
incubator/buildr/trunk/lib/buildr/java/deprecated.rb
incubator/buildr/trunk/lib/buildr/tasks/zip.rb
incubator/buildr/trunk/rakelib/apache.rake
incubator/buildr/trunk/rakelib/doc.rake
incubator/buildr/trunk/rakelib/package.rake
incubator/buildr/trunk/rakelib/release.rake
incubator/buildr/trunk/rakelib/rspec.rake
incubator/buildr/trunk/rakelib/setup.rake
incubator/buildr/trunk/spec/spec_helpers.rb
Modified: incubator/buildr/trunk/buildfile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/buildfile?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/buildfile (original)
+++ incubator/buildr/trunk/buildfile Mon Apr 7 22:45:34 2008
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations under
# the License.
+
$LOADED_FEATURES << 'jruby' unless RUBY_PLATFORM =~ /java/ # Pretend to have JRuby, keeps Nailgun happy.
require 'buildr/jetty'
require 'buildr/nailgun'
Modified: incubator/buildr/trunk/lib/buildr/core/application.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/application.rb?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/application.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/application.rb Mon Apr 7 22:45:34 2008
@@ -45,9 +45,6 @@
ENV["HOME"] ||= File.expand_path(Gem::user_home)
ENV['BUILDR_ENV'] ||= 'development'
-# Add a touch of colors (red) to warnings.
-HighLine.use_color = !Buildr::Util.win_os?
-
module Buildr
class Application < Rake::Application #:nodoc:
@@ -247,6 +244,26 @@
end
private :load_tasks
+ # :call-seq:
+ # deprecated(message)
+ #
+ # Use with deprecated methods and classes. This method automatically adds the file name and line number,
+ # and the text 'Deprecated' before the message, and eliminated duplicate warnings. It only warns when
+ # running in verbose mode.
+ #
+ # For example:
+ # deprecated 'Please use new_foo instead of foo.'
+ def deprecated(message) #:nodoc:
+ return unless verbose
+ "#{caller[1]}: Deprecated: #{message}".tap do |message|
+ @deprecated ||= {}
+ unless @deprecated[message]
+ @deprecated[message] = true
+ warn message
+ end
+ end
+ end
+
end
@@ -271,4 +288,23 @@
Buildr.application = Rake.application = Buildr::Application.new
+end
+
+
+# Add a touch of colors (red) to warnings.
+if $stdout.isatty
+ begin
+ require 'Win32/Console/ANSI' if Config::CONFIG['host_os'] =~ /mswin/
+ HighLine.use_color = true
+ rescue LoadError
+ end
+end
+
+if HighLine.use_color?
+ module Kernel #:nodoc:
+ alias :warn_without_color :warn
+ def warn(message)
+ warn_without_color $terminal.color(message.to_s, :red)
+ 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=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/build.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/build.rb Mon Apr 7 22:45:34 2008
@@ -66,25 +66,25 @@
# *Deprecated:* Use +path_to(:target)+ instead.
def target
- warn_deprecated 'Use path_to(:target) instead'
+ Buildr.application.deprecated 'Use path_to(:target) instead'
layout.expand(:target)
end
# *Deprecated:* Use Layout instead.
def target=(dir)
- warn_deprecated 'Use Layout instead'
+ Buildr.application.deprecated 'Use Layout instead'
layout[:target] = _(dir)
end
# *Deprecated:* Use +path_to(:reports)+ instead.
def reports()
- warn_deprecated 'Use path_to(:reports) instead'
+ Buildr.application.deprecated 'Use path_to(:reports) instead'
layout.expand(:reports)
end
# *Deprecated:* Use Layout instead.
def reports=(dir)
- warn_deprecated 'Use Layout instead'
+ Buildr.application.deprecated 'Use Layout instead'
layout[:reports] = _(dir)
end
Modified: incubator/buildr/trunk/lib/buildr/core/common.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/common.rb?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/common.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/common.rb Mon Apr 7 22:45:34 2008
@@ -14,47 +14,12 @@
# the License.
require 'tempfile'
-require 'pathname'
require 'open-uri'
$LOADED_FEATURES << 'rubygems/open-uri.rb' # avoid loading rubygems' open-uri
require 'uri/open-sftp'
require 'buildr/core/util'
require 'buildr/core/transports'
-module Rake #:nodoc
- class FileList
- class << self
- def recursive(*dirs)
- FileList[dirs.map { |dir| File.join(dir, '/**/{*,.*}') }].reject { |file| File.basename(file) =~ /^[.]{1,2}$/ }
- end
- end
- end
-
- 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
module Buildr
@@ -156,31 +121,3 @@
end
-module Kernel #:nodoc:
-
- alias :warn_without_color :warn
- def warn(message)
- warn_without_color $terminal.color(message.to_s, :red)
- end
-
- # :call-seq:
- # warn_deprecated(message)
- #
- # Use with deprecated methods and classes. This method automatically adds the file name and line number,
- # and the text 'Deprecated' before the message, and eliminated duplicate warnings. It only warns when
- # running in verbose mode.
- #
- # For example:
- # warn_deprecated 'Please use new_foo instead of foo.'
- def warn_deprecated(message) #:nodoc:
- return unless verbose
- "#{caller[1]}: Deprecated: #{message}".tap do |message|
- @deprecated ||= {}
- unless @deprecated[message]
- @deprecated[message] = true
- warn message
- end
- end
- end
-
-end
Modified: incubator/buildr/trunk/lib/buildr/core/compile.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/compile.rb?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/compile.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/compile.rb Mon Apr 7 22:45:34 2008
@@ -249,13 +249,13 @@
# *Deprecated*: Use dependencies instead.
def classpath
- warn_deprecated 'Use dependencies instead.'
+ Buildr.application.deprecated 'Use dependencies instead.'
dependencies
end
# *Deprecated*: Use dependencies= instead.
def classpath=(artifacts)
- warn_deprecated 'Use dependencies= instead.'
+ Buildr.application.deprecated 'Use dependencies= instead.'
self.dependencies = artifacts
end
Modified: incubator/buildr/trunk/lib/buildr/core/filter.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/filter.rb?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/filter.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/filter.rb Mon Apr 7 22:45:34 2008
@@ -165,7 +165,7 @@
raise 'No target directory specified, where am I going to copy the files to?' if target.nil?
copy_map = sources.flatten.map(&:to_s).inject({}) do |map, source|
- files = FileList.recursive(source).
+ files = Util.recursive_with_dot_files(source).
map { |file| Util.relative_path(file, source) }.
select { |file| @include.empty? || @include.any? { |pattern| File.fnmatch(pattern, file, File::FNM_PATHNAME) } }.
reject { |file| @exclude.any? { |pattern| File.fnmatch(pattern, file, File::FNM_PATHNAME) } }
Modified: incubator/buildr/trunk/lib/buildr/core/package.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/package.rb?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/package.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/package.rb Mon Apr 7 22:45:34 2008
@@ -149,7 +149,7 @@
end
package = packages.find { |pkg| pkg.name == file_name } || packager.call(file_name)
else
- warn_deprecated "We changed the way package_as methods are implemented. See the package method documentation for more details."
+ Buildr.application.deprecated "We changed the way package_as methods are implemented. See the package method documentation for more details."
file_name ||= path_to(:target, Artifact.hash_to_file_name(spec))
package = packager.call(file_name, spec)
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=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/project.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/project.rb Mon Apr 7 22:45:34 2008
@@ -322,7 +322,7 @@
# *Deprecated* Check the Extension module to see how extensions are handled.
def on_define(&block)
- warn_deprecated 'This method is deprecated, see Extension'
+ Buildr.application.deprecated 'This method is deprecated, see Extension'
(@on_define ||= []) << block if block
end
Modified: incubator/buildr/trunk/lib/buildr/core/test.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/test.rb?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/test.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/test.rb Mon Apr 7 22:45:34 2008
@@ -204,13 +204,13 @@
# *Deprecated*: Use dependencies instead.
def classpath
- warn_deprecated 'Use dependencies instead.'
+ Buildr.application.deprecated 'Use dependencies instead.'
dependencies
end
# *Deprecated*: Use dependencies= instead.
def classpath=(artifacts)
- warn_deprecated 'Use dependencies= instead.'
+ Buildr.application.deprecated 'Use dependencies= instead.'
self.dependencies = artifacts
end
@@ -313,7 +313,7 @@
elsif name == :integration
options[:integration] = true
else
- warn_deprecated "Please replace with using(:#{name}=>true)"
+ Buildr.application.deprecated "Please replace with using(:#{name}=>true)"
options[name.to_sym] = true
end
end
@@ -350,7 +350,7 @@
# *Deprecated*: Use tests instead.
def classes
- warn_deprecated 'Call tests instead of classes'
+ Buildr.application.deprecated 'Call tests instead of classes'
tests
end
Modified: incubator/buildr/trunk/lib/buildr/core/util.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/util.rb?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/util.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/util.rb Mon Apr 7 22:45:34 2008
@@ -16,6 +16,7 @@
require 'rbconfig'
require 'pathname'
+
module Buildr
module Util
@@ -38,17 +39,6 @@
Config::CONFIG['host_os'] =~ /windows|cygwin|bccwin|cygwin|djgpp|mingw|mswin|wince/i
end
- # Finds and returns path to executable. Consults PATH environment variable.
- # Returns nil if executable not found.
- def which(name)
- if win_os?
- 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:
# :command -- Runs the specified script (e.g., :command=>'gem')
@@ -68,35 +58,6 @@
end
end
- # :call-seq:
- # install_gems(*dependencies)
- #
- def install_gems(*gems)
- installed = Gem::SourceIndex.from_installed_gems
- dependencies = gems.map do |gem|
- case gem
- when Gem::Dependency then gem
- when Array then Gem::Dependency.new(*gem)
- when String then Gem::Dependency.new(gem, '> 0')
- else raise "Invalid gem dependency: #{gem.inspect}"
- end
- end
- dependencies.select { |dep| installed.search(dep.name, dep.version_requirements).empty? }.each do |dep|
- puts "Installing #{dep} ..."
- if win_os? # run the installer directly
- begin
- require 'rubygems/dependency_installer'
- Gem::DependencyInstaller.new(dep.name, dep.version_requirements).install
- rescue LoadError
- require 'rubygems/remote_installer'
- Gem::RemoteInstaller.new.install(dep.name, dep.version_requirements)
- end
- else
- ruby 'install', dep.name, '-v', dep.version_requirements.to_s.inspect, :command=>'gem', :sudo=>true
- end
- end
- end
-
# Just like File.expand_path, but for windows systems it
# capitalizes the drive name and ensures backslashes are used
def normalize_path(path, *dirs)
@@ -121,9 +82,19 @@
to, from = File.expand_path(to.to_s, "/"), File.expand_path(from.to_s, "/")
Pathname.new(to).relative_path_from(Pathname.new(from)).to_s
end
+
+ # Generally speaking, it's not a good idea to operate on dot files (files starting with dot).
+ # These are considered invisible files (.svn, .hg, .irbrc, etc). Dir.glob/FileList ignore them
+ # on purpose. There are few cases where we do have to work with them (filter, zip), a better
+ # solution is welcome, maybe being more explicit with include. For now, this will do.
+ def recursive_with_dot_files(*dirs)
+ FileList[dirs.map { |dir| File.join(dir, '/**/{*,.*}') }].reject { |file| File.basename(file) =~ /^[.]{1,2}$/ }
+ end
+
end
end
+
module Kernel #:nodoc:
# Borrowed from Ruby 1.9.
def tap
@@ -186,6 +157,7 @@
end
end
+
class Hash
class << self
@@ -245,4 +217,32 @@
}.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/java/deprecated.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/deprecated.rb?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/deprecated.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/deprecated.rb Mon Apr 7 22:45:34 2008
@@ -31,7 +31,7 @@
# *Deprecated:* Append to Java.classpath directly.
def classpath
- warn_deprecated 'Append to Java.classpath instead.'
+ Buildr.application.deprecated 'Append to Java.classpath instead.'
::Java.classpath
end
@@ -41,13 +41,13 @@
# *Deprecated:* No longer necessary.
def setup
- warn_deprecated 'See documentation for new way to access Java code.'
+ Buildr.application.deprecated 'See documentation for new way to access Java code.'
yield self if block_given?
end
# *Deprecated:* Use Java.load instead.
def load
- warn_deprecated 'Use Java.load instead.'
+ Buildr.application.deprecated 'Use Java.load instead.'
::Java.load
end
@@ -55,7 +55,7 @@
# *Deprecated:* Use Java.pkg.pkg.ClassName to import a Java class.
def import(class_name)
- warn_deprecated 'Use Java.pkg.pkg.ClassName to import a Java class.'
+ Buildr.application.deprecated 'Use Java.pkg.pkg.ClassName to import a Java class.'
::Java.instance_eval(class_name)
end
end
@@ -66,38 +66,38 @@
# *Deprecated*: Use Java::Commands.java instead.
def java(*args, &block)
return send(:method_missing, :java) if args.empty?
- warn_deprecated 'Use Java::Commands.javadoc instead.'
+ Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
Commands.java(*args, &block)
end
# *Deprecated*: Use Java::Commands.apt instead.
def apt(*args)
- warn_deprecated 'Use Java::Commands.javadoc instead.'
+ Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
Commands.apt(*args)
end
# *Deprecated*: Use Java::Commands.javac instead.
def javac(*args)
- warn_deprecated 'Use Java::Commands.javadoc instead.'
+ Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
Commands.javac(*args)
end
# *Deprecated*: Use Java::Commands.javadoc instead.
def javadoc(*args)
- warn_deprecated 'Use Java::Commands.javadoc instead.'
+ Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
Commands.javadoc(*args)
end
# *Deprecated:* Use ENV_JAVA['java.version'] instead.
def version
- warn_deprecated 'Use ENV_JAVA[\'java.version\'] instead.'
+ Buildr.application.deprecated 'Use ENV_JAVA[\'java.version\'] instead.'
Java.load
ENV_JAVA['java.version']
end
# *Deprecated:* Use ENV['JAVA_HOME'] instead
def home
- warn_deprecated 'Use ENV[\'JAVA_HOME\'] instead.'
+ Buildr.application.deprecated 'Use ENV[\'JAVA_HOME\'] instead.'
ENV['JAVA_HOME']
end
@@ -108,7 +108,7 @@
# and installs various dependencies that are required on the classpath before calling
# any Java code (e.g. Ant and its tasks).
def wrapper
- warn_deprecated 'See documentation for new way to access Java code.'
+ Buildr.application.deprecated 'See documentation for new way to access Java code.'
if block_given?
Java.load
yield JavaWrapper.instance
@@ -126,13 +126,13 @@
# *Deprecated:* Use ENV['JAVA_OPTS'] instead.
def java_args
- warn_deprecated "Use ENV['JAVA_OPTS'] instead"
+ Buildr.application.deprecated "Use ENV['JAVA_OPTS'] instead"
(ENV["JAVA_OPTS"] || ENV["JAVA_OPTIONS"]).to_s.split
end
# *Deprecated:* Use ENV['JAVA_OPTS'] instead.
def java_args=(args)
- warn_deprecated "Use ENV['JAVA_OPTS'] instead"
+ Buildr.application.deprecated "Use ENV['JAVA_OPTS'] instead"
ENV['JAVA_OPTS'] = Array(args).join(' ')
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=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/tasks/zip.rb (original)
+++ incubator/buildr/trunk/lib/buildr/tasks/zip.rb Mon Apr 7 22:45:34 2008
@@ -163,7 +163,7 @@
def in_directory(dir)
prefix = Regexp.new('^' + Regexp.escape(File.dirname(dir) + File::SEPARATOR))
- FileList.recursive(dir).reject { |file| excluded?(file) }.
+ Util.recursive_with_dot_files(dir).reject { |file| excluded?(file) }.
each { |file| yield file, file.sub(prefix, '') }
end
@@ -406,7 +406,7 @@
# coming from, since some tasks touch the directory, e.g. when the
# content of target/classes is included into a WAR.
most_recent = @paths.collect { |name, path| path.sources }.flatten.
- each { |src| File.directory?(src) ? FileList.recursive(src) | [src] : src }.flatten.
+ each { |src| File.directory?(src) ? Util.recursive_with_dot_files(src) | [src] : src }.flatten.
select { |file| File.exist?(file) }.collect { |file| File.stat(file).mtime }.max
File.stat(name).mtime < (most_recent || Rake::EARLY) || super
end
Modified: incubator/buildr/trunk/rakelib/apache.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/apache.rake?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/apache.rake (original)
+++ incubator/buildr/trunk/rakelib/apache.rake Mon Apr 7 22:45:34 2008
@@ -23,7 +23,7 @@
desc 'Check that source files contain the Apache license'
task 'license' do
- say 'Checking that files contain the Apache license ... '
+ print 'Checking that files contain the Apache license ... '
excluded = ['.class', '.png', '.jar', '.tif', 'README', 'LICENSE', 'CHANGELOG', 'DISCLAIMER', 'NOTICE', 'KEYS']
required = FileList[spec.files].exclude(*excluded).exclude(*Array($license_excluded)).select { |fn| File.file?(fn) }
missing = required.reject { |fn|
@@ -32,19 +32,19 @@
comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
}
fail "#{missing.join(', ')} missing Apache License, please add it before making a release!" unless missing.empty?
- say 'OK'
+ puts 'OK'
end
file 'incubating'=>'package' do
rm_rf 'incubating'
mkpath 'incubating'
- say 'Creating -incubating packages ... '
+ print 'Creating -incubating packages ... '
packages = FileList['pkg/*.{gem,zip,tgz}'].map do |package|
package.pathmap('incubating/%n-incubating%x').tap do |incubating|
cp package, incubating
end
end
- say 'Done'
+ puts 'Done'
end
task 'sign', :incubating do |task, args|
@@ -52,14 +52,14 @@
sources = FileList[args.incubating ? 'incubating/*' : 'pkg/*']
gpg_user = ENV['GPG_USER'] or fail 'Please set GPG_USER (--local-user) environment variable so we know which key to use.'
- say 'Signing release files ...'
+ print 'Signing release files ...'
sources.each do |fn|
contents = File.open(fn, 'rb') { |file| file.read }
File.open(fn + '.md5', 'w') { |file| file.write MD5.hexdigest(contents) << ' ' << File.basename(fn) }
File.open(fn + '.sha1', 'w') { |file| file.write SHA1.hexdigest(contents) << ' ' << File.basename(fn) }
sh 'gpg', '--local-user', gpg_user, '--armor', '--output', fn + '.asc', '--detach-sig', fn, :verbose=>true
end
- say 'Done'
+ puts 'Done'
end
task 'upload', :project, :incubating, :depends=>['site', 'KEYS', 'sign'] do |task, args|
@@ -71,11 +71,11 @@
dir = task('sign').prerequisite.find { |prereq| File.directory?(prereq.name) }
fail 'Please enhance sign task with directory containing files to release' unless dir
- say 'Uploading packages to Apache dist ...'
+ puts 'Uploading packages to Apache dist ...'
args = FileList["#{dir}/*", 'KEYS'].flatten << target
sh 'rsync', '-progress', *args
- say 'Done'
+ puts 'Done'
end
end
Modified: incubator/buildr/trunk/rakelib/doc.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/doc.rake?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/doc.rake (original)
+++ incubator/buildr/trunk/rakelib/doc.rake Mon Apr 7 22:45:34 2008
@@ -94,10 +94,10 @@
namespace 'release' do
task 'prepare'=>'docs' do
- say 'Checking that we have site documentation, RDoc and PDF ... '
+ print 'Checking that we have site documentation, RDoc and PDF ... '
fail 'No PDF generated, you need to install PrinceXML!' unless File.exist?('site/buildr.pdf')
fail 'No RDocs in site directory' unless File.exist?('site/rdoc/files/lib/buildr_rb.html')
fail 'No site documentation in site directory' unless File.exist?('site/index.html')
- say 'OK'
+ puts 'OK'
end
end
Modified: incubator/buildr/trunk/rakelib/package.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/package.rake?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/package.rake (original)
+++ incubator/buildr/trunk/rakelib/package.rake Mon Apr 7 22:45:34 2008
@@ -22,9 +22,9 @@
desc 'Compile Java libraries used by Buildr'
task 'compile' do
- say 'Compiling Java libraries ... '
+ puts 'Compiling Java libraries ...'
sh Config::CONFIG['ruby_install_name'], '-Ilib', '-Iaddon', 'bin/buildr', 'compile'
- say 'OK'
+ puts 'OK'
end
Rake::GemPackageTask.new(spec('ruby')) do |pkg|
@@ -44,9 +44,9 @@
desc 'Uninstall previously installed packaged'
task 'uninstall' do |task|
- say "Uninstalling #{$spec.name} ... "
+ print "Uninstalling #{$spec.name} ... "
args = [Config::CONFIG['ruby_install_name'], '-S', 'gem', 'uninstall', spec.name, '--version', spec.version]
args.unshift('sudo') unless windows?
sh *args
- say 'Done'
+ puts 'Done'
end
Modified: incubator/buildr/trunk/rakelib/release.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/release.rake?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/release.rake (original)
+++ incubator/buildr/trunk/rakelib/release.rake Mon Apr 7 22:45:34 2008
@@ -17,7 +17,7 @@
begin
require 'rubyforge'
rescue LoadError
- say 'Please run rake setup to install the RubyForge gem'
+ puts 'Please run rake setup to install the RubyForge gem'
task 'setup' do
install_gem 'rubyforge'
end
@@ -40,11 +40,11 @@
# Does CHANGELOG reflects current release?
task 'check' do
- say 'Checking that CHANGELOG indicates most recent version and today\'s date ... '
+ print 'Checking that CHANGELOG indicates most recent version and today\'s date ... '
expecting = "#{ruby_spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
header = File.readlines('CHANGELOG').first
fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
- say 'OK'
+ puts 'OK'
end
# No local changes.
@@ -62,16 +62,16 @@
task 'rubyforge'=>'pacakge' do
# Read the changes for this release.
- say 'Looking for changes between this release and previous one ... '
+ print 'Looking for changes between this release and previous one ... '
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]
current = changes[spec.version.to_s.split('.')[0..-2].join('.')] if !current && spec.version.to_s =~ /\.0$/
fail "No changeset found for version #{spec.version}" unless current
- say 'OK'
+ puts 'OK'
- say "Uploading #{spec.version} to RubyForge ... "
+ print "Uploading #{spec.version} to RubyForge ... "
files = Dir.glob('pkg/*.{gem,tgz,zip}')
rubyforge = RubyForge.new
rubyforge.login
@@ -79,31 +79,31 @@
rubyforge.userconfig.merge!('release_changes' => '.changes', 'preformatted' => true)
rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version, *files
rm '.changes'
- say 'Done'
+ puts 'Done'
end
# Tag this release in SVN.
task 'tag' do
- say "Tagging release as tags/#{ruby_spec.version} ... "
+ print "Tagging release as tags/#{ruby_spec.version} ... "
cur_url = `svn info`.scan(/URL: (.*)/)[0][0]
new_url = cur_url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{ruby_spec.version.to_s}")
sh 'svn', 'copy', cur_url, new_url, '-m', "Release #{ruby_spec.version.to_s}", :verbose=>false
- say "OK"
+ puts "OK"
end
# Update lib/buildr.rb to next vesion number, add new entry in CHANGELOG.
task 'next_version'=>'tag' do
next_version = ruby_spec.version.to_ints.zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
- say "Updating lib/buildr.rb to next version number (#{next_version}) ... "
+ print "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}" }
File.open(__FILE__.pathmap('%d/lib/buildr.rb'), 'w') { |file| file.write buildr_rb }
- say "OK"
+ puts "OK"
- say 'Adding new entry to CHANGELOG ... '
+ print 'Adding new entry to CHANGELOG ... '
changelog = File.read(__FILE__.pathmap('%d/CHANGELOG'))
File.open(__FILE__.pathmap('%d/CHANGELOG'), 'w') { |file| file.write "#{next_version} (Pending)\n\n#{changelog}" }
- say "OK"
+ puts "OK"
end
task 'wrapup'=>['tag', 'next_version']
Modified: incubator/buildr/trunk/rakelib/rspec.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/rspec.rake?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/rspec.rake (original)
+++ incubator/buildr/trunk/rakelib/rspec.rake Mon Apr 7 22:45:34 2008
@@ -51,7 +51,7 @@
end
rescue LoadError
- say 'Please run rake setup to install RSpec'
+ puts 'Please run rake setup to install RSpec'
task 'release:check' do
fail 'Please run rake setup to install RSpec'
end
@@ -62,13 +62,13 @@
namespace 'spec' do
desc 'Run all specs specifically with Ruby'
task 'ruby' do
- say 'Running test suite using Ruby ...'
+ puts 'Running test suite using Ruby ...'
sh 'ruby -S rake spec'
end
desc 'Run all specs specifically with JRuby'
task 'jruby' do
- say 'Running test suite using JRuby ...'
+ puts 'Running test suite using JRuby ...'
sh 'jruby -S rake spec'
end
end
@@ -76,19 +76,19 @@
namespace 'release' do
# Full test suite depends on having JRuby, Scala and Groovy installed.
task 'check' do
- say 'Checking that we have JRuby, Scala and Groovy available ... '
+ print 'Checking that we have JRuby, Scala and Groovy available ... '
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'
+ puts 'OK'
end
# Release requires RSpec and test coverage reports, uploaded as part of site.
# Primary test environment is Ruby (RCov), also test on JRuby.
task 'prepare'=>['compile', 'reports', 'spec:jruby'] do
- say 'Checking that we have specs and coverage report ... '
+ print 'Checking that we have specs and coverage report ... '
fail 'No specifications in site directory!' unless File.exist?('site/specs.html')
fail 'No coverage reports in site directory!' unless File.exist?('site/coverage/index.html')
- say 'OK'
+ puts 'OK'
end
end
Modified: incubator/buildr/trunk/rakelib/setup.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/setup.rake?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/setup.rake (original)
+++ incubator/buildr/trunk/rakelib/setup.rake Mon Apr 7 22:45:34 2008
@@ -1,5 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
# True if running on the Windows operating sytem. Different from Gem.win_platform?
# which returns true if running on the Windows platform of MRI, false when using JRuby.
+
+
def windows?
Config::CONFIG['host_os'] =~ /windows|cygwin|bccwin|cygwin|djgpp|mingw|mswin|wince/i
end
Modified: incubator/buildr/trunk/spec/spec_helpers.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/spec_helpers.rb?rev=645768&r1=645767&r2=645768&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/spec_helpers.rb (original)
+++ incubator/buildr/trunk/spec/spec_helpers.rb Mon Apr 7 22:45:34 2008
@@ -38,10 +38,12 @@
$warning ||= []
$warning << message
end
+ end
- alias :warn_deprecated_without_capture :warn_deprecated
- def warn_deprecated(message)
- verbose(true) { warn_deprecated_without_capture message }
+ class << Buildr.application
+ alias :deprecated_without_capture :deprecated
+ def deprecated(message)
+ verbose(true) { deprecated_without_capture message }
end
end