kanrisuru 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CONTRIBUTING.md +9 -9
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +7 -8
  4. data/CHANGELOG.md +110 -101
  5. data/CODE_OF_CONDUCT.md +10 -10
  6. data/README.md +1 -0
  7. data/kanrisuru.gemspec +1 -1
  8. data/lib/kanrisuru/core/disk.rb +0 -3
  9. data/lib/kanrisuru/core/find.rb +4 -5
  10. data/lib/kanrisuru/core/socket.rb +2 -1
  11. data/lib/kanrisuru/remote/cpu.rb +5 -1
  12. data/lib/kanrisuru/remote/fstab.rb +4 -4
  13. data/lib/kanrisuru/util.rb +1 -1
  14. data/lib/kanrisuru/version.rb +1 -1
  15. data/spec/functional/core/apt_spec.rb +22 -30
  16. data/spec/functional/core/archive_spec.rb +94 -119
  17. data/spec/functional/core/find_spec.rb +94 -113
  18. data/spec/functional/core/socket_spec.rb +23 -28
  19. data/spec/functional/core/stream_spec.rb +12 -12
  20. data/spec/functional/core/transfer_spec.rb +108 -131
  21. data/spec/functional/core/yum_spec.rb +58 -83
  22. data/spec/functional/remote/cluster_spec.rb +11 -2
  23. data/spec/functional/remote/cpu_spec.rb +104 -0
  24. data/spec/functional/remote/env_spec.rb +3 -5
  25. data/spec/helper/stub_network.rb +30 -11
  26. data/spec/integration/core/file_spec.rb +0 -1
  27. data/spec/integration/core/find_spec.rb +1 -0
  28. data/spec/integration/core/system_spec.rb +0 -1
  29. data/spec/integration/core/zypper_spec.rb +3 -3
  30. data/spec/unit/command_spec.rb +1 -1
  31. data/spec/unit/core/find_spec.rb +1 -1
  32. data/spec/unit/core/yum_spec.rb +1 -1
  33. data/spec/unit/mode_spec.rb +2 -2
  34. data/spec/unit/remote/cluster_spec.rb +3 -1
  35. data/spec/unit/remote/cpu_spec.rb +1 -2
  36. data/spec/unit/remote/env_spec.rb +1 -3
  37. data/spec/unit/util_spec.rb +13 -0
  38. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40303a0de6eed7d5c10708a31ebf33ee7aed8701a21b3118e9bad5cdc751376b
4
- data.tar.gz: 9daec56c51d0a4d6929fbcbbb585744215a61d877993e67453899ccf2db81717
3
+ metadata.gz: 71358a615946331ad5e1d4a0d6cd51523981ad046d788e5e189ba2c0f49c136e
4
+ data.tar.gz: 7b6bec928fcd0b0dc05a77a83a8b5dc224d3f54f1ae162911dd742f90cf8ef81
5
5
  SHA512:
6
- metadata.gz: 11a75804f677a0b72c88ab944c475646eebe68ed64a1fed15acb349e423215f98ddfcdd626681867eee82bb9092cd349ead6f7a44da142937bf329f300a877b0
7
- data.tar.gz: 2605bbf322b06ae28d49d25b7d65970d5e5632527b79e12c6c7d2988173602ed126eab6d263106d866bda146153513573f702e210a36b4a3ee0e812caae06c79
6
+ metadata.gz: 26d0eff2b5548b07af887865f3b899e0e30d16ac4cfb1033eb761be282141156f3e24818d8257f432dfdd2a0687ceac4dee8abf2e7b6dfc9d5313950633ecf1a
7
+ data.tar.gz: 63e244ee640721f7ad653e77d915f150420c9c97949d5f7f441818c13b2c5015fb9c7cb43b503ceff49076823455e3164c06de3e773e8b885f9bb1684e0c1672
@@ -2,16 +2,16 @@
2
2
  Thank you for your interest in contributing to the Kanrisuru project. We appreciate any volunteers that want to help improve, grow and sustain the Kanrisuru code base!
3
3
 
4
4
  ## Submitting a bug
5
- * Do not open up a GitHub issue if the bug is a security vulnerability with the Kanrisuru project, instead send an email to engineeering@avamia.com for any security realted issues.
6
- * Check if there's already an existing issue before submitting a [similar one](https://github.com/avamia/kanrisuru/issues).
7
- * If you can't find a similar issue [open a new one](https://github.com/avamia/kanrisuru/issues/new?assignees=&labels=&template=bug_report.md). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
5
+ * Do not open up a GitHub issue if the bug is a security vulnerability with the Kanrisuru project, instead send an email to engineeering@avamia.com for any security realted issues.
6
+ * Check if there's already an existing issue before submitting a [similar one](https://github.com/avamia/kanrisuru/issues).
7
+ * If you can't find a similar issue [open a new one](https://github.com/avamia/kanrisuru/issues/new?assignees=&labels=&template=bug_report.md). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
8
8
 
