heroku-shortcuts 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +6 -14
  2. data/README.md +5 -0
  3. data/bin/h +17 -5
  4. data/heroku-shortcuts.gemspec +10 -3
  5. metadata +10 -5
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZTQzODU1ZjczYTMyZTJkOWU1OGRiODlhNzBhYjRhNzgxYzg4YzMxZQ==
5
- data.tar.gz: !binary |-
6
- NmRlNmE3OTQ1M2YyYjJhOGM0NWMwNjQ2N2VlNzRjYmIwODlmMjZhYQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZDk5Y2FhNDIwNmIyMGQwMjM5NDFjMzFmMThkMWE2NTYwYTFkOTg0ZmE1Y2Mw
10
- OTRlZWMyMjJjZGQ5ZTUzZGJlNmUwOTAwOGRkNjk2MGFhYTg4ZDZhMWZmZWEy
11
- ZTNkNzI0ZjQ3NWNlMDgxZjg1NTA4NDg2YzM3NTk4YmU1N2M3NWE=
12
- data.tar.gz: !binary |-
13
- YTI3YmExM2M3OTRiMThmMDkzOWFhYTAxOTkwOTFhM2E3ZWIzOTE5YjJmYjhh
14
- YTYxYzg4Y2ViMTgzMmY5MzhkMjM2M2U4NTZlNzhmNjAyMzJmZDI5ZTE5YTZj
15
- NTgxM2Q3OThhNTRlNzg3MjY5NGY5Njk2OTUwOTM5ZjI5MzRhZjU=
2
+ SHA1:
3
+ metadata.gz: 3a352ec9d15744aa78c7701195cfc0d07ac55996
4
+ data.tar.gz: 7838af08c998c66c569eb13c1d58026c43a6555e
5
+ SHA512:
6
+ metadata.gz: a6745933055cfe0e91fc8523a34f85a5565a8066d84a7af99c9192aa5222d4c2ab72b864e963cdad40c01caf9ffad52a4608175f7207834446579f34e227848e
7
+ data.tar.gz: ec5eab58a98d85cffec6a731f98506a9488871b15731aa2cc3f0ee87393bec292d2c1f7d9871af231dd3b973cf76f18eb13cbfb884e74f98620d774e81a3942d
data/README.md CHANGED
@@ -10,6 +10,11 @@ Executing 'heroku logs -t --app heroku-production'...
10
10
  ```
11
11
 
12
12
  ### Installation
13
+ ##### From Rubygems
14
+ ```bash
15
+ gem install heroku-shortcuts
16
+ ```
17
+
13
18
  ##### Building Locally
14
19
  ```bash
15
20
  gem build heroku-shortcuts.gemspec
data/bin/h CHANGED
@@ -42,9 +42,9 @@ actions = {
42
42
  graphite: 'addons:open hostedgraphite',
43
43
  librato: 'addons:open librato',
44
44
  # Backups
45
- backups: 'pgbackups',
46
- capture: 'pgbackups:capture',
47
- grab: 'pgbackups:url',
45
+ backups: 'pg:backups',
46
+ capture: 'pg:backups capture',
47
+ grab: 'pg:backups url',
48
48
  # No mapping, but listed for completeness
49
49
  ps: 'ps',
50
50
  addons: 'addons',
@@ -75,6 +75,16 @@ def get_rmq_addon(env)
75
75
  multiple_addon_handle('RMQ', /rabbitmq|amqp/i, env)
76
76
  end
77
77
 
78
+ # Selects a follower
79
+ def follower_database(env)
80
+ dbs = %x[heroku pg:info --app #{env}]
81
+ .split("\n")
82
+ .grep(/=== HEROKU_POSTGRESQL/)
83
+
84
+ follower = dbs.detect { |db| db !~ /DATABASE_URL/ }
85
+ return follower.delete('=') if follower
86
+ end
87
+
78
88
  if not action_key or action_key =~ /help/i
79
89
  puts "Usage: 'h <action> <environment>'"
80
90
  puts "\nActions:"
@@ -101,9 +111,11 @@ real_action = case action
101
111
  # develop a much more scalable approach to this app.
102
112
  if action_key == 'pg'
103
113
  db = action_args[0] # Assume the first arg (if any) to pg is a DB color
104
- if db and not db =~ /HEROKU/
105
- action_args[0] = "HEROKU_POSTGRESQL_#{action_args[0].upcase}"
114
+ db = follower_database(real_environment) unless db
115
+ if db && db !~ /HEROKU|DATABASE_URL/
116
+ db = "HEROKU_POSTGRESQL_#{action_args[0].upcase}"
106
117
  end
118
+ action_args[0] = db
107
119
  end
108
120
 
109
121
  # Logs specific logic -- add the '-p' arg
@@ -2,11 +2,18 @@
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
+ AUTHORS = [
6
+ ["Rick Dillon", "rpdillon@apartmentlist.com"],
7
+ ["Adam Derewecki", "adam@apartmentlist.com" ],
8
+ ["Kristján Pétursson", "kristjan@apartmentlist.com"],
9
+ ["Heidi Galbraith", "heidi@apartmentlist.com" ]
10
+ ]
11
+
5
12
  Gem::Specification.new do |spec|
6
13
  spec.name = "heroku-shortcuts"
7
- spec.version = "0.0.1"
8
- spec.authors = ["Rick Dillon", "Adam Derewecki"]
9
- spec.email = ["rpdillon@apartmentlist.com", "adam@apartmentlist.com"]
14
+ spec.version = "0.0.3"
15
+ spec.authors = AUTHORS.map(&:first)
16
+ spec.email = AUTHORS.map(&:last)
10
17
  spec.description = %q{Shortcuts for the Heroku CLI}
11
18
  spec.summary = %q{Shortcuts for the Heroku CLI}
12
19
  spec.homepage = "https://github.com/apartmentlist/h"
metadata CHANGED
@@ -1,20 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-shortcuts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Dillon
8
8
  - Adam Derewecki
9
+ - Kristján Pétursson
10
+ - Heidi Galbraith
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
- date: 2013-09-13 00:00:00.000000000 Z
14
+ date: 2015-07-20 00:00:00.000000000 Z
13
15
  dependencies: []
14
16
  description: Shortcuts for the Heroku CLI
15
17
  email:
16
18
  - rpdillon@apartmentlist.com
17
19
  - adam@apartmentlist.com
20
+ - kristjan@apartmentlist.com
21
+ - heidi@apartmentlist.com
18
22
  executables:
19
23
  - h
20
24
  extensions: []
@@ -34,18 +38,19 @@ require_paths:
34
38
  - lib
35
39
  required_ruby_version: !ruby/object:Gem::Requirement
36
40
  requirements:
37
- - - ! '>='
41
+ - - ">="
38
42
  - !ruby/object:Gem::Version
39
43
  version: '0'
40
44
  required_rubygems_version: !ruby/object:Gem::Requirement
41
45
  requirements:
42
- - - ! '>='
46
+ - - ">="
43
47
  - !ruby/object:Gem::Version
44
48
  version: '0'
45
49
  requirements: []
46
50
  rubyforge_project:
47
- rubygems_version: 2.0.3
51
+ rubygems_version: 2.4.6
48
52
  signing_key:
49
53
  specification_version: 4
50
54
  summary: Shortcuts for the Heroku CLI
51
55
  test_files: []
56
+ has_rdoc: false