Skip to content

Commit

Permalink
Fix some rubocop violations
Browse files Browse the repository at this point in the history
  • Loading branch information
Annih committed Nov 18, 2016
1 parent f05ecf1 commit 003d68a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ MethodLength:
Enabled: no
Metrics/AbcSize:
Enabled: no
Metrics/BlockLength:
Max: 30
Metrics/ClassLength:
Enabled: no
Metrics/CyclomaticComplexity:
Expand Down
4 changes: 3 additions & 1 deletion libraries/v2_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ def installed_version
return unless registry_key_exists? REGISTRY_KEY

values = ::Mash[registry_get_values(REGISTRY_KEY).map { |e| [e[:name], e[:data]] }]
return if values[:Install].to_i != 1

case sp = values[:SP].to_i
when 0 then '2.0'
else "2.0.SP#{sp}"
end if values[:Install].to_i == 1
end
end

def supported_versions
Expand Down
8 changes: 5 additions & 3 deletions libraries/v4_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ def installed_version

values = ::Mash[registry_get_values(REGISTRY_KEY).map { |e| [e[:name], e[:data]] }]

return if values[:Install].to_i != 1

case values[:Release].to_i
when 0 then '4.0'
when 378_389 then '4.5'
when 378_675, 378_758 then '4.5.1'
when 379_893 then '4.5.2'
when 393_295, 393_297 then '4.6'
when 394_254, 394_271 then '4.6.1'
end if values[:Install].to_i == 1
end
end

def supported_versions
Expand Down Expand Up @@ -102,8 +104,8 @@ def package_setup
def prerequisite_names
@patch_names ||= case nt_version
when 6.3
prerequisites_46 = %w(KB2919442 KB2919355)
{ '4.6' => prerequisites_46, '4.6.1' => prerequisites_46 }
prerequisites46 = %w(KB2919442 KB2919355)
{ '4.6' => prerequisites46, '4.6.1' => prerequisites46 }
else
{}
end
Expand Down
2 changes: 1 addition & 1 deletion resources/framework.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
attribute :include_patches, default: true, kind_of: [TrueClass, FalseClass]
attribute :package_sources, default: {}.freeze, kind_of: Hash
attribute :require_support, default: false, kind_of: [TrueClass, FalseClass]
attribute :timeout, default: 600, kind_of: Fixnum
attribute :timeout, default: 600, kind_of: Integer
attribute :version, name_attribute: true, kind_of: String
9 changes: 5 additions & 4 deletions spec/libraries/package_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@
is_server = version_support[:server]

version_support[:arch].each do |arch|
is_64 = arch == '64'
is_arch64 = arch == '64'

describe "On Windows#{windows_version}-#{arch}" do
include_examples 'package_helper', data, x64?: is_64, server?: is_server, core?: false
include_examples 'package_helper', data, x64?: is_arch64, server?: is_server, core?: false
end

next unless version_support[:core]
describe "On Windows#{windows_version}-#{arch}-CORE" do
include_examples 'package_helper', data, x64?: is_64, server?: is_server, core?: true
end if version_support[:core]
include_examples 'package_helper', data, x64?: is_arch64, server?: is_server, core?: true
end
end
end

0 comments on commit 003d68a

Please sign in to comment.