Class: DeployChanges::Commit
- Inherits:
-
Object
- Object
- DeployChanges::Commit
- Defined in:
- lib/deploy_changes/commit.rb
Instance Attribute Summary collapse
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(repo) ⇒ Commit
constructor
A new instance of Commit.
- #last_commit ⇒ Object
- #write_head!(sha1 = nil) ⇒ Object
Constructor Details
#initialize(repo) ⇒ Commit
Returns a new instance of Commit.
5 6 7 |
# File 'lib/deploy_changes/commit.rb', line 5 def initialize(repo) @repo = repo end |
Instance Attribute Details
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
3 4 5 |
# File 'lib/deploy_changes/commit.rb', line 3 def repo @repo end |
Instance Method Details
#last_commit ⇒ Object
17 18 19 20 21 |
# File 'lib/deploy_changes/commit.rb', line 17 def last_commit return unless File.exist?(last_deploy_commit_file) File.read(last_deploy_commit_file).strip end |
#write_head!(sha1 = nil) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/deploy_changes/commit.rb', line 9 def write_head!(sha1 = nil) system("mkdir -p #{dir}") sha1 ||= repo.head.target_id File.write(last_deploy_commit_file, sha1) end |