Sha256: 24fd4e8df71fe301175a149ba7779a29a93642a88884172f1b74a9091338f46d

Contents?: true

Size: 451 Bytes

Versions: 7

Compression:

Stored size: 451 Bytes

Contents

module BigBrother
  class StatusFile
    def initialize(*filenames)
      @path = File.join(BigBrother.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

7 entries across 7 versions & 1 rubygems

Version Path
big_brother-0.4.1 lib/big_brother/status_file.rb
big_brother-0.4.0 lib/big_brother/status_file.rb
big_brother-0.3.1 lib/big_brother/status_file.rb
big_brother-0.3.0 lib/big_brother/status_file.rb
big_brother-0.2.1 lib/big_brother/status_file.rb
big_brother-0.2.0 lib/big_brother/status_file.rb
big_brother-0.1.0 lib/big_brother/status_file.rb