kanrisuru 0.9.1 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) 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 +151 -130
  6. data/CODE_OF_CONDUCT.md +10 -10
  7. data/README.md +8 -3
  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/dmi.rb +1 -1
  12. data/lib/kanrisuru/core/file.rb +2 -2
  13. data/lib/kanrisuru/core/find.rb +4 -5
  14. data/lib/kanrisuru/core/socket.rb +2 -1
  15. data/lib/kanrisuru/core/stream.rb +1 -1
  16. data/lib/kanrisuru/core/zypper.rb +3 -3
  17. data/lib/kanrisuru/remote/cpu.rb +5 -1
  18. data/lib/kanrisuru/remote/env.rb +8 -0
  19. data/lib/kanrisuru/remote/fstab.rb +4 -4
  20. data/lib/kanrisuru/util.rb +1 -1
  21. data/lib/kanrisuru/version.rb +1 -1
  22. data/spec/functional/core/apt_spec.rb +22 -30
  23. data/spec/functional/core/archive_spec.rb +169 -0
  24. data/spec/functional/core/find_spec.rb +94 -113
  25. data/spec/functional/core/socket_spec.rb +23 -28
  26. data/spec/functional/core/stream_spec.rb +12 -12
  27. data/spec/functional/core/transfer_spec.rb +108 -131
  28. data/spec/functional/core/yum_spec.rb +58 -83
  29. data/spec/functional/remote/cluster_spec.rb +12 -3
  30. data/spec/functional/remote/cpu_spec.rb +104 -0
  31. data/spec/functional/remote/env_spec.rb +48 -0
  32. data/spec/helper/stub_network.rb +57 -14
  33. data/spec/integration/core/file_spec.rb +0 -1
  34. data/spec/integration/core/find_spec.rb +1 -0
  35. data/spec/integration/core/system_spec.rb +0 -1
  36. data/spec/integration/core/zypper_spec.rb +3 -3
  37. data/spec/{functional → integration}/os_package_spec.rb +0 -0
  38. data/spec/spec_helper.rb +3 -0
  39. data/spec/unit/command_spec.rb +31 -0
  40. data/spec/unit/core/apt_spec.rb +20 -0
  41. data/spec/unit/core/archive_spec.rb +20 -0
  42. data/spec/unit/core/disk_spec.rb +23 -0
  43. data/spec/unit/core/dmi_spec.rb +20 -0
  44. data/spec/unit/core/file_spec.rb +35 -0
  45. data/spec/unit/core/find_spec.rb +21 -1
  46. data/spec/unit/core/group_spec.rb +24 -0
  47. data/spec/unit/core/ip_spec.rb +20 -0
  48. data/spec/unit/core/path_spec.rb +25 -0
  49. data/spec/unit/core/socket_spec.rb +20 -0
  50. data/spec/unit/core/stat_spec.rb +27 -0
  51. data/spec/unit/core/system_spec.rb +35 -0
  52. data/spec/unit/core/transfer_spec.rb +22 -0
  53. data/spec/unit/core/user_spec.rb +25 -0
  54. data/spec/unit/core/yum_spec.rb +20 -0
  55. data/spec/unit/core/zypper_spec.rb +20 -0
  56. data/spec/unit/mode_spec.rb +33 -2
  57. data/spec/unit/remote/cluster_spec.rb +36 -0
  58. data/spec/unit/remote/cpu_spec.rb +3 -4
  59. data/spec/unit/remote/env_spec.rb +17 -0
  60. data/spec/unit/{fstab_spec.rb → remote/fstab_spec.rb} +0 -0
  61. data/spec/unit/util_spec.rb +13 -0
  62. metadata +26 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0ae74abc67963114dc04cc67783eaaab104ad77de4bba9dc497cd2307c92e7c
