kanrisuru 0.9.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) 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/.gitignore +3 -1
  5. data/CHANGELOG.md +147 -125
  6. data/CODE_OF_CONDUCT.md +10 -10
  7. data/README.md +2 -0
  8. data/kanrisuru.gemspec +2 -1
  9. data/lib/kanrisuru/core/archive.rb +6 -5
  10. data/lib/kanrisuru/core/disk.rb +0 -3
  11. data/lib/kanrisuru/core/find.rb +4 -5
  12. data/lib/kanrisuru/core/socket.rb +2 -1
  13. data/lib/kanrisuru/remote/cpu.rb +6 -2
  14. data/lib/kanrisuru/remote/env.rb +8 -0
  15. data/lib/kanrisuru/remote/fstab.rb +4 -4
  16. data/lib/kanrisuru/util.rb +1 -1
  17. data/lib/kanrisuru/version.rb +1 -1
  18. data/spec/functional/core/apt_spec.rb +22 -30
  19. data/spec/functional/core/archive_spec.rb +169 -0
  20. data/spec/functional/core/find_spec.rb +94 -113
  21. data/spec/functional/core/socket_spec.rb +23 -28
  22. data/spec/functional/core/stream_spec.rb +12 -12
  23. data/spec/functional/core/transfer_spec.rb +108 -131
  24. data/spec/functional/core/yum_spec.rb +58 -83
  25. data/spec/functional/remote/cluster_spec.rb +12 -3
  26. data/spec/functional/remote/cpu_spec.rb +104 -0
  27. data/spec/functional/remote/env_spec.rb +48 -0
  28. data/spec/helper/stub_network.rb +52 -9
  29. data/spec/integration/core/file_spec.rb +0 -1
  30. data/spec/integration/core/find_spec.rb +1 -0
  31. data/spec/integration/core/system_spec.rb +0 -1
  32. data/spec/integration/core/zypper_spec.rb +3 -3
  33. data/spec/{functional → integration}/os_package_spec.rb +0 -0
  34. data/spec/spec_helper.rb +3 -0
  35. data/spec/unit/command_spec.rb +31 -0
  36. data/spec/unit/core/apt_spec.rb +20 -0
  37. data/spec/unit/core/archive_spec.rb +20 -0
  38. data/spec/unit/core/disk_spec.rb +23 -0
  39. data/spec/unit/core/dmi_spec.rb +20 -0
  40. data/spec/unit/core/file_spec.rb +35 -0
  41. data/spec/unit/core/find_spec.rb +21 -1
  42. data/spec/unit/core/group_spec.rb +24 -0
  43. data/spec/unit/core/ip_spec.rb +20 -0
  44. data/spec/unit/core/path_spec.rb +25 -0
  45. data/spec/unit/core/socket_spec.rb +20 -0
  46. data/spec/unit/core/stat_spec.rb +27 -0
  47. data/spec/unit/core/system_spec.rb +35 -0
  48. data/spec/unit/core/transfer_spec.rb +22 -0
  49. data/spec/unit/core/user_spec.rb +25 -0
  50. data/spec/unit/core/yum_spec.rb +20 -0
  51. data/spec/unit/core/zypper_spec.rb +20 -0
  52. data/spec/unit/mode_spec.rb +33 -2
  53. data/spec/unit/remote/cluster_spec.rb +36 -0
  54. data/spec/unit/remote/cpu_spec.rb +49 -0
  55. data/spec/unit/remote/env_spec.rb +17 -0
  56. data/spec/unit/{fstab_spec.rb → remote/fstab_spec.rb} +0 -0
  57. data/spec/unit/util_spec.rb +13 -0
  58. metadata +27 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dda87f43ae0afebc6108a846d459da7ba74168ab011bfc883fff81014360111f
4
- data.tar.gz: 3e57869c300218b6b2c2ad01f5a991fd574237b8afcca13c08455defba4d8030
3
+ metadata.gz: 71358a615946331ad5e1d4a0d6cd51523981ad046d788e5e189ba2c0f49c136e
4
+ data.tar.gz: 7b6bec928fcd0b0dc05a77a83a8b5dc224d3f54f1ae162911dd742f90cf8ef81
5
5
  SHA512:
6
- metadata.gz: 2b1d3be849564df655e1ba9e043c4b2632549c9546a963d5b51cb296d358e1c1f1daa29cb559d73625d8b4a024a613e664221d76e5fffcd5fdfc7ce54502ac46
7
- data.tar.gz: ff9e92ccb5b6bd0d45b95a9252955bf442127583a1971febd5c12726b08421519f53b89bdf4e3d807c238f5bcbb47a8fb1867e56a3413c927e6c31427867cdcf
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/.gitignore CHANGED
@@ -14,7 +14,6 @@
14
14
  .ruby-version
