Class: Wix
- Inherits:
-
Object
- Object
- Wix
- Defined in:
- lib/apps/wix.rb
Class Method Summary collapse
- .get_build_commands(wxs_file) ⇒ Object
- .get_wix_with_files(wxs_template_text, component_id, filenames) ⇒ Object
- .update_wix_files(wxs_filename, component_id, filenames) ⇒ Object
Class Method Details
.get_build_commands(wxs_file) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/apps/wix.rb', line 14 def self.get_build_commands wxs_file build_commands=nil if(File.exists?(wxs_file) && !defined?(NO_WIX)) if(Environment.windows?) ext='msi' ext='exe' if(IO.read(wxs_file).include?('<Bundle')) extensions='' ['WixNetFxExtension','WixBalExtension','WixUtilExtension','WixUiExtension'].each{|e| extensions="#{extensions}-ext #{e} " } build_commands=Array.new if build_commands.nil? build_commands << "candle #{wxs_file} #{extensions}" if(defined?(VERSION)) build_commands << "light #{File.basename(wxs_file,'.*')}.wixobj -out #{File.basename(wxs_file,'.*')}-#{VERSION}.#{ext} #{extensions}" else build_commands << "light #{File.basename(wxs_file,'.*')}.wixobj #{extensions}" end end end build_commands end |
.get_wix_with_files(wxs_template_text, component_id, filenames) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/apps/wix.rb', line 37 def self.get_wix_with_files wxs_template_text, component_id, filenames # <Component[-\s\w="]+Id="ApplicationFiles"[-"\s\w=]+>([-<="\/.>\s\w]+)<\/C search=wxs_template_text.scan(/<Component[-\s\w="]+Id="ApplicationFiles"[-"\s\w=]+>([-<="\/.>\s\w]+)<\/C/)[0][0] replace="" index = 0 filenames.each{|f| replace += "\n <File Id=\"#{component_id}#{index}\" Source=\"#{f}\"/>" index += 1 } replace += "\n" wxs_template_text.gsub(search,replace) end |
.update_wix_files(wxs_filename, component_id, filenames) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/apps/wix.rb', line 50 def self.update_wix_files wxs_filename, component_id, filenames wix_text = IO.read(wxs_filename) new_text = get_wix_with_files(wix_text, component_id,filenames) if(wix_text != new_text) File.open(wxs_filename,'w'){|f| f.write(new_text) } end end |