4
- data.tar.gz: 94ba0cb2da9fa973cbcf5ff0e866931b64fdd8b529f44e35e0ede06edcd47581
3
+ metadata.gz: bb936ab5bcccbaa1d4f4b3d97b7bd810aba4e0a1915027e87d5e62fdb1bc8fbb
4
+ data.tar.gz: 5ea1754c5c23dbc4c1d3af3ee922e840b60ac4938573528e66773405d183f60d
5
5
  SHA512:
6
- metadata.gz: 46b7fa66b9fceb225536604774a655f8ad332a1f1565a10005d8ba679fb2d14c894d16862535a98a555ba5a669e1f43674b61c77f8c718fea36efd4071523194
7
- data.tar.gz: b97bbdbf4a2ed6ceb0aef10f63bfc1dad44559d825bdffcc095b979aad2aa9ca3cfdab5c5a0270eb3f96b67cdd93b63d4dad032c8601dc4372ebf54209b127ca
6
+ metadata.gz: 2af6ba4a5774c8f78fe051aaa0cb57ddcb4914d3c633e5b47febfa84d9291ae421f317d800faca714c8442574d77150e6a2b5d3c4dfc308a93dc538e666a83c5
7
+ data.tar.gz: 3b8316665eba3a34c3f961c890df1be79f1cb3772a7dbd1838cda6dfe1b2b5db983476122ef8e0f1f3262fba5e8d0580821006f8f39181112a3b03f0fe0ad7b5
@@ -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,101 +1,127 @@
1
- ## Kanrisuru 0.9.1 (November 29, 2021)
2
- * Fix type on `address_sizes` for `Kanrisuru::Remote::Cpu` class.
3
- * Add unit test cases for the `cpu` class.
4
-
5
- ## Kanrisuru 0.9.0 (November 23, 2021)
6
- * Add `delete` to `Kanrisuru::Remote::Cluster` class to allow removal of hosts from cluster.
7
- * Add functional test cases for remote cluster class.
8
-
9
- ## Kanrisuru 0.8.23 (November 19, 2021)
10
- * Add functional test cases for `yum` command
11
- * Add stub by operating system method, with support for `ubuntu` and `centos` os types.
12
- * Fix `ArgumentError` typo in yum commands, `erase` and `remove`.
13
-
14
- ## Kanrisuru 0.8.22 (November 18, 2021)
15
- * Add functional test cases for `apt` command
16
-
17
- ## Kanrisuru 0.8.21 (November 15, 2021)
18
- * Fix bug with `Kanrisuru::Mode` class, lookup table had incorrect value for execute only symbolic to numeric field.
19
-
20
- ## Kanrisuru 0.8.20 (November 13, 2021)
21
- * Unstub network requests for full rspec test-suite run
22
-
23
- ## Kanrisuru 0.8.19 (October 31, 2021)
24
- * Add functional test cases for `ss` command.
25
- * Enforce contraints on `family` parameter for `ss` command.
26
- * 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.
27
- * Replace `string_join_array` method calls in `apt`, `transfer`, `yum`, and `zypper` with `array_join_string`.
28
-
29
- ## Kanrisuru 0.8.18 (October 19, 2021)
30
- * Add functional test cases for `find` commmand.
31
- * Add `regex_type` option for `find` command.
32
- * 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.
33
-
34
- ## Kanrisuru 0.8.17 (October 16, 2021)
35
- * Add functional test cases for `transfer` module
36
- * Update wget command to accept hash for `headers` opt.
37
-
38
- ## Kanrisuru 0.8.16 (October 14, 2021)
39
- * Add functional test cases for `stream` and `path` modules
40
- * Create `expect_command` helper for quick testing on raw command result
41
-
42
- ## Kanrisuru 0.8.15 (October 12, 20201)
43
- * Move functional specs to integration. Anything that performs an actual network request will be under the integrations test.
44
- * 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.
45
- * Start with testing the `stat` command as a functional test.
46
-
47
- ## Kanrisuru 0.8.14 (October 8, 20201)
48
- * Update `Kanrisuru::Remote::Cluster` instantiation method to use array splat instead of passing array directly.
49
-
50
- ## Kanrisuru 0.8.13 (October 4, 20201)
51
- * Fix `wc` command. Ensure result parsing is cast to integer values.
52
-
53
- ## Kanrisuru 0.8.12 (October 4, 20201)
54
- * Refactor `rmdir` command to only work on empty directories.
55
-
56
- ## Kanrisuru 0.8.11 (October 1, 20201)
57
- * Allow `Kanrisuru::Mode` as mode type option in mkdir method.
58
-
59
- ## Kanrisuru 0.8.10 (August 24, 20201)
60
- * Fix bug with rspec test case.
61
-
62
- ## Kanrisuru 0.8.9 (August 24, 2021)
63
- * Fix spelling error exception `ArgumentError` in `Kanrisuru::Mode` class.
1
+ ## Kanrisuru 0.11.1 (December 04, 2021) ##
2
+ * Cleanup self-assignment branches
3
+ * Fix linting issues.
4
+
5
+ ## Kanrisuru 0.11.0 (December 04, 2021) ##
6
+ * Add codequality badge, cleanup code linting issues.
7
+ * Fix `fstab` issue with blkid device return type.
8
+ * Fix `find` spec with sudo permissions.
9
+ * Change `stub_network` result override to use `block.call` with a conditional check for indvidual command stubs.
10
+ * Add `architecture` method to `cpu`.
11
+ * Add functional test cases for `cpu` class.
12
+ * Add more unit test cases.
13
+
14
+ ## Kanrisuru 0.10.0 (December 03, 2021) ##
15
+ * Add `stub_command` and `unstub_command` to mock indvidual command results from a remote server.
16
+ * Add `count` and `delete` to `Kanrisuru::Remote::Env` class for managing environment variables.
17
+ * Add unit and functional test cases for `Kanrisuru::Remote::Env`.
18
+ * Add functional test cases for the `archive` command.
19
+ * Fix typo bugs in the `archive` command. Fix `--exclude` opt field in `archive` command.
20
+ * Add unit test cases for `Kanrisuru::Mode` class.
21
+
22
+ ## Kanrisuru 0.9.2 (November 30, 2021) ##
23
+ * Add unit test cases for all core commands.
24
+ * Add unit test cases for `cluster` class.
25
+ * Add codecov xml output for coverage badge.
26
+
27
+ ## Kanrisuru 0.9.1 (November 29, 2021) ##
28
+ * Fix type on `address_sizes` for `Kanrisuru::Remote::Cpu` class.
29
+ * Add unit test cases for the `cpu` class.
30
+
31
+ ## Kanrisuru 0.9.0 (November 23, 2021) ##
32
+ * Add `delete` to `Kanrisuru::Remote::Cluster` class to allow removal of hosts from cluster.
33
+ * Add functional test cases for remote cluster class.
34
+
35
+ ## Kanrisuru 0.8.23 (November 19, 2021) ##
36
+ * Add functional test cases for `yum` command
37
+ * Add stub by operating system method, with support for `ubuntu` and `centos` os types.
38
+ * Fix `ArgumentError` typo in yum commands, `erase` and `remove`.
39
+
40
+ ## Kanrisuru 0.8.22 (November 18, 2021) ##
41
+ * Add functional test cases for `apt` command
42
+
43
+ ## Kanrisuru 0.8.21 (November 15, 2021) ##
44
+ * Fix bug with `Kanrisuru::Mode` class, lookup table had incorrect value for execute only symbolic to numeric field.
45
+
46
+ ## Kanrisuru 0.8.20 (November 13, 2021) ##
47
+ * Unstub network requests for full rspec test-suite run
48
+
49
+ ## Kanrisuru 0.8.19 (October 31, 2021) ##
50
+ * Add functional test cases for `ss` command.
51
+ * Enforce contraints on `family` parameter for `ss` command.
52
+ * 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.
53
+ * Replace `string_join_array` method calls in `apt`, `transfer`, `yum`, and `zypper` with `array_join_string`.
54
+
55
+ ## Kanrisuru 0.8.18 (October 19, 2021) ##
56
+ * Add functional test cases for `find` commmand.
57
+ * Add `regex_type` option for `find` command.
58
+ * 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.
59
+
60
+ ## Kanrisuru 0.8.17 (October 16, 2021) ##
61
+ * Add functional test cases for `transfer` module
62
+ * Update wget command to accept hash for `headers` opt.
63
+
64
+ ## Kanrisuru 0.8.16 (October 14, 2021) ##
65
+ * Add functional test cases for `stream` and `path` modules
66
+ * Create `expect_command` helper for quick testing on raw command result
67
+
68
+ ## Kanrisuru 0.8.15 (October 12, 20201) ##
69
+ * Move functional specs to integration. Anything that performs an actual network request will be under the integrations test.
70
+ * 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.
71
+ * Start with testing the `stat` command as a functional test.
72
+
73
+ ## Kanrisuru 0.8.14 (October 8, 20201) ##
74
+ * Update `Kanrisuru::Remote::Cluster` instantiation method to use array splat instead of passing array directly.
75
+
76
+ ## Kanrisuru 0.8.13 (October 4, 20201) ##
77
+ * Fix `wc` command. Ensure result parsing is cast to integer values.
78
+
79
+ ## Kanrisuru 0.8.12 (October 4, 20201) ##
80
+ * Refactor `rmdir` command to only work on empty directories.
81
+
82
+ ## Kanrisuru 0.8.11 (October 1, 20201) ##
83
+ * Allow `Kanrisuru::Mode` as mode type option in mkdir method.
84
+
85
+ ## Kanrisuru 0.8.10 (August 24, 20201) ##
86
+ * Fix bug with rspec test case.
87
+
88
+ ## Kanrisuru 0.8.9 (August 24, 2021) ##
89
+ * Fix spelling error exception `ArgumentError` in `Kanrisuru::Mode` class.
64
90
 
