[macruby-changes] [2486] MacRuby/trunk/rakelib/upstream_git_repo_tasks.rb

source_changes at macosforge.org source_changes at macosforge.org
Sat Sep 5 09:25:18 PDT 2009


Revision: 2486
          http://trac.macosforge.org/projects/ruby/changeset/2486
Author:   eloy.de.enige at gmail.com
Date:     2009-09-05 09:25:15 -0700 (Sat, 05 Sep 2009)
Log Message:
-----------
Made the rubyspec update process a little bit easier.

Modified Paths:
--------------
    MacRuby/trunk/rakelib/upstream_git_repo_tasks.rb

Modified: MacRuby/trunk/rakelib/upstream_git_repo_tasks.rb
===================================================================
--- MacRuby/trunk/rakelib/upstream_git_repo_tasks.rb	2009-09-05 08:35:17 UTC (rev 2485)
+++ MacRuby/trunk/rakelib/upstream_git_repo_tasks.rb	2009-09-05 16:25:15 UTC (rev 2486)
@@ -13,8 +13,12 @@
     define
   end
   
+  def upstream_rev_file
+    File.read(File.join(@local_dir, 'upstream'))
+  end
+  
   def upstream_rev
-    @upstream_rev ||= ENV['REV'] || File.read(File.join(@local_dir, 'upstream'))
+    @upstream_rev ||= ENV['REV'] || upstream_rev_file
   end
   
   def define
@@ -104,13 +108,19 @@
           desc "Creates patch since upstream revision `#{upstream_rev}' and applies it"
           task :patch do
             patch = File.join(@local_dir, 'upstream_patch.diff')
+            new_rev = nil
+
             Dir.chdir(@upstream_dir) do
               git_checkout('master')
+              new_rev = `git log -i -1 --pretty=format:%H`.strip
               sh "git diff #{upstream_rev} > #{patch}"
             end
             Dir.chdir(@local_dir) do
-              sh "/usr/bin/patch -p1 < #{patch}"
+              sh "/usr/bin/patch -p1 < #{patch}" rescue nil
             end
+
+            rm patch
+            File.open(upstream_rev_file, 'w') { |f| f << new_rev }
           end
 
           desc "Remove the `#{@upstream_options[:branch]}' branch and switch to the `master' branch (cleans all untracked files!)"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090905/e64ecdee/attachment.html>


More information about the macruby-changes mailing list