acquia_toolbelt 1.3.0 → 1.4.0

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzhkZmIyMzI0ZTE0OWMyNzJkMzc5NzRjOTI5NjE2ZGQyODJlMzVkNg==
4
+ OGU1ZTg3NjZlZGU2NzZlNGQ2M2IxMDMxMjYyYTg4ZGU5MWJiNTI1Yg==
5
5
  data.tar.gz: !binary |-
6
- YmJlOWZmNDY1MjQ4MmJkYmMwZmE2MzQ5ZDcxMmEwYzA2MzZhN2NlNw==
6
+ N2QyNzk2MmVmYTg0MDEwODRhYmZmYmEzZjE1MmU0YTdjYWE5NzViYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- N2NlOWIyNDIxMmNkYTVlYTJhNDRlMDA5MGEzNWY5ZWIzNGU3MTczMjU0NGI1
10
- YzQ0YTA2Y2Y2ZThkMWI3MTEyM2RjYjljODhlMDcxZjdlOWUzYTg2MTEzOTBl
11
- MDYzZDAyNDhiZDAyYWUwYjk4YjBkZmMxNTJmOTc5ODE2ZGNlOWI=
9
+ ZjYyNzY1ZTAwNDNiNmQxYmZmMzBmMDlhZDg0NzYxYzk1M2IxODk2NGJjMmU3
10
+ MDZlMzk3MDZkMWY5M2UwYjNkZDgwMDRmNDc5ZmU4MTY5OTE1ZDliMzJhZDQw
11
+ MjgwNDc1YWFiYTJmY2M2M2U5OWI5ZjY5M2ZkZDAwODFjMzFmYTk=
12
12
  data.tar.gz: !binary |-
13
- ZGNjMDI1ZTAwN2UzMWFmN2I2ZmFjMWFmYzRjMzU3NzE4MTJlZTNlYmMzZDY0
14
- M2U1NzE2ZWMwMWU2ZmJhYjc1NWQ0M2RlYTNiYTNmZmE0YmNhOTY3ZDVhN2Q3
15
- ZDQ4M2E2ZTYyZmUyYmM3MzQwNTYzYzFiOTc0MzQ0N2E2NzQ5ZWQ=
13
+ NzVhZTM4ZTQyOGUyNGYyNzc1YmM1ZjYxMjVkYTlmYWE3ZGI2OWZmZTM3Mzdj
14
+ ZGY4YmNiNmI3ZmJlOWYzNDk0ODM3NThmNTZkMWRlZmU0NzJiNjNiZjBmZWFi
15
+ YTE3NDA4YmE5ZmQ1YWRlNGQ5ZDhiZjljNmI0ZWFmZmY2ZGE5YTI=
data/bin/acquia CHANGED
@@ -125,6 +125,34 @@ class Acquia < Thor
125
125
  false
126
126
  end
127
127
  end
128
+
129
+ # Internal: Output information on a database instance.
130
+ def output_database_instance(database)
131
+ say "> Username: #{database["username"]}"
132
+ say "> Password: #{database["password"]}"
133
+ say "> Host: #{database["host"]}"
134
+ say "> DB cluster: #{database["db_cluster"]}"
135
+ say "> Instance name: #{database["instance_name"]}"
136
+ end
137
+
138
+ # Internal: Output information for a single task item.
139
+ def output_task_item(task)
140
+ completion_time = (task["completed"].to_i - task["started"].to_i) / 60
141
+ say
142
+ say "Task ID: #{task["id"].to_i}"
143
+ say "Description: #{task["description"]}"
144
+ say "Status: #{task["state"]}"
145
+
146
+ # If the completion time is greater then 0, output it in minutes otherwise
147
+ # just say it was less then a minute.
148
+ if completion_time > 0
149
+ say "Compeletion time: About #{completion_time} minutes"
150
+ else
151
+ say "Compeletion time: Less than 1 minute"
152
+ end
153
+
154
+ say "Queue: #{task["queue"]}"
155
+ end
128
156
  }
129
157
 
130
158
  # Public: Log into the Acquia Cloud API.
@@ -273,11 +301,7 @@ class Acquia < Thor
273
301
  if options[:database] && options[:environment]
274
302
  database = acquia_api_call "sites/#{subscription}/envs/#{options[:environment]}/dbs/#{options[:database]}"
275
303
  say
276
- say "> Username: #{database["username"]}"
277
- say "> Password: #{database["password"]}"
278
- say "> Host: #{database["host"]}"
279
- say "> DB cluster: #{database["db_cluster"]}"
280
- say "> Instance name: #{database["instance_name"]}"
304
+ output_database_instance(database)
281
305
  return
282
306
  end
283
307
 
@@ -287,11 +311,7 @@ class Acquia < Thor
287
311
  databases.each do |db|
288
312
  say
289
313
  say "#{db["name"]}"
290
- say "> Username: #{db["username"]}"
291
- say "> Password: #{db["password"]}"
292
- say "> Host: #{db["host"]}"
293
- say "> DB cluster: #{db["db_cluster"]}"
294
- say "> Instance name: #{db["instance_name"]}"
314
+ output_database_instance(db)
295
315
  end
296
316
  else
297
317
  subscription_envs = [options[:environment]]
@@ -491,6 +511,40 @@ class Acquia < Thor
491
511
  deploy_code = acquia_api_call "sites/#{subscription}/envs/#{environment}/code-deploy", "CODE-DEPLOY-POST", :release => "#{release}"
492
512
  success "#{release} has been deployed to #{environment}." if deploy_code["id"]
493
513
  end
514
+
515
+ # Public: Show tasks for a subscription.
516
+ #
517
+ # Returns a listing of tasks for a subscription.
518
+ desc "list-tasks <subscription>", "Display tasks associated with a subscription."
519
+ option :count, :aliases => "-c"
520
+ option :queue, :aliases => "-q"
521
+ def list_tasks(subscription)
522
+ all_tasks = acquia_api_call "sites/#{subscription}/tasks"
523
+ tasks = []
524
+
525
+ # Fetch a single queue from the tasks list if the queue parameter is set
526
+ # otherwise just add all the tasks.
527
+ if options[:queue]
528
+ all_tasks.each do |task|
529
+ if task["queue"] == options[:queue]
530
+ tasks << task
531
+ end
532
+ end
533
+ else
534
+ all_tasks.each do |task|
535
+ tasks << task
536
+ end
537
+ end
538
+
539
+ # If there is a count to return, restrict it to that required amount.
540
+ if options[:count] && tasks.any?
541
+ tasks = tasks.last(options[:count].to_i)
542
+ end
543
+
544
+ tasks.each do |task|
545
+ output_task_item(task)
546
+ end
547
+ end
494
548
  end
495
549
 
496
550
  Acquia.start
@@ -1,3 +1,3 @@
1
1
  module AcquiaToolbelt
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acquia_toolbelt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Bednarz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-11 00:00:00.000000000 Z
11
+ date: 2013-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -164,3 +164,4 @@ signing_key:
164
164
  specification_version: 4
165
165
  summary: ''
166
166
  test_files: []
167
+ has_rdoc: