Skip to content

Commit

Permalink
build task depends on upx, package task depends on msi
Browse files Browse the repository at this point in the history
  • Loading branch information
vertiginous committed Jan 23, 2011
1 parent 67d175a commit ce0b0b3
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -41,6 +41,7 @@ PIM

end

require 'tasks/common'
require 'tasks/package'
require 'tasks/build'
require 'tasks/cucumber'
Expand Down
4 changes: 2 additions & 2 deletions lib/pik/installer.rb
Expand Up @@ -7,15 +7,15 @@ module Pik
module Installer

def download_directory
@download_dir ||= config.global.fetch(:download_dir, Pik.home + 'downloads')
@download_dir ||= Pik.home + 'downloads'
end

def download(package, opts={})
download_directory.mkpath

target = download_directory + opts.fetch(:filename, filename(package))

Log.info "Downloading: #{package} \n to: #{target.windows}"
Log.info "Downloading: #{package} \n to: #{target.windows}"
URI.download(package, target.to_s, {:progress => true, :verbose => true})
return target
end
Expand Down
4 changes: 2 additions & 2 deletions tasks/build.rb
Expand Up @@ -8,7 +8,6 @@ def correct_version?

abort "You can only build pik with ruby-1.8.7-p330" unless correct_version?


EXE_VERSION = {
'version' => {
'file_version_number' => "#{Pik::VERSION}.0",
Expand Down Expand Up @@ -39,10 +38,11 @@ def correct_version?
file 'tools/pik_runner.exe', :needs => ['tools/pik_runner.exy'] do
Dir.chdir 'tools' do
sh('ruby -S exerb pik_runner.exy')
sh('upx --lzma pik_runner.exe') unless ENV['QUICK']
sh('..\tmp\upx307w\upx --lzma pik_runner.exe') unless ENV['QUICK']
end
end

desc 'lockds down gems for building exe'
task :lockdown do
ENV['ISOLATE_ENV'] = 'production'
Rake::Task['isolate:lockdown'].invoke('lib/vendor')
Expand Down
24 changes: 24 additions & 0 deletions tasks/common.rb
@@ -0,0 +1,24 @@
module Installer
include Pik::Installer
extend self

def download_and_extract(url, install_root)
file = download(url)
extract(install_root, file)
end

end

file 'tmp/upx307w/upx.exe' do
url = 'http://upx.sourceforge.net/download/upx307w.zip'
Installer.download_and_extract(url, Pathname('tmp'))
end

file 'tmp/wix/candle.exe' do
url = 'http://wix.sourceforge.net/releases/3.5.2430.0/wix35-binaries.zip'
Installer.download_and_extract(url, Pathname('tmp/wix'))
end

task :package, :needs => 'tmp/wix/candle.exe'

task :build, :needs => 'tmp/upx307w/upx.exe'
16 changes: 6 additions & 10 deletions tasks/package.rb
@@ -1,7 +1,7 @@
require 'uuid'
require 'rake/packagetask'

task :package => [:rebuild, 'installer:package']
task :package => [:build, 'installer:package']

Rake::PackageTask.new('pik-update', Pik::VERSION) do |p|
p.need_zip = true
Expand Down Expand Up @@ -31,23 +31,19 @@ def version_string
desc "packages the msi installer"
task :package, :needs => [msi_file, :light]

task :build_env do
ENV['PATH'] = "#{ENV['ProgramFiles(x86)']}\\Windows Installer XML v3.5\\bin;#{ENV['PATH']}"
end

task :candle, :needs => [:build_env] do
task :candle do
chdir 'lib/installer/' do
cmd = "../../tmp/wix/candle.exe -nologo"
wxs_files = ["MyInstallDirDialog.wxs",'WixUI_MyInstallDir.wxs' , "#{@package}.wxs"].join(' ')
# wxs_files = ["#{@package}.wxs"].join(' ')
sh("candle -nologo #{wxs_files}")
sh("#{cmd} #{wxs_files}")
end
end

task :light, :needs => :candle do
chdir 'lib/installer/' do
cmd = "../../tmp/wix/light.exe -nologo "
wixobj_files = ["MyInstallDirDialog.wixobj", 'WixUI_MyInstallDir.wixobj', "#{@package}.wixobj"].join(' ')
# wixobj_files = ["#{@package}.wixobj"].join(' ')
sh("light -nologo -ext WixUtilExtension -ext WixUIExtension #{wixobj_files} -o ../../#{msi_file}")
sh("#{cmd} -ext WixUtilExtension -ext WixUIExtension #{wixobj_files} -o ../../#{msi_file}")
end
end

Expand Down

0 comments on commit ce0b0b3

Please sign in to comment.