Sha256: 3a99a193c99a0cd33b38f7aaa737f4b00e3883b3d3f99ad55e52bb49574ebe08

Contents?: true

Size: 1.28 KB

Versions: 12

Compression:

Stored size: 1.28 KB

Contents

require 'chillout/registration'

module Chillout
  class Install < ::Rails::Generators::Base
    argument :emails, :required => true, :type => :array, :banner => "EMAIL1 EMAIL2..."

    desc "Installs chillout in your app"
    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 info@chillout.io."
    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 info@chillout.io."
    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
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
chillout-0.8.9 lib/chillout/generators/install.rb
chillout-0.8.5.1 lib/chillout/generators/install.rb
chillout-0.8.8 lib/chillout/generators/install.rb
chillout-0.8.7 lib/chillout/generators/install.rb
chillout-0.8.6 lib/chillout/generators/install.rb
chillout-0.8.5 lib/chillout/generators/install.rb
chillout-0.8.4 lib/chillout/generators/install.rb
chillout-0.8.3 lib/chillout/generators/install.rb
chillout-0.8.2 lib/chillout/generators/install.rb
chillout-0.8.1 lib/chillout/generators/install.rb
chillout-0.8.0 lib/chillout/generators/install.rb
chillout-0.6.0 lib/chillout/generators/install.rb