Class: Gem::Tasks::SCM::Status
- Defined in:
- lib/rubygems/tasks/scm/status.rb
Overview
The scm:status
task.
Constant Summary
Constants included from Printing
Printing::ANSI_BRIGHT, Printing::ANSI_CLEAR, Printing::ANSI_GREEN, Printing::ANSI_RED, Printing::ANSI_YELLOW, Printing::DEBUG_PREFIX, Printing::ERROR_PREFIX, Printing::STATUS_PREFIX
Instance Attribute Summary
Attributes inherited from Task
Instance Method Summary collapse
-
#define ⇒ Object
Defines the
status
task. -
#dirty? ⇒ Boolean
Checks the status of the project repository.
-
#initialize(options = {}) {|_self| ... } ⇒ Status
constructor
Initializes the
status
task. -
#status ⇒ Object
Displays the status of the project repository.
Methods inherited from Task
#bundle, #gem, #gemspec_tasks, #invoke, #namespaced_tasks, #run, #task?
Methods included from Printing
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Status
Initializes the status
task.
17 18 19 20 21 22 |
# File 'lib/rubygems/tasks/scm/status.rb', line 17 def initialize(={}) super() yield self if block_given? define end |
Instance Method Details
#define ⇒ Object
Defines the status
task.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rubygems/tasks/scm/status.rb', line 27 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 |
#dirty? ⇒ Boolean
Checks the status of the project repository.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rubygems/tasks/scm/status.rb', line 53 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 |
#status ⇒ Object
Displays the status of the project repository.
69 70 71 72 73 74 75 |
# File 'lib/rubygems/tasks/scm/status.rb', line 69 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 |