Method: Solidus::InstallGenerator#prepare_options

Defined in:
lib/generators/solidus/install/install_generator.rb

#prepare_optionsObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/generators/solidus/install/install_generator.rb', line 53

def prepare_options
  @run_migrations = options[:migrate]
  @load_seed_data = options[:seed] && @run_migrations
  @load_sample_data = options[:sample] && @run_migrations && @load_seed_data

  @selected_frontend = selected_option_for(
    'frontend',
    selected: ENV['FRONTEND'] || options[:frontend],
    available_options: FRONTENDS,
  )

  @selected_authentication = selected_option_for(
    'authentication',
    selected:
      ('devise' if @selected_frontend == 'starter') ||
      ('devise' if has_gem?('solidus_auth_devise')) ||
      ENV['AUTHENTICATION'] || options[:authentication],
    available_options: AUTHENTICATIONS,
  )

  @selected_payment_method = selected_option_for(
    'payment method',
    selected:
      ('paypal' if has_gem?('solidus_paypal_commerce_platform')) ||
      ('stripe' if has_gem?('solidus_stripe')) ||
      ('bolt' if has_gem?('solidus_bolt')) ||
      ENV['PAYMENT_METHOD'] || options[:payment_method],
    available_options: PAYMENT_METHODS,
  )

  # Silence verbose output (e.g. Rails migrations will rely on this environment variable)
  ENV['VERBOSE'] = 'false'

  # No reason to check for their presence if we're about to install them
  ENV['SOLIDUS_SKIP_MIGRATIONS_CHECK'] = 'true'
end