9
9
  ## Adding a core feature
10
- * We always welcome improving the core Kanrisuru project. If we are missing a core command available on most linux distros, this would be a place to add that type of functionality.
11
- * Other ideas like performance optimization, additional testing, and ease of use are great ways of improving the project.
12
- * If you want to create something outside of the core project, see the next section.
10
+ * We always welcome improving the core Kanrisuru project. If we are missing a core command available on most linux distros, this would be a place to add that type of functionality.
11
+ * Other ideas like performance optimization, additional testing, and ease of use are great ways of improving the project.
12
+ * If you want to create something outside of the core project, see the next section.
13
13
 
14
14
  ## Adding a new module
15
- * If you want to extent Kanrisuru beyond the underlying system code base or core module packages, the best way is to create a new gem, in the format of `kanrisuru-package`.
16
- * This helps keep the core Kanrisuru package from too much bloat.
17
- * See our developer module section to see how to build a new Kanrisuru module.
15
+ * If you want to extent Kanrisuru beyond the underlying system code base or core module packages, the best way is to create a new gem, in the format of `kanrisuru-package`.
16
+ * This helps keep the core Kanrisuru package from too much bloat.
17
+ * See our developer module section to see how to build a new Kanrisuru module.
@@ -12,10 +12,10 @@ A clear and concise description of what the bug is.
12
12
 
13
13
  **To Reproduce**
14
14
  Steps to reproduce the behavior:
15
- 1. Go to '...'
16
- 2. Click on '....'
17
- 3. Scroll down to '....'
18
- 4. See error
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
19
 
20
20
  **Expected behavior**
21
21
  A clear and concise description of what you expected to happen.
@@ -24,10 +24,9 @@ A clear and concise description of what you expected to happen.
24
24
  If applicable, add screenshots to help explain your problem.
25
25
 
26
26
  **Desktop (please complete the following information):**
27
- - OS: [e.g. Ubuntu]
28
- - Version [e.g. 22]
29
- - Ruby version: [e.g 2.7.4]
30
-
27
+ - OS: [e.g. Ubuntu]
28
+ - Version [e.g. 22]
29
+ - Ruby version: [e.g 2.7.4]
31
30
 
32
31
  **Additional context**
33
32
  Add any other context about the problem here.
data/CHANGELOG.md CHANGED
@@ -1,114 +1,123 @@
1
+ ## Kanrisuru 0.11.0 (December 04, 2021) ##
2
+ * Add codequality badge, cleanup code linting issues.
3
+ * Fix `fstab` issue with blkid device return type.
4
+ * Fix `find` spec with sudo permissions.
5
+ * Change `stub_network` result override to use `block.call` with a conditional check for indvidual command stubs.
6
+ * Add `architecture` method to `cpu`.
7
+ * Add functional test cases for `cpu` class.
8
+ * Add more unit test cases.
9
+
1
10
  ## Kanrisuru 0.10.0 (December 03, 2021) ##
2
- * Add `stub_command` and `unstub_command` to mock indvidual command results from a remote server.
3
- * Add `count` and `delete` to `Kanrisuru::Remote::Env` class for managing environment variables.
4
- * Add unit and functional test cases for `Kanrisuru::Remote::Env`.
5
- * Add functional test cases for the `archive` command.
6
- * Fix typo bugs in the `archive` command. Fix `--exclude` opt field in `archive` command.
7
- * Add unit test cases for `Kanrisuru::Mode` class.
11
+ * Add `stub_command` and `unstub_command` to mock indvidual command results from a remote server.
12
+ * Add `count` and `delete` to `Kanrisuru::Remote::Env` class for managing environment variables.
13
+ * Add unit and functional test cases for `Kanrisuru::Remote::Env`.
14
+ * Add functional test cases for the `archive` command.
15
+ * Fix typo bugs in the `archive` command. Fix `--exclude` opt field in `archive` command.
16
+ * Add unit test cases for `Kanrisuru::Mode` class.
8
17
 
9
18
  ## Kanrisuru 0.9.2 (November 30, 2021) ##