65
91
  ## Kanrisuru 0.8.8 (August 21, 2021) ##
66
- * Add shorthand notation for tar command actions, such as `x` for `extract`, `t` for `list`, and `c` for `create`.
92
+ * Add shorthand notation for tar command actions, such as `x` for `extract`, `t` for `list`, and `c` for `create`.
67
93
 
68
94
  ## Kanrisuru 0.8.7 (August 21, 2021) ##
69
- * Fix `FileInfo` field for ls command. Was set to `memory_blocks`, but was incorrect, corrected this to `hard_links`.
95
+ * Fix `FileInfo` field for ls command. Was set to `memory_blocks`, but was incorrect, corrected this to `hard_links`.
70
96
 
71
97
  ## Kanrisuru 0.8.6 (August 21, 2021) ##
72
- * Add `minimum_io_size`, `physical_sector_size`, and `logical_sector_size` to the blkid low level disk probe for devices.
98
+ * Add `minimum_io_size`, `physical_sector_size`, and `logical_sector_size` to the blkid low level disk probe for devices.
73
99
 
74
100
  ## Kanrisuru 0.8.5 (August 20, 2021) ##
75
- * 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.
101
+ * 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.
76
102
 
77
103
  ## Kanrisuru 0.8.4 (August 20, 2021) ##
