Class: Pod::Command::Repo::Dypush

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Dypush

Returns a new instance of Dypush.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/pod/command/repo/dypush.rb', line 57

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')
  @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)
  super
end

Class Method Details

.optionsObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/pod/command/repo/dypush.rb', line 38

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 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', 'Push JSON spec to repo'],
    ['--swift-version=VERSION', 'The SWIFT_VERSION that should be used when linting the spec. ' \
     'This takes precedence over a .swift-version file.'],
  ].concat(super)
end

Instance Method Details

#runObject



85
86
87
88
89
90
91
92
93
# File 'lib/pod/command/repo/dypush.rb', line 85

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

#validate!Object



75
76
77
78
79
80
81
82
83
# File 'lib/pod/command/repo/dypush.rb', line 75

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