ubalo 0.25 → 0.26

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.
data/bin/ubalo CHANGED
@@ -170,6 +170,26 @@ command :init do |c|
170
170
  end
171
171
  end
172
172
 
173
+ desc 'Fork a pod to your own user'
174
+ command :fork do |c|
175
+ c.action do |global_options,options,args|
176
+ unless name = args.shift
177
+ raise Ubalo::Error, "Please specify a pod name."
178
+ end
179
+ pod = account.pod_by_name!(name)
180
+
181
+ pod_dir = Ubalo::PodDir.new(args.shift || pod.name)
182
+ new_pod = account.pod_by_name(pod.name)
183
+ new_pod.update!
184
+
185
+ logger.print "Forking #{pod.fullname} to #{new_pod.fullname}..."
186
+ pod_dir.write_name(new_pod.fullname)
187
+ pod.archive.extract_to(pod_dir)
188
+ new_pod.push_from(pod_dir)
189
+ logger.puts "Downloaded #{new_pod.fullname} to #{pod_dir.path}."
190
+ end
191
+ end
192
+
173
193
  desc 'Run a pod'
174
194
  command :run do |c|
175
195
  c.flag :arg
@@ -237,14 +257,24 @@ end
237
257
  desc 'Stop a task'
238
258
  arg_name '<task label>'
239
259
  command 'task:stop' do |c|
260
+ c.switch :all
261
+
240
262
  c.action do |global_options,options,args|
241
- if label = args.shift
242
- task = account.task_by_label!(label)
263
+ if options.all
264
+ tasks = account.running_tasks
265
+ logger.puts "You have #{tasks.size} parent tasks running."
266
+ tasks.each do |task|
267
+ task.stop!
268
+ end
243
269
  else
244
- task = pod.latest_task
245
- end
270
+ if label = args.shift
271
+ task = account.task_by_label!(label)
272
+ else
273
+ task = pod.latest_task
274
+ end
246
275
 
247
- task.stop!
276
+ task.stop!
277
+ end
248
278
  end
249
279
  end
250
280
 
@@ -118,8 +118,16 @@ module Ubalo
118
118
  task.refresh!
119
119
  end
120
120
 
121
+ def running_tasks
122
+ request_tasks("/users/#{username}/tasks", :params => {:state => :running})
123
+ end
124
+
121
125
  def tasks
122
- request(:get, "/tasks").map do |task_json|
126
+ request_tasks("/tasks")
127
+ end
128
+
129
+ def request_tasks(path, options = {})
130
+ request(:get, path, options).map do |task_json|
123
131
  task_from_json(task_json)
124
132
  end
125
133
  end
@@ -7,7 +7,7 @@ module Ubalo
7
7
  attr_reader :path
8
8
 
9
9
  def initialize(path)
10
- @path = path
10
+ @path = File.expand_path(path)
11
11
  end
12
12
 
13
13
  def v2?
@@ -1,6 +1,6 @@
1
1
  module Ubalo
2
2
  unless const_defined?('VERSION')
3
- VERSION = "0.25"
3
+ VERSION = "0.26"
4
4
  end
5
5
 
6
6
  def self.version
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.25'
4
+ version: '0.26'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-28 00:00:00.000000000 Z
12
+ date: 2012-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
@@ -137,7 +137,7 @@ require_paths:
137
137
  required_ruby_version: !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
- - - ~>
140
+ - - ! '>='
141
141
  - !ruby/object:Gem::Version
142
142
  version: 1.8.7
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement