Class: Strata::CLI::SubCommands::Project
- Inherits:
-
Thor
- Object
- Thor
- Strata::CLI::SubCommands::Project
- Defined in:
- lib/strata/cli/sub_commands/project.rb
Constant Summary
Constants included from Output
Constants included from Guard
Instance Method Summary collapse
Methods included from Output
format, pastel, print_error, #print_error, print_hint, #print_hint, print_info, #print_info, print_status, #print_status, print_success, #print_success, print_warning, #print_warning, shell_for, thor_color
Methods included from Terminal
#create_spinner, #print_table, #with_spinner
Methods included from Guard
Instance Method Details
#link(project_id) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/strata/cli/sub_commands/project.rb', line 19 def link(project_id) raise Strata::CommandError, "Project ID is required." unless project_id && !project_id.to_s.strip.empty? project_yml_path = "project.yml" project_config = YAML.safe_load_file(project_yml_path, permitted_classes: [Date, Time], aliases: true) || {} if project_config["project_id"] && !project_config["project_id"].to_s.strip.empty? print_warning("Project is already linked to project_id: #{project_config["project_id"]}") return end return unless Helpers::ProjectHelper.persist_project_id_to_yml(project_id, project_yml_path: project_yml_path) print_info("✓ Project linked successfully. project_id: #{project_id}") end |