Sha256: 4209f9e3fc975cc06f6b8bdb24088a6dc7efc4f36f3477d273f6919b20f63b69

Contents?: true

Size: 814 Bytes

Versions: 4

Compression:

Stored size: 814 Bytes

Contents

require "rails/generators"

module Ahoy
  module Generators
    class MessagesGenerator < Rails::Generators::Base
      class_option :unencrypted, type: :boolean

      def copy_templates
        activerecord = defined?(ActiveRecord)
        mongoid = defined?(Mongoid)

        selection =
          if activerecord && mongoid
            puts <<-MSG

Which data store would you like to use?
 1. Active Record (default)
 2. Mongoid
            MSG

            ask(">")
          elsif activerecord
            "1"
          else
            "2"
          end

        case selection
        when "", "1"
          invoke "ahoy:messages:activerecord"
        when "2"
          invoke "ahoy:messages:mongoid"
        else
          abort "Error: must enter a number [1-2]"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ahoy_email-2.1.0 lib/generators/ahoy/messages_generator.rb
ahoy_email-2.0.3 lib/generators/ahoy/messages_generator.rb
ahoy_email-2.0.2 lib/generators/ahoy/messages_generator.rb
ahoy_email-2.0.1 lib/generators/ahoy/messages_generator.rb