Sha256: 39b6521f3318dc1a58d68029e9b31616c669bfd81fd3cc787e9d064d64ad60ef

Contents?: true

Size: 687 Bytes

Versions: 6

Compression:

Stored size: 687 Bytes

Contents

class Terraspace::CLI::Logs
  class Tasks
    def initialize(options={})
      @options = options
    end

    def truncate
      puts "Truncating log files in #{pretty_log_root}/" unless @options[:mute]
      log_files.each do |path|
        File.open(path, "w").close # truncates files
      end
    end

    def remove
      puts "Removing all files in #{pretty_log_root}/" unless @options[:mute]
      FileUtils.rm_rf(log_root)
      FileUtils.mkdir_p(log_root)
    end

    def log_files
      Dir.glob("#{log_root}/**/*.log")
    end

    def pretty_log_root
      Terraspace::Util.pretty_path(log_root)
    end

    def log_root
      Terraspace.config.log.root
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
terraspace-0.3.5 lib/terraspace/cli/logs/tasks.rb
terraspace-0.3.4 lib/terraspace/cli/logs/tasks.rb
terraspace-0.3.3 lib/terraspace/cli/logs/tasks.rb
terraspace-0.3.2 lib/terraspace/cli/logs/tasks.rb
terraspace-0.3.1 lib/terraspace/cli/logs/tasks.rb
terraspace-0.3.0 lib/terraspace/cli/logs/tasks.rb