<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,12 +5,12 @@ require 'date'
 require 'git'
 
 module GithubGem
-  
+
   # Detects the gemspc file of this project using heuristics.
   def self.detect_gemspec_file
     FileList['*.gemspec'].first
   end
-  
+
   # Detects the main include file of this project using heuristics
   def self.detect_main_include
     if detect_gemspec_file =~ /^(\.*)\.gemspec$/ &amp;&amp; File.exist?(&quot;lib/#{$1}.rb&quot;)
@@ -18,16 +18,16 @@ module GithubGem
     elsif FileList['lib/*.rb'].length == 1
       FileList['lib/*.rb'].first
     else
-      raise &quot;Could not detect main include file!&quot;
+      nil
     end
   end
-  
+
   class RakeTasks
-    
+
     attr_reader   :gemspec, :modified_files, :git
     attr_accessor :gemspec_file, :task_namespace, :main_include, :root_dir, :spec_pattern, :test_pattern, :remote, :remote_branch, :local_branch
-    
-    # Initializes the settings, yields itself for configuration 
+
+    # Initializes the settings, yields itself for configuration
     # and defines the rake tasks based on the gemspec file.
     def initialize(task_namespace = :gem)
       @gemspec_file   = GithubGem.detect_gemspec_file
@@ -40,16 +40,16 @@ module GithubGem
       @local_branch   = 'master'
       @remote         = 'origin'
       @remote_branch  = 'master'
-      
+
       yield(self) if block_given?
 
       @git = Git.open(@root_dir)
       load_gemspec!
       define_tasks!
     end
-    
+
     protected
-    
+
     # Define Unit test tasks
     def define_test_tasks!
       require 'rake/testtask'
@@ -61,11 +61,11 @@ module GithubGem
           t.libs &lt;&lt; 'test'
         end
       end
-      
+
       desc &quot;Run all unit tests for #{gemspec.name}&quot;
       task(:test =&gt; ['test:basic'])
     end
-    
+
     # Defines RSpec tasks
     def define_rspec_tasks!
       require 'spec/rake/spectask'
@@ -75,128 +75,128 @@ module GithubGem
         Spec::Rake::SpecTask.new(:basic) do |t|
           t.spec_files = FileList[spec_pattern]
         end
-        
+
         desc &quot;Verify all RSpec examples for #{gemspec.name} and output specdoc&quot;
         Spec::Rake::SpecTask.new(:specdoc) do |t|
           t.spec_files = FileList[spec_pattern]
           t.spec_opts &lt;&lt; '--format' &lt;&lt; 'specdoc' &lt;&lt; '--color'
         end
-        
+
         desc &quot;Run RCov on specs for #{gemspec.name}&quot;
         Spec::Rake::SpecTask.new(:rcov) do |t|
           t.spec_files = FileList[spec_pattern]
           t.rcov = true
-          t.rcov_opts = ['--exclude', '&quot;spec/*,gems/*&quot;', '--rails']          
-        end          
+          t.rcov_opts = ['--exclude', '&quot;spec/*,gems/*&quot;', '--rails']
+        end
       end
-      
+
       desc &quot;Verify all RSpec examples for #{gemspec.name} and output specdoc&quot;
-      task(:spec =&gt; ['spec:specdoc'])      
+      task(:spec =&gt; ['spec:specdoc'])
     end
-    
+
     # Defines the rake tasks
     def define_tasks!
-      
+
       define_test_tasks!  if has_tests?
       define_rspec_tasks! if has_specs?
-      
+
       namespace(@task_namespace) do
         desc &quot;Updates the filelist in the gemspec file&quot;
-        task(:manifest) { manifest_task } 
-        
+        task(:manifest) { manifest_task }
+
         desc &quot;Builds the .gem package&quot;
         task(:build =&gt; :manifest) { build_task }
 
         desc &quot;Sets the version of the gem in the gemspec&quot;
         task(:set_version =&gt; [:check_version, :check_current_branch]) { version_task }
-        task(:check_version =&gt; :fetch_origin) { check_version_task }      
-        
+        task(:check_version =&gt; :fetch_origin) { check_version_task }
+
         task(:fetch_origin) { fetch_origin_task }
-        task(:check_current_branch) { check_current_branch_task }        
+        task(:check_current_branch) { check_current_branch_task }
         task(:check_clean_status) { check_clean_status_task }
         task(:check_not_diverged =&gt; :fetch_origin) { check_not_diverged_task }
-        
+
         checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]
         checks.unshift('spec:basic') if has_specs?
         checks.unshift('test:basic') if has_tests?
         checks.push &lt;&lt; [:check_rubyforge] if gemspec.rubyforge_project
