diff --git a/lib/homesick/actions.rb b/lib/homesick/actions.rb index 8ee4cbb..076a1b5 100644 --- a/lib/homesick/actions.rb +++ b/lib/homesick/actions.rb @@ -69,7 +69,7 @@ class Homesick def git_add(file, config = {}) say_status 'git add file', '', :green unless options[:quiet] - system "git add #{file}" unless options[:pretend] + system "git add '#{file}'" unless options[:pretend] end def git_status(config = {}) @@ -90,11 +90,11 @@ class Homesick say_status :conflict, "#{destination} exists", :red unless options[:quiet] if options[:force] || shell.file_collision(destination) { source } - system "mv #{source} #{destination}" unless options[:pretend] + system "mv '#{source}' '#{destination}'" unless options[:pretend] end else # this needs some sort of message here. - system "mv #{source} #{destination}" unless options[:pretend] + system "mv '#{source}' '#{destination}'" unless options[:pretend] end end @@ -131,19 +131,19 @@ class Homesick say_status :conflict, "#{destination} exists and points to #{destination.readlink}", :red unless options[:quiet] if options[:force] || shell.file_collision(destination) { source } - system "ln -nsf #{source} #{destination}" unless options[:pretend] + system "ln -nsf '#{source}' '#{destination}'" unless options[:pretend] end end elsif destination.exist? say_status :conflict, "#{destination} exists", :red unless options[:quiet] if options[:force] || shell.file_collision(destination) { source } - system "rm -rf #{destination}" unless options[:pretend] - system "ln -sf #{source} #{destination}" unless options[:pretend] + system "rm -rf '#{destination}'" unless options[:pretend] + system "ln -sf '#{source}' '#{destination}'" unless options[:pretend] end else say_status :symlink, "#{source.expand_path} to #{destination.expand_path}", :green unless options[:quiet] - system "ln -s #{source} #{destination}" unless options[:pretend] + system "ln -s '#{source}' '#{destination}'" unless options[:pretend] end end end diff --git a/spec/homesick_spec.rb b/spec/homesick_spec.rb index e8331f5..7c0d752 100644 --- a/spec/homesick_spec.rb +++ b/spec/homesick_spec.rb @@ -398,6 +398,19 @@ describe 'homesick' do some_rc_file.readlink.should == tracked_file end + it 'should handle files with parens' do + castle = given_castle('castle_repo') + + some_rc_file = home.file 'Default (Linux).sublime-keymap' + + homesick.track(some_rc_file.to_s, 'castle_repo') + + tracked_file = castle.join('Default (Linux).sublime-keymap') + tracked_file.should exist + + some_rc_file.readlink.should == tracked_file + end + it 'should track a file in nested folder structure' do castle = given_castle('castle_repo')