Class: GitACP

Inherits:
Object
  • Object
show all
Defined in:
lib/git_acp.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ GitACP

Returns a new instance of GitACP.



3
4
5
# File 'lib/git_acp.rb', line 3

def initialize args
  @args = args
end

Instance Method Details

#addObject



14
15
16
17
# File 'lib/git_acp.rb', line 14

def add
  puts "Running add."
  `git add .`
end

#add_commit_pushObject



7
8
9
10
11
12
# File 'lib/git_acp.rb', line 7

def add_commit_push
  puts "Pushing to #{current_branch}."
  add
  commit
  push
end

#commitObject



19
20
21
22
# File 'lib/git_acp.rb', line 19

def commit
  puts "Running commit with message: #{@args[0]}"
  `git commit -am "#{@args[0]}"`
end

#current_branchObject



29
30
31
# File 'lib/git_acp.rb', line 29

def current_branch
  `git branch --no-color`.match(/\*\s(.+?)\s/)[1]
end

#pushObject



24
25
26
27
# File 'lib/git_acp.rb', line 24

def push
  puts "Running push."
  `git push origin #{current_branch}`
end