Sha256: 2562f03ddd28e0f72d0d0bad65c65fb1e42fa869de6a9617b78767c1a3531c20

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

require 'grit'

class Dirty
  def repo
    @repo ||= Grit::Repo.new(dir)
  end

  def changed_files
    files(:changed)
  end

  def added_files
    files(:added)
  end

  def untracked_files
    files(:untracked)
  end

  def files(type)
    repo.status.send(type).map(&:first)
  end

  def dirty_files
    changed_files | added_files | untracked_files
  end

  def dirty_features
    dirty_files.select { |f| f.split('.').last[/feature/] }
  end

  def dir
    File.expand_path('.')
  end

  def self.run
    new.perform
  end

  def perform
    system("cucumber #{dirty_features.join(' ')}") if dirty_features.any?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dirty-0.0.1 lib/dirty.rb