diff options
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/release.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tasks/release.rb b/tasks/release.rb index cf5b6d6843..0c22f812fc 100644 --- a/tasks/release.rb +++ b/tasks/release.rb @@ -23,8 +23,25 @@ directory "pkg" file = Dir[glob].first ruby = File.read(file) - ruby.gsub!(/^(\s*)Gem::Version\.new .*?$/, "\\1Gem::Version.new \"#{version}\"") - raise "Could not insert Gem::Version in #{file}" unless $1 + if framework == "rails" || framework == "railties" + major, minor, tiny, pre = version.split('.') + pre = pre ? pre.inspect : "nil" + + ruby.gsub!(/^(\s*)MAJOR(\s*)= .*?$/, "\\1MAJOR = #{major}") + raise "Could not insert MAJOR in #{file}" unless $1 + + ruby.gsub!(/^(\s*)MINOR(\s*)= .*?$/, "\\1MINOR = #{minor}") + raise "Could not insert MINOR in #{file}" unless $1 + + ruby.gsub!(/^(\s*)TINY(\s*)= .*?$/, "\\1TINY = #{tiny}") + raise "Could not insert TINY in #{file}" unless $1 + + ruby.gsub!(/^(\s*)PRE(\s*)= .*?$/, "\\1PRE = #{pre}") + raise "Could not insert PRE in #{file}" unless $1 + else + ruby.gsub!(/^(\s*)Gem::Version\.new .*?$/, "\\1Gem::Version.new \"#{version}\"") + raise "Could not insert Gem::Version in #{file}" unless $1 + end File.open(file, 'w') { |f| f.write ruby } end |