ubalo 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/bin/ubalo +8 -46
  2. data/lib/ubalo.rb +3 -14
  3. data/lib/ubalo/version.rb +1 -1
  4. metadata +10 -10
data/bin/ubalo CHANGED
@@ -120,12 +120,11 @@ command :tasks do |c|
120
120
  end
121
121
  end
122
122
 
123
- def process_download pod_response, files_response, destination_path=nil
123
+ def process_download pod_response, destination_path=nil
124
124
  name = pod_response.fetch('name')
125
125
  fullname = pod_response.fetch('fullname')
126
126
  url = pod_response.fetch('url')
127
-
128
- files = files_response.fetch('files')
127
+ files = pod_response.fetch('files')
129
128
 
130
129
  destination_path ||= name
131
130
 
@@ -151,17 +150,17 @@ def process_download pod_response, files_response, destination_path=nil
151
150
  [fullname, destination_path]
152
151
  end
153
152
 
154
- desc 'Download a pod to your computer'
153
+ desc 'Clone a pod to your computer'
155
154
  arg_name '<pod name>'
156
- command :get do |c|
155
+ command :clone do |c|
157
156
  c.action do |global_options,options,args|
158
157
  pod_name = normalize_pod_name(args.shift)
159
158
  destination_path = args.shift
160
159
 
161
- $stderr.print "Fetching files for #{pod_name}..."
162
- pod_response, files_response = ubalo.download(pod_name)
160
+ $stderr.print "Fetching #{pod_name}..."
161
+ pod_response = ubalo.download(pod_name)
163
162
 
164
- fullname, destination_path = process_download(pod_response, files_response)
163
+ fullname, destination_path = process_download(pod_response)
165
164
  $stderr.puts " done."
166
165
  $stderr.puts "Retrieved #{fullname} into #{destination_path}."
167
166
  end
@@ -211,7 +210,7 @@ command :create do |c|
211
210
  $stderr.print "Creating a new #{template_name} pod called #{pod_name}..."
212
211
  pod_response, files_response = ubalo.create_pod(pod_name, template_name)
213
212
 
214
- fullname, destination_path = process_download(pod_response, files_response)
213
+ fullname, destination_path = process_download(pod_response)
215
214
 
216
215
  $stderr.puts " done."
217
216
  $stderr.puts "Created #{fullname} and placed in #{destination_path}/."
@@ -321,43 +320,6 @@ command :push do |c|
321
320
  end
322
321
  end
323
322
 
324
- desc 'Pull files from Ubalo'
325
- command :pull do |c|
326
- c.action do |global_options,options,args|
327
- print "Pulling changes from Ubalo..."
328
- files = ubalo.pull(local_config.fetch('pod_url'))
329
- puts " received."
330
-
331
- filenames = local_config.fetch('filenames')
332
-
333
- filenames.each do |filename|
334
- if File.exists?(filename)
335
- existing_content = File.read(filename)
336
- else
337
- existing_content = nil
338
- end
339
-
340
- if files.fetch(filename) == existing_content
341
- puts "Checking #{filename}... no changes."
342
- else
343
- hl.choose do |menu|
344
- menu.prompt = "Changes made to #{filename}. Overwrite your copy? "
345
- menu.choice :yes do
346
- open(filename, 'w') do |f|
347
- f.write files.fetch(filename)
348
- end
349
- puts "Changes saved to #{filename}."
350
- end
351
-
352
- menu.choice :no do
353
- puts "Cancelled! No changes made to #{filename}."
354
- end
355
- end
356
- end
357
- end
358
- end
359
- end
360
-
361
323
  desc 'Enter username and password for access'
362
324
  command :login do |c|
363
325
  c.desc "Username"
@@ -202,7 +202,7 @@ class Ubalo
202
202
  end
203
203
 
204
204
  def download(pod_name)
205
- [get("#{base_url}/pods/#{pod_name}"), get_files(pod_name)]
205
+ get("#{base_url}/pods/#{pod_name}")
206
206
  end
207
207
 
208
208
  def pods
@@ -246,22 +246,11 @@ class Ubalo
246
246
  end
247
247
 
248
248
  def create_pod name, template
249
- pod_response = post("#{base_url}/templates/#{template}/pods", :pod => {:name => name})
250
- files_response = get_files(pod_response.fetch('fullname'))
251
-
252
- [pod_response, files_response]
253
- end
254
-
255
- def get_files fullname
256
- get("#{base_url}/pods/#{fullname}/files")
249
+ post("#{base_url}/templates/#{template}/pods", :pod => {:name => name})
257
250
  end
258
251
 
259
252
  def push pod_url, files
260
- raw_request(:put, "#{pod_url}/files", :files => files)
261
- end
262
-
263
- def pull pod_url
264
- get("#{pod_url}/files")['files']
253
+ raw_request(:put, "#{pod_url}", :pod => {:files => files})
265
254
  end
266
255
 
267
256
  def check_task label
@@ -1,5 +1,5 @@
1
1
  class Ubalo
2
2
  unless const_defined?('VERSION')
3
- VERSION = "0.0.25"
3
+ VERSION = "0.0.26"
4
4
  end
5
5
  end
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.25
4
+ version: 0.0.26
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: 2012-03-19 00:00:00.000000000 Z
12
+ date: 2012-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
16
- requirement: &70239715075580 !ruby/object:Gem::Requirement
16
+ requirement: &70360634350380 !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: *70239715075580
24
+ version_requirements: *70360634350380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline
27
- requirement: &70239715060740 !ruby/object:Gem::Requirement
27
+ requirement: &70360634349740 !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: *70239715060740
35
+ version_requirements: *70360634349740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &70239715057820 !ruby/object:Gem::Requirement
38
+ requirement: &70360634348920 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70239715057820
46
+ version_requirements: *70360634348920
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rest-client
49
- requirement: &70239714982060 !ruby/object:Gem::Requirement
49
+ requirement: &70360634348040 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 1.6.3
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70239714982060
57
+ version_requirements: *70360634348040
58
58
  description: CLI and API client for Ubalo
59
59
  email: dev@ubalo.com
60
60
  executables: