Skip to content

Commit

Permalink
Usage of generic ERB version of config.
Browse files Browse the repository at this point in the history
- Minor adjustments to rake tasks
- Allow packaging of multiple versions work at the same time
  • Loading branch information
luislavena committed Mar 4, 2010
1 parent 9833d5e commit 64af9e8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.log
downloads
pkg
resources/installer/config-*.iss
resources/installer/changes.txt
sandbox
README
40 changes: 15 additions & 25 deletions recipes/packager/inno.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'erb'

module RubyTools
# read C definitions from 'target' file and return
# a hash of values
Expand All @@ -14,20 +16,6 @@ end
# TODO: port this to it's own innosetup recipe
module InnoSetup
EXECUTABLE = "iscc.exe"
# FIXME cleanup placeholders and test template bindings
VERSIONED_CONFIG =<<EOT
; Ruby <%= options[:version] %> Configuration File.
[Setup]
AppId={<%= pkg.installer_guid %>
DefaultDirName={sd}\Ruby<%= options[:version].sub('.', '') %>
[Files]
Source: ..\..\sandbox\doc\ruby_<%= major_minor.sub('.', '_') %>\*.chm; DestDir: {app}\doc
[Icons]
Name: {group}\Documentation\Ruby <%= options[:version] %> API Reference; Filename: {app}\doc\ruby<%= major_minor.sub('.', '') %>.chm; Flags: createonlyiffileexists
EOT

def self.present?
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
Expand All @@ -36,12 +24,6 @@ EOT
false
end

# FIXME implement
def self.prepare(options={})
puts "creating v#{options[:version]} config.iss file..."
# TODO use erb/erubis VERSIONED_CONFIG template to write config file
end

def self.iscc(script, *args)
cmd = []
options = args.last || {}
Expand Down Expand Up @@ -105,6 +87,7 @@ directory 'pkg'
[RubyInstaller::Ruby18, RubyInstaller::Ruby19].each do |pkg|
if info = RubyTools.ruby_version(File.join(pkg.target, 'version.h'))
version = "#{info[:version]}-p#{info[:patchlevel]}"
version_xyz = info[:version]
major_minor = info[:version][0..2]
namespace_ver = major_minor.sub('.', '')
version << "-#{ENV['RELEASE']}" if ENV['RELEASE']
Expand All @@ -113,11 +96,20 @@ directory 'pkg'
# FIXME remove config-#{major_minor}.iss as this file is dynamically
# created in installer file task below
files = FileList[
"resources/installer/rubyinstaller.iss",
"resources/installer/config-#{major_minor}.iss",
'resources/installer/changes.txt'
'resources/installer/rubyinstaller.iss',
"resources/installer/config-#{version_xyz}.iss"
]

file "resources/installer/config-#{version_xyz}.iss",
:needs => ['resources/installer/config.iss.erb'] do |t|
guid = pkg.installer_guid
contents = ERB.new(File.read(t.prerequisites.first)).result(binding)

when_writing("Generating #{t.name}") do
File.open(t.name, 'w') { |f| f.write contents }
end
end

file 'resources/installer/changes.txt',
:needs => ['pkg', 'History.txt'] do |t|

Expand All @@ -133,8 +125,6 @@ directory 'pkg'
file "pkg/#{installer_pkg}.exe",
:needs => ['pkg', "ruby#{namespace_ver}:docs", :book, *files] do

InnoSetup.prepare :ruby_version => info[:version]

InnoSetup.iscc("resources/installer/rubyinstaller.iss",
:ruby_version => info[:version],
:ruby_patch => info[:patchlevel],
Expand Down
3 changes: 2 additions & 1 deletion resources/installer/rubyinstaller.iss
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@

; INCLUDE
; Include dynamically created version specific definitions
#include "config.iss"
#define InstallerConfigFile "config-" + RubyVersion + ".iss"
#include InstallerConfigFile

#define RubyInstallerId "MRI (" + RubyVersion + ")"

Expand Down

0 comments on commit 64af9e8

Please sign in to comment.