Sha256: 340541d49d78cd7ac41f9c1247d260c2337db5493bd747bcacaed43ba5656dce

Contents?: true

Size: 917 Bytes

Versions: 17

Compression:

Stored size: 917 Bytes

Contents

# coding: utf-8
# frozen_string_literal: true

require 'thor/group'

module Stealth
  module Generators
    class Generate < Thor::Group
      include Thor::Actions

      argument :generator
      argument :name

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

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

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

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

      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

    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
stealth-2.0.0.beta7 lib/stealth/generators/generate.rb
stealth-2.0.0.beta6 lib/stealth/generators/generate.rb
stealth-2.0.0.beta5 lib/stealth/generators/generate.rb
stealth-2.0.0.beta4 lib/stealth/generators/generate.rb
stealth-2.0.0.beta3 lib/stealth/generators/generate.rb
stealth-2.0.0.beta2 lib/stealth/generators/generate.rb
stealth-2.0.0.beta1 lib/stealth/generators/generate.rb
stealth-1.1.6 lib/stealth/generators/generate.rb
stealth-1.1.5 lib/stealth/generators/generate.rb
stealth-1.1.4 lib/stealth/generators/generate.rb
stealth-1.1.3 lib/stealth/generators/generate.rb
stealth-1.1.2 lib/stealth/generators/generate.rb
stealth-1.1.1 lib/stealth/generators/generate.rb
stealth-1.1.0 lib/stealth/generators/generate.rb
stealth-1.1.0.rc3 lib/stealth/generators/generate.rb
stealth-1.1.0.rc2 lib/stealth/generators/generate.rb
stealth-1.1.0.rc1 lib/stealth/generators/generate.rb