kanrisuru 0.16.17 → 0.17.0

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: e31b687d1a4fbd77c62a502ffe4e3ec6e7c314c9e8335fc1964e8fcaca75f554
4
- data.tar.gz: e36de3bb37966123d08c25aa6023be77f932705e49d005590f63a45d6a8c2d1b
3
+ metadata.gz: b3f695ef2a1f50c24f7e2c8a06a107202c72e36a19b4952a4af9fbe3bdda93d3
4
+ data.tar.gz: e4ec5a94e1b24ff564fc46d909ddfd93bcb0d3e2baa916137c07740a896d8a6e
5
5
  SHA512:
6
- metadata.gz: fb5549794cf62990bd0026c315b5c9828884b814f28ea82a7e04f944d12d2d52a77131d72b64e1d2c3d9d9c525f3bd468d020d69f0539304818f78b8b070b5ef
7
- data.tar.gz: dd58f2d707f62615d4a7cc997dea5f27ca0a1678e6d60478f5548c4953685b469f61f8928c879b4965a56c51de4ec8ddb722980bd14cb9f1793355b001f60678
6
+ metadata.gz: a02f65e7d962e2e02594bee48b8a8662bf29a936a02e9e938332340d695618bd92a2a3b6fc26c7324ecb0af236d6d6dc11475fd8205ee6cc77d97ff57f39cbdf
7
+ data.tar.gz: 047b7235f156d77085a413d2af37ce09367d1eb68b33ae0b96b1e2a0ed8f79ba9b8111f3933e02dd37245393fd4c6333455407187fb62ba6ad524dfc42ec1f54
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## Kanrisuru 0.17.0 (January 20, 2022) ##
2
+ * Add `nproc` command with test cases.
3
+
1
4
  ## Kanrisuru 0.16.17 (January 10, 2022) ##
2
5
  * Add additional options to `wget` command.
3
6
  * Rename some options to better reflect options from wget program.
@@ -16,7 +16,7 @@ module Kanrisuru
16
16
 
17
17
  command.append_flag('-l', opts[:lazy])
18
18
  command.append_flag('-f', opts[:force])
19
-
19
+
20
20
  command.append_flag('--all-targets', opts[:all_targets])
21
21
  command.append_flag('--recursive', opts[:recursive])
22
22
 
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kanrisuru
4
+ module Core
5
+ module System
6
+ def nproc(opts = {})
7
+ command = Kanrisuru::Command.new('nproc')
8
+ command.append_flag('--all', opts[:all])
9
+ execute_shell(command)
10
+
11
+ Kanrisuru::Result.new(command, &:to_i)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -9,6 +9,7 @@ require_relative 'commands/load_average'
9
9
  require_relative 'commands/load_env'
10
10
  require_relative 'commands/lscpu'
11
11
  require_relative 'commands/lsof'
12
+ require_relative 'commands/nproc'
12
13
  require_relative 'commands/poweroff'
13
14
  require_relative 'commands/ps'
14
15
  require_relative 'commands/reboot'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanrisuru
4
- VERSION = '0.16.17'
4
+ VERSION = '0.17.0'
5
5
  end
@@ -124,6 +124,11 @@ RSpec.describe Kanrisuru::Core::System do
124
124
  end.to raise_error(ArgumentError)
125
125
  end
126
126
 
127
+ it 'prepares nproc command' do
128
+ expect_command(host.nproc, 'nproc')
129
+ expect_command(host.nproc(all: true), 'nproc --all')
130
+ end
131
+
127
132
  it 'prepares uptime command' do
128
133
  expect_command(host.uptime, 'cat /proc/uptime')
129
134
  end
@@ -127,7 +127,7 @@ RSpec.describe Kanrisuru::Core::Stat do
127
127
  "wget --certificate ~/cert.pem --certificate-type PEM --private-key ~/key.pem --private-key-type PEM --ca-certificate ~/ca.pem --random-file ~/random --https-only #{url}")
128
128
 
129
129
  ## FTP
130
- expect_command(host.wget("ftp.example.com",
130
+ expect_command(host.wget('ftp.example.com',
131
131
  ftp_user: 'admin',
132
132
  ftp_password: '12345678',
133
133
  no_remove_listing: true,
@@ -135,15 +135,15 @@ RSpec.describe Kanrisuru::Core::Stat do
135
135
  no_passive_ftp: true,
136
136
  retr_symlinks: true,
137
137
  preserve_permissions: true),
138
- "wget --ftp-user admin --ftp-password 12345678 --no-remove-listing --no-glob --no-passive-ftp --retr-symlinks --preserve-permissions ftp.example.com")
138
+ 'wget --ftp-user admin --ftp-password 12345678 --no-remove-listing --no-glob --no-passive-ftp --retr-symlinks --preserve-permissions ftp.example.com')
139
139
 
140
- expect_command(host.wget("ftps.example.com",
140
+ expect_command(host.wget('ftps.example.com',
141
141
  ftp_user: 'admin',
142
142
  ftp_password: '12345678',
143
143
  ftps_implicit: true,
144
144
  no_ftps_resume_ssl: true,
145
145
  ftps_fallback_to_ftp: true,
146
- ftps_clear_data_connection: true), "wget --ftp-user admin --ftp-password 12345678 --ftps-implicit --no-ftps-resume-ssl --ftps-clear-data-connection --ftps-fallback-to-ftp ftps.example.com")
146
+ ftps_clear_data_connection: true), 'wget --ftp-user admin --ftp-password 12345678 --ftps-implicit --no-ftps-resume-ssl --ftps-clear-data-connection --ftps-fallback-to-ftp ftps.example.com')
147
147
 
148
148
  ## Recursive Retrieval
149
149
  expect_command(host.wget(url,
@@ -108,6 +108,12 @@ RSpec.shared_examples 'system' do |os_name, host_json, _spec_dir|
108
108
  expect(result).to be_success
109
109
  end
110
110
 
111
+ it 'gets nproc count' do
112
+ result = host.nproc
113
+ expect(result).to be_success
114
+ expect(result.to_i).to be > 0
115
+ end
116
+
111
117
  it 'gets process details' do
112
118
  result = host.ps
113
119
 
@@ -30,6 +30,7 @@ RSpec.describe Kanrisuru::Core::System do
30
30
  expect(host).to respond_to(:kernel_statistics)
31
31
  expect(host).to respond_to(:kstat)
32
32
  expect(host).to respond_to(:lsof)
33
+ expect(host).to respond_to(:nproc)
33
34
  expect(host).to respond_to(:last)
34
35
  expect(host).to respond_to(:uptime)
35
36
  expect(host).to respond_to(:w)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanrisuru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.17
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mammina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-11 00:00:00.000000000 Z
11
+ date: 2022-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel_tests
@@ -314,6 +314,7 @@ files:
314
314
  - lib/kanrisuru/core/system/commands/load_env.rb
315
315
  - lib/kanrisuru/core/system/commands/lscpu.rb
316
316
  - lib/kanrisuru/core/system/commands/lsof.rb
317
+ - lib/kanrisuru/core/system/commands/nproc.rb
317
318
  - lib/kanrisuru/core/system/commands/poweroff.rb
318
319
  - lib/kanrisuru/core/system/commands/ps.rb
319
320
  - lib/kanrisuru/core/system/commands/reboot.rb
@@ -706,7 +707,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
706
707
  - !ruby/object:Gem::Version
707
708
  version: '0'
708
709
  requirements: []
709
- rubygems_version: 3.2.32
710
+ rubygems_version: 3.3.5
710
711
  signing_key:
711
712
  specification_version: 4
712
713
  summary: Manage remote servers over ssh with ruby.