Class: Stealth::Generators::Generate
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Stealth::Generators::Generate
- Includes:
- Thor::Actions
- Defined in:
- lib/stealth/generators/generate.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_controller ⇒ Object
- #create_helper ⇒ Object
- #create_replies ⇒ Object
- #edit_flow_map ⇒ Object
Class Method Details
.source_root ⇒ Object
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_controller ⇒ Object
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_helper ⇒ Object
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_replies ⇒ Object
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_map ⇒ Object
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 |