Sha256: faa3b8d797f8ee43906ee0ec70509ae4d0d7d61ee7697ba15e4661c9f202f2fc

Contents?: true

Size: 799 Bytes

Versions: 3

Compression:

Stored size: 799 Bytes

Contents

module YSI
  class WorkingDirectory < Assertion
    def display_name
      "working directory"
    end

    def git_status
      `git status`
    end

    def status
      if !@status
        g = git_status
        if g =~ /working directory clean/
          @status = "clean"
        elsif g =~ /Changes to be committed/
          @status = "uncommitted changes"
        elsif g =~ /Untracked files/
          @status = "untracked files"
        elsif g =~ /Changes not staged/
          @status = "unstaged changes"
        else
          @status = nil
        end
      end
      @status
    end

    def check
      if status == "clean"
        return status
      else
        @error = status
        return nil
      end
    end

    def assert(dry_run: false)
      "clean"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yes_ship_it-0.0.5 assertions/working_directory.rb
yes_ship_it-0.0.4 assertions/working_directory.rb
yes_ship_it-0.0.3 assertions/working_directory.rb