Class: Ufo::CLI::New::Init
- Defined in:
- lib/ufo/cli/new/init.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_dockefile ⇒ Object
- #generate ⇒ Object
- #set_source ⇒ Object
- #set_variables ⇒ Object
- #update_gitignore ⇒ Object
- #user_message ⇒ Object
Methods included from Utils::Logging
Class Method Details
.options ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/ufo/cli/new/init.rb', line 3 def self. [ [:app, aliases: :a, desc: "App name. If not specified, it's inferred from the folder name"], [:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"], # note: aliases: :r messes up Usage help: ufo init -h so not using it [:repo, required: true, desc: "Docker repo to use. Example: ORG/REPO"], ] end |
Instance Method Details
#create_dockefile ⇒ Object
42 43 44 45 46 |
# File 'lib/ufo/cli/new/init.rb', line 42 def create_dockefile return if File.exist?("Dockerfile") set_template_source("docker") directory ".", "." end |
#generate ⇒ Object
23 24 25 26 |
# File 'lib/ufo/cli/new/init.rb', line 23 def generate puts "Generating .ufo structure" directory "." end |
#set_source ⇒ Object
13 14 15 16 |
# File 'lib/ufo/cli/new/init.rb', line 13 def set_source set_template_source("init") self.destination_root = '.' end |
#set_variables ⇒ Object
18 19 20 21 |
# File 'lib/ufo/cli/new/init.rb', line 18 def set_variables @app = [:app] || inferred_app @repo = [:repo] end |
#update_gitignore ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ufo/cli/new/init.rb', line 28 def update_gitignore text =<<~EOL .ufo/tmp .ufo/log .ufo/output .secrets EOL if File.exist?(".gitignore") append_to_file ".gitignore", text else create_file ".gitignore", text end end |
#user_message ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ufo/cli/new/init.rb', line 48 def puts "Starter .ufo files created" puts <<~EOL Congrats. You have successfully set up your project with ufo. To deploy to ECS: ufo ship EOL end |