Sha256: 5dbc092d931d7e64b98444aa96094b7f6c0297a9377644fab168a8da871980c3

Contents?: true

Size: 1.79 KB

Versions: 14

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: [: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

14 entries across 14 versions & 1 rubygems

Version Path
cfndsl-0.12.3 Rakefile
cfndsl-0.12.2 Rakefile
cfndsl-0.12.1 Rakefile
cfndsl-0.12.0 Rakefile
cfndsl-0.11.12 Rakefile
cfndsl-0.11.11 Rakefile
cfndsl-0.11.10 Rakefile
cfndsl-0.11.9 Rakefile
cfndsl-0.11.8 Rakefile
cfndsl-0.11.6 Rakefile
cfndsl-0.11.5 Rakefile
cfndsl-0.11.4 Rakefile
cfndsl-0.11.3 Rakefile
cfndsl-0.11.1 Rakefile