78
- * Convert `fsize` field to an `integer` for du disk module command.
104
+ * Convert `fsize` field to an `integer` for du disk module command.
79
105
 
80
106
  ## Kanrisuru 0.8.3 (August 20, 2021) ##
81
- * Fix bug with disk usage, `du` command by escaping the awk variables in the command.
82
- * Update `du` command to execute with shell user.
107
+ * Fix bug with disk usage, `du` command by escaping the awk variables in the command.
108
+ * Update `du` command to execute with shell user.
83
109
 
84
110
  ## Kanrisuru 0.8.2 (August 19, 2021) ##
85
- * Convert `major` and `minor` device field values to an `integer` in lsblk disk module.
111
+ * Convert `major` and `minor` device field values to an `integer` in lsblk disk module.
86
112
 
87
113
  ## Kanrisuru 0.8.1 (August 19, 2021) ##
88
- * Fix `nodeps` flag value for `lsblk` command in disk module.
114
+ * Fix `nodeps` flag value for `lsblk` command in disk module.
89
115
 
90
116
  ## Kanrisuru 0.8.0 (August 18, 2021) ##
91
- * Add last / lastb implementation in system core module.
117
+ * Add last / lastb implementation in system core module.
92
118
 
93
119
  ## Kanrisuru 0.7.3 (August 9, 2021) ##
