added command for displaying foreman version

This commit is contained in:
Wojciech Wnętrzak
2012-06-12 17:16:35 +02:00
parent 7774b7f150
commit b1a2a4a0cd
2 changed files with 19 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ require "foreman/helpers"
require "foreman/engine"
require "foreman/engine/cli"
require "foreman/export"
require "foreman/version"
require "shellwords"
require "yaml"
require "thor"
@@ -11,6 +12,8 @@ class Foreman::CLI < Thor
include Foreman::Helpers
map ["-v", "--version"] => :version
class_option :procfile, :type => :string, :aliases => "-f", :desc => "Default: Procfile"
class_option :root, :type => :string, :aliases => "-d", :desc => "Default: Procfile directory"
@@ -80,6 +83,12 @@ class Foreman::CLI < Thor
end
end
desc "version", "Display Foreman gem version"
def version
puts Foreman::VERSION
end
no_tasks do
def engine
@engine ||= begin

View File

@@ -74,4 +74,14 @@ describe "Foreman::CLI", :fakefs do
end
end
describe "version" do
it "displays gem version" do
foreman("version").chomp.should == Foreman::VERSION
end
it "displays gem version on shortcut command" do
foreman("-v").chomp.should == Foreman::VERSION
end
end
end