Sha256: 418ec61f59fb017cf2b1dab75f776bebc6cf53dcfdc5b42d6b6275ad7a91b114

Contents?: true

Size: 547 Bytes

Versions: 8

Compression:

Stored size: 547 Bytes

Contents

module Approvals

  class Dotfile
    class << self

      def reset
        File.truncate(path, 0) if File.exists?(path)
      end

      def append(text)
        unless includes?(text)
          write text
        end
      end

      private

      def path
        File.join(Approvals.project_dir, '.approvals')
      end

      def includes?(text)
        system("cat #{path} | grep -q \"^#{text}$\"")
      end

      def write(text)
        File.open(path, 'a+') do |f|
          f.write "#{text}\n"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
approvals-0.0.17 lib/approvals/dotfile.rb
approvals-0.0.16 lib/approvals/dotfile.rb
approvals-0.0.15 lib/approvals/dotfile.rb
approvals-0.0.14 lib/approvals/dotfile.rb
approvals-0.0.13 lib/approvals/dotfile.rb
approvals-0.0.12 lib/approvals/utilities/dotfile.rb
approvals-0.0.11 lib/approvals/utilities/dotfile.rb
approvals-0.0.10 lib/approvals/utilities/dotfile.rb