Class: Tomo::Commands::Init
Instance Method Summary
collapse
included
after_parse, arg, option, parse, parser
enabled?
Instance Method Details
#banner ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/tomo/commands/init.rb', line 17
def banner
<<~BANNER
Usage: #{green('tomo init')} #{yellow('[APP]')}
Set up a new tomo project named #{yellow('APP')}. If #{yellow('APP')} is not specified, the
name of the current directory will be used.
This command creates a #{DEFAULT_CONFIG_PATH} file relative the current
directory containing some example configuration.
BANNER
end
|
#call(*args, _options) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/tomo/commands/init.rb', line 29
def call(*args, _options)
assert_can_create_tomo_directory!
assert_no_tomo_project!
app = args.first || current_dir_name || "default"
app = app.gsub(/([^\w-]|_)+/, "_").downcase
FileUtils.mkdir_p(".tomo/plugins")
File.write(".tomo/plugins/#{app}.rb", plugin_rb_template)
File.write(DEFAULT_CONFIG_PATH, config_rb_template(app))
logger.info(green("✔ Created #{DEFAULT_CONFIG_PATH}"))
end
|
#summary ⇒ Object
13
14
15
|
# File 'lib/tomo/commands/init.rb', line 13
def summary
"Start a new tomo project with a sample config"
end
|