Module: GitRainbow

Extended by:
GitRainbow
Included in:
GitRainbow
Defined in:
lib/git_rainbow.rb,
lib/git_rainbow/version.rb,
lib/git_rainbow/exploder.rb

Defined Under Namespace

Modules: Painter

Constant Summary collapse

VERSION =
"1.0.0"

Instance Method Summary collapse

Instance Method Details

#ammend?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/git_rainbow/exploder.rb', line 30

def ammend?
  ARGV.include?("--amend")
end

#commandObject



16
17
18
# File 'lib/git_rainbow/exploder.rb', line 16

def command
  %Q{ git commit #{ammend? ? '--amend' : ''} -m "#{Painter.paint(message)}" }
end

#explode!Object



4
5
6
7
8
9
10
# File 'lib/git_rainbow/exploder.rb', line 4

def explode!
  if message
    exec command
  else
    puts usage!
  end
end

#messageObject



20
21
22
23
24
25
26
27
28
# File 'lib/git_rainbow/exploder.rb', line 20

def message
  ARGV.each_with_index do |arg, i|
    if arg == "-m" || arg == "--message"
      return ARGV[i+1]
    end
  end

  nil
end

#usage!Object



12
13
14
# File 'lib/git_rainbow/exploder.rb', line 12

def usage!
  'USAGE: git rainbow -m "Your message here!"'
end