bin/cloudstrap-versions in cloudstrap-0.47.8.pre vs bin/cloudstrap-versions in cloudstrap-0.48.0.pre
- old
+ new
@@ -1,17 +1,17 @@
#!/usr/bin/env ruby
+require 'faraday'
+require 'tty-table'
+require 'pastel'
+
if ENV['HACKING']
require_relative '../lib/cloudstrap'
else
require 'cloudstrap'
end
-require 'faraday'
-require 'tty-table'
-require 'pastel'
-
CLOUDSTRAP_VERSION = $LOADED_FEATURES
.map { |f| f.match %r{cloudstrap-(?<version>[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(\.pre)?)} }
.compact
.map { |m| m['version'] }
.uniq
@@ -23,10 +23,10 @@
config = Cloudstrap::Config.new
green = Pastel.new.green.detach
red = Pastel.new.red.detach
-cloudstrap = (CLOUDSTRAP_VERSION.end_with?('pre') ? red : green).call CLOUDSTRAP_VERSION
+cloudstrap = ((CLOUDSTRAP_VERSION.nil? || CLOUDSTRAP_VERSION.end_with?('pre')) ? red : green).call CLOUDSTRAP_VERSION
latest = ->(component) { config.send(:latest).send(component) }
using = ->(component) { config.send("#{component}_version") }
version = ->(component) { (using.(component) == latest.(component) ? green : red).call using.(component) }