File tree 5 files changed +34
-6
lines changed
5 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
gem . description = 'Manage remote servers over ssh with ruby.'
13
13
gem . homepage = 'https://github.com/avamia/kanrisuru'
14
14
15
- gem . required_ruby_version = '>= 2.5.0'
15
+ gem . required_ruby_version = '>= 2.5.0'
16
16
17
17
gem . add_development_dependency 'rspec' , '~> 3.10'
18
18
gem . add_development_dependency 'rubocop' , '~> 1.12'
Original file line number Diff line number Diff line change @@ -341,8 +341,11 @@ def yum_info(opts)
341
341
end
342
342
end
343
343
344
- current_row . description = description . strip
345
- rows << current_row
344
+ if current_row
345
+ current_row . description = description . strip
346
+ rows << current_row
347
+ end
348
+
346
349
rows
347
350
end
348
351
end
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ def each(&block)
67
67
def append_file!
68
68
@file . append do |f |
69
69
@entries . each do |_ , entry |
70
- f << entry . to_s if entry [ :new ]
70
+ f << entry [ :entry ] . to_s if entry [ :new ]
71
71
end
72
72
end
73
73
@@ -78,13 +78,22 @@ def append_file!
78
78
def write_file!
79
79
@file . write do |f |
80
80
@entries . each do |_ , entry |
81
- f << entry . to_s
81
+ f << entry [ :entry ] . to_s
82
82
end
83
83
end
84
84
85
85
reload!
86
86
end
87
87
88
+ def to_s
89
+ lines = [ ]
90
+ @entries . each do |_ , entry |
91
+ lines << entry [ :entry ] . to_s
92
+ end
93
+
94
+ lines . join ( "\n " )
95
+ end
96
+
88
97
def reload!
89
98
init_from_os
90
99
end
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
module Kanrisuru
4
- VERSION = '0.2.8 '
4
+ VERSION = '0.2.9 '
5
5
end
Original file line number Diff line number Diff line change 16
16
host . disconnect
17
17
end
18
18
19
+ it 'outputs string version of fstab' do
20
+ host . su ( 'root' )
21
+
22
+ result = host . cat ( '/etc/fstab' )
23
+ expect ( result ) . to be_success
24
+ raw_file_lines = [ ]
25
+ result . each do |line |
26
+ next if line . match ( /^#/ ) || line == ''
27
+
28
+ raw_file_lines << line . split . join ( ' ' )
29
+ end
30
+
31
+ raw_file_output = raw_file_lines . join ( "\n " )
32
+ expect ( raw_file_output ) . to eq ( host . fstab . to_s )
33
+ end
34
+
19
35
it 'parses fstab' do
20
36
host . su ( 'root' )
21
37
fstab = host . fstab
You can’t perform that action at this time.
0 commit comments