specinfra 2.82.18 → 2.82.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd4b036255cf5aafd4a11a9e48572fb9a37dd3b3eb1164b0709c7c2cf9fbd845
4
- data.tar.gz: e1d9485748df7c5f3795fcb33b897b061406accaa6586d701b325d3dd1c358aa
3
+ metadata.gz: 2bb01e92f4048c67284e481792e819aa154976574ebecc5d0f08a3f619553dc7
4
+ data.tar.gz: 4df996d6652f4cfaacef45d6ff7a35e0fec0d64951b0767a286325890ec837df
5
5
  SHA512:
6
- metadata.gz: cd4efcf6f4a73749f41ec0e9a53376809ee9db4965524ccc3f0eefc5f7ab952c0644ea85df1124524b193a80e8c9d23461c497929d3864f0198c9aa28914c03d
7
- data.tar.gz: 87069e6caf693b955ee1fffb46d5fd6d2172895ca6d7bd40283f67aa397ada2a2b503e2885cca720cd7f1026ec4f77706ffcb28bb59870ac9928c8ece35a9c17
6
+ metadata.gz: f7b2e74dd455b7ce505871a08bf73b9b01a485233c20eaa2272c0b84dc76baf117fe60174e398081e76ff8701b40ddfb857b18b0c78ca79c563e6fff91cdf576
7
+ data.tar.gz: 4a977f26975443d83927b4e06fb9265f1c251c4f62922f12f4530fabb6d2a8ced02a583ca3b85dfc0cbacdb0849f2b29b22a25a7256397971a3f70ce92dac148
@@ -0,0 +1,21 @@
1
+ function FindInstalledGem
2
+ {
3
+ param($gemName, $gemVersion)
4
+
5
+ $nameVer = $(Invoke-Expression "gem list --local" | Select-String "^$gemName").Line
6
+ if ($nameVer.StartsWith($gemName)) {
7
+ if ($gemVersion) {
8
+ $versions = ($nameVer -split { $_ -eq "(" -or $_ -eq ")"})[1].split(", ")
9
+ if ($versions.Contains($gemVersion)) {
10
+ $true
11
+ } else {
12
+ $false
13
+ }
14
+ } else {
15
+ $true
16
+ }
17
+ } else {
18
+ $false
19
+ }
20
+ }
21
+
@@ -6,9 +6,10 @@ function IsPortListening
6
6
  [array] $networkIPs += "0.0.0.0"
7
7
  [array] $networkIPs += "127.0.0.1"
8
8
  [array] $networkIPs += "[::1]"
9
+ [array] $networkIPs += "[::]"
9
10
  foreach ($ipaddress in $networkIPs)
10
11
  {
11
- $matchExpression = ("$ipaddress" + ":" + $portNumber + ".*LISTENING")
12
+ $matchExpression = ("$ipaddress" + ":" + $portNumber + ".*(LISTENING|\*:\*)")
12
13
  if ($protocol) { $matchExpression = ($protocol.toUpper() + "\s+$matchExpression") }
13
14
  if ($netstatOutput -match $matchExpression) { return $true }
14
15
  }
@@ -4,8 +4,16 @@ class Specinfra::Command::Darwin::Base::Service < Specinfra::Command::Base::Serv
4
4
  "launchctl list | grep #{escape(service)}"
5
5
  end
6
6
 
7
+ def check_is_enabled_under_homebrew(service)
8
+ "brew services list | grep #{escape(service)}"
9
+ end
10
+
7
11
  def check_is_running(service)
8
12
  "launchctl list | grep #{escape(service)} | grep -E '^[0-9]+'"
9
13
  end
14
+
15
+ def check_is_running_under_homebrew(service)
16
+ "brew services list | grep #{escape(service)} | grep 'started'"
17
+ end
10
18
  end
11
19
  end
@@ -22,7 +22,15 @@ module Specinfra
22
22
  if local_address == '0.0.0.0'
23
23
  [ '\*' , '0\.0\.0\.0' ]
24
24
  else
25
- [ local_address ]
25
+ [ fix_format_if_ipv6(local_address) ]
26
+ end
27
+ end
28
+
29
+ def fix_format_if_ipv6(local_address)
30
+ if local_address =~ /.*:.*/
31
+ "\\[#{local_address}\\]"
32
+ else
33
+ local_address
26
34
  end
27
35
  end
28
36
 
@@ -7,5 +7,13 @@ class Specinfra::Command::Windows::Base::Package < Specinfra::Command::Windows::
7
7
  exec "(FindInstalledApplication -appName '#{package}' #{version_selection}) -eq $true"
8
8
  end
9
9
  end
10
+
11
+ def check_is_installed_by_gem(name, version=nil, gem_binary="gem")
12
+ version_selection = version.nil? ? "" : "-gemVersion '#{version}'"
13
+ Backend::PowerShell::Command.new do
14
+ using 'find_installed_gem.ps1'
15
+ exec "(FindInstalledGem -gemName '#{name}' #{version_selection}) -eq $true"
16
+ end
17
+ end
10
18
  end
11
19
  end
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.82.18"
2
+ VERSION = "2.82.23"
3
3
  end
@@ -14,15 +14,15 @@ describe Specinfra::Command::Module::Ss do
14
14
 
15
15
  it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0'})).to eq 'ss -tunl | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' }
16
16
  it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' }
17
- it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' }
17
+ it { expect(klass.check_is_listening('80', options={:local_address => '::', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- \ \\\\\\[::\\\\\\]:80\ ' }
18
18
  it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'udp'})).to eq 'ss -unl4 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' }
19
- it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' }
19
+ it { expect(klass.check_is_listening('80', options={:local_address => '::', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- \ \\\\\\[::\\\\\\]:80\ ' }
20
20
 
21
21
  it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4'})).to eq 'ss -tunl | grep -E -- \ 1.2.3.4:80\ ' }
22
- it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -E -- \ 1.2.3.4:80\ ' }
23
- it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- \ 1.2.3.4:80\ ' }
22
+ it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -E -- \\ 1.2.3.4:80\ ' }
23
+ it { expect(klass.check_is_listening('80', options={:local_address => '2001:db8:dead:beef::1', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- \ \\\\\\[2001:db8:dead:beef::1\\\\\\]:80\ ' }
24
24
  it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'udp'})).to eq 'ss -unl4 | grep -E -- \ 1.2.3.4:80\ ' }
25
- it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- \ 1.2.3.4:80\ ' }
25
+ it { expect(klass.check_is_listening('80', options={:local_address => '2001:db8:dead:beef::1', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- \ \\\\\\[2001:db8:dead:beef::1\\\\\\]:80\ ' }
26
26
 
27
27
  it { expect{klass.check_is_listening('80', options={:protocol => 'bad_proto'})}.to raise_error(ArgumentError, 'Unknown protocol [bad_proto]') }
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.82.18
4
+ version: 2.82.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-06 00:00:00.000000000 Z
11
+ date: 2021-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp
@@ -135,6 +135,7 @@ files:
135
135
  - lib/specinfra/backend/powershell/support/find_group.ps1
136
136
  - lib/specinfra/backend/powershell/support/find_iis_component.ps1
137
137
  - lib/specinfra/backend/powershell/support/find_installed_application.ps1
138
+ - lib/specinfra/backend/powershell/support/find_installed_gem.ps1
138
139
  - lib/specinfra/backend/powershell/support/find_installed_hot_fix.ps1
139
140
  - lib/specinfra/backend/powershell/support/find_scheduled_task.ps1
140
141
  - lib/specinfra/backend/powershell/support/find_service.ps1