15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/rails/generators/intercom/config/config_generator.rb', line 15
def create_config_file
@app_id = app_id
@api_secret = api_secret
@api_key = api_key
@session_duration = session_duration
@include_for_logged_out_users = false
introduction = <<-desc
Intercom will automatically insert its javascript before the closing '</body>'
tag on every page where it can find a logged-in user. Intercom by default
looks for logged-in users, in the controller, via 'current_user' and '@user'.
Is the logged-in user accessible via either 'current_user' or '@user'? [Yn]
desc
print "#{introduction.strip} "
default_ok = $stdin.gets.strip.downcase
if FALSEY_RESPONSES.include?(default_ok)
custom_current_user_question = <<-desc
How do you access the logged-in user in your controllers? This can be
any Ruby code, e.g. 'current_customer', '@admin', etc.:
desc
print "#{custom_current_user_question.rstrip} "
@current_user = $stdin.gets.strip
end
template("intercom.rb.erb", "config/initializers/intercom.rb")
end
|