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.11.3 lib/rails/tasks/log.rake
railties-4.2.11.2 lib/rails/tasks/log.rake
railties-4.2.11.1 lib/rails/tasks/log.rake
railties-4.2.11 lib/rails/tasks/log.rake
railties-4.2.10 lib/rails/tasks/log.rake
railties-4.2.10.rc1 lib/rails/tasks/log.rake
railties-4.2.9 lib/rails/tasks/log.rake
railties-4.2.9.rc2 lib/rails/tasks/log.rake
railties-4.2.9.rc1 lib/rails/tasks/log.rake
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/railties-4.2.8/lib/rails/tasks/log.rake
railties-4.2.8 lib/rails/tasks/log.rake
railties-4.2.8.rc1 lib/rails/tasks/log.rake
railties-4.2.7.1 lib/rails/tasks/log.rake
railties-4.2.7 lib/rails/tasks/log.rake
railties-4.1.16 lib/rails/tasks/log.rake
railties-4.1.16.rc1 lib/rails/tasks/log.rake
railties-4.2.7.rc1 lib/rails/tasks/log.rake
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/tasks/log.rake
railties-4.1.15 lib/rails/tasks/log.rake
railties-4.2.6 lib/rails/tasks/log.rake