Sha256: 50d3ada668d31a63098dd9865e1ef28aa92e0a2fac39cec2ceeb91bfeb68b357

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

class Freighthop::CLI::Init
  def self.match?(*args)
    args.first == 'init'
  end

  attr_reader :language

  def initialize(*args)
  end

  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

  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
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
freighthop-0.6.1 lib/freighthop/cli/init.rb
freighthop-0.6.0 lib/freighthop/cli/init.rb
freighthop-0.5.2 lib/freighthop/cli/init.rb
freighthop-0.5.1 lib/freighthop/cli/init.rb
freighthop-0.5.0 lib/freighthop/cli/init.rb
freighthop-0.4.1 lib/freighthop/cli/init.rb
freighthop-0.4.0 lib/freighthop/cli/init.rb