class InitCommand

Public Instance Methods

execute() click to toggle source
# File lib/sinatra_live.rb, line 9
def execute
  # check for existing Livefile
  unless File.exists?('Livefile')
    # load template
    template = get_livefile_template

    # save the template to a Livefile
    File.open('Livefile', 'w') { |file|
      file.write(template)
    }

    log "Livefile created"
  else
    log_error 'Livefile already exists!'
  end
end