Sha256: 77eeb8c528ee36989eb3fe12a0a228e74e122cf683433af9835acb3aab00c440

Contents?: true

Size: 505 Bytes

Versions: 2

Compression:

Stored size: 505 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").reduce([]) do |memo, diff|
        filename = diff.split(' ').last

        if diff =~ /^[^D]{2}/ && @extensions.include?(File.extname(filename))
          memo << filename
        end

        memo
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phare-0.5.2 lib/phare/git.rb
phare-0.5.1 lib/phare/git.rb