Class: Jets::CLI::Ci::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
|
# File 'lib/jets/cli/ci/init.rb', line 5
def self.cli_options
[
[: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
87
88
89
90
|
# File 'lib/jets/cli/ci/init.rb', line 87
def are_you_sure?
return if options[:yes]
sure?(sure_message)
end
|
#check_already_initialized ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/jets/cli/ci/init.rb', line 69
def check_already_initialized
if File.exist?("config/jets/ci.rb")
puts "Found config/jets/ci.rb"
puts "It looks like the Jets project is already initialized for CI"
exit
end
lines = IO.readlines("config/jets/deploy.rb")
found = lines.detect do |l|
l.include?("config.deploy.") && !l.match?(/^\s*#/)
end
if found
puts "Found config.ci in config/jets/deploy.rb"
puts "It looks like the Jets project has already been set up for CI"
exit
end
end
|
#check_jets_initialized ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/jets/cli/ci/init.rb', line 61
def check_jets_initialized
unless File.exist?("config/jets/deploy.rb")
puts "config/jets/deploy.rb not found."
puts "Please run: jets init"
exit 1
end
end
|
#config_jets_ci ⇒ Object
93
94
95
|
# File 'lib/jets/cli/ci/init.rb', line 93
def config_jets_ci
template "ci.rb.tt", "config/jets/ci.rb"
end
|