Author: assaf
Date: Tue Mar 25 22:23:15 2008
New Revision: 641156
URL: http://svn.apache.org/viewvc?rev=641156&view=rev
Log:
BUILDR-55
Modified:
incubator/buildr/trunk/Rakefile
incubator/buildr/trunk/lib/core/common.rb
incubator/buildr/trunk/lib/java/groovyc.rb
Modified: incubator/buildr/trunk/Rakefile
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/Rakefile?rev=641156&r1=641155&r2=641156&view=diff
==============================================================================
--- incubator/buildr/trunk/Rakefile (original)
+++ incubator/buildr/trunk/Rakefile Tue Mar 25 22:23:15 2008
@@ -78,7 +78,7 @@
options = Hash === args.last ? args.pop : {}
#options[:verbose] ||= false
cmd = []
- cmd << 'sudo' if options.delete(:sudo) && !Gem.win_platform? &&
RUBY_PLATFORM !~ /java/
+ cmd << 'sudo' if options.delete(:sudo) && !Gem.win_platform?
cmd << Config::CONFIG['ruby_install_name']
cmd << '-S' << options.delete(:command) if options[:command]
sh *cmd.push(*args.flatten).push(options)
Modified: incubator/buildr/trunk/lib/core/common.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/common.rb?rev=641156&r1=641155&r2=641156&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/common.rb (original)
+++ incubator/buildr/trunk/lib/core/common.rb Tue Mar 25 22:23:15 2008
@@ -176,30 +176,35 @@
end
-class OpenObject < BasicObject
- def initialize(hash = nil, &block)
+class OpenObject < Hash
+
+ def initialize(source=nil, &block)
@hash = Hash.new(&block)
- @hash.update(hash) if hash
+ @hash.update(source) if source
end
- def method_missing(symbol, *args)
- if symbol.to_s =~ /=$/
- self[symbol.to_s[0..-2].to_sym] = args.first
- else
- self[symbol]
- end
+ def [](key)
+ @hash[key]
end
def []=(key, value)
@hash[key] = value
end
- def [](key)
- @hash[key]
+ def delete(key)
+ @hash.delete(key)
end
def to_hash
@hash.clone
+ end
+
+ def method_missing(symbol, *args)
+ if symbol.to_s =~ /=$/
+ self[symbol.to_s[0..-2].to_sym] = args.first
+ else
+ self[symbol]
+ end
end
end
Modified: incubator/buildr/trunk/lib/java/groovyc.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/groovyc.rb?rev=641156&r1=641155&r2=641156&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/groovyc.rb (original)
+++ incubator/buildr/trunk/lib/java/groovyc.rb Tue Mar 25 22:23:15 2008
@@ -114,14 +114,14 @@
private
def groovyc_options(sources, target)
check_options options, OPTIONS
- groovyc_options = options.only(*GROOVYC_OPTIONS)
+ groovyc_options = options.to_hash.only(*GROOVYC_OPTIONS)
groovyc_options[:destdir] = File.expand_path(target)
groovyc_options
end
def javac_options
check_options options, OPTIONS
- javac_options = options.only(*JAVAC_OPTIONS)
+ javac_options = options.to_hash.only(*JAVAC_OPTIONS)
javac_options[:optimize] = (javac_options.delete(:optimise) || false)
javac_options[:nowarn] = (javac_options.delete(:warnings) ||
verbose).to_s !~ /^(true|yes|on)$/i
other = javac_options.delete(:javac) || {}