kanrisuru 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -0
- data/.rubocop.yml +47 -0
- data/.rubocop_todo.yml +0 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +2 -5
- data/LICENSE.txt +1 -1
- data/README.md +143 -7
- data/Rakefile +5 -3
- data/bin/console +4 -3
- data/kanrisuru.gemspec +21 -12
- data/lib/kanrisuru.rb +41 -2
- data/lib/kanrisuru/command.rb +99 -0
- data/lib/kanrisuru/core.rb +53 -0
- data/lib/kanrisuru/core/archive.rb +154 -0
- data/lib/kanrisuru/core/disk.rb +302 -0
- data/lib/kanrisuru/core/file.rb +332 -0
- data/lib/kanrisuru/core/find.rb +108 -0
- data/lib/kanrisuru/core/group.rb +97 -0
- data/lib/kanrisuru/core/ip.rb +1032 -0
- data/lib/kanrisuru/core/mount.rb +138 -0
- data/lib/kanrisuru/core/path.rb +140 -0
- data/lib/kanrisuru/core/socket.rb +168 -0
- data/lib/kanrisuru/core/stat.rb +104 -0
- data/lib/kanrisuru/core/stream.rb +121 -0
- data/lib/kanrisuru/core/system.rb +348 -0
- data/lib/kanrisuru/core/transfer.rb +203 -0
- data/lib/kanrisuru/core/user.rb +198 -0
- data/lib/kanrisuru/logger.rb +8 -0
- data/lib/kanrisuru/mode.rb +277 -0
- data/lib/kanrisuru/os_package.rb +235 -0
- data/lib/kanrisuru/remote.rb +10 -0
- data/lib/kanrisuru/remote/cluster.rb +95 -0
- data/lib/kanrisuru/remote/cpu.rb +68 -0
- data/lib/kanrisuru/remote/env.rb +33 -0
- data/lib/kanrisuru/remote/file.rb +354 -0
- data/lib/kanrisuru/remote/fstab.rb +412 -0
- data/lib/kanrisuru/remote/host.rb +191 -0
- data/lib/kanrisuru/remote/memory.rb +19 -0
- data/lib/kanrisuru/remote/os.rb +87 -0
- data/lib/kanrisuru/result.rb +78 -0
- data/lib/kanrisuru/template.rb +32 -0
- data/lib/kanrisuru/util.rb +40 -0
- data/lib/kanrisuru/util/bits.rb +203 -0
- data/lib/kanrisuru/util/fs_mount_opts.rb +655 -0
- data/lib/kanrisuru/util/os_family.rb +213 -0
- data/lib/kanrisuru/util/signal.rb +161 -0
- data/lib/kanrisuru/version.rb +3 -1
- data/spec/functional/core/archive_spec.rb +228 -0
- data/spec/functional/core/disk_spec.rb +80 -0
- data/spec/functional/core/file_spec.rb +341 -0
- data/spec/functional/core/find_spec.rb +52 -0
- data/spec/functional/core/group_spec.rb +65 -0
- data/spec/functional/core/ip_spec.rb +71 -0
- data/spec/functional/core/path_spec.rb +93 -0
- data/spec/functional/core/socket_spec.rb +31 -0
- data/spec/functional/core/stat_spec.rb +98 -0
- data/spec/functional/core/stream_spec.rb +99 -0
- data/spec/functional/core/system_spec.rb +96 -0
- data/spec/functional/core/transfer_spec.rb +108 -0
- data/spec/functional/core/user_spec.rb +76 -0
- data/spec/functional/os_package_spec.rb +75 -0
- data/spec/functional/remote/cluster_spec.rb +45 -0
- data/spec/functional/remote/cpu_spec.rb +41 -0
- data/spec/functional/remote/env_spec.rb +36 -0
- data/spec/functional/remote/fstab_spec.rb +76 -0
- data/spec/functional/remote/host_spec.rb +68 -0
- data/spec/functional/remote/memory_spec.rb +29 -0
- data/spec/functional/remote/os_spec.rb +63 -0
- data/spec/functional/remote/remote_file_spec.rb +180 -0
- data/spec/helper/test_hosts.rb +68 -0
- data/spec/hosts.json +92 -0
- data/spec/spec_helper.rb +11 -3
- data/spec/unit/fstab_spec.rb +22 -0
- data/spec/unit/kanrisuru_spec.rb +9 -0
- data/spec/unit/mode_spec.rb +183 -0
- data/spec/unit/template_spec.rb +13 -0
- data/spec/unit/util_spec.rb +177 -0
- data/spec/zz_reboot_spec.rb +46 -0
- metadata +136 -13
- data/spec/kanrisuru_spec.rb +0 -9
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Kanrisuru::Core::System do
|
6
|
+
TestHosts.each_os do |os_name|
|
7
|
+
context "with #{os_name}" do
|
8
|
+
let(:host_json) { TestHosts.host(os_name) }
|
9
|
+
let(:host) do
|
10
|
+
Kanrisuru::Remote::Host.new(
|
11
|
+
host: host_json['hostname'],
|
12
|
+
username: host_json['username'],
|
13
|
+
keys: [host_json['ssh_key']]
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'cancels rebooting system' do
|
18
|
+
host.su('root')
|
19
|
+
result = host.reboot(time: 1000)
|
20
|
+
expect(result).to be_success
|
21
|
+
|
22
|
+
result = host.reboot(cancel: true)
|
23
|
+
expect(result).to be_success
|
24
|
+
|
25
|
+
result = host.reboot(time: '11:11', message: 'Rebooting system')
|
26
|
+
expect(result).to be_success
|
27
|
+
|
28
|
+
result = host.reboot(cancel: true)
|
29
|
+
expect(result).to be_success
|
30
|
+
host.disconnect
|
31
|
+
end
|
32
|
+
|
33
|
+
# it 'reboots system' do
|
34
|
+
# host.su('root')
|
35
|
+
# result = host.reboot(time: 'now')
|
36
|
+
# expect(result).to be_success
|
37
|
+
# end
|
38
|
+
|
39
|
+
# it 'powers off system' do
|
40
|
+
# host.su('root')
|
41
|
+
# result = host.poweroff(time: 'now')
|
42
|
+
# expect(result).to be_success
|
43
|
+
# end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kanrisuru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Mammina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: net-ping
|
15
71
|
requirement: !ruby/object:Gem::Requirement
|
16
72
|
requirements:
|
17
73
|
- - ">="
|
@@ -25,7 +81,7 @@ dependencies:
|
|
25
81
|
- !ruby/object:Gem::Version
|
26
82
|
version: '0'
|
27
83
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: net-
|
84
|
+
name: net-scp
|
29
85
|
requirement: !ruby/object:Gem::Requirement
|
30
86
|
requirements:
|
31
87
|
- - ">="
|
@@ -52,16 +108,18 @@ dependencies:
|
|
52
108
|
- - ">="
|
53
109
|
- !ruby/object:Gem::Version
|
54
110
|
version: '0'
|
55
|
-
description:
|
56
|
-
email:
|
57
|
-
- ryan@avamia.com
|
111
|
+
description:
|
112
|
+
email: ryan@avamia.com
|
58
113
|
executables: []
|
59
114
|
extensions: []
|
60
115
|
extra_rdoc_files: []
|
61
116
|
files:
|
62
117
|
- ".gitignore"
|
63
118
|
- ".rspec"
|
119
|
+
- ".rubocop.yml"
|
120
|
+
- ".rubocop_todo.yml"
|
64
121
|
- ".travis.yml"
|
122
|
+
- CHANGELOG.md
|
65
123
|
- CODE_OF_CONDUCT.md
|
66
124
|
- Gemfile
|
67
125
|
- LICENSE.txt
|
@@ -71,13 +129,78 @@ files:
|
|
71
129
|
- bin/setup
|
72
130
|
- kanrisuru.gemspec
|
73
131
|
- lib/kanrisuru.rb
|
132
|
+
- lib/kanrisuru/command.rb
|
133
|
+
- lib/kanrisuru/core.rb
|
134
|
+
- lib/kanrisuru/core/archive.rb
|
135
|
+
- lib/kanrisuru/core/disk.rb
|
136
|
+
- lib/kanrisuru/core/file.rb
|
137
|
+
- lib/kanrisuru/core/find.rb
|
138
|
+
- lib/kanrisuru/core/group.rb
|
139
|
+
- lib/kanrisuru/core/ip.rb
|
140
|
+
- lib/kanrisuru/core/mount.rb
|
141
|
+
- lib/kanrisuru/core/path.rb
|
142
|
+
- lib/kanrisuru/core/socket.rb
|
143
|
+
- lib/kanrisuru/core/stat.rb
|
144
|
+
- lib/kanrisuru/core/stream.rb
|
145
|
+
- lib/kanrisuru/core/system.rb
|
146
|
+
- lib/kanrisuru/core/transfer.rb
|
147
|
+
- lib/kanrisuru/core/user.rb
|
148
|
+
- lib/kanrisuru/logger.rb
|
149
|
+
- lib/kanrisuru/mode.rb
|
150
|
+
- lib/kanrisuru/os_package.rb
|
151
|
+
- lib/kanrisuru/remote.rb
|
152
|
+
- lib/kanrisuru/remote/cluster.rb
|
153
|
+
- lib/kanrisuru/remote/cpu.rb
|
154
|
+
- lib/kanrisuru/remote/env.rb
|
155
|
+
- lib/kanrisuru/remote/file.rb
|
156
|
+
- lib/kanrisuru/remote/fstab.rb
|
157
|
+
- lib/kanrisuru/remote/host.rb
|
158
|
+
- lib/kanrisuru/remote/memory.rb
|
159
|
+
- lib/kanrisuru/remote/os.rb
|
160
|
+
- lib/kanrisuru/result.rb
|
161
|
+
- lib/kanrisuru/template.rb
|
162
|
+
- lib/kanrisuru/util.rb
|
163
|
+
- lib/kanrisuru/util/bits.rb
|
164
|
+
- lib/kanrisuru/util/fs_mount_opts.rb
|
165
|
+
- lib/kanrisuru/util/os_family.rb
|
166
|
+
- lib/kanrisuru/util/signal.rb
|
74
167
|
- lib/kanrisuru/version.rb
|
75
|
-
- spec/
|
168
|
+
- spec/functional/core/archive_spec.rb
|
169
|
+
- spec/functional/core/disk_spec.rb
|
170
|
+
- spec/functional/core/file_spec.rb
|
171
|
+
- spec/functional/core/find_spec.rb
|
172
|
+
- spec/functional/core/group_spec.rb
|
173
|
+
- spec/functional/core/ip_spec.rb
|
174
|
+
- spec/functional/core/path_spec.rb
|
175
|
+
- spec/functional/core/socket_spec.rb
|
176
|
+
- spec/functional/core/stat_spec.rb
|
177
|
+
- spec/functional/core/stream_spec.rb
|
178
|
+
- spec/functional/core/system_spec.rb
|
179
|
+
- spec/functional/core/transfer_spec.rb
|
180
|
+
- spec/functional/core/user_spec.rb
|
181
|
+
- spec/functional/os_package_spec.rb
|
182
|
+
- spec/functional/remote/cluster_spec.rb
|
183
|
+
- spec/functional/remote/cpu_spec.rb
|
184
|
+
- spec/functional/remote/env_spec.rb
|
185
|
+
- spec/functional/remote/fstab_spec.rb
|
186
|
+
- spec/functional/remote/host_spec.rb
|
187
|
+
- spec/functional/remote/memory_spec.rb
|
188
|
+
- spec/functional/remote/os_spec.rb
|
189
|
+
- spec/functional/remote/remote_file_spec.rb
|
190
|
+
- spec/helper/test_hosts.rb
|
191
|
+
- spec/hosts.json
|
76
192
|
- spec/spec_helper.rb
|
77
|
-
|
193
|
+
- spec/unit/fstab_spec.rb
|
194
|
+
- spec/unit/kanrisuru_spec.rb
|
195
|
+
- spec/unit/mode_spec.rb
|
196
|
+
- spec/unit/template_spec.rb
|
197
|
+
- spec/unit/util_spec.rb
|
198
|
+
- spec/zz_reboot_spec.rb
|
199
|
+
homepage: https://github.com/avamia/kanrisuru
|
78
200
|
licenses:
|
79
201
|
- MIT
|
80
|
-
metadata:
|
202
|
+
metadata:
|
203
|
+
source_code_uri: https://github.com/avamia/kanrisuru/
|
81
204
|
post_install_message:
|
82
205
|
rdoc_options: []
|
83
206
|
require_paths:
|
@@ -86,15 +209,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
209
|
requirements:
|
87
210
|
- - ">="
|
88
211
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
212
|
+
version: 2.5.0
|
90
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
214
|
requirements:
|
92
215
|
- - ">="
|
93
216
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
217
|
+
version: 1.8.11
|
95
218
|
requirements: []
|
96
219
|
rubygems_version: 3.1.2
|
97
220
|
signing_key:
|
98
221
|
specification_version: 4
|
99
|
-
summary: Manage remote servers with ruby
|
222
|
+
summary: Manage remote servers with ruby.
|
100
223
|
test_files: []
|