Class: Danger::DangerfileGem
- Inherits:
-
DangerfileCommand
- Object
- CLAide::Command
- Runner
- DangerfileCommand
- Danger::DangerfileGem
- Defined in:
- lib/danger/commands/dangerfile/gem.rb
Instance Attribute Summary
Attributes inherited from Runner
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ DangerfileGem
constructor
A new instance of DangerfileGem.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from DangerfileCommand
Methods inherited from Runner
Constructor Details
#initialize(argv) ⇒ DangerfileGem
Returns a new instance of DangerfileGem.
20 21 22 23 24 25 26 27 28 |
# File 'lib/danger/commands/dangerfile/gem.rb', line 20 def initialize(argv) @name = argv.shift_argument prefix = "dangerfile-" unless @name.nil? || @name.empty? || @name.start_with?(prefix) @name = prefix + @name.dup end @template_url = argv.shift_argument super end |
Class Method Details
.description ⇒ Object
9 10 11 12 13 14 |
# File 'lib/danger/commands/dangerfile/gem.rb', line 9 def self.description <<-DESC Creates a scaffold for the development of a new gem based Dangerfile named `NAME` according to the best practices. DESC end |
Instance Method Details
#run ⇒ Object
39 40 41 42 43 |
# File 'lib/danger/commands/dangerfile/gem.rb', line 39 def run runner = CLAide::TemplateRunner.new(@name, "https://github.com/danger/dangerfile-gem-template") runner.clone_template runner.configure_template end |
#validate! ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/danger/commands/dangerfile/gem.rb', line 30 def validate! super if @name.nil? || @name.empty? help! "A name for the plugin is required." end help! "The plugin name cannot contain spaces." if @name =~ /\s/ end |