social_stream-presence 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@ SocialStream::Presence.setup do |config|
18
18
  #SSH Login
19
19
  #config.ssh_domain = "domain"
20
20
  #config.ssh_user = "login"
21
+ #Comment to allow SSH authentication with key instead of password
21
22
  #config.ssh_password= "password"
22
23
 
23
24
  #Configure to use a Xmpp Client on Rails App
@@ -1,5 +1,5 @@
1
1
  module Socialstream
2
2
  module Presence
3
- VERSION = "0.0.19"
3
+ VERSION = "0.0.20"
4
4
  end
5
5
  end
@@ -140,22 +140,24 @@ module SocialStream
140
140
  end
141
141
 
142
142
  def executeCommand(command)
143
- puts "Executing " + command
144
- if SocialStream::Presence.remote_xmpp_server
145
- output = executeRemoteCommand(command)
146
- else
147
- #SocialStream::Presence.remote_xmpp_server=false
148
- output = executeLocalCommand(command)
149
- end
143
+ output = executeCommands([command])
150
144
  return output
151
145
  end
152
146
 
153
147
  def executeCommands(commands)
154
- puts "Executing the following commands:"
155
- commands.each do |command|
156
- puts command
157
- end
158
- puts "Command list finish"
148
+ if commands.length > 1
149
+ puts "Executing the following commands:"
150
+ commands.each do |command|
151
+ puts command
152
+ end
153
+ puts "Command list finish"
154
+ elsif commands.length == 1
155
+ puts "Executing " + commands[0]
156
+ else
157
+ puts "No command to execute"
158
+ return
159
+ end
160
+
159
161
  if SocialStream::Presence.remote_xmpp_server
160
162
  output = executeRemoteCommands(commands)
161
163
  else
@@ -164,10 +166,6 @@ module SocialStream
164
166
  end
165
167
  return output
166
168
  end
167
-
168
- def executeLocalCommand(command)
169
- return executeLocalCommands([command])
170
- end
171
169
 
172
170
  def executeLocalCommands(commands)
173
171
  output="No command received";
@@ -177,17 +175,33 @@ module SocialStream
177
175
  return output
178
176
  end
179
177
 
180
- def executeRemoteCommand(command)
181
- return executeRemoteCommands([command])
182
- end
183
-
184
178
  def executeRemoteCommands(commands)
185
179
  output="No command received";
186
- Net::SSH.start( SocialStream::Presence.ssh_domain, SocialStream::Presence.ssh_user, :password => SocialStream::Presence.ssh_password, :auth_methods => ["password"]) do |session|
187
- commands.each do |command|
188
- output = session.exec!(command)
180
+
181
+ begin
182
+ if SocialStream::Presence.ssh_password
183
+ Net::SSH.start( SocialStream::Presence.ssh_domain, SocialStream::Presence.ssh_user, :password => SocialStream::Presence.ssh_password, :auth_methods => ["password"]) do |session|
184
+ commands.each do |command|
185
+ output = session.exec!(command)
186
+ end
187
+ end
188
+ else
189
+ #SSH with authentication key instead of password
190
+ Net::SSH.start( SocialStream::Presence.ssh_domain, SocialStream::Presence.ssh_user) do |session|
191
+ commands.each do |command|
192
+ output = session.exec!(command)
193
+ end
194
+ end
189
195
  end
190
- end
196
+ rescue Exception => e
197
+ case e
198
+ when Net::SSH::AuthenticationFailed
199
+ output = "AuthenticationFailed on remote access"
200
+ else
201
+ output = "Unknown exception in executeRemoteCommands method: #{e.to_s}"
202
+ end
203
+ end
204
+
191
205
  return output
192
206
  end
193
207
 
metadata CHANGED
@@ -1,8 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-presence
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.19
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 20
9
+ version: 0.0.20
6
10
  platform: ruby
7
11
  authors:
8
12
  - Aldo Gordillo
@@ -21,6 +25,10 @@ dependencies:
21
25
  requirements:
22
26
  - - ~>
23
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 9
31
+ - 18
24
32
  version: 0.9.18
25
33
  type: :runtime
26
34
  version_requirements: *id001
@@ -32,6 +40,8 @@ dependencies:
32
40
  requirements:
33
41
  - - ">="
34
42
  - !ruby/object:Gem::Version
43
+ segments:
44
+ - 0
35
45
  version: "0"
36
46
  type: :runtime
37
47
  version_requirements: *id002
@@ -43,6 +53,8 @@ dependencies:
43
53
  requirements:
44
54
  - - ">="
45
55
  - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
46
58
  version: "0"
47
59
  type: :runtime
48
60
  version_requirements: *id003
@@ -54,6 +66,8 @@ dependencies:
54
66
  requirements:
55
67
  - - ">="
56
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
57
71
  version: "0"
58
72
  type: :development
59
73
  version_requirements: *id004
@@ -196,17 +210,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
210
  requirements:
197
211
  - - ">="
198
212
  - !ruby/object:Gem::Version
213
+ segments:
214
+ - 0
199
215
  version: "0"
200
216
  required_rubygems_version: !ruby/object:Gem::Requirement
201
217
  none: false
202
218
  requirements:
203
219
  - - ">="
204
220
  - !ruby/object:Gem::Version
221
+ segments:
222
+ - 0
205
223
  version: "0"
206
224
  requirements: []
207
225
 
208
226
  rubyforge_project: social_stream-presence
209
- rubygems_version: 1.6.1
227
+ rubygems_version: 1.3.7
210
228
  signing_key:
211
229
  specification_version: 3
212
230
  summary: Presence capabilities for Social Stream, the core for building social network websites