Class: InitCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/init_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ InitCommand

Returns a new instance of InitCommand.



2
3
4
# File 'lib/commands/init_command.rb', line 2

def initialize(options)
  @options = options
end

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
# File 'lib/commands/init_command.rb', line 6

def run
  path = File.join(Dir.pwd, CARTRCFILE)
  if File.exist?(path)
    raise AppError.new, "File #{path} already exists"
  else
    File.write(path, file_contents)
  end
end