buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbo...@apache.org
Subject svn commit: r645353 - in /incubator/buildr/trunk: ./ addon/buildr/ lib/ lib/buildr/ lib/buildr/core/ lib/buildr/java/ rakelib/ spec/
Date Mon, 07 Apr 2008 03:35:30 GMT
Author: vborja
Date: Sun Apr  6 20:35:24 2008
New Revision: 645353

URL: http://svn.apache.org/viewvc?rev=645353&view=rev
Log:
Fixed some Windows issues

Modified:
    incubator/buildr/trunk/Rakefile
    incubator/buildr/trunk/addon/buildr/jdepend.rb
    incubator/buildr/trunk/addon/buildr/nailgun.rb
    incubator/buildr/trunk/buildfile
    incubator/buildr/trunk/lib/buildr.rb
    incubator/buildr/trunk/lib/buildr/core.rb
    incubator/buildr/trunk/lib/buildr/core/addon.rb
    incubator/buildr/trunk/lib/buildr/core/application.rb
    incubator/buildr/trunk/lib/buildr/core/common.rb
    incubator/buildr/trunk/lib/buildr/core/util.rb
    incubator/buildr/trunk/lib/buildr/java/commands.rb
    incubator/buildr/trunk/lib/buildr/java/packaging.rb
    incubator/buildr/trunk/rakelib/doc.rake
    incubator/buildr/trunk/spec/java_packaging_spec.rb

Modified: incubator/buildr/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/Rakefile?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/Rakefile (original)
+++ incubator/buildr/trunk/Rakefile Sun Apr  6 20:35:24 2008
@@ -15,7 +15,11 @@
 
 # Load file/system utilities used shared between Buildr's runtime and this Rakefile
 require File.expand_path('lib/buildr/core/util', File.dirname(__FILE__))
