Sha256: 095abc16b6d2d06d1e9b5a752676ce17c316c9b76128af1847931be25761914e

Contents?: true

Size: 759 Bytes

Versions: 10

Compression:

Stored size: 759 Bytes

Contents

require "rails/generators"

module Ahoy
  module Generators
    class ClicksGenerator < Rails::Generators::Base
      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:clicks:activerecord"
        when "2"
          invoke "ahoy:clicks:mongoid"
        else
          abort "Error: must enter a number [1-2]"
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ahoy_email-2.4.0 lib/generators/ahoy/clicks_generator.rb
ahoy_email-2.3.1 lib/generators/ahoy/clicks_generator.rb
ahoy_email-2.3.0 lib/generators/ahoy/clicks_generator.rb
ahoy_email-2.2.0 lib/generators/ahoy/clicks_generator.rb
ahoy_email-2.1.3 lib/generators/ahoy/clicks_generator.rb
ahoy_email-2.1.2 lib/generators/ahoy/clicks_generator.rb
ahoy_email-2.1.1 lib/generators/ahoy/clicks_generator.rb
ahoy_email-2.1.0 lib/generators/ahoy/clicks_generator.rb
ahoy_email-2.0.3 lib/generators/ahoy/clicks_generator.rb
ahoy_email-2.0.2 lib/generators/ahoy/clicks_generator.rb