94
- * Fixed bug with zypper remove package, where the package names weren't being added to the linux command.
95
- * Test case added to ensure package is removed.
120
+ * Fixed bug with zypper remove package, where the package names weren't being added to the linux command.
121
+ * Test case added to ensure package is removed.
96
122
 
97
123
  ## Kanrisuru 0.7.2 (August 9, 2021) ##
98
- * 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:
124
+ * 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:
99
125
 
100
126
  ```ruby
101
127
  host.instance_variable_get(:@os_method_cache)
@@ -104,105 +130,100 @@
104
130
  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`.
105
131
 
106
132
  ## Kanrisuru 0.7.1 (August 8, 2021) ##
107
- * Fix bug with `os_include` when caching namespace unbound methods, use the namespace in the
133
+ * Fix bug with `os_include` when caching namespace unbound methods, use the namespace in the
108
134
  cache key to avoid any namespace collisions with the same method name, namely:
109
135
  ```ruby
110
136
  "#{namespace}.#{method_name}"
111
137
  ```
112
138
 
113
139
  ## Kanrisuru 0.7.0 (August 8, 2021) ##
114
- * Simplify `FileInfo` struct for return object of `ls` command.
115
- * Rename `size` to `fsize` for the `OpenFile` struct to avoid method naming conflicts of the struct class.
116
- * Allow `os_include` and `os_collection` to define multiple groupings of methods with the same namespace.
117
- * Add `clear` method for remote env class, to remove any session based env variables.
118
- * Add `to_s` method to result for quick analysis of string based return values.
119
- * Remove duplicate `numeric` method in the utils module.
140
+ * Simplify `FileInfo` struct for return object of `ls` command.
141
+ * Rename `size` to `fsize` for the `OpenFile` struct to avoid method naming conflicts of the struct class.
142
+ * Allow `os_include` and `os_collection` to define multiple groupings of methods with the same namespace.
143
+ * Add `clear` method for remote env class, to remove any session based env variables.
144
+ * Add `to_s` method to result for quick analysis of string based return values.
145
+ * Remove duplicate `numeric` method in the utils module.
120
146
 
121
147
  ## Kanrisuru 0.6.0 (August 1, 2021) ##
122
- * Add `lsof` implementation in system core module
123
- * Fix changelog formatting
124
- * Add changelog url to gemspec
148
+ * Add `lsof` implementation in system core module
149
+ * Fix changelog formatting
150
+ * Add changelog url to gemspec
125
151
 
126
152
  ## Kanrisuru 0.5.2 (July 30, 2021) ##
127
- * Add changelog documentation
128
- * Update documentation table with new tested core module
129
- * Deprecating `cpu_info` with replacement of `lscpu`. `cpu_info` will be removed in the next major release.
153
+ * Add changelog documentation
154
+ * Update documentation table with new tested core module
155
+ * Deprecating `cpu_info` with replacement of `lscpu`. `cpu_info` will be removed in the next major release.
130
156
 
131
157
  ## Kanrisuru 0.5.1 (July 29, 2021) ##
132
-
133
- * Unit test cases for core module structs, constants and types.
158
+ * Unit test cases for core module structs, constants and types.
134
159
 
135
160
  ## Kanrisuru 0.5.0 (July 29, 2021) ##
