Class: Ufo::Init
Class Method Summary collapse
-
.cli_options ⇒ Object
Ugly, this is how I can get the options from to match with this Thor::Group.
Instance Method Summary collapse
- #init_files ⇒ Object
-
#set_destination_root ⇒ Object
for specs.
- #set_source_path ⇒ Object
- #setup_template_repo ⇒ Object
- #upsert_gitignore ⇒ Object
- #user_message ⇒ Object
Methods inherited from Sequence
Class Method Details
.cli_options ⇒ Object
Ugly, this is how I can get the options from to match with this Thor::Group
7 8 9 10 11 12 13 14 15 |
# File 'lib/ufo/init.rb', line 7 def self. [ [:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files."], [:image, required: true, desc: "Docker image name without the tag. Example: tongueroo/hi. Configures ufo/settings.yml"], [:app, required: true, desc: "App name. Preferably one word. Used in the generated ufo/task_definitions.rb."], [:template, desc: "Custom template to use."], [:template_mode, desc: "Template mode: replace or additive."], ] end |
Instance Method Details
#init_files ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/ufo/init.rb', line 49 def init_files # map variables @app = [:app] @image = [:image] # copy the files puts "Setting up ufo project..." # directory ".ufo", ".ufo" directory ".", exclude_pattern: /\.git/ end |
#set_destination_root ⇒ Object
for specs
40 41 42 43 44 45 46 47 |
# File 'lib/ufo/init.rb', line 40 def set_destination_root return unless ENV['UFO_ROOT'] dest = ENV['UFO_ROOT'] FileUtils.rm_rf(dest) && FileUtils.mkdir_p(dest) self.destination_root = dest FileUtils.cd(dest) end |
#set_source_path ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ufo/init.rb', line 26 def set_source_path return unless @options[:template] custom_template = "#{ENV['HOME']}/.ufo/templates/#{@options[:template]}" if @options[:template_mode] == "replace" # replace the template entirely override_source_paths(custom_template) else # additive: modify on top of default template default_template = File.("../../template", __FILE__) override_source_paths([custom_template, default_template]) end end |
#setup_template_repo ⇒ Object
20 21 22 23 24 |
# File 'lib/ufo/init.rb', line 20 def setup_template_repo return unless @options[:template]&.include?('/') sync_template_repo end |
#upsert_gitignore ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/ufo/init.rb', line 60 def upsert_gitignore return unless File.exist?(".gitignore") append_to_file ".gitignore", <<-EOL .ufo/output .ufo/data EOL end |
#user_message ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/ufo/init.rb', line 68 def puts "Starter ufo files created." puts <<-EOL #{"="*64} Congrats 🎉 You have successfully set up ufo for your project. To deploy to ECS: ufo ship #{@app}-web If you need to customize the ECS task definition to configure things like memory and cpu allocation. You can do this by adjusting the files the .ufo/variables folder. These variables get applied to the .ufo/templates/main.json.erb task definition json that is passed to the ECS register task definition api. Some additional starter example roles for your apps were set up in in .ufo/task_definitions.rb. Be sure to check it out and adjust it for your needs. This allows you to fully customize and control your environment to fit your application's needs. More info: http://ufoships.com EOL end |