Commit 0830504b authored by Eloy Duran's avatar Eloy Duran

Update a named spec repo.

parent 2e909ac2
...@@ -13,7 +13,11 @@ module Pod ...@@ -13,7 +13,11 @@ module Pod
unless (@name = argv[1]) && (@url = argv[2]) unless (@name = argv[1]) && (@url = argv[2])
raise ArgumentError, "needs a NAME and URL" raise ArgumentError, "needs a NAME and URL"
end end
when 'cd' when 'update'
unless @name = argv[1]
raise ArgumentError, "needs a NAME"
end
when 'cd'
unless @name = argv[1] unless @name = argv[1]
raise ArgumentError, "needs a NAME" raise ArgumentError, "needs a NAME"
end end
...@@ -34,6 +38,10 @@ module Pod ...@@ -34,6 +38,10 @@ module Pod
FileUtils.mkdir_p(repos_dir) FileUtils.mkdir_p(repos_dir)
Dir.chdir(repos_dir) { git("clone #{@url} #{@name}") } Dir.chdir(repos_dir) { git("clone #{@url} #{@name}") }
end end
def update
Dir.chdir(File.join(repos_dir, @name)) { git("pull") }
end
end end
end end
end end
......
...@@ -23,4 +23,23 @@ describe "Pod::Command" do ...@@ -23,4 +23,23 @@ describe "Pod::Command" do
command.run command.run
git_config('private', 'remote.origin.url').should == fixture('master-spec-repo.git') git_config('private', 'remote.origin.url').should == fixture('master-spec-repo.git')
end end
it "updates a spec-repo" do
repo1 = Pod::Command.parse('repo', 'add', 'repo1', fixture('master-spec-repo.git'))
def repo1.repos_dir; SpecHelper.tmp_repos_path; end
repo1.run
repo2 = Pod::Command.parse('repo', 'add', 'repo2', repo1.dir)
def repo2.repos_dir; SpecHelper.tmp_repos_path; end
repo2.run
File.open(File.join(repo1.dir, 'README'), 'a') { |f| f << 'updated!' }
git('repo1', 'commit -a -m "update"')
command = Pod::Command.parse('repo', 'update', 'repo2')
def command.repos_dir; SpecHelper.tmp_repos_path; end
command.run
File.read(File.join(repo2.dir, 'README')).should.include 'updated!'
end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment