Class: Maestro::Command::Init

Inherits:
Maestro::Command show all
Defined in:
lib/commands/project_commands.rb

Instance Method Summary collapse

Methods inherited from Maestro::Command

command, describe

Constructor Details

#initialize(project) ⇒ Init

Returns a new instance of Init.



13
14
15
# File 'lib/commands/project_commands.rb', line 13

def initialize(project)
  @project = project
end

Instance Method Details

#invokeObject



17
18
19
20
21
22
23
24
25
# File 'lib/commands/project_commands.rb', line 17

def invoke
  project = Maestro::Project.find(@project, :params => { :context => 'user' })
  File.open(".maestro.yml", "w") do |io|
    io.puts "project_id: #{project.id}"
  end
  Dir.pwd + "/.maestro.yml written successfully"
rescue ActiveResource::ResourceNotFound
  raise RuntimeError.new("Could not find project \"#{@project}\". Please double-check the name on Maestro.")
end