Added command to display current version of homesick.
This commit is contained in:
3
Rakefile
3
Rakefile
@@ -1,5 +1,6 @@
|
|||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'bundler'
|
require 'bundler'
|
||||||
|
require_relative 'lib/homesick/version'
|
||||||
begin
|
begin
|
||||||
Bundler.setup(:default, :development)
|
Bundler.setup(:default, :development)
|
||||||
rescue Bundler::BundlerError => e
|
rescue Bundler::BundlerError => e
|
||||||
@@ -23,7 +24,7 @@ Jeweler::Tasks.new do |gem|
|
|||||||
gem.email = ["josh@technicalpickles.com", "info@muratayusuke.com"]
|
gem.email = ["josh@technicalpickles.com", "info@muratayusuke.com"]
|
||||||
gem.homepage = "http://github.com/technicalpickles/homesick"
|
gem.homepage = "http://github.com/technicalpickles/homesick"
|
||||||
gem.authors = ["Joshua Nichols", "Yusuke Murata"]
|
gem.authors = ["Joshua Nichols", "Yusuke Murata"]
|
||||||
gem.version = "0.9.7"
|
gem.version = Homesick::Version::STRING
|
||||||
gem.license = "MIT"
|
gem.license = "MIT"
|
||||||
# Have dependencies? Add them to Gemfile
|
# Have dependencies? Add them to Gemfile
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ require 'thor'
|
|||||||
class Homesick < Thor
|
class Homesick < Thor
|
||||||
autoload :Shell, 'homesick/shell'
|
autoload :Shell, 'homesick/shell'
|
||||||
autoload :Actions, 'homesick/actions'
|
autoload :Actions, 'homesick/actions'
|
||||||
|
autoload :Version, 'homesick/version'
|
||||||
|
|
||||||
include Thor::Actions
|
include Thor::Actions
|
||||||
include Homesick::Actions
|
include Homesick::Actions
|
||||||
|
include Homesick::Version
|
||||||
|
|
||||||
add_runtime_options!
|
add_runtime_options!
|
||||||
|
|
||||||
@@ -15,6 +17,9 @@ class Homesick < Thor
|
|||||||
|
|
||||||
DEFAULT_CASTLE_NAME = 'dotfiles'
|
DEFAULT_CASTLE_NAME = 'dotfiles'
|
||||||
|
|
||||||
|
map '-v' => :version
|
||||||
|
map '--version' => :version
|
||||||
|
|
||||||
def initialize(args = [], options = {}, config = {})
|
def initialize(args = [], options = {}, config = {})
|
||||||
super
|
super
|
||||||
self.shell = Homesick::Shell.new
|
self.shell = Homesick::Shell.new
|
||||||
@@ -264,6 +269,11 @@ class Homesick < Thor
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'version', 'Display the current version of homesick'
|
||||||
|
def version
|
||||||
|
say Homesick::Version::STRING
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def home_dir
|
def home_dir
|
||||||
|
|||||||
10
lib/homesick/version.rb
Normal file
10
lib/homesick/version.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
class Homesick
|
||||||
|
module Version
|
||||||
|
MAJOR = 0
|
||||||
|
MINOR = 9
|
||||||
|
PATCH = 8
|
||||||
|
|
||||||
|
STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -611,4 +611,11 @@ describe 'homesick' do
|
|||||||
expect { homesick.open "castle_repo" }.to raise_error(SystemExit)
|
expect { homesick.open "castle_repo" }.to raise_error(SystemExit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'version' do
|
||||||
|
it 'should print the current version of homesick' do
|
||||||
|
text = Capture.stdout { homesick.version }
|
||||||
|
text.chomp.should =~ /\d+\.\d+\.\d+/
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user