Class: Boxen::Checkout
- Inherits:
-
Object
- Object
- Boxen::Checkout
- Defined in:
- lib/boxen/checkout.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #changes ⇒ Object
- #dirty? ⇒ Boolean
-
#initialize(config) ⇒ Checkout
constructor
A new instance of Checkout.
- #master? ⇒ Boolean
- #sha ⇒ Object
Constructor Details
#initialize(config) ⇒ Checkout
Returns a new instance of Checkout.
5 6 7 |
# File 'lib/boxen/checkout.rb', line 5 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/boxen/checkout.rb', line 3 def config @config end |
Instance Method Details
#changes ⇒ Object
21 22 23 |
# File 'lib/boxen/checkout.rb', line 21 def changes Dir.chdir(config.repodir) { `git status --porcelain`.strip } end |
#dirty? ⇒ Boolean
17 18 19 |
# File 'lib/boxen/checkout.rb', line 17 def dirty? !changes.empty? end |
#master? ⇒ Boolean
13 14 15 |
# File 'lib/boxen/checkout.rb', line 13 def master? Dir.chdir(config.repodir) { `git symbolic-ref HEAD`.strip == 'refs/heads/master' } end |
#sha ⇒ Object
9 10 11 |
# File 'lib/boxen/checkout.rb', line 9 def sha Dir.chdir(config.repodir) { `git rev-parse HEAD`.strip } end |