Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update all spec repos in case a name is omitted.

  • Loading branch information...
commit 4c8530b131c6528d0022b4c4e48acf762651bea2 1 parent 0830504
@alloy alloy authored
Showing with 27 additions and 17 deletions.
  1. +5 −4 lib/cocoa_pods/command/repo.rb
  2. +22 −13 spec/functional/command_spec.rb
View
9 lib/cocoa_pods/command/repo.rb
@@ -14,9 +14,7 @@ def initialize(*argv)
raise ArgumentError, "needs a NAME and URL"
end
when 'update'
- unless @name = argv[1]
- raise ArgumentError, "needs a NAME"
- end
+ @name = argv[1]
when 'cd'
unless @name = argv[1]
raise ArgumentError, "needs a NAME"
@@ -40,7 +38,10 @@ def add
end
def update
- Dir.chdir(File.join(repos_dir, @name)) { git("pull") }
+ names = @name ? [@name] : Dir.entries(repos_dir)[2..-1]
+ names.each do |name|
+ Dir.chdir(File.join(repos_dir, name)) { git("pull") }
+ end
end
end
end
View
35 spec/functional/command_spec.rb
@@ -16,30 +16,39 @@ def (command.add_master_repo_command).repos_dir; SpecHelper.tmp_repos_path; end
git_config('master', 'remote.origin.url').should == fixture('master-spec-repo.git')
end
- it "adds a spec-repo" do
- command = Pod::Command.parse('repo', 'add', 'private', fixture('master-spec-repo.git'))
+ def command(*argv)
+ command = Pod::Command.parse(*argv)
def command.repos_dir; SpecHelper.tmp_repos_path; end
-
command.run
+ command
+ end
+
+ it "adds a spec-repo" do
+ command('repo', 'add', 'private', fixture('master-spec-repo.git'))
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
+ repo1 = command('repo', 'add', 'repo1', fixture('master-spec-repo.git'))
+ repo2 = command('repo', 'add', 'repo2', repo1.dir)
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
+ command('repo', 'update', 'repo2')
+ File.read(File.join(repo2.dir, 'README')).should.include 'updated!'
+ end
+
+ it "updates all the spec-repos" do
+ repo1 = command('repo', 'add', 'repo1', fixture('master-spec-repo.git'))
+ repo2 = command('repo', 'add', 'repo2', repo1.dir)
+ repo3 = command('repo', 'add', 'repo3', repo1.dir)
+
+ File.open(File.join(repo1.dir, 'README'), 'a') { |f| f << 'updated!' }
+ git('repo1', 'commit -a -m "update"')
+ command('repo', 'update')
File.read(File.join(repo2.dir, 'README')).should.include 'updated!'
+ File.read(File.join(repo3.dir, 'README')).should.include 'updated!'
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.