Sha256: 765cdaf825e6bcb80bfad83a72015d58be191a882fecdd416dd3767cbe3b29e6

Contents?: true

Size: 1.42 KB

Versions: 22

Compression:

Stored size: 1.42 KB

Contents

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "cfndsl/version"

RSpec::Core::RakeTask.new

task default: [:spec]

task :bump, :type do |t, args|
  type = args[:type].downcase
  version_path = "lib/cfndsl/version.rb"

  types = %w[major minor patch]

  fail unless types.include? type

  if `git rev-parse --abbrev-ref HEAD`.strip != "master"
    fail "Looks like you're trying to create a release in a branch, you can only create one in 'master'"
  end

  version_segments = CfnDsl::VERSION.split(".").map(&:to_i)

  segment_index = types.find_index type

  version_segments = version_segments.take(segment_index) +
                     [version_segments.at(segment_index).succ] +
                     [0] * version_segments.drop(segment_index.succ).count

  version = version_segments.join(".")

  puts "Bumping gem from version #{CfnDsl::VERSION} to #{version} as a '#{type.capitalize}' release"

  contents         = File.read version_path
  updated_contents = contents.gsub(/([0-9\.]+)/, version)
  File.write(version_path, updated_contents)

  puts "Commiting version update"
  `git add #{version_path}`
  `git commit --message='#{type.capitalize} release #{version}'`

  puts "Tagging release"
  `git tag -a v#{version} -m 'Version #{version}'`

  puts "Pushing branch"
  `git push origin master`

  puts "Pushing tag"
  `git push origin v#{version}`

  puts "All done, travis should pick up and release the gem now!"
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
cfndsl-0.4.4 Rakefile
cfndsl-0.4.3 Rakefile
cfndsl-0.4.2 Rakefile
cfndsl-0.4.1 Rakefile
cfndsl-0.4.0 Rakefile
cfndsl-0.3.6 Rakefile
cfndsl-0.3.5 Rakefile
cfndsl-0.3.4 Rakefile
cfndsl-0.3.3 Rakefile
cfndsl-0.3.2 Rakefile
cfndsl-0.3.1 Rakefile
cfndsl-0.2.9 Rakefile
cfndsl-0.2.8 Rakefile
cfndsl-0.3.0 Rakefile
cfndsl-0.2.7 Rakefile
cfndsl-0.2.4 Rakefile
cfndsl-0.2.3 Rakefile
cfndsl-0.2.2 Rakefile
cfndsl-0.2.1 Rakefile
cfndsl-0.2.0 Rakefile