-extend Buildr::SystemUtil
+extend Buildr::Util
+
+class << self
+  alias_method :say, :puts
+end unless respond_to?(:say)
 
 # We need two specifications, for Ruby and Java, and one for the platform we run on.
 $specs = ['ruby', 'java'].inject({}) { |hash, platform|
@@ -71,7 +75,7 @@
 desc "If you're building from sources, run this task one to setup the necessary dependencies."
 task 'setup' do
   dependencies = $spec.dependencies
-  dependencies << Gem::Dependency.new('win32console', nil) if Gem.win_platform? # Colors
for RSpec.
+  dependencies << Gem::Dependency.new('win32console', '> 0') if win_os? # Colors
for RSpec.
   install_gems(*dependencies)
 end
 

Modified: incubator/buildr/trunk/addon/buildr/jdepend.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/addon/buildr/jdepend.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/addon/buildr/jdepend.rb (original)
+++ incubator/buildr/trunk/addon/buildr/jdepend.rb Sun Apr  6 20:35:24 2008
@@ -33,7 +33,7 @@
 
       def paths()
         Project.projects.map(&:compile).each(&:invoke).map(&:target).
-          map(&:to_s).select { |path| File.exist?(path) }.map { |path| FileUtil.normalize_path(path)
}
+          map(&:to_s).select { |path| File.exist?(path) }.map { |path| File.expand_path(path)
}
       end
 
     end

Modified: incubator/buildr/trunk/addon/buildr/nailgun.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/addon/buildr/nailgun.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/addon/buildr/nailgun.rb (original)
+++ incubator/buildr/trunk/addon/buildr/nailgun.rb Sun Apr  6 20:35:24 2008
@@ -841,8 +841,8 @@
         puts "Starting #{$nailgun_server}"
         $nailgun_server.start_server
 
-        is_win = SystemUtil.win_os?
-        bin_path = FileUtil.normalize_path(installed_bin.to_s.pathmap("%d"))
+        is_win = Util.win_os?
+        bin_path = File.expand_path(installed_bin.to_s.pathmap("%d"))
         bin_name = installed_bin.to_s.pathmap("%f")
 
         puts <<-NOTICE
@@ -862,7 +862,7 @@
         Runtime for #{Rake.application.buildfile} has been cached, this 
         means you can open a terminal inside 
 
-              #{FileUtil.normalize_path(Rake.application.buildfile.pathmap("%d"))}
+              #{Rake.application.buildfile.pathmap("%d")}
 
         Invoke tasks by executing the #{bin_name} program, it takes the
         same parameters you normally use for ``buildr''. 

Modified: incubator/buildr/trunk/buildfile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/buildfile?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/buildfile (original)
+++ incubator/buildr/trunk/buildfile Sun Apr  6 20:35:24 2008
@@ -15,7 +15,7 @@
 
 $LOADED_FEATURES << 'jruby' unless RUBY_PLATFORM =~ /java/ # Pretend to have JRuby,
keeps Nailgun happy.
 require 'buildr/jetty'
-require 'buildr/java/nailgun'
+require 'buildr/nailgun'
 repositories.remote << 'http://repo1.maven.org/maven2'
 
 

Modified: incubator/buildr/trunk/lib/buildr.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr.rb (original)
+++ incubator/buildr/trunk/lib/buildr.rb Sun Apr  6 20:35:24 2008
@@ -24,17 +24,14 @@
 require 'highline/import'
 require 'builder' # A different kind of buildr, one we use to create XML.
 
-
 module Buildr
   VERSION = '1.3.0'.freeze # unless const_defined?(:VERSION)
 end
 
-
 require 'buildr/core'
 require 'buildr/tasks'
 require 'buildr/java'
 require 'buildr/ide'
-
 
 # Methods defined in Buildr are both instance methods (e.g. when included in Project)
 # and class methods when invoked like Buildr.artifacts().

Modified: incubator/buildr/trunk/lib/buildr/core.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core.rb Sun Apr  6 20:35:24 2008
@@ -14,6 +14,7 @@
 # the License.
 
 
+require 'buildr/core/common'
 require 'buildr/core/application'
 require 'buildr/core/project'
 require 'buildr/core/environment'

Modified: incubator/buildr/trunk/lib/buildr/core/addon.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/addon.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/addon.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/addon.rb Sun Apr  6 20:35:24 2008
@@ -34,11 +34,11 @@
     end
 
     def install
-      SystemUtil.ruby 'install', name, :command => 'gem', :sudo => true
+      Util.ruby 'install', name, :command => 'gem', :sudo => true
     end
 
     def uninstall
-      SystemUtil.ruby 'uninstall', spec.name, '-v', spec.version.to_s, :command => 'gem',
:sudo => true
+      Util.ruby 'uninstall', spec.name, '-v', spec.version.to_s, :command => 'gem', :sudo
=> true
     end
 
     def upload

Modified: incubator/buildr/trunk/lib/buildr/core/application.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/application.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/application.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/application.rb Sun Apr  6 20:35:24 2008
@@ -46,8 +46,7 @@
 ENV['BUILDR_ENV'] ||= 'development'
 
 # Add a touch of colors (red) to warnings.
-HighLine.use_color = !Gem.win_platform?
-
+HighLine.use_color = !Buildr::Util.win_os?
 
 module Buildr
 
@@ -188,7 +187,7 @@
         end
         install.each do |spec|
           say "Installing #{spec.full_name} ... " if verbose
-          SystemUtil.ruby 'install', spec.name, '-v', spec.version.to_s, :command => 'gem',
:sudo => true, :verbose => false
+          Util.ruby 'install', spec.name, '-v', spec.version.to_s, :command => 'gem',
:sudo => true, :verbose => false
           Gem.source_index.load_gems_in Gem::SourceIndex.installed_spec_directories
         end
         installed += install

Modified: incubator/buildr/trunk/lib/buildr/core/common.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/common.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/common.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/common.rb Sun Apr  6 20:35:24 2008
@@ -13,14 +13,13 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
-
 require 'tempfile'
 require 'pathname'
-require 'buildr/core/transports'
 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

Modified: incubator/buildr/trunk/lib/buildr/core/util.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/util.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/util.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/util.rb Sun Apr  6 20:35:24 2008
@@ -17,7 +17,7 @@
 
 module Buildr
   
-  module SystemUtil
+  module Util
     extend self
 
     def java_platform?
@@ -56,14 +56,15 @@
     def ruby(*args)
       options = Hash === args.last ? args.pop : {}
       cmd = []
-      ruby_bin = FileUtil.normalize_path(Config::CONFIG['ruby_install_name'], Config::CONFIG['bindir'])
-      euid, ruby_uid = Process.uid, File.stat(ruby_bin).uid
-      if options.delete(:sudo) && !win_os? && euid != ruby_uid
-        cmd << 'sudo' << '-u' << '##{ruby_uid}'
+      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}'
       end
       cmd << ruby_bin
       cmd << '-S' << options.delete(:command) if options[:command]
-      Rake.application.sh *cmd.push(*args.flatten).push(options)
+      Rake.application.send :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
 
     # :call-seq:
@@ -75,28 +76,31 @@
         case gem
         when Gem::Dependency then gem
         when Array then Gem::Dependency.new(*gem)
