Sha256: fbf43b4ce4f73111ac7b35e956883aba33bdd472e29ea18ceb43ae26e6b67c85

Contents?: true

Size: 453 Bytes

Versions: 10

Compression:

Stored size: 453 Bytes

Contents

module LitmusPaper
  class StatusFile
    def initialize(*filenames)
      @path = File.join(LitmusPaper.config_dir, *filenames)
    end

    def content
      File.read(@path).chomp
    end

    def create(reason)
      FileUtils.mkdir_p(File.dirname(@path))
      File.open(@path, 'w') do |file|
        file.puts(reason)
      end
    end

    def delete
      FileUtils.rm(@path)
    end

    def exists?
      File.exists?(@path)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
litmus_paper-0.3.5 lib/litmus_paper/status_file.rb
litmus_paper-0.3.3 lib/litmus_paper/status_file.rb
litmus_paper-0.3.2 lib/litmus_paper/status_file.rb
litmus_paper-0.3.1 lib/litmus_paper/status_file.rb
litmus_paper-0.3.0 lib/litmus_paper/status_file.rb
litmus_paper-0.2.2 lib/litmus_paper/status_file.rb
litmus_paper-0.2.1 lib/litmus_paper/status_file.rb
litmus_paper-0.2.0 lib/litmus_paper/status_file.rb
litmus_paper-0.1.0 lib/litmus_paper/status_file.rb
litmus_paper-0.0.3 lib/litmus_paper/status_file.rb