Class: Lita::Ext::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/lita/ext/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootString

Note:

This is a magic method required by Thor for file operations.

The root path for the templates directory.

Returns:

  • (String)

    The path.



14
15
16
# File 'lib/lita/ext/cli.rb', line 14

def self.source_root
  File.expand_path("../../../../templates", __FILE__)
end

Instance Method Details

#handler(name) ⇒ Object



24
25
26
27
28
29
# File 'lib/lita/ext/cli.rb', line 24

def handler(name)
  config = {}
  config[:handler_name] = name.split(/_/).map { |p| p.capitalize }.join
  target = File.join(Lita.root, "app/handlers/#{name}.rb")
  template("handler.tt", target, config)
end

#new(name = "lita") ⇒ Object



19
20
21
# File 'lib/lita/ext/cli.rb', line 19

def new(name = "lita")
  directory "robot", name
end