Class: Jets::CLI::Init
Class Method Summary
collapse
Instance Method Summary
collapse
#class_name, #framework, #init_project_name, #package_type, #underscore_name
#comment_out_line, #config_environment, #environment, #optimize_indentation
Class Method Details
.cli_options ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/jets/cli/init.rb', line 5
def self.cli_options
[
[:env, type: :boolean, desc: "Generate config/jets/env/.env example file"],
[:force, aliases: :f, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
[:yes, aliases: :y, type: :boolean, desc: "Skip are you sure prompt"]
]
end
|
Instance Method Details
#are_you_sure? ⇒ Boolean
64
65
66
67
|
# File 'lib/jets/cli/init.rb', line 64
def are_you_sure?
return if options[:yes] || options[:force]
sure?(sure_message)
end
|
#config_jets ⇒ Object
77
78
79
|
# File 'lib/jets/cli/init.rb', line 77
def config_jets
directory "config/jets", "config/jets"
end
|
81
82
83
84
85
86
87
88
|
# File 'lib/jets/cli/init.rb', line 81
def configure_environment
case framework
when "rails"
configure_rails
when "hanami"
configure_hanami
end
end
|
#env_example ⇒ Object
69
70
71
72
73
74
75
|
# File 'lib/jets/cli/init.rb', line 69
def env_example
create_env = @options[:env].nil? ? framework == "rails" : @options[:env]
if create_env
template "env/.env.tt", "config/jets/env/.env"
end
end
|