You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2009/11/23 18:44:59 UTC

svn commit: r883432 - in /buildr/trunk: CHANGELOG lib/buildr/core/application.rb lib/buildr/packaging/artifact.rb spec/core/application_spec.rb

Author: boisvert
Date: Mon Nov 23 17:44:58 2009
New Revision: 883432

URL: http://svn.apache.org/viewvc?rev=883432&view=rev
Log:
Load buildr.rb from $HOME/.buildr instead of $HOME
($HOME/buildr.rb is still loaded with deprecation warning)


Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/core/application.rb
    buildr/trunk/lib/buildr/packaging/artifact.rb
    buildr/trunk/spec/core/application_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=883432&r1=883431&r2=883432&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Mon Nov 23 17:44:58 2009
@@ -15,6 +15,8 @@
 * Change: Updated to JRuby 1.4.0
 * Change: Updated to JtestR 0.5
 * Change: Updated to JUnit 4.7
+* Change: Load buildr.rb from $HOME/.buildr instead of $HOME
+          ($HOME/buildr.rb is still loaded with deprecation warning)
 * Fixed:  BUILDR-223 Release Task: customizable commit message (Alexis Midon)
 * Fixed:  BUILDR-330  Install task should re-install artifact even if they 
           already exist (Alexis Midon)

Modified: buildr/trunk/lib/buildr/core/application.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/application.rb?rev=883432&r1=883431&r2=883432&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/application.rb (original)
+++ buildr/trunk/lib/buildr/core/application.rb Mon Nov 23 17:44:58 2009
@@ -444,11 +444,17 @@
       Buildr::ArtifactNamespace.load(:root => hash)
     end
     
-    # Loads buildr.rb files from users home directory and project directory.
+    # Loads buildr.rb files from home/.buildr directory and project directory.
     # Loads custom tasks from .rake files in tasks directory.
     def load_tasks #:nodoc:
       # TODO: this might need to be split up, look for deprecated features, better method name.
-      files = [ File.expand_path('buildr.rb', ENV['HOME']), 'buildr.rb' ].select { |file| File.exist?(file) }
+      old = File.expand_path('buildr.rb', ENV['HOME'])
+      new = File.expand_path('buildr.rb', home_dir)
+      if File.exist?(old) && !File.exist?(new) 
+        warn "Deprecated: Please move buildr.rb from your home directory to the .buildr directory in your home directory"
+      end
+      # Load home/.buildr/buildr.rb in preference
+      files = [ File.exist?(new) ? new : old, 'buildr.rb' ].select { |file| File.exist?(file) }
       files += [ File.expand_path('buildr.rake', ENV['HOME']), File.expand_path('buildr.rake') ].
         select { |file| File.exist?(file) }.each { |file| warn "Please use '#{file.ext('rb')}' instead of '#{file}'" }
       files += (options.rakelib || []).collect { |rlib| Dir["#{rlib}/*.rake"] }.flatten

Modified: buildr/trunk/lib/buildr/packaging/artifact.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/artifact.rb?rev=883432&r1=883431&r2=883432&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/artifact.rb (original)
+++ buildr/trunk/lib/buildr/packaging/artifact.rb Mon Nov 23 17:44:58 2009
@@ -458,8 +458,9 @@
     # Sets the path to the local repository.
     #
     # The best place to set the local repository path is from a buildr.rb file
-    # located in your home directory. That way all your projects will share the same
-    # path, without affecting other developers collaborating on these projects.
+    # located in the .buildr directory under your home directory. That way all 
+    # your projects will share the same path, without affecting other developers 
+    # collaborating on these projects.
     def local=(dir)
       @local = dir ? File.expand_path(dir) : nil
     end

Modified: buildr/trunk/spec/core/application_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/application_spec.rb?rev=883432&r1=883431&r2=883432&view=diff
==============================================================================
--- buildr/trunk/spec/core/application_spec.rb (original)
+++ buildr/trunk/spec/core/application_spec.rb Mon Nov 23 17:44:58 2009
@@ -470,11 +470,18 @@
       Buildr.application.buildfile.timestamp.should be_close(@buildfile_time, 1)
     end
     
-    it 'should have the same timestamp as build.rb in home dir if the latter is newer' do
+    it 'should have the same timestamp as build.rb in home dir if the latter is newer (until version 1.6)' do
+      Buildr::VERSION.should < '1.6'
       write 'home/buildr.rb'; File.utime(@buildfile_time + 5, @buildfile_time + 5, 'home/buildr.rb')
       Buildr.application.send :load_tasks
       Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
     end
+
+    it 'should have the same timestamp as build.rb in home dir if the latter is newer' do
+      write 'home/.buildr/buildr.rb'; File.utime(@buildfile_time + 5, @buildfile_time + 5, 'home/buildr.rb')
+      Buildr.application.send :load_tasks
+      Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
+    end
   end
 end