Class: Stealth::Generators::Generate

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/stealth/generators/generate.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



14
15
16
# File 'lib/stealth/generators/generate.rb', line 14

def self.source_root
  File.dirname(__FILE__) + "/generate/flow"
end

Instance Method Details

#create_controllerObject



18
19
20
# File 'lib/stealth/generators/generate.rb', line 18

def create_controller
  template('controllers/controller.tt', "bot/controllers/#{name.pluralize}_controller.rb")
end

#create_helperObject



27
28
29
# File 'lib/stealth/generators/generate.rb', line 27

def create_helper
  template('helpers/helper.tt', "bot/helpers/#{name}_helper.rb")
end

#create_repliesObject



22
23
24
25
# File 'lib/stealth/generators/generate.rb', line 22

def create_replies
  # Sample Ask Reply
  template('replies/ask_example.tt', "bot/replies/#{name.pluralize}/ask_example.yml.erb")
end

#edit_flow_mapObject



31
32
33
34
35
# File 'lib/stealth/generators/generate.rb', line 31

def edit_flow_map
  inject_into_file "config/flow_map.rb", after: "include Stealth::Flow\n" do
    "\n\tflow :#{name} do\n\t\tstate :ask_example\n\tend\n"
  end
end