diff --git a/README.markdown b/README.markdown index f264833..63e3d36 100644 --- a/README.markdown +++ b/README.markdown @@ -33,6 +33,18 @@ If you're not sure what castles you have around, you can easily list them: homesick list +To pull your castle (or all castles): + + homesick pull --all|CASTLE + +To commit your castle's changes: + + homesick commit CASTLE + +To push your castle: + + homesick push CASTLE + Not sure what else homesick has up its sleeve? There's always the built in help: homesick help diff --git a/lib/homesick.rb b/lib/homesick.rb index f19aca9..3416d14 100644 --- a/lib/homesick.rb +++ b/lib/homesick.rb @@ -64,7 +64,7 @@ class Homesick < Thor end end - desc "pull NAME", "Update the specified castle" + desc "pull CASTLE", "Update the specified castle" method_option :all, :type => :boolean, :default => false, :required => false, :desc => "Update all cloned castles" def pull(name="") if options[:all] @@ -78,7 +78,19 @@ class Homesick < Thor end - desc "symlink NAME", "Symlinks all dotfiles from the specified castle" + desc "commit CASTLE", "Commit the specified castle's changes" + def commit(name) + commit_castle name + + end + + desc "push CASTLE", "Push the specified castle" + def push(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) check_castle_existance(name, "symlink") @@ -189,4 +201,18 @@ class Homesick < Thor git_submodule_update end end + + def commit_castle(castle) + check_castle_existance(castle, "commit") + inside repos_dir.join(castle) do + git_commit_all + end + end + + def push_castle(castle) + check_castle_existance(castle, "push") + inside repos_dir.join(castle) do + git_push + end + end end diff --git a/lib/homesick/actions.rb b/lib/homesick/actions.rb index 247ceb8..930c8ab 100644 --- a/lib/homesick/actions.rb +++ b/lib/homesick/actions.rb @@ -59,6 +59,16 @@ class Homesick system "git pull --quiet" unless options[:pretend] end + def git_push(config = {}) + say_status 'git push', '', :green unless options[:quiet] + system "git push" unless options[:pretend] + end + + def git_commit_all(config = {}) + say_status 'git commit all', '', :green unless options[:quiet] + system "git commit -v -a" unless options[:pretend] + end + def mv(source, destination, config = {}) source = Pathname.new(source) destination = Pathname.new(destination + source.basename) diff --git a/spec/homesick_spec.rb b/spec/homesick_spec.rb index 5dd2b6d..81fafb7 100644 --- a/spec/homesick_spec.rb +++ b/spec/homesick_spec.rb @@ -144,6 +144,18 @@ describe "homesick" do end + describe "commit" do + + xit "needs testing" + + end + + describe "push" do + + xit "needs testing" + + end + describe "track" do it "should move the tracked file into the castle" do castle = given_castle('castle_repo')