Class: GameOfGithubLife::GitExecutor
- Inherits:
-
Object
- Object
- GameOfGithubLife::GitExecutor
- Defined in:
- lib/game_of_github_life/git_executor.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #commit(date, msg = 'draw') ⇒ Object
-
#initialize(path) ⇒ GitExecutor
constructor
A new instance of GitExecutor.
- #push ⇒ Object
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.("#{path}/.git") end |
Instance Attribute Details
#path ⇒ Object (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 |
#push ⇒ Object
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 |