Class: Rys::RailsGenerator::Base

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/rys/rails_generator.rb

Direct Known Subclasses

Controller, Helper, Migration, Model, Scaffold

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.help(shell) ⇒ Object


9
10
11
12
13
14
# File 'lib/rys/rails_generator.rb', line 9

def self.help(shell)
  shell.say "Usage for Rys:"
  shell.say "  rails generate rys:#{origin_name} RYS_PLUGIN NAME ...same as below..."
  shell.say
  Rails::Generators.find_by_namespace(origin_name).help(shell)
end

.namespaceObject


5
6
7
# File 'lib/rys/rails_generator.rb', line 5

def self.namespace
  "rys:#{origin_name}"
end

Instance Method Details

#invoke_originObject


16
17
18
19
20
21
# File 'lib/rys/rails_generator.rb', line 16

def invoke_origin
  name = ARGV.shift.to_s.camelize
  plugin = "#{name}::Engine".constantize

  Rails::Generators.invoke self.class.origin_name, ARGV, behavior: :invoke, destination_root: plugin.root
end