Sha256: 548ff28380b851b63b73393d65a1fb852cf7d906ce6245e0c70ec7eec57ca327

Contents?: true

Size: 521 Bytes

Versions: 116

Compression:

Stored size: 521 Bytes

Contents

namespace :log do
  desc "Truncates all *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)"
  task :clear do
    log_files.each do |file|
      clear_log_file(file)
    end
  end

  def log_files
    if ENV['LOGS']
      ENV['LOGS'].split(',')
                  .map    { |file| "log/#{file.strip}.log" }
                  .select { |file| File.exist?(file) }
    else
      FileList["log/*.log"]
    end
  end

  def clear_log_file(file)
    f = File.open(file, "w")
    f.close
  end
end

Version data entries

116 entries across 112 versions & 9 rubygems

Version Path
railties-4.2.1.rc4 lib/rails/tasks/log.rake
railties-4.1.10.rc3 lib/rails/tasks/log.rake
railties-4.2.1.rc3 lib/rails/tasks/log.rake
railties-4.1.10.rc2 lib/rails/tasks/log.rake
railties-4.2.1.rc2 lib/rails/tasks/log.rake
railties-4.1.10.rc1 lib/rails/tasks/log.rake
railties-4.2.1.rc1 lib/rails/tasks/log.rake
activejob-lock-0.0.1 rails/railties/lib/rails/tasks/log.rake
railties-4.0.13 lib/rails/tasks/log.rake
railties-4.1.9 lib/rails/tasks/log.rake
railties-4.1.9.rc1 lib/rails/tasks/log.rake
railties-4.0.13.rc1 lib/rails/tasks/log.rake
railties-4.2.0 lib/rails/tasks/log.rake
railties-4.2.0.rc3 lib/rails/tasks/log.rake
railties-4.2.0.rc2 lib/rails/tasks/log.rake
railties-4.2.0.rc1 lib/rails/tasks/log.rake
railties-4.1.7.1 lib/rails/tasks/log.rake
railties-4.0.11.1 lib/rails/tasks/log.rake
railties-4.1.8 lib/rails/tasks/log.rake
railties-4.0.12 lib/rails/tasks/log.rake