Class: Rake::ShipitTask::VC::Git
- Inherits:
-
Object
- Object
- Rake::ShipitTask::VC::Git
- Defined in:
- lib/shipit/vc.rb
Class Method Summary collapse
Instance Method Summary collapse
- #are_local_diffs(ver) ⇒ Object
- #commit(msg) ⇒ Object
- #exists_tagged_version(ver) ⇒ Object
- #local_diff(file) ⇒ Object
- #precommit ⇒ Object
- #tag_version(ver, msg = nil) ⇒ Object
Class Method Details
.accept? ⇒ Boolean
15 16 17 |
# File 'lib/shipit/vc.rb', line 15 def self.accept? File.exist? ".git" end |
Instance Method Details
#are_local_diffs(ver) ⇒ Object
55 56 57 |
# File 'lib/shipit/vc.rb', line 55 def are_local_diffs(ver) `git diff --no-color #{ver}`.match(/\S/) end |
#commit(msg) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/shipit/vc.rb', line 19 def commit(msg) temp = Tempfile.open("COMMIT_MESSAGE") temp << msg temp.close system "git", "commit", "-a", "-F", temp.path end |
#exists_tagged_version(ver) ⇒ Object
34 35 36 |
# File 'lib/shipit/vc.rb', line 34 def exists_tagged_version(ver) !`git tag -l #{ver}`.empty? end |
#local_diff(file) ⇒ Object
51 52 53 |
# File 'lib/shipit/vc.rb', line 51 def local_diff(file) `git diff --no-color HEAD '#{file}'` end |
#precommit ⇒ Object
27 28 29 30 31 32 |
# File 'lib/shipit/vc.rb', line 27 def precommit unknown = `git ls-files -z --others --exclude-per-directory=.gitignore --exclude-from=.git/info/exclude` if unknown.gsub!(/\0/, "\n") raise unknown end end |
#tag_version(ver, msg = nil) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/shipit/vc.rb', line 39 def tag_version(ver, msg=nil) msg = "Tagging version #{ver}." unless msg temp = Tempfile.open("COMMIT_MESSAGE") temp << msg temp.close tag = ver system "git", "tag", "-a", "-F", temp.path, tag end |