Class: Pod::Command::Plugins::Publish
- Inherits:
-
Pod::Command::Plugins
- Object
- Pod::Command
- Pod::Command::Plugins
- Pod::Command::Plugins::Publish
- 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
-
#initialize(argv) ⇒ Publish
constructor
A new instance of Publish.
- #run ⇒ Object
- #validate! ⇒ Object
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
#run ⇒ Object
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 |