Class: Pod::Command::Repo::Push

Inherits:
Pod::Command::Repo show all
Extended by:
Executable
Defined in:
lib/cocoapods/command/repo/push.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Executable

capture_command, capture_command!, executable, execute_command, which, which!

Methods inherited from Pod::Command::Repo

#dir

Methods inherited from Pod::Command

#ensure_master_spec_repo_exists!, report_error, run

Methods included from Pod::Config::Mixin

#config

Constructor Details

#initialize(argv) ⇒ Push

Returns a new instance of Push


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/cocoapods/command/repo/push.rb', line 43

def initialize(argv)
  @allow_warnings = argv.flag?('allow-warnings')
  @local_only = argv.flag?('local-only')
  @repo = argv.shift_argument
  @source = source_for_repo
  @source_urls = argv.option('sources', config.sources_manager.all.map(&:url).join(',')).split(',')
  @podspec = argv.shift_argument
  @use_frameworks = !argv.flag?('use-libraries')
  @use_modular_headers = argv.flag?('use-modular-headers', false)
  @private = argv.flag?('private', true)
  @message = argv.option('commit-message')
  @commit_message = argv.flag?('commit-message', false)
  @use_json = argv.flag?('use-json')
  @swift_version = argv.option('swift-version', nil)
  @skip_import_validation = argv.flag?('skip-import-validation', false)
  @skip_tests = argv.flag?('skip-tests', false)
  @allow_overwrite = argv.flag?('overwrite', true)
  super
end

Class Method Details

.optionsObject


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cocoapods/command/repo/push.rb', line 23

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'],
    ["--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'],
    ['--no-private', 'Lint includes checks that apply only to public repos'],
    ['--skip-import-validation', 'Lint skips validating that the pod can be imported'],
    ['--skip-tests', 'Lint skips building and running tests during validation'],
    ['--commit-message="Fix bug in pod"', 'Add custom commit message. Opens default editor if no commit ' \
      'message is specified'],
    ['--use-json', 'Convert the podspec to JSON before pushing it to the repo'],
    ['--swift-version=VERSION', 'The `SWIFT_VERSION` that should be used when linting the spec. ' \
     'This takes precedence over the Swift versions specified by the spec or a `.swift-version` file'],
    ['--no-overwrite', 'Disallow pushing that would overwrite an existing spec'],
  ].concat(super)
end

Instance Method Details

#runObject


73
74
75
76
77
78
79
80
81
# File 'lib/cocoapods/command/repo/push.rb', line 73

def run
  open_editor if @commit_message && @message.nil?
  check_if_push_allowed
  validate_podspec_files
  check_repo_status
  update_repo
  add_specs_to_repo
  push_repo unless @local_only
end

#validate!Object


63
64
65
66
67
68
69
70
71
# File 'lib/cocoapods/command/repo/push.rb', line 63

def validate!
  super
  help! 'A spec-repo name or url is required.' unless @repo
  unless @source && @source.repo.directory?
    raise Informative,
          "Unable to find the `#{@repo}` repo. " \
          'If it has not yet been cloned, add it via `pod repo add`.'
  end
end