class InitCommand

Public Class Methods

new(options) click to toggle source
# File lib/commands/init_command.rb, line 2
def initialize(options)
  @options = options
end

Public Instance Methods

run() click to toggle source
# 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

Private Instance Methods

file_contents() click to toggle source
# File lib/commands/init_command.rb, line 17
  def file_contents
    <<~EOS
      Configuration.setup do |c|
        c.server = "http://localhost:#{SERVER_DEFAULT_PORT}/"
      end
    EOS
  end