Class: PreactGenerator

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

Instance Method Summary collapse

Instance Method Details

#create_config_fileObject



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
# File 'lib/generators/preact_generator.rb', line 17

def create_config_file
  create_file "config/preact.yml", "# Preact Logging Configs\nproduction: &defaults\n\n# your Preact API credentials\ncode: \"\#{project_code}\"\nsecret: \"\#{api_secret}\"\n\n# automatically log controller actions for authed users\n# disable this if you want to only log manual events\nautolog: true\n\n# specify controller#action items that you want to ignore and not log to Preact.\n# default is to not log sessions#create beacuse if you're using Devise, we get that already\nautolog_ignored_actions:\n  - \"sessions#create\"\n  - \"devise/sessions#create\"\n\n# specify how to retrieve the current user and account from within the application controller\n# you may use either an instance variable (prefixed with @) or a method name\n#current_user_getter: \"current_user\"\n#current_account_getter: \"@current_account\"\n\ndevelopment:\n<<: *defaults\n\n# we usually suggest that you use a different project for development, to keep\n# those events separate from production events\n#code: \"DEV_CODE\"\n#secret: \"DEV_SECRET\"\n\n# you may also completely disable event logging in development\n#disabled: false\n\nstaging:\n<<: *defaults\n\n# if you want to log staging events separately as well\n#code: \"STAGING_CODE\"\n#secret: \"STAGING_SECRET\"\n\n# you may also completely disable event logging in staging\n#disabled: false\n"
end

#create_initializer_fileObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/preact_generator.rb', line 6

def create_initializer_file
  create_file "config/initializers/preact.rb", "# Preact Logging Configuration\n# see documentation about configuration options here: https://github.com/preact/preact-ruby\nPreact.configure do |config|\n# all standard configuration is done in the config/preact.yml file\n# if you need to do smarter things during configuration, do them here\nend\n"
end