method
update_versions
v7.2.3 -
Show latest stable
- Class:
Releaser
update_versions(framework)public
No documentation available.
# File tools/releaser/lib/releaser.rb, line 228
def update_versions(framework)
return if framework == "rails"
Dir.chdir(root) do
glob = "#{framework}/lib/*/gem_version.rb"
file = Dir[glob].first
ruby = File.read(file)
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.inspect}")
raise "Could not insert PRE in #{file}" unless $1
File.open(file, "w") { |f| f.write ruby }
package_json = "#{framework}/package.json"
if File.exist?(package_json) && JSON.parse(File.read(package_json))["version"] != npm_version
Dir.chdir("#{framework}") do
if sh("which npm > /dev/null 2>&1", verbose: false)
sh "npm version #{npm_version} --no-git-tag-version > /dev/null 2>&1", verbose: false
else
raise "You must have npm installed to release Rails."
end
end
end
end
end