|
6 | 6 | module OctocatalogDiff |
7 | 7 | # A class to contain methods and constants for cleaner code |
8 | 8 | class Gem |
| 9 | + # Override version number from the environment |
| 10 | + def self.version |
| 11 | + version = ENV['OCTOCATALOG_DIFF_VERSION'] || OctocatalogDiff::Version::VERSION |
| 12 | + unless version == OctocatalogDiff::Version::VERSION |
| 13 | + warn "WARNING: Using version #{version}, not #{OctocatalogDiff::Version::VERSION}" |
| 14 | + end |
| 15 | + version |
| 16 | + end |
| 17 | + |
9 | 18 | BASEDIR = File.expand_path('..', File.dirname(__FILE__)).freeze |
10 | | - VERSION = OctocatalogDiff::Version::VERSION |
| 19 | + VERSION = version.freeze |
11 | 20 | GEMFILE = "octocatalog-diff-#{VERSION}.gem".freeze |
12 | 21 | PKGDIR = File.join(BASEDIR, 'pkg').freeze |
13 | 22 | OUTFILE = File.join(BASEDIR, GEMFILE).freeze |
@@ -77,8 +86,12 @@ def self.exec_command(command) |
77 | 86 |
|
78 | 87 | task 'force-build' do |
79 | 88 | branch = OctocatalogDiff::Gem.branch |
80 | | - warn "WARNING: Force-building from non-master branch #{branch}" unless branch == 'master' |
81 | | - OctocatalogDiff::Gem.build("octocatalog-diff-#{OctocatalogDiff::Gem::VERSION}-#{branch}.gem") |
| 89 | + unless branch == 'master' |
| 90 | + warn "WARNING: Force-building from non-master branch #{branch}" |
| 91 | + end |
| 92 | + |
| 93 | + version = OctocatalogDiff::Gem.version |
| 94 | + OctocatalogDiff::Gem.build("octocatalog-diff-#{version}-#{branch}.gem") |
82 | 95 | end |
83 | 96 |
|
84 | 97 | task 'push' do |
@@ -127,7 +140,7 @@ def self.exec_command(command) |
127 | 140 |
|
128 | 141 | # Make sure the gem has been built |
129 | 142 | branch = OctocatalogDiff::Gem.branch |
130 | | - version = OctocatalogDiff::Gem::VERSION |
| 143 | + version = OctocatalogDiff::Gem.version |
131 | 144 | gemfile = if branch == 'master' |
132 | 145 | OctocatalogDiff::Gem::FINAL_GEMFILE |
133 | 146 | else |
|
0 commit comments