Skip to content

Commit

Permalink
Undo option for push - only for lint
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 committed May 26, 2020
1 parent 6b1103c commit bc53d58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
3 changes: 0 additions & 3 deletions lib/cocoapods/command/repo/push.rb
Expand Up @@ -25,7 +25,6 @@ def self.options
['--allow-warnings', 'Allows pushing even if there are warnings'],
['--use-libraries', 'Linter uses static libraries to install the spec'],
['--use-modular-headers', 'Lint uses modular headers during installation'],
['--use-static-frameworks', 'Lint uses static frameworks during installation'],
["--sources=#{Pod::TrunkSource::TRUNK_REPO_URL}", 'The sources from which to pull dependent 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'],
Expand All @@ -50,7 +49,6 @@ def initialize(argv)
@podspec = argv.shift_argument
@use_frameworks = !argv.flag?('use-libraries')
@use_modular_headers = argv.flag?('use-modular-headers', false)
@use_static_frameworks = argv.flag?('use-static-frameworks', false)
@private = argv.flag?('private', true)
@message = argv.option('commit-message')
@commit_message = argv.flag?('commit-message', false)
Expand Down Expand Up @@ -139,7 +137,6 @@ def validate_podspec_files
validator.allow_warnings = @allow_warnings
validator.use_frameworks = @use_frameworks
validator.use_modular_headers = @use_modular_headers
validator.use_static_frameworks = @use_static_frameworks
validator.ignore_public_only_results = @private
validator.swift_version = @swift_version
validator.skip_import_validation = @skip_import_validation
Expand Down
38 changes: 12 additions & 26 deletions spec/functional/command/repo/push_spec.rb
Expand Up @@ -204,10 +204,10 @@ module Pod
end

it 'validates specs as frameworks by default' do
Validator.any_instance.expects(:podfile_from_spec).with(:ios, '8.0', true, [], false, false).times(3).returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, true, [], false, false).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, true, [], false, false).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, true, [], false, false).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:ios, '8.0', true, [], false, nil).times(3).returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, true, [], false, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, true, [], false, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, true, [], false, nil).twice.returns(stub('Podfile'))

cmd = command('repo', 'push', 'master')
# Git push will throw an exception here since this is a local custom git repo. All we care is the validator
Expand All @@ -218,10 +218,10 @@ module Pod
end

it 'validates specs as libraries if requested' do
Validator.any_instance.expects(:podfile_from_spec).with(:ios, nil, false, [], false, false).times(3).returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, false, [], false, false).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, false, [], false, false).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, false, [], false, false).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:ios, nil, false, [], false, nil).times(3).returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, false, [], false, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, false, [], false, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, false, [], false, nil).twice.returns(stub('Podfile'))

cmd = command('repo', 'push', 'master', '--use-libraries')
# Git push will throw an exception here since this is a local custom git repo. All we care is the validator
Expand All @@ -232,10 +232,10 @@ module Pod
end

it 'validates specs with modular headers if requested' do
Validator.any_instance.expects(:podfile_from_spec).with(:ios, nil, false, [], true, false).times(3).returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, false, [], true, false).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, false, [], true, false).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, false, [], true, false).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:ios, nil, false, [], true, nil).times(3).returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, false, [], true, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, false, [], true, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, false, [], true, nil).twice.returns(stub('Podfile'))

cmd = command('repo', 'push', 'master', '--use-libraries', '--use-modular-headers')
# Git push will throw an exception here since this is a local custom git repo. All we care is the validator
Expand All @@ -245,20 +245,6 @@ module Pod
end.should.raise Informative
end

it 'validates specs with static frameworks if requested' do
Validator.any_instance.expects(:podfile_from_spec).with(:ios, '8.0', true, [], false, true).times(3).returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, true, [], false, true).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, true, [], false, true).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, true, [], false, true).twice.returns(stub('Podfile'))

cmd = command('repo', 'push', 'master', '--use-static-frameworks')
# Git push will throw an exception here since this is a local custom git repo. All we care is the validator
# tests so the exception is swallowed.
lambda do
Dir.chdir(temporary_directory) { cmd.run }
end.should.raise Informative
end

it 'raises error and exit code when push fails' do
cmd = command('repo', 'push', 'master')
Pod::TrunkSource.any_instance.stubs(:refresh_metadata)
Expand Down

0 comments on commit bc53d58

Please sign in to comment.