Class: Pod::Command::Plugins::Publish

Inherits:
Pod::Command::Plugins show all
Defined in:
lib/pod/command/plugins/publish.rb

Overview

The publish subcommand. Used to request to add a plugin to the official list of plugins

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Publish

Returns a new instance of Publish.



22
23
24
25
# File 'lib/pod/command/plugins/publish.rb', line 22

def initialize(argv)
  @gemspec_files = Dir.glob('*.gemspec')
  super
end

Instance Method Details

#runObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/pod/command/plugins/publish.rb', line 36

def run
  gemspec = Gem::Specification.load(@gemspec_files.first)
  unless gemspec.name.start_with?('cocoapods-')
    UI.notice 'Your gem name should start with `cocoapods-` to be ' \
      'loaded as a plugin by CocoaPods'
  end

  json = json_from_gemspec(gemspec)

  title = "[plugins.json] Add #{gemspec.name}"
  body = 'Please add the following entry to the `plugins.json` file:' \
    "\n\n```\n#{json}\n```"
  open_new_issue_url(title, body)
end

#validate!Object



27
28
29
30
31
32
33
34
# File 'lib/pod/command/plugins/publish.rb', line 27

def validate!
  super
  if @gemspec_files.count > 1
    help! 'There is more than one gemspec in the current directory'
  elsif @gemspec_files.empty?
    help! 'No `.gemspec` file found in the current directory.'
  end
end