#!/usr/bin/env ruby # bin/publish 0.0.1 class Publish def start version, name system "bundle && bundle exec rake spec" unless File.exists? "#{name}-#{version}.gem" system "gem build #{name}.gemspec" if File.exists? "#{name}-#{version}.gem" system "git tag -a v#{version} -m 'version #{version}'" system "git push --tags" system "gem push #{name}-#{version}.gem" system "git push origin master" else puts "Build Fail" end else puts "Version already exist" end end end if ARGV.length != 1 # or !ARGV[0].match(/\d{1,3}.\d{1,3}.\d{1,3}/) puts 'HELP: ' puts '$ bin/publish 0.0.1' exit 0 end Publish.new.start ARGV[0], (ARGV[1] || 'i18n_helper')