Commit 59f09980 authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by Dimitris Couchell-Koutsogiorgas

Add --sources option to push command

parent 0b643c4c
......@@ -12,6 +12,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Boris Bügling](https://github.com/neonichu)
[#3920](https://github.com/CocoaPods/CocoaPods/pull/3920)
##### Enhancements
* Add `--sources` option to `push` command.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#3912](https://github.com/CocoaPods/CocoaPods/issues/3912)
## 0.38.2
......@@ -3960,4 +3966,4 @@ allowing you to automate Xcode related tasks.
[4]: https://github.com/CocoaPods/Xcodeproj
[5]: https://github.com/tomaz/appledoc
[6]: https://github.com/CocoaPods/CocoaPods/compare/0.5.1...0.6.0
[7]: https://github.com/CocoaPods/CocoaPods/compare/0.3.10...0.5.0
[7]: https://github.com/CocoaPods/CocoaPods/compare/0.3.10...0.5.0
\ No newline at end of file
......@@ -22,6 +22,9 @@ module Pod
def self.options
[['--allow-warnings', 'Allows pushing even if there are warnings'],
['--use-libraries', 'Linter uses static libraries to install the spec'],
['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependant pods ' \
'(defaults to all available repos). '\
'Multiple sources must be comma-delimited.'],
['--local-only', 'Does not perform the step of pushing REPO to its remote']].concat(super)
end
......@@ -29,6 +32,7 @@ module Pod
@allow_warnings = argv.flag?('allow-warnings')
@local_only = argv.flag?('local-only')
@repo = argv.shift_argument
@source_urls = argv.option('sources', SourcesManager.all.map(&:url).join(',')).split(',')
@podspec = argv.shift_argument
@use_frameworks = !argv.flag?('use-libraries')
super
......@@ -84,7 +88,7 @@ module Pod
def validate_podspec_files
UI.puts "\nValidating #{'spec'.pluralize(count)}".yellow
podspec_files.each do |podspec|
validator = Validator.new(podspec, SourcesManager.all.map(&:url))
validator = Validator.new(podspec, @source_urls)
validator.allow_warnings = @allow_warnings
validator.use_frameworks = @use_frameworks
begin
......
......@@ -113,6 +113,16 @@ module Pod
(@upstream + 'PushTest/1.4/PushTest.podspec').read.should.include('PushTest')
end
it 'initializes with default sources if no custom sources specified' do
cmd = command('repo', 'push', 'master')
cmd.instance_variable_get(:@source_urls).should.equal [@upstream.to_s]
end
it 'initializes with custom sources if specified' do
cmd = command('repo', 'push', 'master', '--sources=test_repo2,test_repo1')
cmd.instance_variable_get(:@source_urls).should.equal %w(test_repo2 test_repo1)
end
before do
%i(prepare resolve_dependencies download_dependencies).each do |m|
Installer.any_instance.stubs(m)
......
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