thor-ssh 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/thor-ssh/local_server.rb +1 -1
- data/lib/thor-ssh/version.rb +1 -1
- data/spec/actions_spec.rb +50 -13
- metadata +3 -3
data/lib/thor-ssh/version.rb
CHANGED
data/spec/actions_spec.rb
CHANGED
@@ -37,7 +37,7 @@ describe ThorSsh do
|
|
37
37
|
@remote_test.empty_directory(@remote_base_path)
|
38
38
|
@remote_test.destination_files.exists?(@remote_base_path)
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
it 'should create an empty directory locally' do
|
42
42
|
@local_test.empty_directory(@local_base_path)
|
43
43
|
@local_test.destination_files.exists?(@local_base_path)
|
@@ -47,7 +47,7 @@ describe ThorSsh do
|
|
47
47
|
@remote_test.get('http://www.google.com/', "#{@remote_base_path}/google.txt")
|
48
48
|
@remote_test.destination_files.binread("#{@remote_base_path}/google.txt").should match(/Google/)
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
it 'should create get a url locally' do
|
52
52
|
@local_test.get('http://www.google.com/', "#{@local_base_path}/google.txt")
|
53
53
|
@local_test.destination_files.binread("#{@local_base_path}/google.txt").should match(/Google/)
|
@@ -57,7 +57,7 @@ describe ThorSsh do
|
|
57
57
|
@remote_test.create_file("#{@remote_base_path}/createdFile", "More awesome content\nSecond Line of content")
|
58
58
|
@remote_test.destination_files.binread("#{@remote_base_path}/createdFile").should == "More awesome content\nSecond Line of content"
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
it 'should create a file and set the text locally' do
|
62
62
|
@local_test.create_file("#{@local_base_path}/createdFile", "More awesome content\nSecond Line of content")
|
63
63
|
@local_test.destination_files.binread("#{@local_base_path}/createdFile").should == "More awesome content\nSecond Line of content"
|
@@ -68,7 +68,7 @@ describe ThorSsh do
|
|
68
68
|
@remote_test.template "templates/test_template.rb.tt"
|
69
69
|
@remote_test.destination_files.binread("#{@remote_base_path}/templates/test_template.rb").should match(/Test Ruby File/)
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
it "should copy in text locally" do
|
73
73
|
@local_test.destination_root = @local_base_path + "/"
|
74
74
|
@local_test.template "templates/test_template.rb.tt"
|
@@ -88,13 +88,13 @@ describe ThorSsh do
|
|
88
88
|
@remote_test.chmod("#{@remote_base_path}/modeFile", 0600)
|
89
89
|
remote_mode('modeFile').should == '-rw-------'
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
def local_mode(path)
|
93
93
|
ls = @local_test.destination_server.run("ls -lh \"#{@local_base_path}/#{path}\"")
|
94
94
|
mode = ls.strip.split(/ /).first.strip
|
95
95
|
return mode
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
it "should set the mode locally" do
|
99
99
|
@local_test.create_file("#{@local_base_path}/modeFile", "More awesome content")
|
100
100
|
@local_test.chmod("#{@local_base_path}/modeFile", 0644)
|
@@ -103,14 +103,21 @@ describe ThorSsh do
|
|
103
103
|
local_mode('modeFile').should == '-rw-------'
|
104
104
|
end
|
105
105
|
|
106
|
-
it "should gsub files" do
|
106
|
+
it "should gsub files remotely" do
|
107
107
|
file = "#{@remote_base_path}/gsubFile"
|
108
108
|
@remote_test.create_file(file, "More awesome content")
|
109
109
|
@remote_test.gsub_file file, /awesome/, 'cool'
|
110
110
|
@remote_test.destination_files.binread(file).should == 'More cool content'
|
111
111
|
end
|
112
112
|
|
113
|
-
it "should
|
113
|
+
it "should gsub files locally" do
|
114
|
+
file = "#{@local_base_path}/gsubFile"
|
115
|
+
@local_test.create_file(file, "More awesome content")
|
116
|
+
@local_test.gsub_file file, /awesome/, 'cool'
|
117
|
+
@local_test.destination_files.binread(file).should == 'More cool content'
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should remove files remotely" do
|
114
121
|
file = "#{@remote_base_path}/removeFile"
|
115
122
|
@remote_test.create_file(file, "More awesome content")
|
116
123
|
@remote_test.destination_files.exists?(file).should == true
|
@@ -118,14 +125,29 @@ describe ThorSsh do
|
|
118
125
|
@remote_test.destination_files.exists?(file).should == false
|
119
126
|
end
|
120
127
|
|
121
|
-
it "should
|
128
|
+
it "should remove files locally" do
|
129
|
+
file = "#{@local_base_path}/removeFile"
|
130
|
+
@local_test.create_file(file, "More awesome content")
|
131
|
+
@local_test.destination_files.exists?(file).should == true
|
132
|
+
@local_test.remove_file(file)
|
133
|
+
@local_test.destination_files.exists?(file).should == false
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should inject text into files remotely" do
|
122
137
|
file = "#{@remote_base_path}/injectFile"
|
123
138
|
@remote_test.create_file(file, "First line\nSecond Line\nThird Line")
|
124
139
|
@remote_test.insert_into_file(file, "2.5 line\n", :after => "Second Line\n")
|
125
140
|
@remote_test.destination_files.binread(file).should == "First line\nSecond Line\n2.5 line\nThird Line"
|
126
141
|
end
|
127
142
|
|
128
|
-
it "should
|
143
|
+
it "should inject text into files locally" do
|
144
|
+
file = "#{@local_base_path}/injectFile"
|
145
|
+
@local_test.create_file(file, "First line\nSecond Line\nThird Line")
|
146
|
+
@local_test.insert_into_file(file, "2.5 line\n", :after => "Second Line\n")
|
147
|
+
@local_test.destination_files.binread(file).should == "First line\nSecond Line\n2.5 line\nThird Line"
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should create links remotely" do
|
129
151
|
file = "#{@remote_base_path}/symFile"
|
130
152
|
link_file = "#{@remote_base_path}/linkedFile"
|
131
153
|
@remote_test.create_file(file, "Text")
|
@@ -135,17 +157,32 @@ describe ThorSsh do
|
|
135
157
|
@remote_test.destination_files.binread(link_file).should == "Text"
|
136
158
|
end
|
137
159
|
|
138
|
-
it "should
|
139
|
-
@
|
160
|
+
it "should create links locally" do
|
161
|
+
file = "#{@local_base_path}/symFile"
|
162
|
+
link_file = "#{@local_base_path}/linkedFile"
|
163
|
+
@local_test.create_file(file, "Text")
|
164
|
+
|
165
|
+
@local_test.create_link(link_file, file)
|
166
|
+
|
167
|
+
@local_test.destination_files.binread(link_file).should == "Text"
|
140
168
|
end
|
141
169
|
|
142
|
-
it "should run exec with an exit code" do
|
170
|
+
it "should run exec with an exit code remotely" do
|
143
171
|
stdout, stderr, exit_code, exit_signal = @remote_test.exec('false', true)
|
144
172
|
exit_code.should == 1
|
145
173
|
|
146
174
|
stdout, stderr, exit_code, exit_signal = @remote_test.exec('true', true)
|
147
175
|
exit_code.should == 0
|
148
176
|
end
|
177
|
+
|
178
|
+
it "should run exec with an exit code locally" do
|
179
|
+
stdout, stderr, exit_code, exit_signal = @local_test.exec('false', true)
|
180
|
+
exit_code.should == 1
|
181
|
+
|
182
|
+
stdout, stderr, exit_code, exit_signal = @local_test.exec('true', true)
|
183
|
+
exit_code.should == 0
|
184
|
+
end
|
185
|
+
|
149
186
|
end
|
150
187
|
|
151
188
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thor-ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -205,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
segments:
|
207
207
|
- 0
|
208
|
-
hash:
|
208
|
+
hash: 1900233715508289127
|
209
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
210
|
none: false
|
211
211
|
requirements:
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
segments:
|
216
216
|
- 0
|
217
|
-
hash:
|
217
|
+
hash: 1900233715508289127
|
218
218
|
requirements: []
|
219
219
|
rubyforge_project:
|
220
220
|
rubygems_version: 1.8.22
|