Added scripts for nightly builds.

CQTexperiment
vspader 2007-03-17 00:56:02 +00:00
parent 08f233b4e1
commit a29ab1e885
3 changed files with 95 additions and 0 deletions

17
Scripts/appcast.erb Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>Cog Nightlies</title>
<link>http://cogosx.sf.net/appcast.xml</link>
<description>Cog nightly builds.</description>
<language>en</language>
<% entries.slice(0..5).each do |entry| %>
<item>
<title>Cog r<%= entry['revision'] %></title>
<description><%= entry['changelog'] %></description>
<pubDate><%= entry['date'] %></pubDate>
<enclosure url="http://cogosx.sf.net/<%= entry['filename'] %>" length="<%= entry['filesize'] %>" type="application/octet-stream"/>
</item>
<% end %>
</channel>
</rss>

6
Scripts/build_cog.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
./Scripts/build_dependencies.sh
xcodebuild -alltargets -configuration Release

72
Scripts/build_nightly.rb Executable file
View File

@ -0,0 +1,72 @@
#!/sw/bin/ruby
require 'yaml'
require 'erb'
include ERB::Util
yaml_file = 'Scripts/nightlies.yaml'
#Load yaml and get the current revision
if File.exists?(yaml_file)
entries = YAML::load(File.open(yaml_file))
local_revision = entries[0]['revision'].to_i()
else
entries = []
local_revision = 0
end
#Update to the latest revision
latest_revision = %x[svn update | tail -n 1].gsub(/[^\d]+/, '').to_i()
if local_revision < latest_revision
#Get the changelog
changelog = %x[svn log -r #{latest_revision}:#{local_revision+1}]
#Remove the previous build directories
%x[find . -type d -name build -print0 | xargs -0 rm -r ]
#Build Cog!
%x[./Scripts/build_cog.sh].each_line do |line|
if line.match(/\*\* BUILD FAILED \*\*/)
exit
end
end
filename = "Cog-r#{latest_revision}.tbz2"
#Zip the app!
%x[tar cjf build/Release/#{filename} build/Release/Cog.app]
filesize = File.size("build/Release/#{filename}")
#Update yaml
entry = {
'revision' => latest_revision,
'changelog' => changelog,
'filename' => filename,
'filesize' => filesize,
'date' => Time.now().strftime("%a, %d %b %Y %H:%M:%S %Z") #RFC 822
}
#Send the new build to the server
%x[scp build/Release/#{filename} vince@vspader.com:~/public_html/]
entries.insert(0, entry)
File.open(yaml_file, 'w') do |output|
output << entries.to_yaml()
end
#Build the appcast from the template!
appcast = ERB.new(File.open('Scripts/appcast.erb'), 0, '<>')
File.open('Scripts/appcast.xml', 'w') do |output|
output << appcast.result()
end
#Send the updated appcast to the server
%x[scp Scripts/appcast.xml vince@vspader.com:~/public_html/]
end