Class: Pod::Command::RepoArt::Push

Inherits:
Pod::Command::RepoArt show all
Extended by:
Executable
Defined in:
lib/pod/command/repo_art/push.rb

Constant Summary collapse

UTIL =
Pod::RepoArt::RepoUtil

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::RepoArt

#init

Constructor Details

#initialize(argv) ⇒ Push


30
31
32
33
34
35
# File 'lib/pod/command/repo_art/push.rb', line 30

def initialize(argv)
  @local_only = argv.flag?('local-only')
  @repo = argv.shift_argument
  @podspec = argv.shift_argument
  super
end

Class Method Details

.optionsObject


24
25
26
27
28
# File 'lib/pod/command/repo_art/push.rb', line 24

def self.options
  [
      ['--local-only', 'Does not push changes to Artifactory']
  ].concat(super)
end

Instance Method Details

#add_specs_to_repoObject

Adds the specs to the local repo and pushes them to Artifactory if required


57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/pod/command/repo_art/push.rb', line 57

def add_specs_to_repo
  UI.puts "Adding the #{'spec'.pluralize(podspec_files.count)} to repo `#{@repo}'\n"
  podspec_files.each do |spec_file|
    spec = Pod::Specification.from_file(spec_file)
    output_path = File.join(repo_specs_dir, spec.name, spec.version.to_s)
    UI.puts " --> #{get_message(output_path, spec)}"
    if @local_only
      create_json_in_path(output_path, spec)
    else
      # TODO push to local disabled until virtual repo support
      raise Informative, 'Pushing specs to Artifactory is currently disabled'
=begin
      begin
        podspec_json_tmp_path = create_json_in_path(output_path, spec)
      rescue => e
        FileUtils.remove(output_path, :force => true)
        raise Informative, "Error writing spec file in target path '#{output_path}': #{e.message}"
      end

      begin
        push_to_remote(spec, podspec_json_tmp_path)
      rescue => e
        FileUtils.remove(output_path, :force => true)
        raise Informative, "Error pushing to remote '#{@repo}': #{e.message}"
      end
      FileUtils.remove(podspec_json_tmp_path, :force => true)
=end
    end
  end
end

#runObject


42
43
44
45
# File 'lib/pod/command/repo_art/push.rb', line 42

def run
  # update_repo
  add_specs_to_repo
end

#validate!Object


37
38
39
40
# File 'lib/pod/command/repo_art/push.rb', line 37

def validate!
  super
  help! 'A spec-repo name is required.' unless @repo
end