Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update a named spec repo.

  • Loading branch information...
commit 0830504b196b8bb7c2a5dd4695e6ffdbef9e5229 1 parent 2e909ac
@alloy alloy authored
Showing with 28 additions and 1 deletion.
  1. +9 −1 lib/cocoa_pods/command/repo.rb
  2. +19 −0 spec/functional/command_spec.rb
View
10 lib/cocoa_pods/command/repo.rb
@@ -13,7 +13,11 @@ def initialize(*argv)
unless (@name = argv[1]) && (@url = argv[2])
raise ArgumentError, "needs a NAME and URL"
end
- when 'cd'
+ when 'update'
+ unless @name = argv[1]
+ raise ArgumentError, "needs a NAME"
+ end
+ when 'cd'
unless @name = argv[1]
raise ArgumentError, "needs a NAME"
end
@@ -34,6 +38,10 @@ def add
FileUtils.mkdir_p(repos_dir)
Dir.chdir(repos_dir) { git("clone #{@url} #{@name}") }
end
+
+ def update
+ Dir.chdir(File.join(repos_dir, @name)) { git("pull") }
+ end
end
end
end
View
19 spec/functional/command_spec.rb
@@ -23,4 +23,23 @@ def command.repos_dir; SpecHelper.tmp_repos_path; end
command.run
git_config('private', 'remote.origin.url').should == fixture('master-spec-repo.git')
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
Please sign in to comment.
Something went wrong with that request. Please try again.