Class: Horatio::VCS::Git
- Inherits:
-
Object
- Object
- Horatio::VCS::Git
- Includes:
- Helper::VCS
- Defined in:
- lib/horatio/vcs/git.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Helper::VCS
Class Method Details
.detect ⇒ Object
10 11 12 |
# File 'lib/horatio/vcs/git.rb', line 10 def self.detect sh('git rev-parse HEAD').last.exitstatus == 0 end |
Instance Method Details
#commit(file) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/horatio/vcs/git.rb', line 18 def commit(file) color { Log.info "Adding remote before pushing verion update: #{remote_url}" } sh "git remote rm horatio &> /dev/null" run_sh "git remote add horatio #{remote_url}" run_sh "git commit -m 'image release' #{file}" run_sh "git push horatio master" end |
#latest_revision ⇒ Object
14 15 16 |
# File 'lib/horatio/vcs/git.rb', line 14 def latest_revision sh('git rev-parse --short HEAD').first.strip end |
#remote_url ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/horatio/vcs/git.rb', line 26 def remote_url begin url = @options.fetch('git-repo-url') rescue => e color(ERROR) { Log.error "Since Horatio 1.0 you must specify a remote repo URL when building a docker only / horatio build" } color(ERROR) { Log.error "If you see this message update your build to look like the following example: 'horatio --git-repo-url http://github.com/test/test.git'" } raise e end url end |