Class: WindClutter::CLI::Commands::Project::Use

Inherits:
Dry::CLI::Command
  • Object
show all
Includes:
Util
Defined in:
lib/windclutter/cli/commands/project.rb

Overview

Use specified project

Instance Method Summary collapse

Instance Method Details

#call(name: nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/windclutter/cli/commands/project.rb', line 30

def call(name: nil, **)
  project_name = name || File.basename(Dir.pwd)

  FileHandler.init_config unless Config.exists?
  unless FileHandler.list_projects.include? project_name
    FileHandler.create_project(project_name)
    puts 'No project, we created one instead'.yellow
  end

  Config.update('active_project', project_name)
  Config.setup_project(project_name)
  Config.update_project(project_name, 'project_path', Dir.pwd)
  puts "Using project \"#{project_name}\"".green
end