Sha256: 674366f9f09b8d08175a83be1d4277fff6536bc971be03353387642872087bbe

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

require 'bundler/gem_tasks'
require 'bump/tasks'

task :default do
  ['~>2', '~>3'].each do |version|
    sh "export AR='#{version}' && (bundle check || bundle install) && bundle exec rspec spec"
  end
  sh "git checkout Gemfile.lock"
end

task :benchmark do
  puts "Running on #{RUBY_DESCRIPTION}"
  %w[baseline ideal fast_gettext original i18n_simple].each do |bench|
    puts `ruby -I. benchmark/#{bench}.rb`
    puts ""
  end
end

task :namespaces do
  puts `ruby benchmark/namespace/original.rb`
  puts `ruby benchmark/namespace/fast_gettext.rb`
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/fast_gettext/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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fast_gettext-0.6.11 Rakefile