Class: Codepipe::Init
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Sequence
source_paths
#cfn, #codepipeline, #s3
#are_you_sure?, #inferred_pipeline_name, #inferred_stack_name, #pipeline_name_convention, #stack_exists?
Class Method Details
.cli_options ⇒ Object
Ugly, this is how I can get the options from to match with this Thor::Group
4
5
6
7
8
9
10
11
|
# File 'lib/codepipe/init.rb', line 4
def self.cli_options
[
[:name, desc: "CodePipeline project name."],
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files."],
[:template, desc: "Custom template to use."],
[:template_mode, desc: "Template mode: replace or additive."],
]
end
|
Instance Method Details
#copy_project ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/codepipe/init.rb', line 33
def copy_project
puts "Initialize codepipeline project in .codepipeline"
if @options[:template]
directory ".", ".codepipeline", exclude_pattern: /.git/
else
directory ".", exclude_pattern: /.git/
end
end
|
#set_source_path ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/codepipe/init.rb', line 20
def set_source_path
return unless @options[:template]
custom_template = "#{ENV['HOME']}/.codepipeline/templates/#{full_repo_name}"
if @options[:template_mode] == "replace" override_source_paths(custom_template)
else default_template = File.expand_path("../../template", __FILE__)
override_source_paths([custom_template, default_template])
end
end
|
#setup_template_repo ⇒ Object
14
15
16
17
18
|
# File 'lib/codepipe/init.rb', line 14
def setup_template_repo
return unless @options[:template]&.include?('/')
sync_template_repo
end
|