-        when String then Gem::Dependency.new(gem, nil)
+        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} ..."
-        ruby 'install', dep.name, '-v', dep.version_requirements.to_s, :command=>'gem',
:sudo=>true
+        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
-  end
-  
-  module FileUtil
-    extend self
 
     # Just like File.expand_path, but for windows systems it
     # capitalizes the drive name and ensures backslashes are used
-    #
-    # Use this function when you want to execute a shell command 
-    # with a full path name.
     def normalize_path(path, *dirs)
       path = File.expand_path(path, *dirs)
-      if SystemUtil.win_os?
+      if win_os?
         path.gsub!('/', '\\').gsub!(/^[a-zA-Z]+:/) { |s| s.upcase }
       else
         path

Modified: incubator/buildr/trunk/lib/buildr/java/commands.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/commands.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/commands.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/commands.rb Sun Apr  6 20:35:24 2008
@@ -189,7 +189,7 @@
       # Returns the path to the specified Java command (with no argument to java itself).
       def path_to_bin(name = nil)
         home = ENV['JAVA_HOME'] or fail 'Are we forgetting something? JAVA_HOME not set.'
-        FileUtil.normalize_path(File.join(home, 'bin', name.to_s))
+        File.expand_path(File.join(home, 'bin', name.to_s))
       end
 
       # :call-seq:
@@ -199,7 +199,7 @@
       # each of the artifacts and returns an array of paths.
       def classpath_from(options)
         Buildr.artifacts(options[:classpath] || []).map(&:to_s).
-          map { |t| task(t).invoke; FileUtil.normalize_path(t) }
+          map { |t| task(t).invoke; File.expand_path(t) }
       end
 
     end

Modified: incubator/buildr/trunk/lib/buildr/java/packaging.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/packaging.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/packaging.rb Sun Apr  6 20:35:24 2008
@@ -354,7 +354,7 @@
               component = options.merge(:artifact => artifact, :type => type, 
                 :id=>artifact.respond_to?(:to_spec) ? artifact.id : artifact.to_s.pathmap('%n'),
                 :path=>options[:path] || dirs[type].to_s)
-              update_classpath(component) unless :lib == type
+              update_classpath(component) unless :lib == type || Artifact === artifact
               @components << component
             end
           end

Modified: incubator/buildr/trunk/rakelib/doc.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/doc.rake?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/doc.rake (original)
+++ incubator/buildr/trunk/rakelib/doc.rake Sun Apr  6 20:35:24 2008
@@ -32,7 +32,7 @@
 rescue LoadError
   puts 'Please run rake setup to install the Allison RDoc template'
   task 'setup' do
-    ruby 'install', 'allison', :command=>'gem', :sudo=>true
+    install_gems 'allison'
   end
   task 'release:check' do
     fail 'Please run rake setup to install the Allison RDoc template'
@@ -67,7 +67,7 @@
 rescue LoadError
   puts 'Please run rake setup to install the Docter document generation library'
   task 'setup' do
-    ruby 'install', 'docter', :command=>'gem', :sudo=>true
+    install_gems 'docter'
   end
   task 'release:check' do
     fail 'Please run rake setup to install the Docter document generation library'

Modified: incubator/buildr/trunk/spec/java_packaging_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/java_packaging_spec.rb?rev=645353&r1=645352&r2=645353&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/java_packaging_spec.rb (original)
+++ incubator/buildr/trunk/spec/java_packaging_spec.rb Sun Apr  6 20:35:24 2008
@@ -637,7 +637,26 @@
     inspect_ear { |files| files.should include('ejb/foo-1.0.jar') }
   end
 
-  it 'should accept an artifact with component type' do
+  it 'should accept an artifact as non-lib component, without updating its manifest' do
+    define 'bar', :version => '1.0' do
+      write 'hello', 'world'
+      package(:zip).include('hello')
+      package(:zip).manifest = {'Class-Path' => 'bar'}
+      package(:zip).invoke
+      artifact('hello:world:jar:1.0').from(package(:zip).to_s)
+      package(:jar)
+    end
+    define 'foo', :version => '1.0' do
+      package(:ear).add project(:bar).package(:jar)
+      package(:ear).add :ejb => 'hello:world:jar:1.0'
+    end
+    inspect_ear { |files| files.should include('ejb/world-1.0.jar', 'lib/bar-1.0.jar') }
+    inspect_classpath 'ejb/world-1.0.jar'do |classpath|
+      classpath.should == ['bar'] # should not be updated by EarTask
+    end
+  end
+
+  it 'should accept an artifact clone with component type' do
     define 'foo', :version=>'1.0' do
       write 'src/main/resources/foo', 'true'
       artifact("foo:bar:jar:1.0").from(package(:jar, :id => 'muu').to_s)



Mime
View raw message