Merge pull request #26 from jbuckner/castle_push

Castle Commit & Push
This commit is contained in:
Yusuke Murata
2013-03-28 08:23:45 -07:00
4 changed files with 62 additions and 2 deletions

View File

@@ -33,6 +33,18 @@ If you're not sure what castles you have around, you can easily list them:
homesick list 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: Not sure what else homesick has up its sleeve? There's always the built in help:
homesick help homesick help

View File

@@ -64,7 +64,7 @@ class Homesick < Thor
end end
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" method_option :all, :type => :boolean, :default => false, :required => false, :desc => "Update all cloned castles"
def pull(name="") def pull(name="")
if options[:all] if options[:all]
@@ -78,7 +78,19 @@ class Homesick < Thor
end 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." method_option :force, :default => false, :desc => "Overwrite existing conflicting symlinks without prompting."
def symlink(name) def symlink(name)
check_castle_existance(name, "symlink") check_castle_existance(name, "symlink")
@@ -189,4 +201,18 @@ class Homesick < Thor
git_submodule_update git_submodule_update
end end
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 end

View File

@@ -59,6 +59,16 @@ class Homesick
system "git pull --quiet" unless options[:pretend] system "git pull --quiet" unless options[:pretend]
end 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 = {}) def mv(source, destination, config = {})
source = Pathname.new(source) source = Pathname.new(source)
destination = Pathname.new(destination + source.basename) destination = Pathname.new(destination + source.basename)

View File

@@ -144,6 +144,18 @@ describe "homesick" do
end end
describe "commit" do
xit "needs testing"
end
describe "push" do
xit "needs testing"
end
describe "track" do describe "track" do
it "should move the tracked file into the castle" do it "should move the tracked file into the castle" do
castle = given_castle('castle_repo') castle = given_castle('castle_repo')