class Gem::Tasks::SCM::Status


The ‘scm:status` task.

def define


Defines the `status` task.
def define
  namespace :scm do
    task :status do
      if dirty?
        error "Project has uncommitted changes!"
        status
        abort
      end
    end
  end
  # alias the `validate` task to scm:status
  task :validate => 'scm:status'
end

def dirty?

Other tags:
    Since: - 0.2.1

Other tags:
    Api: - semipublic

Returns:
  • (Boolean) -
def dirty?
  status = case @project.scm
           when :git then `git status --porcelain --untracked-files=no`
           when :hg  then `hg status --quiet`
           when :svn then `svn status --quiet`
           else            ''
           end
  return !status.chomp.empty?
end

def initialize(options={})

Parameters:
  • options (Hash) --
def initialize(options={})
  super()
  yield self if block_given?
  define
end

def status

Other tags:
    Api: - semipublic
def status
  case @project.scm
  when :git then run 'git', 'status', '--untracked-files=no'
  when :hg  then run 'hg', 'status', '--quiet'
  when :svn then run 'svn', 'status', '--quiet'
  end
end