Permalink
Browse files

Allow alternate version to be specified from command line

  • Loading branch information...
1 parent 13f0cb7 commit cc3100d23a491c5089f913071f2bae3ad2b9b2ef @kpaulisse kpaulisse committed Dec 30, 2016
Showing with 18 additions and 5 deletions.
  1. +1 −1 octocatalog-diff.gemspec
  2. +17 −4 rake/gem.rb
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.0.0'
s.name = 'octocatalog-diff'
- s.version = OctocatalogDiff::Version::VERSION
+ s.version = ENV['OCTOCATALOG_DIFF_VERSION'] || OctocatalogDiff::Version::VERSION
s.license = 'MIT'
s.authors = ['GitHub, Inc.', 'Kevin Paulisse']
s.email = 'opensource+octocatalog-diff@github.com'
View
@@ -6,8 +6,17 @@
module OctocatalogDiff
# A class to contain methods and constants for cleaner code
class Gem
+ # Override version number from the environment
+ def self.version
+ version = ENV['OCTOCATALOG_DIFF_VERSION'] || OctocatalogDiff::Version::VERSION
+ unless version == OctocatalogDiff::Version::VERSION
+ warn "WARNING: Using version #{version}, not #{OctocatalogDiff::Version::VERSION}"
+ end
+ version
+ end
+
BASEDIR = File.expand_path('..', File.dirname(__FILE__)).freeze
- VERSION = OctocatalogDiff::Version::VERSION
+ VERSION = version.freeze
GEMFILE = "octocatalog-diff-#{VERSION}.gem".freeze
PKGDIR = File.join(BASEDIR, 'pkg').freeze
OUTFILE = File.join(BASEDIR, GEMFILE).freeze
@@ -77,8 +86,12 @@ def self.exec_command(command)
task 'force-build' do
branch = OctocatalogDiff::Gem.branch
- warn "WARNING: Force-building from non-master branch #{branch}" unless branch == 'master'
- OctocatalogDiff::Gem.build("octocatalog-diff-#{OctocatalogDiff::Gem::VERSION}-#{branch}.gem")
+ unless branch == 'master'
+ warn "WARNING: Force-building from non-master branch #{branch}"
+ end
+
+ version = OctocatalogDiff::Gem.version
+ OctocatalogDiff::Gem.build("octocatalog-diff-#{version}-#{branch}.gem")
end
task 'push' do
@@ -127,7 +140,7 @@ def self.exec_command(command)
# Make sure the gem has been built
branch = OctocatalogDiff::Gem.branch
- version = OctocatalogDiff::Gem::VERSION
+ version = OctocatalogDiff::Gem.version
gemfile = if branch == 'master'
OctocatalogDiff::Gem::FINAL_GEMFILE
else

0 comments on commit cc3100d

Please sign in to comment.