-                
+
         desc &quot;Perform all checks that would occur before a release&quot;
-        task(:release_checks =&gt; checks) 
+        task(:release_checks =&gt; checks)
 
         release_tasks = [:release_checks, :set_version, :build, :github_release]
         release_tasks &lt;&lt; [:rubyforge_release] if gemspec.rubyforge_project
-        
+
         desc &quot;Release a new verison of the gem&quot;
         task(:release =&gt; release_tasks) { release_task }
-        
+
         task(:check_rubyforge)   { check_rubyforge_task }
         task(:rubyforge_release) { rubyforge_release_task }
         task(:github_release =&gt; [:commit_modified_files, :tag_version]) { github_release_task }
         task(:tag_version) { tag_version_task }
         task(:commit_modified_files) { commit_modified_files_task }
-        
+
         desc &quot;Updates the gem release tasks with the latest version on Github&quot;
         task(:update_tasks) { update_tasks_task }
       end
     end
-    
+
     # Updates the files list and test_files list in the gemspec file using the list of files
     # in the repository and the spec/test file pattern.
     def manifest_task
       # Load all the gem's files using &quot;git ls-files&quot;
       repository_files = git.ls_files.keys
       test_files       = Dir[test_pattern] + Dir[spec_pattern]
-      
+
       update_gemspec(:files, repository_files)
       update_gemspec(:test_files, repository_files &amp; test_files)
     end
-    
+
     # Builds the gem
     def build_task
       sh &quot;gem build -q #{gemspec_file}&quot;
       Dir.mkdir('pkg') unless File.exist?('pkg')
-      sh &quot;mv #{gemspec.name}-#{gemspec.version}.gem pkg/#{gemspec.name}-#{gemspec.version}.gem&quot; 
+      sh &quot;mv #{gemspec.name}-#{gemspec.version}.gem pkg/#{gemspec.name}-#{gemspec.version}.gem&quot;
     end
-    
+
     # Updates the version number in the gemspec file, the VERSION constant in the main
     # include file and the contents of the VERSION file.
     def version_task
       update_gemspec(:version, ENV['VERSION']) if ENV['VERSION']
       update_gemspec(:date, Date.today)
-      
+
       update_version_file(gemspec.version)
       update_version_constant(gemspec.version)
     end
-    
+
     def check_version_task
       raise &quot;#{ENV['VERSION']} is not a valid version number!&quot; if ENV['VERSION'] &amp;&amp; !Gem::Version.correct?(ENV['VERSION'])
       proposed_version = Gem::Version.new(ENV['VERSION'] || gemspec.version)
       # Loads the latest version number using the created tags
