Class: ThisData::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/this_data/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_configuration_fileObject



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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/generators/this_data/install_generator.rb', line 8

def create_configuration_file
  initializer "this_data.rb" do
    "# Specifies configuration options for the ThisData gem.\nThisData.setup do |config|\n\n  # This is where your API key goes. You should almost certainly not have it\n  # committed to source control, but instead load it from a secret store.\n  # Default: nil\n  config.api_key = \"\#{api_key}\"\n\n  # Define a Logger instance if you want to debug or track errors\n  # This tells ThisData to log in the development environment.\n  # Comment it out to use the default behaviour across all environments.\n  # Default: nil\n  config.logger = Rails.logger if Rails.env.development?\n\n  # When true, will perform track events asynchronously.\n  # It is true by default, but here we explicitly tell ThisData to make it\n  # synchronous in test and development mode, to aide getting started.\n  # Comment it out to use the default behaviour across all environments.\n  # Default: true\n  config.async  = !(Rails.env.test? || Rails.env.development?)\n\n\n  # These configuration options are used when for the TrackRequest module.\n\n  # user_method will be called on a controller to get a user object.\n  # Default: :current_user\n  # config.user_method =        :current_user\n\n  # The following methods will be called on the object returned by user_method,\n  # to capture details about the user\n\n  # Required. This method should return a unique ID for a user.\n  # Default: :id\n  # config.user_id_method =     :id\n\n  # Optional. This method should return the user's name.\n  # Default: :name\n  # config.user_name_method =   :name\n  # This method should return the user's email.\n  # Default: :email\n  # config.user_email_method =  :email\n  # This method should return the user's mobile phone number.\n  # Default: :mobile\n  # config.user_mobile_method = :mobile\n\n\n  # ThisData's JS library (optional) adds a cookie.\n  # If you're using the library, set this to true, so that we know to expect\n  # a cookie value\n  # Default: false\n  # config.expect_js_cookie = true\n\nend\n"
  end
end