Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
buildgem / features / step_definitions / versioning_steps.rb
Size: Mime:
def testing_origin_remote_url
  "git@github.com:neotericdesign/for-testing-please-do-not-delete.git"
end

def version_file_path
  "#{$gem_home}/lib/dummy/version.rb"
end

Given(/^a gem that is versioned "(.*?)"$/) do |version|
  # Destroy and recreate the gem innards every time
  `rm -rf #{$gem_home}/.git`
  `rm -rf #{$gem_home}/lib`

  `mkdir #{$gem_home}/lib`
  `mkdir #{$gem_home}/lib/dummy`
  `touch #{$gem_home}/lib/dummy/.gitkeep`

  `cd #{$gem_home} && git init`
  `cd #{$gem_home} && git remote add origin #{testing_origin_remote_url}`
  `cd #{$gem_home} && git add .`
  `cd #{$gem_home} && git ci -m 'Initial commit'`

  # Write the VERSION file in
  # features/support/dummy_gem/lib/dummy/version.rb
  File.open(version_file_path, 'w') do |f|
    f.write <<-VERSION
module Dummy
  VERSION = "#{version}"
end
VERSION
  end

  `cd #{$gem_home} && git add lib`
end

When(/^I run the buildgem with the options:$/) do |table|
  table.raw.flatten.each_with_index do |arg, i|
    ARGV[i] = arg
  end

  Buildgem.run!
end

When(/^I run the buildgem with no options$/) do
  Object.send(:remove_const, :ARGV)
  ARGV = []

  Buildgem.run!
end

Then(/^the gem version file should read "(.*?)"$/) do |version|
  version_file = File.open(version_file_path)

  version_file.read.should =~ /"#{version}"/
end