Sha256: 19a29bd870fd67b7d0e99a6ccf6788398482eb25da5213774b3f81464abc7890

Contents?: true

Size: 465 Bytes

Versions: 13

Compression:

Stored size: 465 Bytes

Contents

module BigBrother
  class StatusFile
    def initialize(*filenames)
      @path = File.join(BigBrother.config_dir, *[filenames.map(&:to_s)])
    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

13 entries across 13 versions & 1 rubygems

Version Path
big_brother-0.8.8.1 lib/big_brother/status_file.rb
big_brother-0.8.8 lib/big_brother/status_file.rb
big_brother-0.8.7 lib/big_brother/status_file.rb
big_brother-0.6.8 lib/big_brother/status_file.rb
big_brother-0.6.7 lib/big_brother/status_file.rb
big_brother-0.6.6 lib/big_brother/status_file.rb
big_brother-0.6.5 lib/big_brother/status_file.rb
big_brother-0.6.4 lib/big_brother/status_file.rb
big_brother-0.6.3 lib/big_brother/status_file.rb
big_brother-0.6.2 lib/big_brother/status_file.rb
big_brother-0.6.1 lib/big_brother/status_file.rb
big_brother-0.6.0 lib/big_brother/status_file.rb
big_brother-0.5.0 lib/big_brother/status_file.rb