set default castle name: 'dotfiles' for some commands
This commit is contained in:
@@ -68,7 +68,7 @@ class Homesick < Thor
|
||||
|
||||
desc 'pull CASTLE', 'Update the specified castle'
|
||||
method_option :all, :type => :boolean, :default => false, :required => false, :desc => 'Update all cloned castles'
|
||||
def pull(name = '')
|
||||
def pull(name = 'dotfiles')
|
||||
if options[:all]
|
||||
inside_each_castle do |castle|
|
||||
shell.say castle.to_s.gsub(repos_dir.to_s + '/', '') + ':'
|
||||
@@ -81,20 +81,20 @@ class Homesick < Thor
|
||||
end
|
||||
|
||||
desc 'commit CASTLE', "Commit the specified castle's changes"
|
||||
def commit(name)
|
||||
def commit(name = 'dotfiles')
|
||||
commit_castle name
|
||||
|
||||
end
|
||||
|
||||
desc 'push CASTLE', 'Push the specified castle'
|
||||
def push(name)
|
||||
def push(name = 'dotfiles')
|
||||
push_castle name
|
||||
|
||||
end
|
||||
|
||||
desc 'symlink CASTLE', 'Symlinks all dotfiles from the specified castle'
|
||||
method_option :force, :default => false, :desc => 'Overwrite existing conflicting symlinks without prompting.'
|
||||
def symlink(name)
|
||||
def symlink(name = 'dotfiles')
|
||||
check_castle_existance(name, 'symlink')
|
||||
|
||||
inside castle_dir(name) do
|
||||
@@ -111,7 +111,7 @@ class Homesick < Thor
|
||||
end
|
||||
|
||||
desc 'track FILE CASTLE', 'add a file to a castle'
|
||||
def track(file, castle)
|
||||
def track(file, castle = 'dotfiles')
|
||||
castle = Pathname.new(castle)
|
||||
file = Pathname.new(file.chomp('/'))
|
||||
check_castle_existance(castle, 'track')
|
||||
|
||||
@@ -176,6 +176,17 @@ describe 'homesick' do
|
||||
home_someapp_dir.join('.some_appfile').readlink.should == someapp_dotfile
|
||||
end
|
||||
end
|
||||
|
||||
context "when call with no castle name" do
|
||||
let(:castle) { given_castle('dotfiles') }
|
||||
it 'using default castle name: "dotfiles"' do
|
||||
dotfile = castle.file('.some_dotfile')
|
||||
|
||||
homesick.symlink
|
||||
|
||||
home.join('.some_dotfile').readlink.should == dotfile
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'list' do
|
||||
@@ -248,6 +259,21 @@ describe 'homesick' do
|
||||
some_nested_dir.realpath.should == tracked_file.realpath
|
||||
end
|
||||
|
||||
context "when call with no castle name" do
|
||||
it 'using default castle name: "dotfiles"' do
|
||||
castle = given_castle('dotfiles')
|
||||
|
||||
some_rc_file = home.file '.some_rc_file'
|
||||
|
||||
homesick.track(some_rc_file.to_s)
|
||||
|
||||
tracked_file = castle.join('.some_rc_file')
|
||||
tracked_file.should exist
|
||||
|
||||
some_rc_file.readlink.should == tracked_file
|
||||
end
|
||||
end
|
||||
|
||||
describe 'subdir_file' do
|
||||
|
||||
it 'should add the nested files parent to the subdir_file' do
|
||||
|
||||
Reference in New Issue
Block a user