Created
October 22, 2012 15:06
-
-
Save AnthonyMastrean/3931930 to your computer and use it in GitHub Desktop.
InstallShield multi version support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module InstallShield | |
class InstallShieldConfiguration | |
attr_accessor :command, :parameters, :ism, :product_version, :product_code | |
attr_reader :new_product_code | |
def initialize | |
@command = File.join ENV['ProgramFiles(x86)'], 'InstallShield/2010 StandaloneBuild/System/IsCmdBld.exe' | |
@parameters = [] | |
end | |
def new_product_code! | |
@new_product_code = true | |
end | |
def make_parameters | |
@parameters ||= [] | |
@parameters << "-p \"#{windows_path @ism}\"" | |
@parameters.flatten | |
end | |
def windows_path(path) | |
path.gsub '/', '\\' | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module InstallShield | |
V2010 = InstallShieldContext.new(2010, 16) | |
V2011 = InstallShieldContext.new(2011, 17) | |
V2012 = InstallShieldContext.new(2012, 18) | |
class InstallShieldContext | |
attr_reader :command_path, :com_object | |
def initialize(year, version) | |
@command_path = File.join ENV['ProgramFiles(x86)'], "InstallShield/#{year} StandaloneBuild/System/IsCmdBld.exe" | |
@com_object = "ISWiAuto#{version}.ISWiProject" | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module InstallShield | |
require 'win32ole' | |
class IsmProject | |
def initialize(ism) | |
@project = WIN32OLE.new 'ISWiAuto16.ISWiProject' | |
@ism = ism | |
end | |
def modify | |
@project.OpenProject @ism | |
yield(@project) if block_given? | |
puts "MSI:: #{@ism} v#{@project.ProductVersion} #{@project.ProductCode}" | |
@project.SaveProject | |
@project.CloseProject | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment