Sha256: a791403c39a4fa36c84710f06211b5ff0ebbacda364cf044bd2741eaae6b61c9

Contents?: true

Size: 879 Bytes

Versions: 7

Compression:

Stored size: 879 Bytes

Contents

require "rails/generators"

module Ahoy
  module Generators
    class MessagesGenerator < Rails::Generators::Base
      class_option :encryption, type: :string
      # deprecated
      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

7 entries across 7 versions & 1 rubygems

Version Path
ahoy_email-2.4.0 lib/generators/ahoy/messages_generator.rb
ahoy_email-2.3.1 lib/generators/ahoy/messages_generator.rb
ahoy_email-2.3.0 lib/generators/ahoy/messages_generator.rb
ahoy_email-2.2.0 lib/generators/ahoy/messages_generator.rb
ahoy_email-2.1.3 lib/generators/ahoy/messages_generator.rb
ahoy_email-2.1.2 lib/generators/ahoy/messages_generator.rb
ahoy_email-2.1.1 lib/generators/ahoy/messages_generator.rb