136
- * Add `zypper` package manager core module
137
- * Add `dmi` core module. Support for getting hardware information from virtual and physical machines.
138
- * 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.
139
- * Add additional bit conversion string handling in the util module, such as kib, mib, and gib.
140
- * Remove redudant namespacing in struct names, such as
161
+ * Add `zypper` package manager core module
162
+ * Add `dmi` core module. Support for getting hardware information from virtual and physical machines.
163
+ * 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.
164
+ * Add additional bit conversion string handling in the util module, such as kib, mib, and gib.
165
+ * Remove redudant namespacing in struct names, such as
141
166
  `Kanrisuru::Core::Yum::YumPackageOverview`, to `Kanrisuru::Core::Yum::PackageOverview`.
142
- * Fix backups test case for `cp` command with the correct filename.
143
- * Use 0755 as expected numeric mode for all OS functional tests in the `mkdir` test case.
144
- * Fix bug with `lscpu` regex match on cpus with more than 9 cores, ie `/cpu\d/` to `/cpu\d+/`
167
+ * Fix backups test case for `cp` command with the correct filename.
168
+ * Use 0755 as expected numeric mode for all OS functional tests in the `mkdir` test case.
169
+ * Fix bug with `lscpu` regex match on cpus with more than 9 cores, ie `/cpu\d/` to `/cpu\d+/`
145
170
 
146
171
 
147
172
  ## Kanrisuru 0.4.1 (July 26, 2021) ##
148
- * Add `kernel_statistics` to system core module.
173
+ * Add `kernel_statistics` to system core module.
149
174
 
150
175
  ## Kanrisuru 0.4.0 (July 25, 2021) ##
151
- * Update internal exit code of command from 0, to array of accpeted exit codes, with 0 being the default value.
152
- * Add `append_exit_code` to command, allowing additional exit codes to be considered true for `success?` return value.
153
- * Add `@port` to `Net::SSH.start` method
154
- * Fix test case with `host.os` return value of `opensuse_leap`.
155
- * Add `cpu_flags` method to `cpu` module
176
+ * Update internal exit code of command from 0, to array of accpeted exit codes, with 0 being the default value.
177
+ * Add `append_exit_code` to command, allowing additional exit codes to be considered true for `success?` return value.
178
+ * Add `@port` to `Net::SSH.start` method
179
+ * Fix test case with `host.os` return value of `opensuse_leap`.
180
+ * Add `cpu_flags` method to `cpu` module
156
181
 
157
182
  ## Kanrisuru 0.3.2 (July 23, 2021) ##
158
- * Fix typo from `key` to `signal` in hash fetch method.
183
+ * Fix typo from `key` to `signal` in hash fetch method.
159
184
 
160
185
  ## Kanrisuru 0.3.1 (July 22, 2021) ##
161
- * Add additional methods to `cpu` pulling from `lscpu` struct.
162
- * Fix `address_size` in `cpu` method call.
186
+ * Add additional methods to `cpu` pulling from `lscpu` struct.
187
+ * Fix `address_size` in `cpu` method call.
163
188
 
164
189
  ## Kanrisuru 0.3.0 (July 22, 2021) ##
165
- * Add `lscpu` system core module
166
- * Replace `cpu` module internal fetching of data from `cpu_info` to `lscpu` struct.
190
+ * Add `lscpu` system core module
191
+ * Replace `cpu` module internal fetching of data from `cpu_info` to `lscpu` struct.
167
192
 
168
193
  ## Kanrisuru 0.2.9 (July 20, 2021) ##
169
-
170
- * Fix fstab entry from `entry` to `entry[:entry]` in the `for_each`iteration.
194
+ * Fix fstab entry from `entry` to `entry[:entry]` in the `for_each`iteration.
171
195
 
172
196
  ## Kanrisuru 0.2.8 (July 20, 2021) ##
173
-
174
- * Update gem development and runtime depedencies with stricter depencies.
197
+ * Update gem development and runtime depedencies with stricter depencies.
175
198
 
176
199
  ## Kanrisuru 0.2.7 (July 18, 2021) ##
177
-
178
- * Set opensuse upstream to sles (Suse Enterprise Linux) in `os_family`
200
+ * Set opensuse upstream to sles (Suse Enterprise Linux) in `os_family`
179
201
 