10
- * Add unit test cases for all core commands.
11
- * Add unit test cases for `cluster` class.
12
- * Add codecov xml output for coverage badge.
19
+ * Add unit test cases for all core commands.
20
+ * Add unit test cases for `cluster` class.
21
+ * Add codecov xml output for coverage badge.
13
22
 
14
23
  ## Kanrisuru 0.9.1 (November 29, 2021) ##
15
- * Fix type on `address_sizes` for `Kanrisuru::Remote::Cpu` class.
16
- * Add unit test cases for the `cpu` class.
24
+ * Fix type on `address_sizes` for `Kanrisuru::Remote::Cpu` class.
25
+ * Add unit test cases for the `cpu` class.
17
26
 
18
27
  ## Kanrisuru 0.9.0 (November 23, 2021) ##
19
- * Add `delete` to `Kanrisuru::Remote::Cluster` class to allow removal of hosts from cluster.
20
- * Add functional test cases for remote cluster class.
28
+ * Add `delete` to `Kanrisuru::Remote::Cluster` class to allow removal of hosts from cluster.
29
+ * Add functional test cases for remote cluster class.
21
30
 
22
31
  ## Kanrisuru 0.8.23 (November 19, 2021) ##
23
- * Add functional test cases for `yum` command
24
- * Add stub by operating system method, with support for `ubuntu` and `centos` os types.
25
- * Fix `ArgumentError` typo in yum commands, `erase` and `remove`.
32
+ * Add functional test cases for `yum` command
33
+ * Add stub by operating system method, with support for `ubuntu` and `centos` os types.
34
+ * Fix `ArgumentError` typo in yum commands, `erase` and `remove`.
26
35
 
27
36
  ## Kanrisuru 0.8.22 (November 18, 2021) ##
28
- * Add functional test cases for `apt` command
37
+ * Add functional test cases for `apt` command
29
38
 
30
39
  ## Kanrisuru 0.8.21 (November 15, 2021) ##
31
- * Fix bug with `Kanrisuru::Mode` class, lookup table had incorrect value for execute only symbolic to numeric field.
40
+ * Fix bug with `Kanrisuru::Mode` class, lookup table had incorrect value for execute only symbolic to numeric field.
32
41
 
33
42
  ## Kanrisuru 0.8.20 (November 13, 2021) ##
34
- * Unstub network requests for full rspec test-suite run
43
+ * Unstub network requests for full rspec test-suite run
35
44
 
36
45
  ## Kanrisuru 0.8.19 (October 31, 2021) ##
37
- * Add functional test cases for `ss` command.
38
- * Enforce contraints on `family` parameter for `ss` command.
39
- * Deprecating `string_join_array` in favor of `array_join_string`. Both methods do the same thing, and the `array_join_string` has a better nameing interface; will be removed in the next major release.
40
- * Replace `string_join_array` method calls in `apt`, `transfer`, `yum`, and `zypper` with `array_join_string`.
46
+ * Add functional test cases for `ss` command.
47
+ * Enforce contraints on `family` parameter for `ss` command.
48
+ * Deprecating `string_join_array` in favor of `array_join_string`. Both methods do the same thing, and the `array_join_string` has a better nameing interface; will be removed in the next major release.
49
+ * Replace `string_join_array` method calls in `apt`, `transfer`, `yum`, and `zypper` with `array_join_string`.
41
50
 
42
51
  ## Kanrisuru 0.8.18 (October 19, 2021) ##
43
- * Add functional test cases for `find` commmand.
44
- * Add `regex_type` option for `find` command.
45
- * Fix bug with `size` option when using number in a string format, regex testing has been simplified on matching correctness for size with options like `100`, `+100`, `-100M` for comparitive fields.
52
+ * Add functional test cases for `find` commmand.
53
+ * Add `regex_type` option for `find` command.
54
+ * Fix bug with `size` option when using number in a string format, regex testing has been simplified on matching correctness for size with options like `100`, `+100`, `-100M` for comparitive fields.
46
55
 
47
56
  ## Kanrisuru 0.8.17 (October 16, 2021) ##
48
- * Add functional test cases for `transfer` module
49
- * Update wget command to accept hash for `headers` opt.
57
+ * Add functional test cases for `transfer` module
58
+ * Update wget command to accept hash for `headers` opt.
50
59
 
51
60
  ## Kanrisuru 0.8.16 (October 14, 2021) ##
52
- * Add functional test cases for `stream` and `path` modules
53
- * Create `expect_command` helper for quick testing on raw command result
61
+ * Add functional test cases for `stream` and `path` modules
62
+ * Create `expect_command` helper for quick testing on raw command result
54
63
 
