dev_commands 0.0.28 → 0.0.29
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/publish.rb +41 -1
- metadata +1 -1
data/lib/publish.rb
CHANGED
@@ -5,6 +5,46 @@ class Publish < Array
|
|
5
5
|
Dir.glob('*.gemspec').each{|gemspec_file|
|
6
6
|
add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
|
7
7
|
}
|
8
|
+
|
9
|
+
if(defined?(PUBLISH_PATH))
|
10
|
+
if(PUBLISH_PATH.include?('svn://') && File.exists?('.svn') && defined?(ARTIFACTS))
|
11
|
+
|
12
|
+
latestRev=Publish.svn_latest_revision
|
13
|
+
svn_publish_uri="#{PUBLISH_PATH}/#{Publish.relative_directory}-#{latestRev}"
|
14
|
+
local_dir="#{Command.dev_root}/tmp/#{Publish.relative_directory}@#{latestRev}"
|
15
|
+
FileUtils.mkdir_p(File.dirname(local_dir)) if(!File.exists?(File.dirname(local_dir)))
|
16
|
+
dep_dir="#{Command.dev_root}/dep/#{Publish.relative_directory}@#{latestRev}"
|
17
|
+
svn_info=`svn info #{svn_publish_uri} 2>&1`
|
18
|
+
if(svn_info.include?('URL:'))
|
19
|
+
#puts "#{svn_publish_uri} already exists."
|
20
|
+
else
|
21
|
+
#Console.debug "adding publish commands.."
|
22
|
+
add "svn mkdir #{svn_publish_uri} --parents -m\"publish\""
|
23
|
+
add "svn checkout #{svn_publish_uri} #{local_dir}"
|
24
|
+
add "<%Environment.copy_files(ARTIFACTS,'#{local_dir}')%>"
|
25
|
+
add "<%Environment.svn_add_all('#{local_dir}')%>"
|
26
|
+
add "svn commit #{local_dir}@ -m\"publish\""
|
27
|
+
add "<%FileUtils.rm_r('#{local_dir}')%>"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
8
31
|
end
|
9
32
|
end
|
10
|
-
|
33
|
+
|
34
|
+
def self.svn_latest_revision
|
35
|
+
if(Dir.exists?(".svn"))
|
36
|
+
`svn info`.scan(/Last Changed Rev: ([\d]+)/).each{|m|
|
37
|
+
return m.first.to_s
|
38
|
+
}
|
39
|
+
end
|
40
|
+
"0"
|
41
|
+
end
|
42
|
+
def self.context
|
43
|
+
dir =Rake.application.original_dir.gsub(Command.dev_root + '/','')
|
44
|
+
return dir.split('/').first
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.relative_directory
|
48
|
+
Rake.application.original_dir.gsub(Command.dev_root + '/' + Publish.context + '/','')
|
49
|
+
end
|
50
|
+
end
|