diff options
author | Genadi Samokovarov <gsamokovarov@gmail.com> | 2016-05-30 14:53:03 +0300 |
---|---|---|
committer | Genadi Samokovarov <gsamokovarov@gmail.com> | 2016-05-30 14:53:03 +0300 |
commit | a11a3861b474ef642ac48796572d6276436c7eb0 (patch) | |
tree | 5e7da0567079981991e9a23696c7d20faf4c9f2b /tasks | |
parent | e6ed3aaf437887bc25a1f715f21c5ca3ebbc966f (diff) | |
parent | 3f2e83d964fcb4cd7f7f2ed8fb2b2592ffc57647 (diff) | |
download | rails-a11a3861b474ef642ac48796572d6276436c7eb0.tar.gz rails-a11a3861b474ef642ac48796572d6276436c7eb0.tar.bz2 rails-a11a3861b474ef642ac48796572d6276436c7eb0.zip |
Merge branch 'master' into always-inherit-from-application-record
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/release.rb | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/tasks/release.rb b/tasks/release.rb index de9c51a140..4a1ed04478 100644 --- a/tasks/release.rb +++ b/tasks/release.rb @@ -13,7 +13,6 @@ directory "pkg" task :clean do rm_f gem - sh "cd #{framework} && bundle exec rake package:clean" unless framework == "rails" end task :update_versions do @@ -44,6 +43,36 @@ directory "pkg" raise "Could not insert PRE in #{file}" unless $1 File.open(file, 'w') { |f| f.write ruby } + + if File.exist?("#{framework}/package.json") + Dir.chdir("#{framework}") do + # This "npm-ifies" the current version + # With npm, versions such as "5.0.0.rc1" or "5.0.0.beta1.1" are not compliant with its + # versioning system, so they must be transformed to "5.0.0-rc1" and "5.0.0-beta1-1" respectively. + + # In essence, the code below runs through all "."s that appear in the version, + # and checks to see if their index in the version string is greater than or equal to 2, + # and if so, it will change the "." to a "-". + + # Sample version transformations: + # irb(main):001:0> version = "5.0.1.1" + # => "5.0.1.1" + # irb(main):002:0> version.gsub(/\./).with_index { |s, i| i >= 2 ? '-' : s } + # => "5.0.1-1" + # irb(main):003:0> version = "5.0.0.rc1" + # => "5.0.0.rc1" + # irb(main):004:0> version.gsub(/\./).with_index { |s, i| i >= 2 ? '-' : s } + # => "5.0.0-rc1" + version = version.gsub(/\./).with_index { |s, i| i >= 2 ? '-' : s } + + # Check if npm is installed, and raise an error if not + if sh 'which npm' + sh "npm version #{version} --no-git-tag-version" + else + raise 'You must have npm installed to release Rails.' + end + end + end end task gem => %w(update_versions pkg) do @@ -56,11 +85,12 @@ directory "pkg" task :build => [:clean, gem] task :install => :build do - sh "gem install #{gem}" + sh "gem install --pre #{gem}" end task :push => :build do sh "gem push #{gem}" + sh "npm publish" if File.exist?("#{framework}/package.json") end end end @@ -135,7 +165,7 @@ namespace :all do end task :tag do - sh "git tag -m '#{tag} release' #{tag}" + sh "git tag -s -m '#{tag} release' #{tag}" sh "git push --tags" end |