Class: Fluidfeatures::ConfigGenerator

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

Constant Summary collapse

CONFIG_FILE =
"config/fluidfeatures.yml"

Instance Method Summary collapse

Instance Method Details

#create_initializer_fileObject



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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/generators/fluidfeatures/config_generator.rb', line 6

def create_initializer_file

  puts "Enter FluidFeatures credentials [press enter to skip]"
  print "development app_id: "
  dev_app_id = gets.chomp

  print "development secret: "
  dev_secret = gets.chomp

  print "production app_id: "
  prod_app_id = gets.chomp

  print "production secret: "
  prod_secret = gets.chomp

  print "test app_id: "
  test_app_id = gets.chomp

  print "test secret: "
  test_secret = gets.chomp

  puts "Warning: production app_id and secret have not been set in #{CONFIG_FILE}"

  create_file CONFIG_FILE, """
common:
  base_uri: https://www.fluidfeatures.com/service
  cache:
enable: false
dir: tmp/fluidfeatures
limit: 2mb

development:
  app_id: #{dev_app_id}
  secret: #{dev_secret}

test:
  app_id: #{test_app_id}
  secret: #{test_secret}

production:
  app_id: #{prod_app_id}
  secret: #{prod_secret}
"""
end