forked from maetl/yarrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
38 lines (30 loc) · 920 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'rexml/document'
$version = File.read('VERSION')
task :version do
xml = File.read('package.xml')
pkg = REXML::Document.new(xml)
pkg.elements.each('/package/version/*') do |version|
version.text = $version
end
pkg.elements.each('/package/date') do |date|
date.text = Time.now.strftime('%Y-%m-%d')
end
pkg.elements.each('/package/time') do |time|
time.text = Time.now.strftime('%H:%M:%S')
end
File.open('package.xml', 'w') do |file|
file.write(pkg)
end
end
task :package do
sh 'pear package'
end
task :publish do
package = "Yarrow-#{$version}.tgz"
sh "scp #{package} #{ENV['USER']}@#{ENV['HOST']}:/var/www/yarrow-channel/public"
sh "ssh #{ENV['USER']}@#{ENV['HOST']} 'cd /var/www/yarrow-channel/public; pirum add /var/www/yarrow-channel/public #{package}'"
end
task :clean do
sh 'rm Yarrow-*.tgz'
end
task :release => [:version, :package, :publish, :clean]