Commit 1a883aba authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into core-extraction

* master:
  Updated master repo fixture.
  [Specs] Fix for master repo update & small performance improvements.

Conflicts:
	spec/functional/command/list_spec.rb
	spec/functional/command/push_spec.rb
	spec/functional/command/repo_spec.rb
	spec/functional/command/setup_spec.rb
	spec/spec_helper/temporary_repos.rb
	spec/unit/resolver_spec.rb
	spec/unit/source_spec.rb
parents 72534339 75f7c742
...@@ -27,6 +27,12 @@ module Pod ...@@ -27,6 +27,12 @@ module Pod
errors.empty? && warnings.empty? && deprecations.empty? errors.empty? && warnings.empty? && deprecations.empty?
end end
# TODO
def result_type
:note
end
# @return [Bool] whether the lint should skip the checks that requires # @return [Bool] whether the lint should skip the checks that requires
# the download or the build of the library. # the download or the build of the library.
# #
......
...@@ -39,14 +39,14 @@ module Pod ...@@ -39,14 +39,14 @@ module Pod
class New < List class New < List
self.summary = 'Lists pods introduced in the master spec-repo since the last check' self.summary = 'Lists pods introduced in the master spec-repo since the last check'
def run def run_a
update_if_necessary! update_if_necessary!
days = [1,2,3,5,8] days = [1,2,3,5,8]
dates, groups = {}, {} dates, groups = {}, {}
days.each {|d| dates[d] = Time.now - 60 * 60 * 24 * d} days.each {|d| dates[d] = Time.now - 60 * 60 * 24 * d}
sets = Source.all_sets sets = Source.all_sets
creation_dates = Pod::Specification::Set::Statistics.instance.creation_dates(sets) creation_dates = Specification::Set::Statistics.instance.creation_dates(sets)
sets.each do |set| sets.each do |set|
set_date = creation_dates[set.name] set_date = creation_dates[set.name]
......
...@@ -87,7 +87,7 @@ module Pod ...@@ -87,7 +87,7 @@ module Pod
lint_argv = ["lint"] lint_argv = ["lint"]
lint_argv << "--only-errors" if @allow_warnings lint_argv << "--only-errors" if @allow_warnings
lint_argv << "--silent" if config.silent lint_argv << "--silent" if config.silent
all_valid = true # all_valid = true
podspec_files.each do |podspec| podspec_files.each do |podspec|
Spec.parse(lint_argv + [podspec.to_s]).run Spec.parse(lint_argv + [podspec.to_s]).run
end end
......
...@@ -107,7 +107,7 @@ module Pod ...@@ -107,7 +107,7 @@ module Pod
invalid_count = 0 invalid_count = 0
podspecs.each do |podspec| podspecs.each do |podspec|
linter = Linter.new(podspec) linter = DeepLinter.new(podspec)
linter.quick = true linter.quick = true
linter.repo_path = dir linter.repo_path = dir
...@@ -178,6 +178,8 @@ module Pod ...@@ -178,6 +178,8 @@ module Pod
is_compatilbe(versions) is_compatilbe(versions)
end end
#--------------------------------------#
private private
def versions(dir) def versions(dir)
......
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
module Pod module Pod
describe Command::List do describe "Command::List" do
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
extend SpecHelper::TemporaryDirectory
it "lists the known pods" do def command(arguments = argv)
out = run_command('list') command = Command::List.new(arguments)
[ /ZBarSDK/, end
/TouchJSON/,
/SDURLCache/, before do
/MagicalRecord/, set_up_test_repo
/A2DynamicDelegate/, config.repos_dir = SpecHelper.tmp_repos_path
end
it "presents the known pods" do
command.run
UI.output
[ /BananaLib/,
/JSONKit/,
/\d+ pods were found/ /\d+ pods were found/
].each { |regex| out.should =~ regex } ].each { |regex| UI.output.should =~ regex }
end end
it "lists the new pods" do it "returns the new pods" do
Time.stubs(:now).returns(Time.mktime(2012,2,3)) sets = Source.all_sets
out = run_command('list', 'new') jsonkit_set = sets.find { |s| s.name == 'JSONKit' }
[ 'iCarousel', dates = {
'libPusher', 'BananaLib' => Time.now,
'SSCheckBoxView', 'JSONKit' => Time.parse('01/01/1970') }
'KKPasscodeLock', Specification::Set::Statistics.any_instance.stubs(:creation_dates).returns(dates)
'SOCKit', command(argv('new')).run
'FileMD5Hash', UI.output.should.include('BananaLib')
'cocoa-oauth', UI.output.should.not.include('JSONKit')
'iRate'
].each {|s| out.should.include s }
end end
end end
end end
......
...@@ -10,41 +10,43 @@ module Pod ...@@ -10,41 +10,43 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path config.repos_dir = SpecHelper.tmp_repos_path
end end
def master_repo
fixture('spec-repos/master')
end
it "requires a spec-repo name" do it "requires a spec-repo name" do
lambda { command('push').validate! }.should.raise CLAide::Help lambda { command('push').validate! }.should.raise CLAide::Help
end end
it "complains if it can't find the repo" do it "complains if it can't find the repo" do
repo1 = add_repo('repo1', master_repo)
Dir.chdir(fixture('banana-lib')) do Dir.chdir(fixture('banana-lib')) do
lambda { run_command('push', 'repo2') }.should.raise Informative cmd = command('push', 'missing_repo')
cmd.expects(:validate_podspec_files).returns(true)
e = lambda { cmd.run }.should.raise Informative
e.message.should.match(/repo not found/)
end end
end end
it "complains if it can't find a spec" do it "complains if it can't find a spec" do
repo1 = add_repo('repo1', master_repo) repo_make('test_repo')
lambda { run_command('push', 'repo1') }.should.raise Informative e = lambda { run_command('push', 'test_repo') }.should.raise Pod::Informative
e.message.should.match(/Couldn't find any .podspec/)
end end
it "it raises if the pod is not validated" do # TODO: the validation should not use the pod spec command
repo1 = add_repo('repo1', master_repo) xit "it raises if the specification doesn't validates" do
repo2 = add_repo('repo2', repo1.dir) repo_make('test_repo')
git_config('repo2', 'remote.origin.url').should == (tmp_repos_path + 'repo1').to_s Dir.chdir(temporary_directory) do
Dir.chdir(fixture('banana-lib')) do spec = "Spec.new do |s|; s.name = 'Broken'; end"
lambda { run_command('push', 'repo2', '--silent') }.should.raise Informative File.open('Broken.podspec', 'w') {|f| f.write(spec) }
cmd = command('push', 'test_repo')
cmd.expects(:validate_podspec_files).returns(true)
e = lambda { cmd.run }.should.raise Pod::Informative
e.message.should.match(/repo not clean/)
end end
# (repo1.dir + 'BananaLib/1.0/BananaLib.podspec').read.should.include 'Added!'
end end
#--------------------------------------#
before do before do
# prepare the repos repo_make('upstream')
@upstream = add_repo('upstream', master_repo) repo_clone('upstream', 'local_repo')
@local_repo = add_repo('local_repo', @upstream.dir)
git_config('local_repo', 'remote.origin.url').should == (tmp_repos_path + 'upstream').to_s
# prepare the spec # prepare the spec
spec = (fixture('spec-repos') + 'master/JSONKit/1.4/JSONKit.podspec').read spec = (fixture('spec-repos') + 'master/JSONKit/1.4/JSONKit.podspec').read
...@@ -55,26 +57,29 @@ module Pod ...@@ -55,26 +57,29 @@ module Pod
end end
it "refuses to push if the repo is not clean" do it "refuses to push if the repo is not clean" do
File.open(@local_repo.dir + 'README', 'w') {|f| f.write('Added!') } repo_make_readme_change('local_repo', 'dirty')
(@local_repo.dir + 'README').read.should.include 'Added!' Dir.chdir(temporary_directory) do
cmd = command('push', 'local_repo') cmd = command('push', 'local_repo')
cmd.expects(:validate_podspec_files).returns(true) cmd.expects(:validate_podspec_files).returns(true)
Dir.chdir(temporary_directory) { lambda { cmd.run }.should.raise Informative } e = lambda { cmd.run }.should.raise Pod::Informative
e.message.should.match(/repo not clean/)
(@upstream.dir + 'PushTest/1.4/PushTest.podspec').should.not.exist? end
(repo_path('upstream') + 'PushTest/1.4/PushTest.podspec').should.not.exist?
end end
it "sucessfully pushes a spec" do it "sucessfully pushes a spec" do
git('upstream', 'checkout master') # checkout master, to allow push in a non-bare repository
cmd = command('push', 'local_repo') cmd = command('push', 'local_repo')
Dir.chdir(repo_path 'upstream') { `git checkout -b tmp_for_push -q` }
cmd.expects(:validate_podspec_files).returns(true) cmd.expects(:validate_podspec_files).returns(true)
Dir.chdir(temporary_directory) { cmd.run } Dir.chdir(temporary_directory) { cmd.run }
UI.output.should.include('[Add] PushTest (1.4)') Pod::UI.output.should.include('[Add] PushTest (1.4)')
UI.output.should.include('[Fix] JSONKit (1.4)') Pod::UI.output.should.include('[Add] JSONKit (1.4)')
# TODO check the commit messages
# Pod::UI.output.should.include('[Fix] JSONKit (1.4)')
git('upstream', 'checkout test') # checkout because test because is it the branch used in the specs. Dir.chdir(repo_path 'upstream') { `git checkout master -q` }
(@upstream.dir + 'PushTest/1.4/PushTest.podspec').read.should.include('PushTest') (repo_path('upstream') + 'PushTest/1.4/PushTest.podspec').read.should.include('PushTest')
end end
end end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
describe "Pod::Command::Repo" do module Pod
describe Command::Repo do
describe "In general" do
extend SpecHelper::Command
extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos
before do before do
set_up_test_repo
config.repos_dir = SpecHelper.tmp_repos_path config.repos_dir = SpecHelper.tmp_repos_path
end end
describe "In general" do it "updates a repository" do
extend SpecHelper::TemporaryDirectory upstream = SpecHelper.temporary_directory + 'upstream'
extend SpecHelper::TemporaryRepos FileUtils.cp_r(test_repo_path, upstream)
Dir.chdir(test_repo_path) do
`git remote add origin #{upstream}`
`git remote -v`
`git fetch -q`
`git branch --set-upstream master origin/master`
end
lambda { command('repo', 'update').run }.should.not.raise
end
it "lints a repository" do
lambda { run_command('repo', 'lint', temporary_directory.to_s) }.should.not.raise
end
it "adds a spec-repo" do it "adds a spec-repo" do
run_command('repo', 'add', 'private', fixture('spec-repos/master')) run_command('repo', 'add', 'private', test_repo_path)
git_config('private', 'remote.origin.url').should == fixture('spec-repos/master').to_s Dir.chdir(config.repos_dir + 'private') do
`git config --get remote.origin.url`.chomp.should == test_repo_path.to_s
end
end end
it "adds a spec-repo with on a specified branch" do it "adds a spec-repo with a specified branch" do
repo1 = add_repo('repo1', fixture('spec-repos/master')) repo1 = repo_make('repo1')
Dir.chdir(repo1.dir) do Dir.chdir(repo1) do
`git checkout -b my-branch >/dev/null 2>&1` `git checkout -b my-branch >/dev/null 2>&1`
`git checkout master >/dev/null 2>&1` `git checkout master >/dev/null 2>&1`
end end
repo2 = command( 'repo' ,'add', 'repo2', repo1.dir, 'my-branch') repo2 = command( 'repo' ,'add', 'repo2', repo1.to_s, 'my-branch')
repo2.run repo2.run
Dir.chdir(repo2.dir) { `git symbolic-ref HEAD` }.should.include? 'my-branch' Dir.chdir(repo2.dir) { `git symbolic-ref HEAD` }.should.include? 'my-branch'
end end
it "updates a spec-repo" do it "updates a spec-repo" do
repo1 = add_repo('repo1', fixture('spec-repos/master')) repo1 = repo_make('repo1')
repo2 = add_repo('repo2', repo1.dir) repo2 = repo_clone('repo1', 'repo2')
make_change(repo1, 'repo1') repo_make_readme_change(repo1, 'Updated')
Dir.chdir(repo1) {`git commit -a -m "Update"`}
run_command('repo', 'update', 'repo2') run_command('repo', 'update', 'repo2')
(repo2.dir + 'README').read.should.include 'Added!' (repo2 + 'README').read.should.include 'Updated'
end
it "updates all the spec-repos" do
repo1 = add_repo('repo1', fixture('spec-repos/master'))
repo2 = add_repo('repo2', repo1.dir)
repo3 = add_repo('repo3', repo1.dir)
make_change(repo1, 'repo1')
run_command('repo', 'update')
(repo2.dir + 'README').read.should.include 'Added!'
(repo3.dir + 'README').read.should.include 'Added!'
end
before do
config.repos_dir = fixture('spec-repos')
end
it "lints a repo" do
cmd = command('repo', 'lint', 'master')
lambda { cmd.run }.should.raise Pod::Informative
Pod::UI.output.should.include "Missing license type"
end end
end end
describe "Concerning a repo support" do describe "CocoaPods version" do
extend SpecHelper::Command
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
before do
add_repo('repo1', fixture('spec-repos/master'))
FileUtils.rm_rf(versions_file)
versions_file.should.not.exist?
end
require 'yaml' require 'yaml'
def versions_file before do
tmp_repos_path + "repo1/CocoaPods-version.yml" config.repos_dir = SpecHelper.tmp_repos_path
@repo = repo_make('repo1')
end end
def write_version_file(hash) def write_version_file(hash)
yaml = YAML.dump(hash) yaml = YAML.dump(hash)
File.open(versions_file, 'w') {|f| f.write(yaml) } @versions_file = tmp_repos_path + "repo1/CocoaPods-version.yml"
File.open(@versions_file, 'w') {|f| f.write(yaml) }
end end
it "it doesn't requires CocoaPods-version.yml" do it "it doesn't requires CocoaPods-version.yml" do
cmd = command('repo', 'update') cmd = command('repo', 'update')
lambda { cmd.check_versions(versions_file.dirname) }.should.not.raise lambda { cmd.check_versions(@repo) }.should.not.raise
end end
it "runs with a compatible repo" do it "runs with a compatible repo" do
write_version_file({'min' => "0.0.1"}) write_version_file({'min' => "0.0.1"})
cmd = command('repo', 'update') cmd = command('repo', 'update')
lambda { cmd.check_versions(versions_file.dirname) }.should.not.raise lambda { cmd.check_versions(@repo) }.should.not.raise
end end
it "raises if a repo is not compatible" do it "raises if a repo is not compatible" do
write_version_file({'min' => "999.0.0"}) write_version_file({'min' => "999.0.0"})
cmd = command('repo', 'update') cmd = command('repo', 'update')
lambda { cmd.check_versions(versions_file.dirname) }.should.raise Pod::Informative lambda { cmd.check_versions(@repo) }.should.raise Informative
end end
it "informs about a higher known CocoaPods version" do it "informs about a higher known CocoaPods version" do
write_version_file({'last' => "999.0.0"}) write_version_file({'last' => "999.0.0"})
cmd = command('repo', 'update') cmd = command('repo', 'update')
cmd.check_versions(versions_file.dirname) cmd.check_versions(@repo)
Pod::UI.output.should.include "Cocoapods 999.0.0 is available" UI.output.should.include "Cocoapods 999.0.0 is available"
end end
it "has a class method that returns if a repo is supported" do it "has a class method that returns if a repo is supported" do
write_version_file({'min' => "999.0.0"}) write_version_file({'min' => "999.0.0"})
Pod::Command::Repo.compatible?('repo1').should == false Command::Repo.compatible?('repo1').should == false
write_version_file({'min' => "0.0.1"}) write_version_file({'min' => "0.0.1"})
Pod::Command::Repo.compatible?('repo1').should == true Command::Repo.compatible?('repo1').should == true
end
end end
end end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
module Pod describe Pod::Command::Setup do
describe Command::Setup do extend SpecHelper::Command
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
...@@ -9,50 +9,47 @@ module Pod ...@@ -9,50 +9,47 @@ module Pod
config.repos_dir = SpecHelper.tmp_repos_path config.repos_dir = SpecHelper.tmp_repos_path
end end
it "runs with correct parameters" do it "returns the read only URL of the `master` spec-repo" do
lambda { run_command('setup') }.should.not.raise cmd = Pod::Command::Setup.new(argv)
end
it "complains for wrong parameters" do
lambda { run_command('setup', 'wrong') }.should.raise CLAide::Help
lambda { run_command('setup', '--wrong') }.should.raise CLAide::Help
end
it "returns the read only URL of the `master' spec-repo" do
cmd = Command::Setup.new(argv)
cmd.url.should == 'https://github.com/CocoaPods/Specs.git' cmd.url.should == 'https://github.com/CocoaPods/Specs.git'
end end
it "returns the push URL of the `master' spec-repo" do it "returns the push URL of the `master' spec-repo" do
config.silent = true config.silent = true
cmd = Command::Setup.new(argv('--push')) cmd = Pod::Command::Setup.new(argv('--push'))
cmd.url.should == 'git@github.com:CocoaPods/Specs.git' cmd.url.should == 'git@github.com:CocoaPods/Specs.git'
end end
class Command::Setup before do
def read_only_url; SpecHelper.fixture('spec-repos/master'); end set_up_test_repo
Pod::Command::Setup.any_instance.stubs(:read_only_url).returns(test_repo_path.to_s)
config.repos_dir = SpecHelper.temporary_directory
end
it "runs with correct parameters" do
lambda { run_command('setup') }.should.not.raise
end end
it "creates the local spec-repos directory and creates a clone of the `master' repo" do it "creates the local spec-repos directory and creates a clone of the `master' repo" do
output = run_command('setup') output = run_command('setup')
output.should.include "Setup completed" output.should.include "Setup completed"
output.should.not.include "push" output.should.not.include "push"
git_config('master', 'remote.origin.url').should == fixture('spec-repos/master').to_s url = Dir.chdir(config.repos_dir + 'master') { `git config --get remote.origin.url`.chomp }
url.should == test_repo_path.to_s
end end
it "preserves push access for the `master' repo" do it "preserves push access for the `master' repo" do
output = run_command('setup') output = run_command('setup')
output.should.not.include "push" output.should.not.include "push"
git('master', 'remote set-url origin git@github.com:CocoaPods/Specs.git') Dir.chdir(config.repos_dir + 'master') { `git remote set-url origin git@github.com:CocoaPods/Specs.git` }
command('setup').url.should == 'git@github.com:CocoaPods/Specs.git' command('setup').url.should == 'git@github.com:CocoaPods/Specs.git'
end end
it "can run if needed" do it "can run if needed" do
output = run_command('setup') output = run_command('setup')
output.should.include "Setup completed" output.should.include "Setup completed"
UI.output = '' Pod::UI.output = ''
command('setup').run_if_needed command('setup').run_if_needed
UI.output.should == '' Pod::UI.output.should == ''
end
end end
end end
...@@ -15,6 +15,7 @@ describe Pod::UI do ...@@ -15,6 +15,7 @@ describe Pod::UI do
output.should.include? 'CocoaLumberjack' output.should.include? 'CocoaLumberjack'
output.should.include? '1.0' output.should.include? '1.0'
output.should.include? '1.1' output.should.include? '1.1'
output.should.include? '[master repo]'
output.should.include? 'A fast & simple, yet powerful & flexible logging framework for Mac and iOS.' output.should.include? 'A fast & simple, yet powerful & flexible logging framework for Mac and iOS.'
output.should.include? 'https://github.com/robbiehanson/CocoaLumberjack' output.should.include? 'https://github.com/robbiehanson/CocoaLumberjack'
output.should.include? 'https://github.com/robbiehanson/CocoaLumberjack.git' output.should.include? 'https://github.com/robbiehanson/CocoaLumberjack.git'
......
...@@ -192,15 +192,19 @@ else ...@@ -192,15 +192,19 @@ else
result = installer.lockfile.to_hash result = installer.lockfile.to_hash
result['PODS'].should == [ result['PODS'].should == [
{ "ASIHTTPRequest (1.8.1)" => ["ASIHTTPRequest/ASIWebPageRequest (= 1.8.1)", { "ASIHTTPRequest (1.8.1)" =>
[ "ASIHTTPRequest/ASIWebPageRequest (= 1.8.1)",
"ASIHTTPRequest/CloudFiles (= 1.8.1)", "ASIHTTPRequest/CloudFiles (= 1.8.1)",
"ASIHTTPRequest/S3 (= 1.8.1)", "ASIHTTPRequest/S3 (= 1.8.1)",
"Reachability"]}, "Reachability"
]
},
{ "ASIHTTPRequest/ASIWebPageRequest (1.8.1)" => ["Reachability"] }, { "ASIHTTPRequest/ASIWebPageRequest (1.8.1)" => ["Reachability"] },
{ "ASIHTTPRequest/CloudFiles (1.8.1)" => ["Reachability"] }, { "ASIHTTPRequest/CloudFiles (1.8.1)" => ["Reachability"] },
{ "ASIHTTPRequest/S3 (1.8.1)" => ["Reachability"] }, { "ASIHTTPRequest/S3 (1.8.1)" => ["Reachability"] },
"JSONKit (1.4)", "JSONKit (1.4)",
"Reachability (3.0.0)"] "Reachability (3.1.0)"
]
result['DEPENDENCIES'].should == ["ASIHTTPRequest", "JSONKit (= 1.4)"] result['DEPENDENCIES'].should == ["ASIHTTPRequest", "JSONKit (= 1.4)"]
# TODO might be nicer looking to not show the dependencies of the top level spec for each subspec (Reachability). # TODO might be nicer looking to not show the dependencies of the top level spec for each subspec (Reachability).
...@@ -300,7 +304,7 @@ else ...@@ -300,7 +304,7 @@ else
lockfile_contents = { lockfile_contents = {
'PODS' => [ 'PODS' => [
'JSONKit (999.999.999)', 'JSONKit (999.999.999)',
'Reachability (3.0.0)', 'Reachability (3.1.0)',
'SSZipArchive (0.1.1)', 'SSZipArchive (0.1.1)',
], ],
'DEPENDENCIES' => [ 'DEPENDENCIES' => [
......
require 'spec_helper/temporary_directory' require 'spec_helper/temporary_directory'
# Important
# Include with temporary directory
module SpecHelper module SpecHelper
def self.tmp_repos_path def self.tmp_repos_path
TemporaryRepos.tmp_repos_path TemporaryRepos.tmp_repos_path
...@@ -9,41 +12,64 @@ module SpecHelper ...@@ -9,41 +12,64 @@ module SpecHelper
extend Pod::Executable extend Pod::Executable
executable :git executable :git
def tmp_repos_path # @return [Pathname] The path for the repo with the given name.
SpecHelper.temporary_directory + 'cocoapods' #
def repo_path(name)
tmp_repos_path + name
end end
module_function :tmp_repos_path
alias_method :git_super, :git # Makes a repo with the given name.
def git(repo, command) #
Dir.chdir(tmp_repos_path + repo) do def repo_make(name)
if output = git_super(command) path = repo_path(name)
output.strip path.mkpath
Dir.chdir(path) do
`git init`
repo_make_readme_change(name, 'Added')
`git add .`
`git commit -m "Initialized."`
end end
path
end end
# Clones a repo to the given name.
#
def repo_clone(from_name, to_name)
Dir.chdir(tmp_repos_path) { `git clone #{from_name} #{to_name}` }
repo_path(to_name)
end end
def git_config(repo, attr) def repo_make_readme_change(name, string)
git repo, "config --get #{attr}" file = repo_path(name) + 'README'
file.open('w') { |f| f << "#{string}" }
end end
def add_repo(name, from) #--------------------------------------#
command = Pod::Command.parse(['repo', 'add', name, from])
command.run def test_repo_path
# The test branch is used by the push specs repo_path('master')
Dir.chdir(command.dir) do
`git checkout -b test >/dev/null 2>&1`
`git branch --set-upstream test origin/master >/dev/null 2>&1`
end end
command
# Sets up a lighweight master repo in `tmp/cocoapods/master` with the
# contents of `spec/fixtures/spec-repos/test_repo`.
#
def set_up_test_repo
require 'fileutils'
test_repo_path.mkpath
origin = ROOT + 'spec/fixtures/spec-repos/test_repo/.'
destination = tmp_repos_path + 'master'
FileUtils.cp_r(origin, destination)
repo_make('master')
end end
def make_change(repo, name) #--------------------------------------#
(repo.dir + 'README').open('w') { |f| f << 'Added!' }
git(name, 'add README') def tmp_repos_path
git(name, 'commit -m "changed"') SpecHelper.temporary_directory + 'cocoapods'
end end
module_function :tmp_repos_path
def self.extended(base) def self.extended(base)
base.before do base.before do
tmp_repos_path.mkpath tmp_repos_path.mkpath
......
...@@ -28,9 +28,9 @@ module Pod ...@@ -28,9 +28,9 @@ module Pod
end end
it "does not raise if all dependencies match the platform of the root spec (Podfile)" do it "does not raise if all dependencies match the platform of the root spec (Podfile)" do
@podfile.platform :ios @podfile.platform :ios, '6.0'
lambda { @resolver.resolve }.should.not.raise lambda { @resolver.resolve }.should.not.raise
@podfile.platform :osx @podfile.platform :osx, '10.7'
lambda { @resolver.resolve }.should.not.raise lambda { @resolver.resolve }.should.not.raise
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