Class: Rake::ShipitTask::VC::SVN
- Inherits:
-
Object
- Object
- Rake::ShipitTask::VC::SVN
- 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) ⇒ Object
Class Method Details
.accept? ⇒ Boolean
61 62 63 |
# File 'lib/shipit/vc.rb', line 61 def self.accept? File.exist? ".svn" end |
Instance Method Details
#are_local_diffs(ver) ⇒ Object
108 109 110 |
# File 'lib/shipit/vc.rb', line 108 def are_local_diffs(ver) `svn diff`.match(/\S/) end |
#commit(msg) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/shipit/vc.rb', line 65 def commit(msg) temp = Tempfile.open("svn-commit") temp << msg temp.close system "svn", "ci", "--file", temp.path end |
#exists_tagged_version(ver) ⇒ Object
92 93 94 |
# File 'lib/shipit/vc.rb', line 92 def exists_tagged_version(ver) !!`svn info '#{tag_url(ver)}'`[/Node Kind: directory/] end |
#local_diff(file) ⇒ Object
104 105 106 |
# File 'lib/shipit/vc.rb', line 104 def local_diff(file) `svn diff #{file}` end |
#precommit ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/shipit/vc.rb', line 73 def precommit unknown = [] changes = false `svn st`.split(/\n/).each do |l| changes = true next unless l =~ /^\?/ unknown << l end unless unknown.empty? raise unknown.join("\n") end unless changes warn "No locally changed files. skipping commit" return end end |
#tag_version(ver, msg) ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/shipit/vc.rb', line 96 def tag_version(ver, msg) temp = Tempfile.open("svn-commit") temp << msg temp.close system 'svn', 'copy', '--file', temp.path, trunk_url.to_s, tag_url(ver).to_s end |