Added three commands: show_path, status, diff

This commit is contained in:
David Simon
2013-06-25 16:11:08 -04:00
parent 4aa76ce444
commit 99760c27af
3 changed files with 54 additions and 0 deletions

View File

@@ -161,6 +161,28 @@ class Homesick < Thor
end end
end end
desc 'status CASTLE', 'Shows the git status of a castle'
def status(castle)
check_castle_existance(castle, 'status')
inside repos_dir.join(castle) do
git_status
end
end
desc 'diff CASTLE', 'Shows the git diff of a castle'
def diff(castle)
check_castle_existance(castle, 'diff')
inside repos_dir.join(castle) do
git_diff
end
end
desc 'show_path CASTLE', 'Prints the path of a castle'
def show_path(castle)
check_castle_existance(castle, 'show_path')
say repos_dir.join(castle)
end
desc 'generate PATH', 'generate a homesick-ready git repo at PATH' desc 'generate PATH', 'generate a homesick-ready git repo at PATH'
def generate(castle) def generate(castle)
castle = Pathname.new(castle).expand_path castle = Pathname.new(castle).expand_path

View File

@@ -71,6 +71,16 @@ class Homesick
system "git add #{file}" unless options[:pretend] system "git add #{file}" unless options[:pretend]
end end
def git_status(config = {})
say_status 'git status', '', :green unless options[:quiet]
system "git status" unless options[:pretend]
end
def git_diff(config = {})
say_status 'git diff', '', :green unless options[:quiet]
system "git diff" unless options[:pretend]
end
def mv(source, destination, config = {}) def mv(source, destination, config = {})
source = Pathname.new(source) source = Pathname.new(source)
destination = Pathname.new(destination + source.basename) destination = Pathname.new(destination + source.basename)

View File

@@ -200,6 +200,28 @@ describe 'homesick' do
end end
end end
describe 'status' do
xit 'needs testing'
end
describe 'diff' do
xit 'needs testing'
end
describe 'show_path' do
it 'should say the path of a castle' do
castle = given_castle('castle_repo')
homesick.should_receive(:say).with(castle.dirname)
homesick.show_path('castle_repo')
end
end
describe 'pull' do describe 'pull' do
xit 'needs testing' xit 'needs testing'