Permalink
Browse files

Fix release task after ceb3b87

  • Loading branch information...
spastorino committed Apr 1, 2013
1 parent 0eec487 commit 78defbb78ee6ddf804340a54eaad28f4e0ea723f
Showing with 27 additions and 10 deletions.
  1. +4 −4 railties/lib/rails/version.rb
  2. +19 −2 tasks/release.rb
  3. +4 −4 version.rb
@@ -1,9 +1,9 @@
module Rails
module VERSION
- MAJOR = 4
- MINOR = 0
- TINY = 0
- PRE = "beta1"
+ MAJOR = 4
+ MINOR = 0
+ TINY = 0
+ PRE = "beta1"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
View
@@ -23,8 +23,25 @@
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
View
@@ -1,9 +1,9 @@
module Rails
module VERSION
- MAJOR = 4
- MINOR = 0
- TINY = 0
- PRE = "beta1"
+ MAJOR = 4
+ MINOR = 0
+ TINY = 0
+ PRE = "beta1"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

0 comments on commit 78defbb

Please sign in to comment.