180
202
  ## Kanrisuru 0.2.6 (July 17, 2021) ##
181
- * Force "-" to "\_" from `os-release` release name in `host.os` module.
203
+ * Force "-" to "\_" from `os-release` release name in `host.os` module.
182
204
 
183
205
  ## Kanrisuru 0.2.5 (July 16, 2021) ##
184
- * Update gem depedencies to non-zero values
185
- * Change summary and description fields for `apt`
186
- * Move `normalize_size` from `apt` core module, to
187
- `Kanrisuru::Util::Bits` class.
188
- * Add additional test cases for `apt` core module.
189
- * Add `-hi` to `who` command to explicility print out ip address for user.
190
- * Update `inode?` command to execute without shell user.
191
- * Add `yum` package manager core module
206
+ * Update gem depedencies to non-zero values.
207
+ * Change summary and description fields for `apt`.
208
+ * Move `normalize_size` from `apt` core module, to `Kanrisuru::Util::Bits` class.
209
+ * Add additional test cases for `apt` core module.
210
+ * Add `-hi` to `who` command to explicility print out ip address for user.
211
+ * Update `inode?` command to execute without shell user.
212
+ * Add `yum` package manager core module
192
213
 
193
214
  ## Kanrisuru 0.2.4 (July 10, 2021) ##
194
- * Fix error in `ip_rule` and `ip_address` sub modules with command typo.
215
+ * Fix error in `ip_rule` and `ip_address` sub modules with command typo.
195
216
 
196
217
  ## Kanrisuru 0.2.3 (July 07, 2021) ##
197
- * Add `apt` package manager core module
218
+ * Add `apt` package manager core module
198
219
 
199
220
  ## Kanrisuru 0.2.2 (June 16, 2021) ##
200
- * Fix `read_file_chunk` on checking bounds for start and end line values.
221
+ * Fix `read_file_chunk` on checking bounds for start and end line values.
201
222
 
202
223
  ## Kanrisuru 0.2.1 (June 16, 2021) ##
203
- * Add first working release on rubygems.org
224
+ * Add first working release on rubygems.org
204
225
 
205
226
  ## Kanrisuru 0.2.0 (June 16, 2021) [YANKED] ##
206
227
 
207
228
  ## Kanrisuru 0.1.0 (December 12, 2020) ##
208
- * Initialize repository, start working on project.
229
+ * 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" />
@@ -26,14 +28,17 @@ gem 'kanrisuru'
26
28
 
27
29
  And then execute:
28
30
 
29
- $ bundle install
31
+ ```bash
32
+ $ bundle install
33
+ ```
30
34
 
31
35
  Or install it yourself as:
32
36
 
33
- $ gem install kanrisuru
37
+ ```bash
38
+ $ gem install kanrisuru
39
+ ```
34
40
 
35
41
  ## Usage
36
-
37
42
  Run basic commands you would have access to while running on a remote host or on a cluster of hosts.
38
43
 
39
44
  ### Host
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] if paths.instance_of?(String)
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)
@@ -511,7 +511,7 @@ module Kanrisuru
511
511
  return unless Kanrisuru::Util.present?(opts[:types])
512
512
 
513
513
  types = opts[:types]
514
- types = types.instance_of?(Array) ? types : [types]
514
+ types = [types] if types.instance_of?(String)
515
515
 
516
516
  types.each do |type|
517
517
  type = parse_dmi_type(type)
@@ -65,10 +65,10 @@ module Kanrisuru
65
65
  elsif opts[:target_directory]
66
66
  command.append_arg('-t', dest)
67
67
 
68
- source = source.instance_of?(String) ? [source] : source
68
+ source = [source] if source.instance_of?(String)
69
69
  command << source.join(' ')
70
70
  else
71
- source = source.instance_of?(String) ? [source] : source
71
+ source = [source] if source.instance_of?(String)
72
72
  command << source.join(' ')
73
73
  command << dest
74
74
  end