-      newest_version   = git.tags.map { |tag| tag.name.split('-').last }.compact.map { |v| Gem::Version.new(v) }.max      
+      newest_version   = git.tags.map { |tag| tag.name.split('-').last }.compact.map { |v| Gem::Version.new(v) }.max
       raise &quot;This version (#{proposed_version}) is not higher than the highest tagged version (#{newest_version})&quot; if newest_version &amp;&amp; newest_version &gt;= proposed_version
     end
-    
+
     # Checks whether the current branch is not diverged from the remote branch
     def check_not_diverged_task
-      raise &quot;The current branch is diverged from the remote branch!&quot; if git.log.between('HEAD', git.branches[&quot;#{remote}/#{remote_branch}&quot;].gcommit).any?
+      raise &quot;The current branch is diverged from the remote branch!&quot; if git.log.between('HEAD', git.remote(remote).branch(remote_branch).gcommit).any?
     end
-    
+
     # Checks whether the repository status ic clean
     def check_clean_status_task
       raise &quot;The current working copy contains modifications&quot; if git.status.changed.any?
     end
-    
+
     # Checks whether the current branch is correct
     def check_current_branch_task
       raise &quot;Currently not on #{local_branch} branch!&quot; unless git.branch.name == local_branch.to_s
     end
-    
+
     # Fetches the latest updates from Github
     def fetch_origin_task
       git.fetch('origin')
     end
-    
+
     # Commits every file that has been changed by the release task.
     def commit_modified_files_task
       if modified_files.any?
@@ -204,30 +204,31 @@ module GithubGem
         git.commit(&quot;Released #{gemspec.name} gem version #{gemspec.version}&quot;)
       end
     end
-    
+
     # Adds a tag for the released version
     def tag_version_task
       git.add_tag(&quot;#{gemspec.name}-#{gemspec.version}&quot;)
     end
-    
+
     # Pushes the changes and tag to github
     def github_release_task
       git.push(remote, remote_branch, true)
     end
-    
+
     # Checks whether Rubyforge is configured properly
     def check_rubyforge_task
-      raise &quot;Could not login on rubyforge!&quot; unless `rubyforge login 2&gt;&amp;1`.strip.empty?
+      # Login no longer necessary when using rubyforge 2.0.0 gem
+      # raise &quot;Could not login on rubyforge!&quot; unless `rubyforge login 2&gt;&amp;1`.strip.empty?
       output = `rubyforge names`.split(&quot;\n&quot;)
       raise &quot;Rubyforge group not found!&quot;   unless output.any? { |line| %r[^groups\s*\:.*\b#{Regexp.quote(gemspec.rubyforge_project)}\b.*] =~ line }
-      raise &quot;Rubyforge package not found!&quot; unless output.any? { |line| %r[^packages\s*\:.*\b#{Regexp.quote(gemspec.name)}\b.*] =~ line }      
+      raise &quot;Rubyforge package not found!&quot; unless output.any? { |line| %r[^packages\s*\:.*\b#{Regexp.quote(gemspec.name)}\b.*] =~ line }
     end
-    
+
     # Task to release the .gem file toRubyforge.
     def rubyforge_release_task
       sh 'rubyforge', 'add_release', gemspec.rubyforge_project, gemspec.name, gemspec.version.to_s, &quot;pkg/#{gemspec.name}-#{gemspec.version}.gem&quot;
     end
-    
+
     # Gem release task.
     # All work is done by the task's dependencies, so just display a release completed message.
     def release_task
@@ -235,78 +236,88 @@ module GithubGem
       puts '------------------------------------------------------------'
       puts &quot;Released #{gemspec.name} version #{gemspec.version}&quot;
     end
-    
+
     private
-    
+
     # Checks whether this project has any RSpec files
     def has_specs?
       FileList[spec_pattern].any?
     end
-    
+
     # Checks whether this project has any unit test files
     def has_tests?
       FileList[test_pattern].any?
     end
-    
+
     # Loads the gemspec file
     def load_gemspec!
       @gemspec = eval(File.read(@gemspec_file))
     end
-    
+
     # Updates the VERSION file with the new version
     def update_version_file(version)
       if File.exists?('VERSION')
-        File.open('VERSION', 'w') { |f| f &lt;&lt; version.to_s } 
+        File.open('VERSION', 'w') { |f| f &lt;&lt; version.to_s }
         modified_files &lt;&lt; 'VERSION'
       end
     end
-    
+
     # Updates the VERSION constant in the main include file if it exists
     def update_version_constant(version)
-     file_contents = File.read(main_include)
-     if file_contents.sub!(/^(\s+VERSION\s*=\s*)[^\s].*$/) { $1 + version.to_s.inspect }
-       File.open(main_include, 'w') { |f| f &lt;&lt; file_contents }      
-       modified_files &lt;&lt; main_include
-     end
+      if main_include &amp;&amp; File.exist?(main_include)
+        file_contents = File.read(main_include)
+        if file_contents.sub!(/^(\s+VERSION\s*=\s*)[^\s].*$/) { $1 + version.to_s.inspect }
+          File.open(main_include, 'w') { |f| f &lt;&lt; file_contents }
+          modified_files &lt;&lt; main_include
+        end
+      end
     end
-    
+
     # Updates an attribute of the gemspec file.
     # This function will open the file, and search/replace the attribute using a regular expression.
     def update_gemspec(attribute, new_value, literal = false)
-      
+
       unless literal
         new_value = case new_value
           when Array        then &quot;%w(#{new_value.join(' ')})&quot;
           when Hash, String then new_value.inspect
-          when Date         then new_value.strftime('%Y-%m-%d').inspect 
+          when Date         then new_value.strftime('%Y-%m-%d').inspect
           else              raise &quot;Cannot write value #{new_value.inspect} to gemspec file!&quot;
         end
       end
-      
+
       spec   = File.read(gemspec_file)
       regexp = Regexp.new('^(\s+\w+\.' + Regexp.quote(attribute.to_s) + '\s*=\s*)[^\s].*$')
       if spec.sub!(regexp) { $1 + new_value }
-        File.open(gemspec_file, 'w') { |f| f &lt;&lt; spec }      
+        File.open(gemspec_file, 'w') { |f| f &lt;&lt; spec }
         modified_files &lt;&lt; gemspec_file
-            
+
         # Reload the gemspec so the changes are incorporated
         load_gemspec!
       end
     end
-    
+
     # Updates the tasks file using the latest file found on Github
     def update_tasks_task
       require 'net/http'
-      
+
       server = 'github.com'
       path   = '/wvanbergen/github-gem/raw/master/tasks/github-gem.rake'
-      
+
       Net::HTTP.start(server) do |http|
         response = http.get(path)
         open(__FILE__, &quot;w&quot;) { |file| file.write(response.body) }
       end
-      puts &quot;Updated gem release tasks file with latest version.&quot;
+
+      relative_file = File.expand_path(__FILE__).sub(%r[^#{git.dir.path}/], '')
+      if git.status[relative_file] &amp;&amp; git.status[relative_file].type == 'M'
+        git.add(relative_file)
+        git.commit(&quot;Updated to latest gem release management tasks.&quot;)
+        puts &quot;Updated to latest version of gem release management tasks.&quot;
+      else
+        puts &quot;Release managament tasks already are at the latest version.&quot;
+      end
     end
-    
+
   end
 end</diff>
      <filename>tasks/github-gem.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8ed965107b3ce361d9d402e2c2daa96d5d52b0c0</id>
    </parent>
  </parents>
  <author>
    <name>Willem van Bergen</name>
    <email>willem@vanbergen.org</email>
  </author>
  <url>http://github.com/wvanbergen/active_olap/commit/13209042c74d7f3185724e06ffc22aef34988065</url>
  <id>13209042c74d7f3185724e06ffc22aef34988065</id>
  <committed-date>2009-10-10T01:32:51-07:00</committed-date>
  <authored-date>2009-10-10T01:32:51-07:00</authored-date>
  <message>Updated to latest gem release management tasks.</message>
  <tree>424c680b68ebf15167aa168018071a5f8e86822b</tree>
  <committer>
    <name>Willem van Bergen</name>
    <email>willem@vanbergen.org</email>
  </committer>
</commit>
