From ca832a38e28f118770f7a8f613c8a1e236cb0da3 Mon Sep 17 00:00:00 2001 From: Jason Buckner Date: Sat, 24 Nov 2012 21:01:37 -0800 Subject: [PATCH 1/5] 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) From 38a43ba7ff161c8c58d3d4127bb7898c96dd3546 Mon Sep 17 00:00:00 2001 From: Jason Buckner Date: Sat, 24 Nov 2012 21:24:41 -0800 Subject: [PATCH 2/5] add homesick push to readme, a placeholder test, and removed the all option from git push --- README.markdown | 8 ++++++++ lib/homesick.rb | 1 - spec/homesick_spec.rb | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index f264833..09411bf 100644 --- a/README.markdown +++ b/README.markdown @@ -33,6 +33,14 @@ If you're not sure what castles you have around, you can easily list them: homesick list +To pull your castle (omit CASTLE_NAME to pull all castles): + + homesick pull CASTLE_NAME + +To push your castle: + + homesick push CASTLE_NAME + 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 8610ac5..c55d0ce 100644 --- a/lib/homesick.rb +++ b/lib/homesick.rb @@ -79,7 +79,6 @@ 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 diff --git a/spec/homesick_spec.rb b/spec/homesick_spec.rb index 5dd2b6d..efc92ca 100644 --- a/spec/homesick_spec.rb +++ b/spec/homesick_spec.rb @@ -144,6 +144,12 @@ describe "homesick" do 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') From 74713f8b7c4d3b9f91979db3ce9f6401d1ef0631 Mon Sep 17 00:00:00 2001 From: Jason Buckner Date: Sat, 24 Nov 2012 22:36:45 -0800 Subject: [PATCH 3/5] fix homesick pull documentation --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 09411bf..d9aac4e 100644 --- a/README.markdown +++ b/README.markdown @@ -33,9 +33,9 @@ If you're not sure what castles you have around, you can easily list them: homesick list -To pull your castle (omit CASTLE_NAME to pull all castles): +To pull your castle (or all castles): - homesick pull CASTLE_NAME + homesick pull --all|CASTLE_NAME To push your castle: From e6c0ac91cd1e216367f1f36905fe53e3ace89435 Mon Sep 17 00:00:00 2001 From: Jason Buckner Date: Sat, 24 Nov 2012 22:56:17 -0800 Subject: [PATCH 4/5] update documentation for naming consistency --- README.markdown | 4 ++-- lib/homesick.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index d9aac4e..c58edfe 100644 --- a/README.markdown +++ b/README.markdown @@ -35,11 +35,11 @@ If you're not sure what castles you have around, you can easily list them: To pull your castle (or all castles): - homesick pull --all|CASTLE_NAME + homesick pull --all|CASTLE To push your castle: - homesick push CASTLE_NAME + homesick push CASTLE Not sure what else homesick has up its sleeve? There's always the built in help: diff --git a/lib/homesick.rb b/lib/homesick.rb index c55d0ce..8dff9c5 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,13 +78,13 @@ class Homesick < Thor end - desc "push NAME", "Push the specified castle" + desc "push CASTLE", "Push the specified castle" def push(name) push_castle name end - desc "symlink NAME", "Symlinks all dotfiles from the specified castle" + 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") From d8291edae0d822c2b6e5c1043b2fa930846a82f8 Mon Sep 17 00:00:00 2001 From: Jason Buckner Date: Sat, 24 Nov 2012 23:18:48 -0800 Subject: [PATCH 5/5] splits up castle commit from castle push for more fine-grained control --- README.markdown | 4 ++++ lib/homesick.rb | 14 +++++++++++++- spec/homesick_spec.rb | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index c58edfe..63e3d36 100644 --- a/README.markdown +++ b/README.markdown @@ -37,6 +37,10 @@ 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 diff --git a/lib/homesick.rb b/lib/homesick.rb index 8dff9c5..3416d14 100644 --- a/lib/homesick.rb +++ b/lib/homesick.rb @@ -78,6 +78,12 @@ class Homesick < Thor end + 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 @@ -196,10 +202,16 @@ class Homesick < Thor 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_commit_all git_push end end diff --git a/spec/homesick_spec.rb b/spec/homesick_spec.rb index efc92ca..81fafb7 100644 --- a/spec/homesick_spec.rb +++ b/spec/homesick_spec.rb @@ -144,6 +144,12 @@ describe "homesick" do end + describe "commit" do + + xit "needs testing" + + end + describe "push" do xit "needs testing"