Class: Lambit::Commands::Common::CreateWorkspaceCommand

Inherits:
Base
  • Object
show all
Defined in:
lib/lambit/commands/common.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#dry_run, #exitstatus, #run

Instance Method Summary collapse

Methods inherited from Base

#execute, run

Constructor Details

#initialize(opts, args) ⇒ CreateWorkspaceCommand

Returns a new instance of CreateWorkspaceCommand.



69
70
71
72
# File 'lib/lambit/commands/common.rb', line 69

def initialize(opts, args)
  super
  @workspace = opts['workspace']
end

Instance Attribute Details

#workspaceObject (readonly)

Returns the value of attribute workspace.



67
68
69
# File 'lib/lambit/commands/common.rb', line 67

def workspace
  @workspace
end

Instance Method Details

#commandObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/lambit/commands/common.rb', line 74

def command
  begin
    FileUtils.mkdir_p self.workspace
    @exitstatus = 0
  rescue Exception => e
    if Lambit.is_debug?
      Lambit.logger.error e
    else
      Lambit.logger.error e.message
    end
    @exitstatus = 1
  end
  return '', self.exitstatus
end