Impatient 1.0.0

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/imp +33 -0
  2. data/lib/impatient.rb +32 -0
  3. metadata +48 -0
data/bin/imp ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'impatient'
4
+
5
+ $open_when_ready = false
6
+
7
+ ARGV.each do |arg|
8
+ case arg
9
+ when "-v", "--version"
10
+ puts "***"
11
+ puts "Impatient v#{Impatient.version}"
12
+ puts "***"
13
+ abort
14
+ when "-h", "--help"
15
+ puts "Impatient is the impatient ones among the Heroku userbase. Essentially, it runs 'heroku ps' repeatedly until the status stops indicating that the app is in the process of starting\n\n"
16
+ puts "If the app's ready to go, it'll tell you. If there are any problems and the app can't start, it'll tell you that too and fetch the logs for you.\n\n"
17
+ puts "===================="
18
+ puts "Command line options"
19
+ puts "====================\n\n"
20
+ puts "-h or --help - Show this message"
21
+ puts "-v or --version - Show the current version of Impatient gem"
22
+ puts "-o or --open - Open the Heroku app once it's ready to go\n\n"
23
+ puts "--------------------------------------------"
24
+ puts "by Tim Rogers (https://github.com/timrogers)"
25
+ puts "--------------------------------------------\n\n"
26
+ exit
27
+ when "-o", "--open"
28
+ puts "I'll open the app once it's ready.\n\n"
29
+ $open_when_ready = true
30
+ end
31
+ end
32
+
33
+ Impatient.execute($open_when_ready)
@@ -0,0 +1,32 @@
1
+ class Impatient
2
+ VERSION = "1.0.0"
3
+
4
+ def self.execute(open_when_ready = false)
5
+ ready = false
6
+ while !ready do
7
+ print "."
8
+ ps = `heroku ps`
9
+ ready = true if !ps.include?("starting")
10
+ end
11
+
12
+ puts "\n\n"
13
+ if ps.include?("up")
14
+ puts "The app is ready to go:\n\n"
15
+ puts ps
16
+ if open_when_ready
17
+ `heroku open`
18
+ puts "\nLaunching app..."
19
+ end
20
+ else
21
+ puts "Something went wrong when the app was launching - the process responded:\n\n"
22
+ puts ps
23
+ puts "\n\nFetching logs from Heroku...\n\n"
24
+ print `heroku logs`
25
+ end
26
+ end
27
+
28
+ def self.version
29
+ "1.0.0"
30
+ end
31
+
32
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Impatient
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tim Rogers
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-08 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Some of us are impatient. At least, I am - when I deploy an update to
15
+ my app to Heroku, I want to know whether it's ready. This tells you.
16
+ email: tim@gocardless.com
17
+ executables:
18
+ - imp
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - lib/impatient.rb
23
+ - bin/imp
24
+ homepage: https://github.com/timrogers/impatient-gem
25
+ licenses: []
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 1.8.24
45
+ signing_key:
46
+ specification_version: 3
47
+ summary: A quick command to let you know when a Heroku app is ready to go
48
+ test_files: []