Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
  • Loading branch information
clintoncwolfe committed Aug 6, 2019
1 parent d639f05 commit 38feb25
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
39 changes: 19 additions & 20 deletions lib/train/platforms/detect/specifications/os.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,30 +235,29 @@ def self.load

# suse family
plat.family("suse").in_family("linux")
.detect do
if linux_os_release && linux_os_release["ID_LIKE"] =~ /suse/i
@platform[:release] = linux_os_release["VERSION"]
true
elsif !(suse = unix_file_contents("/etc/SuSE-release")).nil?
# https://rubular.com/r/UKaYWolCYFMfp1
version = suse.scan(/VERSION = (\d+)\nPATCHLEVEL = (\d+)/).flatten.join(".")
# https://rubular.com/r/b5PN3hZDxa5amV
version = suse[/VERSION\s?=\s?"?([\d\.]{2,})"?/, 1] if version == ""
@platform[:release] = version
true
end
.detect do
if linux_os_release && linux_os_release["ID_LIKE"] =~ /suse/i
@platform[:release] = linux_os_release["VERSION"]
true
elsif !(suse = unix_file_contents("/etc/SuSE-release")).nil?
# https://rubular.com/r/UKaYWolCYFMfp1
version = suse.scan(/VERSION = (\d+)\nPATCHLEVEL = (\d+)/).flatten.join(".")
# https://rubular.com/r/b5PN3hZDxa5amV
version = suse[/VERSION\s?=\s?"?([\d\.]{2,})"?/, 1] if version == ""
@platform[:release] = version
true
end
end
plat.name("opensuse").title("OpenSUSE Linux").in_family("suse")
.detect do
true if (linux_os_release && linux_os_release["NAME"] =~ /^opensuse/i) ||
unix_file_contents("/etc/SuSE-release") =~ /^opensuse/i
end
.detect do
true if (linux_os_release && linux_os_release["NAME"] =~ /^opensuse/i) ||
unix_file_contents("/etc/SuSE-release") =~ /^opensuse/i
end
plat.name("suse").title("Suse Linux").in_family("suse")
.detect do
true if (linux_os_release && linux_os_release["NAME"] =~ /^sles/i) ||
unix_file_contents("/etc/SuSE-release") =~ /suse/i
end
.detect do
true if (linux_os_release && linux_os_release["NAME"] =~ /^sles/i) ||
unix_file_contents("/etc/SuSE-release") =~ /suse/i
end

# arch
plat.name("arch").title("Arch Linux").in_family("linux")
Expand Down
2 changes: 1 addition & 1 deletion test/unit/platforms/os_detect_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def debian_scan(id, version)

describe "windows" do
it "sets the correct family/release for windows " do
platform = scan_with_windows()
platform = scan_with_windows

platform[:name].must_equal("windows_6.3.9600")
platform[:family].must_equal("windows")
Expand Down

0 comments on commit 38feb25

Please sign in to comment.