Class: GameOfGithubLife::GitExecutor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ GitExecutor

Returns a new instance of GitExecutor.



5
6
7
# File 'lib/game_of_github_life/git_executor.rb', line 5

def initialize(path)
  @path = File.expand_path("#{path}/.git")
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#commit(date, msg = 'draw') ⇒ Object



9
10
11
# File 'lib/game_of_github_life/git_executor.rb', line 9

def commit(date, msg = 'draw')
  `git --git-dir=#{path} commit --allow-empty -m "#{msg}" --date "#{date}"`
end

#pushObject



13
14
15
# File 'lib/game_of_github_life/git_executor.rb', line 13

def push
  `git --git-dir=#{path} push --force -u origin master`
end