diff --git a/lib/homesick.rb b/lib/homesick.rb index 314c0ee..ed30af9 100644 --- a/lib/homesick.rb +++ b/lib/homesick.rb @@ -12,6 +12,8 @@ class Homesick < Thor GITHUB_NAME_REPO_PATTERN = /\A([A-Za-z_-]+\/[A-Za-z_-]+)\Z/ SUBDIR_FILENAME = '.homesick_subdir' + DEFAULT_CASTLE_NAME = 'dotfiles' + def initialize(args = [], options = {}, config = {}) super self.shell = Homesick::Shell.new @@ -67,7 +69,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 = 'dotfiles') + def pull(name = DEFAULT_CASTLE_NAME) if options[:all] inside_each_castle do |castle| shell.say castle.to_s.gsub(repos_dir.to_s + '/', '') + ':' @@ -80,20 +82,20 @@ class Homesick < Thor end desc 'commit CASTLE', "Commit the specified castle's changes" - def commit(name = 'dotfiles') + def commit(name = DEFAULT_CASTLE_NAME) commit_castle name end desc 'push CASTLE', 'Push the specified castle' - def push(name = 'dotfiles') + def push(name = DEFAULT_CASTLE_NAME) 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 = 'dotfiles') + def symlink(name = DEFAULT_CASTLE_NAME) check_castle_existance(name, 'symlink') inside castle_dir(name) do @@ -110,7 +112,7 @@ class Homesick < Thor end desc 'track FILE CASTLE', 'add a file to a castle' - def track(file, castle = 'dotfiles') + def track(file, castle = DEFAULT_CASTLE_NAME) castle = Pathname.new(castle) file = Pathname.new(file.chomp('/')) check_castle_existance(castle, 'track')