Class: Chillout::Install

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

Instance Method Summary collapse

Instance Method Details

#install_chilloutObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/chillout/generators/install.rb', line 8

def install_chillout
  project_name = File.basename(Rails.root)
  registration = Registration.new
  api_key = registration.register(project_name, emails)
  application nil, :env => :production do
    "config.chillout = { :secret => '#{api_key}' }"
  end
  puts "Chillout installed - you can find its configuration in config/environments/production.rb."
rescue Registration::NotRegisteredByLimit
  puts "Chillout not installed - we're currently out of limit for new projects. Please try again later or send us email on [email protected]."
rescue Registration::NotRegisteredByInvalidData
  puts "Chillout not installed - you've passed incorrect data."
rescue Registration::NotRegisteredByAccident
  puts "Chillout not installed - our API returned a silly response. Please send us email on [email protected]."
rescue Registration::NotRegisteredByCommunicationError
  puts "Chillout not installed - we couldn't get response from our API. Please check if you can access https://chillout.io/ with your browser."
end