Skip to content

Commit

Permalink
add support for light to delay validation
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Martin <Jeffrey_Martin@rapid7.com>
  • Loading branch information
jmartin-tech committed Feb 1, 2019
1 parent f9fd5ac commit 271ab22
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/omnibus/packagers/msi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,29 @@ def wix_light_extension(extension)
end
expose :wix_light_extension

#
# Signal delay validation for wix light
#
# @example
# wix_light_deplay_validation true
#
# @param [TrueClass, FalseClass] value
# whether to delay validation or not
#
# @return [String]
# whether we're a bundle or not
def wix_light_delay_validation(val = false)
unless val.is_a?(TrueClass) || val.is_a?(FalseClass)
raise InvalidValue.new(:iwix_light_delay_validation, "be TrueClass or FalseClass")
end
@delay_validation ||= val
unless @delay_validation
return ""
end
"-sval"
end
expose :wix_light_delay_validation

#
# Set the wix candle extensions to load
#
Expand Down Expand Up @@ -465,6 +488,7 @@ def light_command(out_file, is_bundle: false)
<<-EOH.split.join(" ").squeeze(" ").strip
light.exe
-nologo
#{wix_light_delay_validation}
-ext WixUIExtension
-ext WixBalExtension
#{wix_extension_switches(wix_light_extensions)}
Expand All @@ -477,6 +501,7 @@ def light_command(out_file, is_bundle: false)
<<-EOH.split.join(" ").squeeze(" ").strip
light.exe
-nologo
#{wix_light_delay_validation}
-ext WixUIExtension
#{wix_extension_switches(wix_light_extensions)}
-cultures:en-us
Expand Down
22 changes: 22 additions & 0 deletions spec/unit/packagers/msi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,28 @@ module Omnibus
end
end

describe "#wix_light_delay_validation" do
it "is a DSL method" do
expect(subject).to have_exposed_method(:wix_light_delay_validation)
end

it "requires the value to be a TrueClass or a FalseClass" do
expect do
subject.wix_light_delay_validation(Object.new)
end.to raise_error(InvalidValue)
end

it "defaults to an empty String" do
expect(subject.wix_light_delay_validation).to be_a(String)
expect(subject.wix_light_delay_validation).to be_empty
end

it "returns the string `-sval` when true" do
subject.wix_light_delay_validation(true)
expect(subject.wix_light_delay_validation).to eq("-sval")
end
end

describe "#wix_candle_extension" do
it "is a DSL method" do
expect(subject).to have_exposed_method(:wix_candle_extension)
Expand Down

0 comments on commit 271ab22

Please sign in to comment.