Class: Tetra::InitSubcommand
- Inherits:
-
Subcommand
- Object
- Clamp::Command
- Subcommand
- Tetra::InitSubcommand
- Defined in:
- lib/tetra/ui/init_subcommand.rb
Overview
tetra init
Instance Method Summary collapse
Methods inherited from Subcommand
#bypass_parsing, #checking_exceptions, #configure_log_level, #ensure_dry_running, #format_path, #print_generation_result, #verbose=, #very_verbose=, #very_very_verbose=
Methods included from Logging
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/tetra/ui/init_subcommand.rb', line 11 def execute checking_exceptions do # Ensure the user provided an archive OR explicitly opted out if source_archive.nil? && !no_archive? signal_usage_error "please specify a source archive file or use \"--no-archive\" (see SPECIAL_CASES.md)." end # Ensure the file exists if provided if source_archive && !File.readable?(source_archive) signal_usage_error "#{source_archive} is not a file or it is not readable." end Tetra::Project.init(package_name) project = Tetra::Project.new(package_name) puts "Project inited in #{package_name}/." if source_archive puts "Decompressing sources..." # Expand path immediately to ensure we reference the correct file # relative to where the command was run, not inside the new project dir. full_archive_path = File.(source_archive) project.commit_source_archive(full_archive_path, "Initial sources added from archive") puts "Sources decompressed in #{package_name}/src/, original archive copied in #{package_name}/packages/." else puts "Use \"tetra change-sources\" to add sources to this project." end puts "Please add any other precompiled build dependency to kit/." puts "When you are ready to test a build, use \"tetra dry-run\" from the project directory" end end |