class Freighthop::CLI::Init

Attributes

language[R]

Public Class Methods

match?(*args) click to toggle source
# File lib/freighthop/cli/init.rb, line 2
def self.match?(*args)
  args.first == 'init'
end
new(*args) click to toggle source
# File lib/freighthop/cli/init.rb, line 8
def initialize(*args)
end

Public Instance Methods

default_config() click to toggle source
# File lib/freighthop/cli/init.rb, line 21
def default_config
  {
    'freighthop::cpus'                          => 2,
    'freighthop::ram'                           => 512,
    'freighthop::languages'                     => ['ruby'],
    'freighthop::web::servers'                  => ['nginx'],
    'freighthop::web::nginx::upstream_port'     => 3000,
    'freighthop::database::servers'             => ['postgres'],
    'freighthop::database::postgres::databases' => [],
    'freighthop::database::postgres::users'     => [],
    'freighthop::ppas'                          => [],
    'freighthop::packages'                      => [ "libpq-dev" ],
  }
end
run() click to toggle source
# File lib/freighthop/cli/init.rb, line 11
def run
  if Freighthop::Config.exist?
    puts "This directory already contains a #{Freighthop::Config.file.basename}"
    exit 1
  end

  puts "Writing a new config to #{Freighthop::Config.file.basename}"
  Freighthop::Config.write(default_config)
end