55
64
  ## Kanrisuru 0.8.15 (October 12, 20201) ##
56
- * Move functional specs to integration. Anything that performs an actual network request will be under the integrations test.
57
- * Create a `StubNetwork` to quickly monkey patch the `Kanrisuru::Remote::Host` to simulate a `Net::SSH` channel request. Will add additional functionality for different simulations later on.
58
- * Start with testing the `stat` command as a functional test.
65
+ * Move functional specs to integration. Anything that performs an actual network request will be under the integrations test.
66
+ * Create a `StubNetwork` to quickly monkey patch the `Kanrisuru::Remote::Host` to simulate a `Net::SSH` channel request. Will add additional functionality for different simulations later on.
67
+ * Start with testing the `stat` command as a functional test.
59
68
 
60
69
  ## Kanrisuru 0.8.14 (October 8, 20201) ##
61
- * Update `Kanrisuru::Remote::Cluster` instantiation method to use array splat instead of passing array directly.
70
+ * Update `Kanrisuru::Remote::Cluster` instantiation method to use array splat instead of passing array directly.
62
71
 
63
72
  ## Kanrisuru 0.8.13 (October 4, 20201) ##
64
- * Fix `wc` command. Ensure result parsing is cast to integer values.
73
+ * Fix `wc` command. Ensure result parsing is cast to integer values.
65
74
 
66
75
  ## Kanrisuru 0.8.12 (October 4, 20201) ##
67
- * Refactor `rmdir` command to only work on empty directories.
76
+ * Refactor `rmdir` command to only work on empty directories.
68
77
 
69
78
  ## Kanrisuru 0.8.11 (October 1, 20201) ##
70
- * Allow `Kanrisuru::Mode` as mode type option in mkdir method.
79
+ * Allow `Kanrisuru::Mode` as mode type option in mkdir method.
71
80
 
72
81
  ## Kanrisuru 0.8.10 (August 24, 20201) ##
73
- * Fix bug with rspec test case.
82
+ * Fix bug with rspec test case.
74
83
 
75
84
  ## Kanrisuru 0.8.9 (August 24, 2021) ##
76
- * Fix spelling error exception `ArgumentError` in `Kanrisuru::Mode` class.
85
+ * Fix spelling error exception `ArgumentError` in `Kanrisuru::Mode` class.
77
86
 
78
87
  ## Kanrisuru 0.8.8 (August 21, 2021) ##
79
- * Add shorthand notation for tar command actions, such as `x` for `extract`, `t` for `list`, and `c` for `create`.
88
+ * Add shorthand notation for tar command actions, such as `x` for `extract`, `t` for `list`, and `c` for `create`.
80
89
 
81
90
  ## Kanrisuru 0.8.7 (August 21, 2021) ##
82
- * Fix `FileInfo` field for ls command. Was set to `memory_blocks`, but was incorrect, corrected this to `hard_links`.
91
+ * Fix `FileInfo` field for ls command. Was set to `memory_blocks`, but was incorrect, corrected this to `hard_links`.
83
92
 
84
93
  ## Kanrisuru 0.8.6 (August 21, 2021) ##
85
- * Add `minimum_io_size`, `physical_sector_size`, and `logical_sector_size` to the blkid low level disk probe for devices.
94
+ * Add `minimum_io_size`, `physical_sector_size`, and `logical_sector_size` to the blkid low level disk probe for devices.
86
95
 
87
96
  ## Kanrisuru 0.8.5 (August 20, 2021) ##
88
- * Add `summarize` option to `du` command. This will only output a total disk usage size for the entire directory versus disk usage for each file individually.
97
+ * Add `summarize` option to `du` command. This will only output a total disk usage size for the entire directory versus disk usage for each file individually.
89
98
 
90
99
  ## Kanrisuru 0.8.4 (August 20, 2021) ##
91
- * Convert `fsize` field to an `integer` for du disk module command.
100
+ * Convert `fsize` field to an `integer` for du disk module command.
92
101
 
93
102
  ## Kanrisuru 0.8.3 (August 20, 2021) ##
94
- * Fix bug with disk usage, `du` command by escaping the awk variables in the command.
95
- * Update `du` command to execute with shell user.
103
+ * Fix bug with disk usage, `du` command by escaping the awk variables in the command.
104
+ * Update `du` command to execute with shell user.
96
105
 
97
106
  ## Kanrisuru 0.8.2 (August 19, 2021) ##
