Module: Feature

Included in:
Diff, Land
Defined in:
lib/straight_line/common/feature.rb,
lib/straight_line/common/feature/diff.rb,
lib/straight_line/common/feature/land.rb,
lib/straight_line/common/feature/create.rb

Overview

Base module for all features

Defined Under Namespace

Classes: Create, Diff, Land

Instance Method Summary collapse

Instance Method Details

#changes_committed?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
# File 'lib/straight_line/common/feature.rb', line 17

def changes_committed?
  cmd = Command.new 'git'
  cmd.arg 'status'

  out = cmd.run
  out =~ /nothing to commit/
end

#current_featureObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/straight_line/common/feature.rb', line 4

def current_feature
  res = Command.new('git')
               .arg('branch')
               .run
               .match(/^\*\s+(.*)/)[1].strip
  if res =~ /no branch/
    raise UserError, 'A rebase is in process.
      Finish the rebase, then run the command again'
  else
    res
  end
end