Class: Pod::Command::Trunk::Push

Inherits:
Pod::Command::Trunk show all
Defined in:
lib/pod/command/trunk/push.rb

Constant Summary

Constants inherited from Pod::Command::Trunk

BASE_URL, SCHEME_AND_HOST

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Push

Returns a new instance of Push.



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/pod/command/trunk/push.rb', line 43

def initialize(argv)
  @allow_warnings = argv.flag?('allow-warnings', false)
  @use_frameworks = !argv.flag?('use-libraries')
  @use_modular_headers = argv.flag?('use-modular-headers')
  @swift_version = argv.option('swift-version', nil)
  @skip_import_validation = argv.flag?('skip-import-validation', false)
  @skip_tests = argv.flag?('skip-tests', false)
  @path = argv.shift_argument || '.'
  @synchronous = argv.flag?('synchronous', false)
  find_podspec_file if File.directory?(@path)
  super
end

Class Method Details

.optionsObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/pod/command/trunk/push.rb', line 30

def self.options
  [
    ['--allow-warnings', 'Allows push even if there are lint warnings'],
    ['--use-libraries', 'Linter uses static libraries to install the spec'],
    ['--use-modular-headers', 'Lint uses modular headers during installation'],
    ['--swift-version=VERSION', 'The SWIFT_VERSION that should be used to lint the spec. ' \
     'This takes precedence over a .swift-version file.'],
    ['--skip-import-validation', 'Lint skips validating that the pod can be imported'],
    ['--skip-tests', 'Lint skips building and running tests during validation'],
    ['--synchronous', 'If validation depends on other recently pushed pods, synchronize'],
  ].concat(super)
end

Instance Method Details

#runObject



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/pod/command/trunk/push.rb', line 70

def run
  update_master_repo
  validate_podspec
  status, json = push_to_trunk
  update_master_repo

  if (400...600).cover?(status)
    print_messages(json['data_url'], json['messages'], nil)
  else
    print_messages(json['data_url'], json['messages'], spec, 'published')
  end
end

#validate!Object



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/pod/command/trunk/push.rb', line 56

def validate!
  super
  unless token
    help! 'You need to run `pod trunk register` to register a session first.'
  end
  unless @path
    help! 'Please specify the path to the podspec file.'
  end
  unless File.exist?(@path) && !File.directory?(@path)
    help! "The specified path `#{@path}` does not point to " \
            'an existing podspec file.'
  end
end