Class: Freighthop::CLI::Init
- Inherits:
-
Object
- Object
- Freighthop::CLI::Init
- Defined in:
- lib/freighthop/cli/init.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
readonly
Returns the value of attribute language.
Class Method Summary collapse
Instance Method Summary collapse
- #default_config ⇒ Object
-
#initialize(*args) ⇒ Init
constructor
A new instance of Init.
- #run ⇒ Object
Constructor Details
#initialize(*args) ⇒ Init
Returns a new instance of Init.
8 9 |
# File 'lib/freighthop/cli/init.rb', line 8 def initialize(*args) end |
Instance Attribute Details
#language ⇒ Object (readonly)
Returns the value of attribute language.
6 7 8 |
# File 'lib/freighthop/cli/init.rb', line 6 def language @language end |
Class Method Details
.match?(*args) ⇒ Boolean
2 3 4 |
# File 'lib/freighthop/cli/init.rb', line 2 def self.match?(*args) args.first == 'init' end |
Instance Method Details
#default_config ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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 ⇒ Object
11 12 13 14 15 16 17 18 19 |
# 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 |