dev_svn 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/svn.rb +8 -0
- metadata +1 -1
data/lib/svn.rb
CHANGED
@@ -17,9 +17,12 @@ class Svn
|
|
17
17
|
# source_glob is a string or array of glob directives to specify files in source_dir to be publish
|
18
18
|
# source_glob defaults to '**/*' to publish all files in the source_dir
|
19
19
|
def self.publish source_dir, destination, source_glob='**/*'
|
20
|
+
|
21
|
+
output = "\n"
|
20
22
|
raise "Svn.publish: destination #{destination} already exists" if(`svn info #{destination} 2>&1`.include?('Revision:'))
|
21
23
|
|
22
24
|
# create subversion directory
|
25
|
+
output = output + "svn mkdir #{destination} --parents --message mkdir_for_publishing"
|
23
26
|
if(!`svn mkdir #{destination} --parents --message mkdir_for_publishing`.include?('Committed'))
|
24
27
|
raise "failure 'svn mkdir #{destination} --parents --message mkdir_for_publishing'"
|
25
28
|
end
|
@@ -28,11 +31,13 @@ class Svn
|
|
28
31
|
Dir.chdir(source_dir) do
|
29
32
|
files=FileList.new(source_glob).to_a
|
30
33
|
end
|
34
|
+
output = output + "\nfiles: #{files}.to_s"
|
31
35
|
|
32
36
|
pwd=Dir.pwd
|
33
37
|
Dir.mktmpdir{|dir|
|
34
38
|
|
35
39
|
# checkout new subversion directory
|
40
|
+
output = output + "\nsvn checkout #{destination} to_publish_checkout"
|
36
41
|
if(!`svn checkout #{destination} to_publish_checkout`.include?('Checked out'))
|
37
42
|
raise "failure 'svn checkout #{destination} to_publish_checkout'"
|
38
43
|
end
|
@@ -51,14 +56,17 @@ class Svn
|
|
51
56
|
add_file.close
|
52
57
|
}
|
53
58
|
|
59
|
+
output = output + "\nsvn add --parents --targets add.txt 2>&1"
|
54
60
|
`svn add --parents --targets add.txt 2>&1`
|
55
61
|
commit_output = `svn commit -m"add" 2>&1`
|
62
|
+
output = output + "\n#{commit_output}"
|
56
63
|
if(!commit_output.include?("Committed"))
|
57
64
|
raise "failure 'svn commit -m'added files''"
|
58
65
|
end
|
59
66
|
end
|
60
67
|
|
61
68
|
FileUtils.rm_r 'to_publish_checkout'
|
69
|
+
output
|
62
70
|
}
|
63
71
|
end
|
64
72
|
end
|