Sha256: 894b1f0aea2fb5fa2b8bffcc773dcc03e6e0b45f082601d17c9729ce8b3300d2

Contents?: true

Size: 964 Bytes

Versions: 4

Compression:

Stored size: 964 Bytes

Contents

require 'bundler/gem_tasks'
require 'appraisal'

task :spec do
  sh "rspec spec/"
end

# extracted from https://github.com/grosser/project_template
rule /^version:bump:.*/ do |t|
  sh "git status | grep 'nothing to commit'" # ensure we are not dirty
  index = ['major', 'minor','patch'].index(t.name.split(':').last)
  file = 'lib/lazy_observers/version.rb'

  version_file = File.read(file)
  old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
  version_parts[index] = version_parts[index].to_i + 1
  version_parts[2] = 0 if index < 2 # remove patch for minor
  version_parts[1] = 0 if index < 1 # remove minor for major
  new_version = version_parts * '.'
  File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }

  sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
end

task :default do
  sh "bundle exec rake appraisal:install && bundle exec rake appraisal spec"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lazy_observers-0.0.4 Rakefile
lazy_observers-0.0.3 Rakefile
lazy_observers-0.0.2 Rakefile
lazy_observers-0.0.1 Rakefile