Sha256: d52ba101bfcf1671a9d1643b8175149c80b9bfa45b5ad5fc63e46aa802effd5f

Contents?: true

Size: 1.79 KB

Versions: 6

Compression:

Stored size: 1.79 KB

Contents

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'cfndsl/version'
require 'rubocop/rake_task'
require 'yamllint/rake_task'

RSpec::Core::RakeTask.new
RuboCop::RakeTask.new

desc 'Run RSpec with SimpleCov'
task :cov do
  ENV['CFNDSL_COV'] = 'true'
  Rake::Task[:spec].execute
end

YamlLint::RakeTask.new do |t|
  t.paths = %w[
    lib/cfndsl/aws/types.yaml
    lib/cfndsl/os/types.yaml
    sample/t1.yaml
    .travis.yml
    .rubocop.yml
  ]
end

task default: %i[spec rubocop yamllint]

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

  types = %w[major minor patch]

  raise unless types.include?(type)

  if `git rev-parse --abbrev-ref HEAD`.strip != 'master'
    raise "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

6 entries across 6 versions & 1 rubygems

Version Path
cfndsl-0.12.10 Rakefile
cfndsl-0.12.9 Rakefile
cfndsl-0.12.8 Rakefile
cfndsl-0.12.7 Rakefile
cfndsl-0.12.6 Rakefile
cfndsl-0.12.5 Rakefile