98
- * Convert `major` and `minor` device field values to an `integer` in lsblk disk module.
107
+ * Convert `major` and `minor` device field values to an `integer` in lsblk disk module.
99
108
 
100
109
  ## Kanrisuru 0.8.1 (August 19, 2021) ##
101
- * Fix `nodeps` flag value for `lsblk` command in disk module.
110
+ * Fix `nodeps` flag value for `lsblk` command in disk module.
102
111
 
103
112
  ## Kanrisuru 0.8.0 (August 18, 2021) ##
104
- * Add last / lastb implementation in system core module.
113
+ * Add last / lastb implementation in system core module.
105
114
 
106
115
  ## Kanrisuru 0.7.3 (August 9, 2021) ##
107
- * Fixed bug with zypper remove package, where the package names weren't being added to the linux command.
108
- * Test case added to ensure package is removed.
116
+ * Fixed bug with zypper remove package, where the package names weren't being added to the linux command.
117
+ * Test case added to ensure package is removed.
109
118
 
110
119
  ## Kanrisuru 0.7.2 (August 9, 2021) ##
111
- * Fixed bug with the `os_method_cache` instance variable set in the namespaced instance of a host. This was causing collision issues inbetween host instances, where, hosts with the same aliased method name was getting overwritten (with a different OS), since the namespace instance variable existing on the host class definition wasn't getting reset inbetween host instantiations. Given that the `os_method_cache` is normally re-instantiated, this bug fix addresses this so that the `os_method_cache` is always defined on the host instance, ie:
120
+ * Fixed bug with the `os_method_cache` instance variable set in the namespaced instance of a host. This was causing collision issues inbetween host instances, where, hosts with the same aliased method name was getting overwritten (with a different OS), since the namespace instance variable existing on the host class definition wasn't getting reset inbetween host instantiations. Given that the `os_method_cache` is normally re-instantiated, this bug fix addresses this so that the `os_method_cache` is always defined on the host instance, ie:
112
121
 
113
122
  ```ruby
114
123
  host.instance_variable_get(:@os_method_cache)
@@ -117,101 +126,101 @@
117
126
  This is done instead of being saved on the namespace module. With the previous bug fix of using namespaced keys, there's no way for a method to be overwritten otherwise with a global `os_method_cache`.
118
127
 
119
128
  ## Kanrisuru 0.7.1 (August 8, 2021) ##
120
- * Fix bug with `os_include` when caching namespace unbound methods, use the namespace in the
129
+ * Fix bug with `os_include` when caching namespace unbound methods, use the namespace in the
121
130
  cache key to avoid any namespace collisions with the same method name, namely:
122
131
  ```ruby
123
132
  "#{namespace}.#{method_name}"
