Class: Hookers::Commands::GitCommit

Inherits:
Object
  • Object
show all
Includes:
Hookers::Command
Defined in:
lib/hookers/commands/git_commit.rb

Constant Summary collapse

KEYS =
%w(bug feature story fixed fixes completed finished delivers)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Hookers::Command

included, #parse_options

Constructor Details

#initialize(command, args) ⇒ GitCommit

Returns a new instance of GitCommit.



21
22
23
24
# File 'lib/hookers/commands/git_commit.rb', line 21

def initialize(command, args)
  self.options = parse_options(args)
  self.git = Git::Repository.new
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



8
9
10
# File 'lib/hookers/commands/git_commit.rb', line 8

def command
  @command
end

#gitObject

Returns the value of attribute git.



8
9
10
# File 'lib/hookers/commands/git_commit.rb', line 8

def git
  @git
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/hookers/commands/git_commit.rb', line 8

def options
  @options
end

Class Method Details

.slopObject



14
15
16
17
18
19
# File 'lib/hookers/commands/git_commit.rb', line 14

def self.slop
  Slop.new(help: true) do
    on :m, "Message to be used on commit", argument: true
    on :id, "Pivotal story id", argument: true
  end
end

Instance Method Details

#runObject



26
27
28
# File 'lib/hookers/commands/git_commit.rb', line 26

def run
  puts git.commit "[#{self.command.upcase} ##{options[:id]}] #{options[:m]}"
end