15
15
 
16
16
  *.gem
17
- coverage/*
18
17
  Gemfile.lock
19
18
  *~
20
19
  .bundle
@@ -26,3 +25,6 @@ pkg/*
26
25
  .env
27
26
  spec/dummy/tmp/*
28
27
  spec/dummy/log/*.log
28
+
29
+ coverage/*
30
+ codecov
data/CHANGELOG.md CHANGED
@@ -1,97 +1,123 @@
1
- ## Kanrisuru 0.9.0 (November 23, 2021)
2
- * Add `delete` to `Kanrisuru::Remote::Cluster` class to allow removal of hosts from cluster.
3
- * Add functional test cases for remote cluster class.
4
-
5
- ## Kanrisuru 0.8.23 (November 19, 2021)
6
- * Add functional test cases for `yum` command
7
- * Add stub by operating system method, with support for `ubuntu` and `centos` os types.
8
- * Fix `ArgumentError` typo in yum commands, `erase` and `remove`.
9
-
10
- ## Kanrisuru 0.8.22 (November 18, 2021)
11
- * Add functional test cases for `apt` command
12
-
13
- ## Kanrisuru 0.8.21 (November 15, 2021)
14
- * Fix bug with `Kanrisuru::Mode` class, lookup table had incorrect value for execute only symbolic to numeric field.
15
-
16
- ## Kanrisuru 0.8.20 (November 13, 2021)
17
- * Unstub network requests for full rspec test-suite run
18
-
19
- ## Kanrisuru 0.8.19 (October 31, 2021)
20
- * Add functional test cases for `ss` command.
21
- * Enforce contraints on `family` parameter for `ss` command.
22
- * 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.
23
- * Replace `string_join_array` method calls in `apt`, `transfer`, `yum`, and `zypper` with `array_join_string`.
24
-
25
- ## Kanrisuru 0.8.18 (October 19, 2021)
26
- * Add functional test cases for `find` commmand.
27
- * Add `regex_type` option for `find` command.
28
- * 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.
29
-
30
- ## Kanrisuru 0.8.17 (October 16, 2021)
31
- * Add functional test cases for `transfer` module
32
- * Update wget command to accept hash for `headers` opt.
33
-
34
- ## Kanrisuru 0.8.16 (October 14, 2021)
35
- * Add functional test cases for `stream` and `path` modules
36
- * Create `expect_command` helper for quick testing on raw command result
37
-
38
- ## Kanrisuru 0.8.15 (October 12, 20201)
39
- * Move functional specs to integration. Anything that performs an actual network request will be under the integrations test.
40
- * 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.
41
- * Start with testing the `stat` command as a functional test.
42
-
43
- ## Kanrisuru 0.8.14 (October 8, 20201)
44
- * Update `Kanrisuru::Remote::Cluster` instantiation method to use array splat instead of passing array directly.
45
-
46
- ## Kanrisuru 0.8.13 (October 4, 20201)
47
- * Fix `wc` command. Ensure result parsing is cast to integer values.
48
-
49
- ## Kanrisuru 0.8.12 (October 4, 20201)
50
- * Refactor `rmdir` command to only work on empty directories.
51
-
52
- ## Kanrisuru 0.8.11 (October 1, 20201)
53
- * Allow `Kanrisuru::Mode` as mode type option in mkdir method.
54
-
55
- ## Kanrisuru 0.8.10 (August 24, 20201)
56
- * Fix bug with rspec test case.
57
-
58
- ## Kanrisuru 0.8.9 (August 24, 2021)
59
- * Fix spelling error exception `ArgumentError` in `Kanrisuru::Mode` class.
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
+
10
+ ## Kanrisuru 0.10.0 (December 03, 2021) ##
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.
17
+
18
+ ## Kanrisuru 0.9.2 (November 30, 2021) ##
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.
22
+
23
+ ## Kanrisuru 0.9.1 (November 29, 2021) ##
24
+ * Fix type on `address_sizes` for `Kanrisuru::Remote::Cpu` class.
25
+ * Add unit test cases for the `cpu` class.
26
+
27
+ ## Kanrisuru 0.9.0 (November 23, 2021) ##
28
+ * Add `delete` to `Kanrisuru::Remote::Cluster` class to allow removal of hosts from cluster.
29
+ * Add functional test cases for remote cluster class.
30
+
31
+ ## Kanrisuru 0.8.23 (November 19, 2021) ##
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`.
35
+
36
+ ## Kanrisuru 0.8.22 (November 18, 2021) ##
37
+ * Add functional test cases for `apt` command
38
+
39
+ ## Kanrisuru 0.8.21 (November 15, 2021) ##
40
+ * Fix bug with `Kanrisuru::Mode` class, lookup table had incorrect value for execute only symbolic to numeric field.
41
+
42
+ ## Kanrisuru 0.8.20 (November 13, 2021) ##
43
+ * Unstub network requests for full rspec test-suite run
44
+
45
+ ## Kanrisuru 0.8.19 (October 31, 2021) ##
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`.
50
+
51
+ ## Kanrisuru 0.8.18 (October 19, 2021) ##
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.
55
+
56
+ ## Kanrisuru 0.8.17 (October 16, 2021) ##
57
+ * Add functional test cases for `transfer` module
58
+ * Update wget command to accept hash for `headers` opt.
59
+
60
+ ## Kanrisuru 0.8.16 (October 14, 2021) ##
61
+ * Add functional test cases for `stream` and `path` modules
62
+ * Create `expect_command` helper for quick testing on raw command result
63
+
64
+ ## Kanrisuru 0.8.15 (October 12, 20201) ##
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.
68
+
69
+ ## Kanrisuru 0.8.14 (October 8, 20201) ##
70
+ * Update `Kanrisuru::Remote::Cluster` instantiation method to use array splat instead of passing array directly.
71
+
72
+ ## Kanrisuru 0.8.13 (October 4, 20201) ##
73
+ * Fix `wc` command. Ensure result parsing is cast to integer values.
74
+
75
+ ## Kanrisuru 0.8.12 (October 4, 20201) ##
76
+ * Refactor `rmdir` command to only work on empty directories.
77
+
78
+ ## Kanrisuru 0.8.11 (October 1, 20201) ##
79
+ * Allow `Kanrisuru::Mode` as mode type option in mkdir method.
80
+
81
+ ## Kanrisuru 0.8.10 (August 24, 20201) ##
82
+ * Fix bug with rspec test case.
83
+
84
+ ## Kanrisuru 0.8.9 (August 24, 2021) ##
85
+ * Fix spelling error exception `ArgumentError` in `Kanrisuru::Mode` class.
60
86
 
61
87
  ## Kanrisuru 0.8.8 (August 21, 2021) ##
62
- * 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`.
63
89
 
64
90
  ## Kanrisuru 0.8.7 (August 21, 2021) ##
65
- * 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`.
66
92
 
67
93
  ## Kanrisuru 0.8.6 (August 21, 2021) ##
68
- * 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.
69
95
 
70
96
  ## Kanrisuru 0.8.5 (August 20, 2021) ##
71
- * 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.
72
98
 
73
99
  ## Kanrisuru 0.8.4 (August 20, 2021) ##
74
- * Convert `fsize` field to an `integer` for du disk module command.
100
+ * Convert `fsize` field to an `integer` for du disk module command.
75
101
 
76
102
  ## Kanrisuru 0.8.3 (August 20, 2021) ##
77
- * Fix bug with disk usage, `du` command by escaping the awk variables in the command.
78
- * 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.
79
105
 
80
106
  ## Kanrisuru 0.8.2 (August 19, 2021) ##
81
- * 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.
82
108
 
83
109
  ## Kanrisuru 0.8.1 (August 19, 2021) ##
84
- * Fix `nodeps` flag value for `lsblk` command in disk module.
110
+ * Fix `nodeps` flag value for `lsblk` command in disk module.
85
111
 
86
112
  ## Kanrisuru 0.8.0 (August 18, 2021) ##
87
- * Add last / lastb implementation in system core module.
113
+ * Add last / lastb implementation in system core module.
88
114
 
89
115
  ## Kanrisuru 0.7.3 (August 9, 2021) ##
90
- * Fixed bug with zypper remove package, where the package names weren't being added to the linux command.
91
- * 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.
92
118
 
93
119
  ## Kanrisuru 0.7.2 (August 9, 2021) ##
94
- * 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:
95
121
 
96
122
  ```ruby
97
123
  host.instance_variable_get(:@os_method_cache)
@@ -100,105 +126,101 @@
100
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`.
101
127
 
102
128
  ## Kanrisuru 0.7.1 (August 8, 2021) ##
103
- * 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
104
130
  cache key to avoid any namespace collisions with the same method name, namely:
105
131
  ```ruby
106
132
  "#{namespace}.#{method_name}"
107
133
  ```
108
134
 
109
135
  ## Kanrisuru 0.7.0 (August 8, 2021) ##
110
- * Simplify `FileInfo` struct for return object of `ls` command.
111
- * Rename `size` to `fsize` for the `OpenFile` struct to avoid method naming conflicts of the struct class.
112
- * Allow `os_include` and `os_collection` to define multiple groupings of methods with the same namespace.
113
- * Add `clear` method for remote env class, to remove any session based env variables.
114
- * Add `to_s` method to result for quick analysis of string based return values.
115
- * 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.
116
142
 
117
143
  ## Kanrisuru 0.6.0 (August 1, 2021) ##
118
- * Add `lsof` implementation in system core module
119
- * Fix changelog formatting
120
- * Add changelog url to gemspec
144
+ * Add `lsof` implementation in system core module
145
+ * Fix changelog formatting
146
+ * Add changelog url to gemspec
121
147
 
122
148
  ## Kanrisuru 0.5.2 (July 30, 2021) ##
123
- * Add changelog documentation
124
- * Update documentation table with new tested core module
125
- * 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.
126
152
 
127
153
  ## Kanrisuru 0.5.1 (July 29, 2021) ##
128
-
129
- * Unit test cases for core module structs, constants and types.
154
+ * Unit test cases for core module structs, constants and types.
130
155
 
131
156
  ## Kanrisuru 0.5.0 (July 29, 2021) ##
132
- * Add `zypper` package manager core module
133
- * Add `dmi` core module. Support for getting hardware information from virtual and physical machines.
134
- * 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.
135
- * Add additional bit conversion string handling in the util module, such as kib, mib, and gib.
136
- * 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
137
162
  `Kanrisuru::Core::Yum::YumPackageOverview`, to `Kanrisuru::Core::Yum::PackageOverview`.
138
- * Fix backups test case for `cp` command with the correct filename.
139
- * Use 0755 as expected numeric mode for all OS functional tests in the `mkdir` test case.
140
- * 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+/`
141
166
 
142
167
 
143
168
  ## Kanrisuru 0.4.1 (July 26, 2021) ##
144
- * Add `kernel_statistics` to system core module.
169
+ * Add `kernel_statistics` to system core module.
145
170
 
146
171
  ## Kanrisuru 0.4.0 (July 25, 2021) ##
147
- * Update internal exit code of command from 0, to array of accpeted exit codes, with 0 being the default value.
148
- * Add `append_exit_code` to command, allowing additional exit codes to be considered true for `success?` return value.
149
- * Add `@port` to `Net::SSH.start` method
150
- * Fix test case with `host.os` return value of `opensuse_leap`.
151
- * 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
152
177
 
153
178
  ## Kanrisuru 0.3.2 (July 23, 2021) ##
154
- * Fix typo from `key` to `signal` in hash fetch method.
179
+ * Fix typo from `key` to `signal` in hash fetch method.
155
180
 
156
181
  ## Kanrisuru 0.3.1 (July 22, 2021) ##
157
- * Add additional methods to `cpu` pulling from `lscpu` struct.
158
- * 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.
159
184
 
160
185
  ## Kanrisuru 0.3.0 (July 22, 2021) ##
161
- * Add `lscpu` system core module
162
- * 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.
163
188
 
164
189
  ## Kanrisuru 0.2.9 (July 20, 2021) ##
165
-
166
- * 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.
167
191
 
168
192
  ## Kanrisuru 0.2.8 (July 20, 2021) ##
169
-
170
- * Update gem development and runtime depedencies with stricter depencies.
193
+ * Update gem development and runtime depedencies with stricter depencies.
171
194
 
172
195
  ## Kanrisuru 0.2.7 (July 18, 2021) ##
173
-
174
- * Set opensuse upstream to sles (Suse Enterprise Linux) in `os_family`
196
+ * Set opensuse upstream to sles (Suse Enterprise Linux) in `os_family`
175
197
 
176
198
  ## Kanrisuru 0.2.6 (July 17, 2021) ##
177
- * Force "-" to "\_" from `os-release` release name in `host.os` module.
199
+ * Force "-" to "\_" from `os-release` release name in `host.os` module.
178
200
 
179
201
  ## Kanrisuru 0.2.5 (July 16, 2021) ##
180
- * Update gem depedencies to non-zero values
181
- * Change summary and description fields for `apt`
182
- * 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
183
205
  `Kanrisuru::Util::Bits` class.
184
- * Add additional test cases for `apt` core module.
185
- * Add `-hi` to `who` command to explicility print out ip address for user.
186
- * Update `inode?` command to execute without shell user.
187
- * 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
188
210
 
189
211
  ## Kanrisuru 0.2.4 (July 10, 2021) ##
190
- * 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.
191
213
 
192
214
  ## Kanrisuru 0.2.3 (July 07, 2021) ##
193
- * Add `apt` package manager core module
215
+ * Add `apt` package manager core module
194
216
 
195
217
  ## Kanrisuru 0.2.2 (June 16, 2021) ##
196
- * 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.
197
219
 
198
220
  ## Kanrisuru 0.2.1 (June 16, 2021) ##
199
- * Add first working release on rubygems.org
221
+ * Add first working release on rubygems.org
200
222
 
201
223
  ## Kanrisuru 0.2.0 (June 16, 2021) [YANKED] ##
202
224
 
203
225
  ## Kanrisuru 0.1.0 (December 12, 2020) ##
204
- * 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
@@ -1,6 +1,8 @@
1
1
  [![Latest version](https://img.shields.io/gem/v/kanrisuru?style=flat-square)](https://rubygems.org/gems/kanrisuru) 
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
+ ![Codecov](https://img.shields.io/codecov/c/gh/avamia/kanrisuru?token=2Q1BE106B2) 
5
+ ![Codacy grade](https://img.shields.io/codacy/grade/9e839eb160bc445ea4e81b64cef22b27) 
4
6
 
5
7
  <p align='center'>
6
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 = '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.'
13
13
  gem.homepage = 'https://github.com/avamia/kanrisuru'
14
14
 
15
15
  gem.required_ruby_version = '>= 2.5.0'
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.add_development_dependency 'rubocop', '~> 1.12'
19
19
  gem.add_development_dependency 'rubocop-rspec', '~> 2.2'
20
20
  gem.add_development_dependency 'simplecov', '~> 0.21'
21
+ gem.add_development_dependency 'simplecov-cobertura', '~> 2.0'
21
22
 
22
23
  gem.add_runtime_dependency 'net-ping', '~> 2.0'
23
24
  gem.add_runtime_dependency 'net-scp', '~> 3.0'
@@ -50,7 +50,7 @@ module Kanrisuru
50
50
  command.append_flag('--same-owner', opts[:same_owners])
51
51
  command.append_flag('--multi-volume', opts[:multi_volume])
52
52
  command.append_flag('--label', opts[:label])
53
- command.append_flag('--one-file-system ', opts[:one_file_system])
53
+ command.append_flag('--one-file-system', opts[:one_file_system])
54
54
  command.append_flag('--keep-old-files', opts[:keep_old_files])
55
55
  command.append_flag('--skip-old-files', opts[:skip_old_files])
56
56
  command.append_flag('--overwrite', opts[:overwrite])
@@ -59,7 +59,7 @@ module Kanrisuru
59
59
  command.append_flag('--recursive-unlink', opts[:recursive_unlink])
60
60
 
61
61
  if Kanrisuru::Util.present?(paths)
62
- paths = paths.instance_of(String) ? [paths] : paths
62
+ paths = paths.instance_of?(String) ? [paths] : paths
63
63
  command << paths.join(' ')
64
64
  end
65
65
 
@@ -70,8 +70,10 @@ module Kanrisuru
70
70
  command.append_flag('--multi-volume', opts[:multi_volume])
71
71
 
72
72
  if Kanrisuru::Util.present?(exclude)
73
- exclude = exclude.instance_of?(String) ? [exclude] : exclude
74
- command.append_arg('--exclude', exclude.join(' '))
73
+ exclude_options = exclude.instance_of?(String) ? [exclude] : exclude
74
+ exclude_options.each do |exclude_option|
75
+ command << "--exclude=#{exclude_option}"
76
+ end
75
77
  end
76
78
 
77
79
  if Kanrisuru::Util.present?(paths)
@@ -80,7 +82,6 @@ module Kanrisuru
80
82
  end
81
83
 
82
84
  execute_shell(command)
83
-
84
85
  Kanrisuru::Result.new(command)
85
86
  when 'append', 'r'
86
87
  command.append_flag('-r')
@@ -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
@@ -75,8 +79,8 @@ module Kanrisuru
75
79
  @cpu_architecture.byte_order
76
80
  end
77
81
 
78
- def address_size
79
- @cpu_architecture.address_size
82
+ def address_sizes
83
+ @cpu_architecture.address_sizes
80
84
  end
81
85
 
82
86
  def cpu_mhz
@@ -25,6 +25,14 @@ module Kanrisuru
25
25
  string
26
26
  end
27
27
 
28
+ def count
29
+ @env.count
30
+ end
31
+
32
+ def delete(key)
33
+ @env.delete(key.to_s.upcase)
34
+ end
35
+
28
36
  def [](key)
29
37
  @env[key.to_s.upcase]
30
38
  end