From ca832a38e28f118770f7a8f613c8a1e236cb0da3 Mon Sep 17 00:00:00 2001 From: Jason Buckner Date: Sat, 24 Nov 2012 21:01:37 -0800 Subject: [PATCH] start adding git push functionality --- lib/homesick.rb | 15 +++++++++++++++ lib/homesick/actions.rb | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/lib/homesick.rb b/lib/homesick.rb index f19aca9..8610ac5 100644 --- a/lib/homesick.rb +++ b/lib/homesick.rb @@ -78,6 +78,13 @@ class Homesick < Thor end + desc "push NAME", "Push the specified castle" + method_option :all, :type => :boolean, :default => false, :required => false, :desc => "Update all cloned castles" + def push(name) + push_castle name + + end + desc "symlink NAME", "Symlinks all dotfiles from the specified castle" method_option :force, :default => false, :desc => "Overwrite existing conflicting symlinks without prompting." def symlink(name) @@ -189,4 +196,12 @@ class Homesick < Thor git_submodule_update end end + + def push_castle(castle) + check_castle_existance(castle, "push") + inside repos_dir.join(castle) do + git_commit_all + git_push + end + end end diff --git a/lib/homesick/actions.rb b/lib/homesick/actions.rb index 603ad68..2cbf176 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)