Changeset 4958

Show
Ignore:
Timestamp:
01/19/08 19:46:30 (5 years ago)
Author:
cho45
Message:

lang/ruby/shipit/trunk/Rakefile,
lang/ruby/shipit/trunk/lib/shipit.rb,
lang/ruby/shipit/trunk/README:

Implement checking VERS constant to avoid trap.

Location:
lang/ruby/shipit/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/shipit/trunk/README

    r4432 r4958  
    5555 
    5656* NAME -> name of the library. 
     57* DESCRIPTION -> description of the library 
     58* VERS -> version of the library 
    5759          This is MUST reference to version string of ChangeVersion step, or 
    5860          the package task will fail and RubyForge step release wrong version. 
    59 * DESCRIPTION -> description of the library 
    60 * VERS -> version of the library 
    6161 
    6262If you use different constants, please assign the value to above constants. 
  • lang/ruby/shipit/trunk/Rakefile

    r4148 r4958  
    117117                system("svn", "up") 
    118118        }.and {} 
     119        s.Step.new { 
     120                raise "changelog-with-hatenastar.rb is not found" unless system("which", "changelog-with-hatenastar.rb") 
     121        }.and { 
     122                system("changelog-with-hatenastar.rb > ChangeLog") 
     123        } 
    119124        s.Task :rubyforge 
    120         s.Step.new { 
    121                 raise "svn2cl.sh is not found" unless `svn2cl.sh --version`[/svn2cl.sh/] 
    122         }.and { 
    123                 system("svn2cl.sh --break-before-msg=2 --group-by-day  --include-rev --separate-daylogs") 
    124         } 
    125         s.ChangeVersion __FILE__, "VERS" 
     125        s.ChangeVersion "Rakefile", "VERS" 
    126126        s.Commit 
    127127        s.Task :clean, :package 
  • lang/ruby/shipit/trunk/lib/shipit.rb

    r4186 r4958  
    33require "rake/tasklib" 
    44require "term/ansicolor" 
     5require "fileutils" 
    56 
    67class Rake::ShipitTask < Rake::TaskLib 
     
    130131                @match    = @content.match(/#{@name}\s*=\s*['"](\d+\.\d+\.\d+)['"]/) 
    131132                @new_version = @match[1].succ 
     133                @newcont  = @content[0..@match.begin(1)-1] + @new_version + @content[@match.end(1)..-1] 
    132134                raise "Can't find version string in #{@file}." if @match.nil? 
    133135                puts "Find version string #{@match[1]} and will change to #{@new_version}" 
     136 
     137                # check content of Rakefile 
     138                @org = @file.parent + "#{@file.basename}.org" 
     139                FileUtils.cp @file, @org 
     140                @file.open("w") do |f| 
     141                        f.print @newcont 
     142                end 
     143                m = Module.new 
     144                m.module_eval(File.read("Rakefile")) 
     145 
     146                FileUtils.mv @org, @file 
     147                raise "Constant VERS in Rakefile must be same as 3rd argument of ChangeVersion step." unless @vers == m.const_get(:VERS) 
     148 
    134149                @vers.replace @new_version 
    135150        end 
     
    138153                puts "Changing version to #{@new_version}" 
    139154                @file.open("w") do |f| 
    140                         f.print @content[0..@match.begin(1)-1] 
    141                         f.print @new_version 
    142                         f.print @content[@match.end(1)..-1] 
     155                        f.print @newcont 
    143156                end 
    144157        end