Class: Semaph::Shells::Project::SaveCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/semaph/shells/project/save_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ SaveCommand

Returns a new instance of SaveCommand.



9
10
11
12
# File 'lib/semaph/shells/project/save_command.rb', line 9

def initialize(project)
  @project = project
  @help = "save current project as default for this folder"
end

Instance Attribute Details

#helpObject (readonly)

Returns the value of attribute help.



7
8
9
# File 'lib/semaph/shells/project/save_command.rb', line 7

def help
  @help
end

#projectObject (readonly)

Returns the value of attribute project.



7
8
9
# File 'lib/semaph/shells/project/save_command.rb', line 7

def project
  @project
end

Instance Method Details

#execute(_ignored) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/semaph/shells/project/save_command.rb', line 14

def execute(_ignored)
  config = {
    host: project.client.host,
    project: project.raw,
  }
  File.open(".semaph", "w") do |file|
    file.puts config.to_yaml
  end
end