Sha256: 5056d94fb0ce6cc242d4c18b041aac79afcab006a175a91b292c95920e7b4cc8

Contents?: true

Size: 823 Bytes

Versions: 25

Compression:

Stored size: 823 Bytes

Contents

RSpec::Matchers.define :have_version do |version|
  match do |file|
    version_dll = Fiddle.dlopen('version.dll')

    s=''
    vsize = Fiddle::Function.new(version_dll['GetFileVersionInfoSize'],
                [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],
                Fiddle::TYPE_LONG).call(file.name, s)

    raise 'Unable to determine the version number' unless vsize > 0

    result = ' '*vsize
    Fiddle::Function.new(version_dll['GetFileVersionInfo'],
                         [Fiddle::TYPE_VOIDP, Fiddle::TYPE_LONG,
                          Fiddle::TYPE_LONG, Fiddle::TYPE_VOIDP],
            Fiddle::TYPE_VOIDP).call(file.name, 0, vsize, result)

    rstring = result.unpack('v*').map{|s| s.chr if s<256}*''
    r = /FileVersion..(.*?)\000/.match(rstring)

    r[1] == version
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
octopus-serverspec-extensions-0.13.2 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.13.1 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.13.0 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.12.2 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.12.1 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.12.0 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.11.8 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.11.7 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.11.6 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.11.5 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.11.4 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.11.2 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.11.1 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.11.0 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.10.2 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.10.1 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.10.0 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.9.0 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.8.1 lib/octopus_serverspec_extensions/matcher/have_version.rb
octopus-serverspec-extensions-0.8.0 lib/octopus_serverspec_extensions/matcher/have_version.rb