forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp-engine-python.rb
64 lines (59 loc) · 1.54 KB
/
app-engine-python.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
class AppEnginePython < Formula
desc "Google App Engine"
homepage "https://cloud.google.com/appengine/docs"
url "https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.86.zip"
sha256 "8a1d57f8819792a4c18bc337762f73f3bf207da986fd6028e3e591f24cfde9f2"
bottle :unneeded
def install
pkgshare.install Dir["*"]
%w[
_python_runtime.py
_php_runtime.py
api_server.py
appcfg.py
backends_conversion.py
bulkload_client.py
bulkloader.py
dev_appserver.py
download_appstats.py
endpointscfg.py
gen_protorpc.py
php_cli.py
remote_api_shell.py
run_tests.py
wrapper_util.py
].each do |fn|
bin.install_symlink share/name/fn
end
end
test do
(testpath/"app.yaml").write <<~EOS
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: main.app
EOS
(testpath/"main.py").write <<~EOS
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, World!')
app = webapp2.WSGIApplication([
('/', MainPage),
], debug=True)
EOS
begin
pid = fork do
exec "#{pkgshare}/dev_appserver.py app.yaml --skip_sdk_update_check"
end
sleep 5
output = shell_output("curl -s http://localhost:8080/")
assert_equal "Hello, World!", output.chomp
ensure
Process.kill("HUP", pid)
end
end
end