Class: Pleiades::CommandGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/pleiades/generators/pleiades/command/command_generator.rb

Defined Under Namespace

Modules: EventOption

Instance Method Summary collapse

Instance Method Details

#drow_routeObject



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/pleiades/generators/pleiades/command/command_generator.rb', line 39

def drow_route
  @names.each do |name|
    arg =
      [
        Pleiades::Constants::File::ROUTER,
        event_with_option(name),
        { after: /^Pleiades::Command::Router.route do/ }
      ]
    inject_into_file(*arg)
  end
end

#generate_commandObject



31
32
33
34
35
36
37
# File 'lib/pleiades/generators/pleiades/command/command_generator.rb', line 31

def generate_command
  commands_path = Pleiades::Config.command.commands_path
  @names.each do |name|
    @command_name = name
    template 'command.erb', "#{commands_path}/#{options['dir']}/#{name}.rb"
  end
end

#setupObject



27
28
29
# File 'lib/pleiades/generators/pleiades/command/command_generator.rb', line 27

def setup
  @names.unshift @name
end