ubalo 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/ubalo +8 -7
  2. data/lib/ubalo.rb +7 -6
  3. metadata +9 -9
data/bin/ubalo CHANGED
@@ -44,7 +44,7 @@ def ubalo
44
44
  end
45
45
 
46
46
  program_desc 'Command-line access to ubalo.com.'
47
- version "0.0.3"
47
+ version "0.0.4"
48
48
 
49
49
  desc "Change the connect url"
50
50
  flag 'connect-url'
@@ -168,12 +168,12 @@ desc 'Set the code in a pod'
168
168
  arg_name '<pod_name> <code_file>'
169
169
  command :code do |c|
170
170
  c.action do |global_options,options,args|
171
- pod_name = args.shift
171
+ pod_name = args.first
172
172
  unless pod_name
173
173
  raise "please specify a pod"
174
174
  end
175
175
 
176
- file_name = args.shift
176
+ file_name = args.last
177
177
  if file_name
178
178
  code = File.read(file_name)
179
179
  elsif $stdin.tty?
@@ -200,7 +200,7 @@ command :ls do |c|
200
200
  opts << " -l" if options.l
201
201
  opts << " -h" if options.h
202
202
 
203
- pod_name = args.shift
203
+ pod_name = args.last
204
204
  unless pod_name
205
205
  raise "please specify a pod"
206
206
  end
@@ -218,12 +218,13 @@ command :cp do |c|
218
218
  opts = ""
219
219
  opts << " -r" if options.r
220
220
 
221
+ environ = nil
221
222
  scp_args = args.join(" ").gsub(/[\w-]+(?=:)/) do |pod_name|
222
223
  ssh_path, environ = ubalo.ssh_path(pod_name)
223
- "#{ssh_path}:#{environ}"
224
+ "#{ssh_path}"
224
225
  end
225
226
 
226
- ubalo.scp(opts, scp_args)
227
+ ubalo.scp(environ, opts, scp_args)
227
228
  end
228
229
  end
229
230
 
@@ -270,7 +271,7 @@ command :check do |c|
270
271
  c.switch [:json, :j]
271
272
 
272
273
  c.action do |global_options,options,args|
273
- task_id = args.shift
274
+ task_id = args.first
274
275
  unless task_id
275
276
  raise "please specify a task"
276
277
  end
data/lib/ubalo.rb CHANGED
@@ -146,18 +146,19 @@ class Ubalo
146
146
  def ssh(pod_name)
147
147
  ssh_path, environ = ssh_path(pod_name)
148
148
  puts "Opening an ssh connection to edit the '#{environ}' environment for the '#{pod_name}' pod."
149
- ssh_command = "ssh -tq #{ssh_path} #{environ}"
150
- Process.exec({'TERM' => 'xterm'}, ssh_command)
149
+ ssh_command = "ssh -o SendEnv='UBALO_ENVIRON TERM' -tq #{ssh_path}"
150
+ Process.exec({'UBALO_ENVIRON' => environ}, ssh_command)
151
151
  end
152
152
 
153
- def scp(opts, args)
154
- Process.exec("scp#{opts} #{args}")
153
+ def scp(environ, opts, args)
154
+ Process.exec({'UBALO_ENVIRON' => environ}, "scp -o SendEnv=UBALO_ENVIRON #{opts} #{args}")
155
155
  end
156
156
 
157
157
  def ls(pod_name, options)
158
158
  ssh_path, environ = ssh_path(pod_name)
159
- ssh_command = "ssh -tq #{ssh_path} #{environ}"
160
- `#{ssh_command} ls#{options}`
159
+ ssh_command = "ssh -o SendEnv=UBALO_ENVIRON -q #{ssh_path}"
160
+ out_and_err, status = Open3.capture2e({'UBALO_ENVIRON' => environ}, "#{ssh_command} ls#{options}")
161
+ out_and_err
161
162
  end
162
163
 
163
164
  def show_result(result, verbose=false, json=false)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ubalo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-22 00:00:00.000000000Z
12
+ date: 2011-11-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
16
- requirement: &70217783652080 !ruby/object:Gem::Requirement
16
+ requirement: &2153165080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70217783652080
24
+ version_requirements: *2153165080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline
27
- requirement: &70217783651640 !ruby/object:Gem::Requirement
27
+ requirement: &2153164620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70217783651640
35
+ version_requirements: *2153164620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rest-client
38
- requirement: &70217783651120 !ruby/object:Gem::Requirement
38
+ requirement: &2153164060 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.6.3
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70217783651120
46
+ version_requirements: *2153164060
47
47
  description: CLI and API client for Ubalo
48
48
  email: dev@ubalo.com
49
49
  executables:
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  requirements: []
75
75
  rubyforge_project:
76
- rubygems_version: 1.8.7
76
+ rubygems_version: 1.8.6
77
77
  signing_key:
78
78
  specification_version: 3
79
79
  summary: CLI and API client for Ubalo