zenslap 0.2.3 → 0.2.4
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/zenslap +35 -14
- data/zenslap.gemspec +1 -1
- metadata +3 -3
data/bin/zenslap
CHANGED
@@ -1,23 +1,44 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
require 'rubygems'
|
4
|
+
require 'heroku'
|
5
|
+
require 'heroku/command'
|
6
|
+
require 'ruby-debug'
|
7
|
+
|
8
|
+
def error_out(message)
|
9
|
+
puts message
|
10
|
+
exit 1
|
11
|
+
end
|
12
|
+
|
13
|
+
def find_app
|
14
|
+
github_url = `git config --get remote.origin.url`
|
15
|
+
zenslap_id = github_url[/github.com.(.+)/, 1].gsub(/\.git$/, "")
|
16
|
+
error_out "Unable to find zenslap id" unless zenslap_id
|
17
|
+
puts "Searching for a heroku app for #{zenslap_id}"
|
18
|
+
heroku = Heroku::Command::Auth.new(nil).client
|
19
|
+
app = heroku.list.map{|a|a[0]}.find do |app|
|
20
|
+
heroku.config_vars(app)['ZENSLAP_ID'] == zenslap_id
|
21
|
+
end
|
22
|
+
error_out "Failed!" unless app
|
23
|
+
puts "Found #{app}"
|
24
|
+
app
|
25
|
+
end
|
26
|
+
|
27
|
+
def retrieve_app
|
28
|
+
@app ||= %x{ git config zenslap.zenslap }
|
29
|
+
end
|
30
|
+
|
31
|
+
def store_app(name)
|
32
|
+
system "git config zenslap.zenslap #{name}"
|
6
33
|
end
|
7
34
|
|
8
35
|
def app
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
if unvalidated_app == ""
|
14
|
-
# retry
|
15
|
-
elsif valid_app? unvalidated_app
|
16
|
-
system "git config zenslap.zenslap #{unvalidated_app}"
|
17
|
-
app = unvalidated_app
|
18
|
-
end
|
36
|
+
name = retrieve_app
|
37
|
+
if name == ""
|
38
|
+
name = find_app
|
39
|
+
store_app(name)
|
19
40
|
end
|
20
|
-
|
41
|
+
name
|
21
42
|
end
|
22
43
|
|
23
44
|
exec "heroku #{ARGV.join(" ")} --app #{app}"
|
data/zenslap.gemspec
CHANGED
metadata
CHANGED