Sha256: 5e74b66d1a618557fb000c7defc3d5b46328699ce52b894b9297439b1dc2ee0a

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec

desc "Upload to rubygems"
task :upload => :build do
  # Check if tag with v#{ResearchSiteApiClient::VERSION} version exists, if so, return with error

  # if tag_exists?(current_tag_name)
  #   puts "Tag exists, did you run rake increase_revision_number after merging with master?"
  #   exit 1
  # end

  # create_tag(current_tag_name)
  Rake::Task[:release].invoke
end

desc "Increase the revision number"
task :increase_revision_number do
  version_file = "lib/restful_resource/version.rb"
  file_content = File.read(version_file)
  rule = /(\d+\.\d+\.)(\d+)/
  new_revision_number = rule.match(file_content)[2].to_i + 1
  new_file_content = file_content.sub(rule, '\1' + new_revision_number.to_s)

  File.open(version_file, 'w') { |file| file.write(new_file_content) }
end

def tag_exists?(tag_name)
  result = `git tag | grep #{tag_name}`.strip
  result == tag_name
end

def create_tag(tag_name)
  sh "git tag -a #{tag_name} -m \"Released version #{tag_name}\""
  sh "git push origin #{tag_name}"
end

def current_tag_name
  "v#{RestfulResource::VERSION}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restful_resource-2.3.0 Rakefile
restful_resource-1.2.2 Rakefile