124
133
  ```
125
134
 
126
135
  ## Kanrisuru 0.7.0 (August 8, 2021) ##
127
- * Simplify `FileInfo` struct for return object of `ls` command.
128
- * Rename `size` to `fsize` for the `OpenFile` struct to avoid method naming conflicts of the struct class.
129
- * Allow `os_include` and `os_collection` to define multiple groupings of methods with the same namespace.
130
- * Add `clear` method for remote env class, to remove any session based env variables.
131
- * Add `to_s` method to result for quick analysis of string based return values.
132
- * Remove duplicate `numeric` method in the utils module.
136
+ * Simplify `FileInfo` struct for return object of `ls` command.
137
+ * Rename `size` to `fsize` for the `OpenFile` struct to avoid method naming conflicts of the struct class.
138
+ * Allow `os_include` and `os_collection` to define multiple groupings of methods with the same namespace.
139
+ * Add `clear` method for remote env class, to remove any session based env variables.
140
+ * Add `to_s` method to result for quick analysis of string based return values.
141
+ * Remove duplicate `numeric` method in the utils module.
133
142
 
134
143
  ## Kanrisuru 0.6.0 (August 1, 2021) ##
135
- * Add `lsof` implementation in system core module
136
- * Fix changelog formatting
137
- * Add changelog url to gemspec
144
+ * Add `lsof` implementation in system core module
145
+ * Fix changelog formatting
146
+ * Add changelog url to gemspec
138
147
 
139
148
  ## Kanrisuru 0.5.2 (July 30, 2021) ##
140
- * Add changelog documentation
141
- * Update documentation table with new tested core module
142
- * Deprecating `cpu_info` with replacement of `lscpu`. `cpu_info` will be removed in the next major release.
149
+ * Add changelog documentation
150
+ * Update documentation table with new tested core module
151
+ * Deprecating `cpu_info` with replacement of `lscpu`. `cpu_info` will be removed in the next major release.
143
152
 
144
153
  ## Kanrisuru 0.5.1 (July 29, 2021) ##
145
- * Unit test cases for core module structs, constants and types.
154
+ * Unit test cases for core module structs, constants and types.
146
155
 
147
156
  ## Kanrisuru 0.5.0 (July 29, 2021) ##
148
- * Add `zypper` package manager core module
149
- * Add `dmi` core module. Support for getting hardware information from virtual and physical machines.
150
- * Add only options for test_hosts to filter on which hosts to use for function style test cases. This is used within a test case and takes priority over command line `HOSTS=` and `EXCLUDE=` env variables.
151
- * Add additional bit conversion string handling in the util module, such as kib, mib, and gib.
152
- * Remove redudant namespacing in struct names, such as
157
+ * Add `zypper` package manager core module
158
+ * Add `dmi` core module. Support for getting hardware information from virtual and physical machines.
159
+ * Add only options for test_hosts to filter on which hosts to use for function style test cases. This is used within a test case and takes priority over command line `HOSTS=` and `EXCLUDE=` env variables.
160
+ * Add additional bit conversion string handling in the util module, such as kib, mib, and gib.
161
+ * Remove redudant namespacing in struct names, such as
153
162
  `Kanrisuru::Core::Yum::YumPackageOverview`, to `Kanrisuru::Core::Yum::PackageOverview`.
154
- * Fix backups test case for `cp` command with the correct filename.
155
- * Use 0755 as expected numeric mode for all OS functional tests in the `mkdir` test case.
156
- * Fix bug with `lscpu` regex match on cpus with more than 9 cores, ie `/cpu\d/` to `/cpu\d+/`
163
+ * Fix backups test case for `cp` command with the correct filename.
164
+ * Use 0755 as expected numeric mode for all OS functional tests in the `mkdir` test case.
165
+ * Fix bug with `lscpu` regex match on cpus with more than 9 cores, ie `/cpu\d/` to `/cpu\d+/`
157
166
 
158
167
 
159
168
  ## Kanrisuru 0.4.1 (July 26, 2021) ##
160
- * Add `kernel_statistics` to system core module.
169
+ * Add `kernel_statistics` to system core module.
161
170
 
162
171
  ## Kanrisuru 0.4.0 (July 25, 2021) ##
163
- * Update internal exit code of command from 0, to array of accpeted exit codes, with 0 being the default value.
164
- * Add `append_exit_code` to command, allowing additional exit codes to be considered true for `success?` return value.
165
- * Add `@port` to `Net::SSH.start` method
166
- * Fix test case with `host.os` return value of `opensuse_leap`.
167
- * Add `cpu_flags` method to `cpu` module
172
+ * Update internal exit code of command from 0, to array of accpeted exit codes, with 0 being the default value.
173
+ * Add `append_exit_code` to command, allowing additional exit codes to be considered true for `success?` return value.
174
+ * Add `@port` to `Net::SSH.start` method
175
+ * Fix test case with `host.os` return value of `opensuse_leap`.
176
+ * Add `cpu_flags` method to `cpu` module
168
177
 
169
178
  ## Kanrisuru 0.3.2 (July 23, 2021) ##
170
- * Fix typo from `key` to `signal` in hash fetch method.
179
+ * Fix typo from `key` to `signal` in hash fetch method.
171
180
 
172
181
  ## Kanrisuru 0.3.1 (July 22, 2021) ##
173
- * Add additional methods to `cpu` pulling from `lscpu` struct.
174
- * Fix `address_size` in `cpu` method call.
182
+ * Add additional methods to `cpu` pulling from `lscpu` struct.
183
+ * Fix `address_size` in `cpu` method call.
175
184
 
176
185
  ## Kanrisuru 0.3.0 (July 22, 2021) ##
177
- * Add `lscpu` system core module
178
- * Replace `cpu` module internal fetching of data from `cpu_info` to `lscpu` struct.
186
+ * Add `lscpu` system core module
187
+ * Replace `cpu` module internal fetching of data from `cpu_info` to `lscpu` struct.
179
188
 
180
189
  ## Kanrisuru 0.2.9 (July 20, 2021) ##
181
- * Fix fstab entry from `entry` to `entry[:entry]` in the `for_each`iteration.
190
+ * Fix fstab entry from `entry` to `entry[:entry]` in the `for_each`iteration.
182
191
 
183
192
  ## Kanrisuru 0.2.8 (July 20, 2021) ##
184
- * Update gem development and runtime depedencies with stricter depencies.
193
+ * Update gem development and runtime depedencies with stricter depencies.
185
194
 
186
195
  ## Kanrisuru 0.2.7 (July 18, 2021) ##
187
- * Set opensuse upstream to sles (Suse Enterprise Linux) in `os_family`
196
+ * Set opensuse upstream to sles (Suse Enterprise Linux) in `os_family`
188
197
 
189
198
  ## Kanrisuru 0.2.6 (July 17, 2021) ##
190
- * Force "-" to "\_" from `os-release` release name in `host.os` module.
199
+ * Force "-" to "\_" from `os-release` release name in `host.os` module.
191
200
 
192
201
  ## Kanrisuru 0.2.5 (July 16, 2021) ##
193
- * Update gem depedencies to non-zero values
194
- * Change summary and description fields for `apt`
195
- * Move `normalize_size` from `apt` core module, to
202
+ * Update gem depedencies to non-zero values
203
+ * Change summary and description fields for `apt`
204
+ * Move `normalize_size` from `apt` core module, to
196
205
  `Kanrisuru::Util::Bits` class.
197
- * Add additional test cases for `apt` core module.
198
- * Add `-hi` to `who` command to explicility print out ip address for user.
199
- * Update `inode?` command to execute without shell user.
200
- * Add `yum` package manager core module
206
+ * Add additional test cases for `apt` core module.
207
+ * Add `-hi` to `who` command to explicility print out ip address for user.
208
+ * Update `inode?` command to execute without shell user.
209
+ * Add `yum` package manager core module
201
210
 
202
211
  ## Kanrisuru 0.2.4 (July 10, 2021) ##
203
- * Fix error in `ip_rule` and `ip_address` sub modules with command typo.
212
+ * Fix error in `ip_rule` and `ip_address` sub modules with command typo.
204
213
 
205
214
  ## Kanrisuru 0.2.3 (July 07, 2021) ##
206
- * Add `apt` package manager core module
215
+ * Add `apt` package manager core module
207
216
 
208
217
  ## Kanrisuru 0.2.2 (June 16, 2021) ##
209
- * Fix `read_file_chunk` on checking bounds for start and end line values.
218
+ * Fix `read_file_chunk` on checking bounds for start and end line values.
210
219
 
211
220
  ## Kanrisuru 0.2.1 (June 16, 2021) ##
212
- * Add first working release on rubygems.org
221
+ * Add first working release on rubygems.org
213
222
 
214
223
  ## Kanrisuru 0.2.0 (June 16, 2021) [YANKED] ##
215
224
 
216
225
  ## Kanrisuru 0.1.0 (December 12, 2020) ##
217
- * Initialize repository, start working on project.
226
+ * Initialize repository, start working on project.
data/CODE_OF_CONDUCT.md CHANGED
@@ -14,21 +14,21 @@ orientation.
14
14
  Examples of behavior that contributes to creating a positive environment
15
15
  include:
16
16
 
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
22
 
23
23
  Examples of unacceptable behavior by participants include:
24
24
 
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
26
  advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
30
  address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
32
  professional setting
33
33
 
34
34
  ## Our Responsibilities
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  [![Latest version](https://img.shields.io/github/license/avamia/kanrisuru)](https://github.com/avamia/kanrisuru/blob/main/LICENSE.txt) 
3
3
  ![GitHub repo size](https://img.shields.io/github/repo-size/avamia/kanrisuru) 
4
4
  ![Codecov](https://img.shields.io/codecov/c/gh/avamia/kanrisuru?token=2Q1BE106B2) 
5
+ ![Codacy grade](https://img.shields.io/codacy/grade/9e839eb160bc445ea4e81b64cef22b27) 
5
6
 
6
7
  <p align='center'>
7
8
  <img src="https://s3.us-east-2.amazonaws.com/kanrisuru.com/kanrisuru-banner-02.png" width="600" />
data/kanrisuru.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.email = 'ryan@avamia.com'
10
10
  gem.license = 'MIT'
11
11
  gem.summary = 'Manage remote servers over ssh with ruby.'
12
- gem.description = 'Kanrisuru helps manage remote servers with objected oriented ruby. Results come back as structured data, parsed, prepared and ready .'
12
+ gem.description = 'Kanrisuru helps manage remote servers with objected oriented ruby. Results come back as structured data, parsed, prepared and ready.'
13
13
  gem.homepage = 'https://github.com/avamia/kanrisuru'
14
14
 
15
15
  gem.required_ruby_version = '>= 2.5.0'
@@ -113,9 +113,6 @@ module Kanrisuru
113
113
  case mode
114
114
  when 'search'
115
115
  cmd.to_s
116
- when 'device'
117
- lines = cmd.to_a
118
- blkid_devices(lines)
119
116
  else
120
117
  lines = cmd.to_a
121
118
  blkid_devices(lines)
@@ -10,7 +10,7 @@ module Kanrisuru
10
10
  os_define :linux, :find
11
11
 
12
12
  FilePath = Struct.new(:path)
13
- REGEX_TYPES = ['emacs', 'posix-awk', 'posix-basic', 'posix-egrep', 'posix-extended']
13
+ REGEX_TYPES = %w[emacs posix-awk posix-basic posix-egrep posix-extended].freeze
14
14
 
15
15
  def find(opts = {})
16
16
  paths = opts[:paths]
@@ -66,9 +66,7 @@ module Kanrisuru
66
66
  command.append_arg('-mmin', opts[:mmin])
67
67
 
68
68
  if Kanrisuru::Util.present?(opts[:regex_type])
69
- unless REGEX_TYPES.include?(opts[:regex_type])
70
- raise ArgumentError, 'invalid regex type'
71
- end
69
+ raise ArgumentError, 'invalid regex type' unless REGEX_TYPES.include?(opts[:regex_type])
72
70
 
73
71
  command.append_arg('-regextype', opts[:regex_type])
74
72
  end
@@ -77,7 +75,8 @@ module Kanrisuru
77
75
 
78
76
  if size.instance_of?(String)
79
77
  regex = Regexp.new(/^([-+])?(\d+)([bcwkMG])*$/)
80
- raise ArgumentError, "invalid size string: '#{@size}'" unless regex.match?(size)
78
+ raise ArgumentError, "invalid size string: '#{@size}'" unless regex.match?(size)
79
+
81
80
  command.append_arg('-size', size)
82
81
  elsif size.instance_of?(Integer)
83
82
  command.append_arg('-size', size)
@@ -59,7 +59,8 @@ module Kanrisuru
59
59
  command.append_flag('-w', opts[:raw])
60
60
 
61
61
  if Kanrisuru::Util.present?(family)
62
- raise ArgumentError, 'invalid family type' if !NETWORK_FAMILIES.include?(family)
62
+ raise ArgumentError, 'invalid family type' unless NETWORK_FAMILIES.include?(family)
63
+
63
64
  command.append_arg('-f', family)
64
65
  end
65
66
 
@@ -27,6 +27,10 @@ module Kanrisuru
27
27
  load_average[2]
28
28
  end
29
29
 
30
+ def architecture
31
+ @cpu_architecture.architecture
32
+ end
33
+
30
34
  def sockets
31
35
  @cpu_architecture.sockets
32
36
  end
@@ -103,7 +107,7 @@ module Kanrisuru
103
107
  @cpu_architecture.flags
104
108
  end
105
109
 
106
- def hyperthreading?
110
+ def hyperthreading?
107
111
  threads_per_core > 1
108
112
  end
109
113
 
@@ -255,7 +255,7 @@ module Kanrisuru
255
255
  end
256
256
 
257
257
  result = @host.blkid(device: @device)
258
- @uuid = result.success? ? result.uuid : nil
258
+ @uuid = result.success? ? result[0].uuid : nil
259
259
  end
260
260
 
261
261
  def parse_uuid(fsline)
@@ -269,15 +269,15 @@ module Kanrisuru
269
269
  end
270
270
 
271
271
  result = @host.blkid(device: @device)
272
- @label = result.success? ? result.label : nil
272
+ @label = result.success? ? result[0].label : nil
273
273
  end
274
274
 
275
275
  def parse_dev(fsline)
276
276
  @device = fsline
277
277
  result = @host.blkid(device: @device)
278
278
 
279
- @label = result.success? ? result.label : nil
280
- @uuid = result.success? ? result.uuid : nil
279
+ @label = result.success? ? result[0].label : nil
280
+ @uuid = result.success? ? result[0].uuid : nil
281
281
  end
282
282
  end
283
283
 
@@ -24,7 +24,7 @@ module Kanrisuru
24
24
  Kanrisuru.logger.info do
25
25
  'DEPRECATION WARNING: string_join_array will be removed in the upcoming major release. Use array_join_string instead.'
26
26
  end
27
-
27
+
28
28
  array = arg.instance_of?(String) ? [arg] : arg
29
29
  array.join(field)
30
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanrisuru
4
- VERSION = '0.10.0'
4
+ VERSION = '0.11.0'
5
5
  end