Commit ba041adf authored by Mark Schall's avatar Mark Schall

cleaning up robocop warnings

parent 7b09cfc5
...@@ -39,10 +39,7 @@ module Pod ...@@ -39,10 +39,7 @@ module Pod
@allow_warnings = argv.flag?('allow-warnings') @allow_warnings = argv.flag?('allow-warnings')
@local_only = argv.flag?('local-only') @local_only = argv.flag?('local-only')
@repo = argv.shift_argument @repo = argv.shift_argument
begin @source = source_for_repo
@source = config.sources_manager.source_with_name_or_url(@repo) unless @repo.nil?
rescue
end
@source_urls = argv.option('sources', config.sources_manager.all.map(&:url).join(',')).split(',') @source_urls = argv.option('sources', config.sources_manager.all.map(&:url).join(',')).split(',')
@podspec = argv.shift_argument @podspec = argv.shift_argument
@use_frameworks = !argv.flag?('use-libraries') @use_frameworks = !argv.flag?('use-libraries')
...@@ -246,6 +243,18 @@ module Pod ...@@ -246,6 +243,18 @@ module Pod
podspec_files.count podspec_files.count
end end
# Returns source for @repo
#
# @note If URL is invalid or repo doesn't exist, validate! will throw the error
#
# @return [Source]
#
def source_for_repo
config.sources_manager.source_with_name_or_url(@repo) unless @repo.nil?
rescue
nil
end
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
end end
end end
......
...@@ -16,7 +16,7 @@ module Pod ...@@ -16,7 +16,7 @@ module Pod
e.message.should.match(/Unable to find the `missing_repo` repo/) e.message.should.match(/Unable to find the `missing_repo` repo/)
end end
end end
it "complains if it can't get repo url" do it "complains if it can't get repo url" do
Dir.chdir(fixture('banana-lib')) do Dir.chdir(fixture('banana-lib')) do
Command::Repo::Add.any_instance.stubs(:clone_repo) Command::Repo::Add.any_instance.stubs(:clone_repo)
...@@ -126,7 +126,7 @@ module Pod ...@@ -126,7 +126,7 @@ module Pod
Dir.chdir(@upstream) { `git checkout master -q` } Dir.chdir(@upstream) { `git checkout master -q` }
(@upstream + 'PushTest/1.4/PushTest.podspec').read.should.include('PushTest') (@upstream + 'PushTest/1.4/PushTest.podspec').read.should.include('PushTest')
end end
it 'successfully pushes a spec to URL' do it 'successfully pushes a spec to URL' do
cmd = command('repo', 'push', @upstream) cmd = command('repo', 'push', @upstream)
Dir.chdir(@upstream) { `git checkout -b tmp_for_push -q` } Dir.chdir(@upstream) { `git checkout -b tmp_for_push -q` }
......
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