Sha256: 333ad082265d137d0e5244a78e24f4a1871229b91abef13ea5d8128da93ebb55

Contents?: true

Size: 529 Bytes

Versions: 4

Compression:

Stored size: 529 Bytes

Contents

module Phare
  class Git
    def initialize(extensions, options)
      @extensions = extensions
      @options = options
    end

    def changed?
      @options[:diff] && changes.any?
    end

    def changes
      @changes ||= Phare.system_output('git status -s').split("\n").each_with_object([]) do |diff, memo|
        filename = diff.split(' ').last

        if diff =~ /^[A|M].*/ && @extensions.include?(File.extname(filename))
          memo << filename
        else
          next
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phare-1.0.1 lib/phare/git.rb
phare-1.0.0 lib/phare/git.rb
phare-0.7.1 lib/phare/git.rb
phare-0.7 lib/phare/git.rb