6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/generators/ahoy/clicks_generator.rb', line 6
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
|