Rakefile in embulk-input-jira-0.0.4 vs Rakefile in embulk-input-jira-0.0.5

- old
+ new

@@ -1,11 +1,10 @@ require "bundler/gem_tasks" require 'rspec/core/rake_task' require "json" require "pathname" require "open-uri" -require File.expand_path("../lib/embulk/input/jira/version.rb", __FILE__) task default: :spec desc "Run all examples" @@ -16,15 +15,16 @@ namespace :release do desc "Add header of now version release to ChangeLog and bump up version" task :prepare do root_dir = Pathname.new(File.expand_path("../", __FILE__)) changelog_file = root_dir.join("CHANGELOG.md") + gemspec_file = root_dir.join("embulk-input-jira.gemspec") system("git fetch origin") # detect merged PR - old_version = Embulk::Input::Jira::VERSION + old_version = gemspec_file.read[/spec\.version += *"([0-9]+\.[0-9]+\.[0-9]+)"/, 1] pr_numbers = `git log v#{old_version}..origin/master --oneline`.scan(/#[0-9]+/) if !$?.success? || pr_numbers.empty? puts "Detecting PR failed. Please confirm if any PR were merged after the latest release." exit(false) @@ -49,13 +49,12 @@ HEADER File.open(changelog_file, "w") {|f| f.write(new_changelog) } # Update version.rb - version_file = root_dir.join("./lib/embulk/input/jira/version.rb") - old_content = version_file.read - File.open(version_file, "w") do |f| - f.write old_content.gsub(old_version, new_version) + old_content = gemspec_file.read + File.open(gemspec_file, "w") do |f| + f.write old_content.gsub(/(spec\.version += *)".*?"/, %Q!\\1"#{new_version}"!) end # Update Gemfile.lock system("bundle install")