dev_svn 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/svn.rb +10 -0
- data/spec/svn_spec.rb +12 -0
- metadata +1 -1
data/lib/svn.rb
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'tmpdir'
|
3
3
|
class Svn
|
4
|
+
|
5
|
+
def self.latest_revision
|
6
|
+
if(Dir.exists?(".svn"))
|
7
|
+
`svn info`.scan(/Last Changed Rev: ([\d]+)/).each{|m|
|
8
|
+
return m.first.to_s
|
9
|
+
}
|
10
|
+
end
|
11
|
+
"0"
|
12
|
+
end
|
13
|
+
|
4
14
|
# publish a directory to a new subversion path
|
5
15
|
# source_dir is the directory with the files to be published
|
6
16
|
# destination is the new subversion path URL
|
data/spec/svn_spec.rb
CHANGED
@@ -2,6 +2,18 @@ require_relative '../lib/svn.rb'
|
|
2
2
|
require 'rake'
|
3
3
|
|
4
4
|
describe Svn do
|
5
|
+
it "should be able to obtain lastest revision" do
|
6
|
+
Dir.mktmpdir{|dir|
|
7
|
+
`svnadmin create svn_test_repo 2>&1`
|
8
|
+
expect(File.exists?("#{dir}/svn_test_repo"))
|
9
|
+
svn_repo="file:///#{dir}/svn_test_repo"
|
10
|
+
#{}`svn checkout #{svn_repo} trunk`
|
11
|
+
|
12
|
+
FileUtils.rm_r('svn_test_repo')
|
13
|
+
}
|
14
|
+
|
15
|
+
end
|
16
|
+
|
5
17
|
it "should be able to publish files to a subversion repository" do
|
6
18
|
|
7
19
|
FileUtils.mkdir('tmp') if(!File.exists?('tmp'))
|