Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-static
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-static
Commits
c378c665
Commit
c378c665
authored
Jul 14, 2016
by
Terence Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move tmpdir handling into ProxyRunner
parent
a9d6c9ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
14 deletions
+27
-14
app_runner.rb
spec/support/app_runner.rb
+1
-13
proxy_runner.rb
spec/support/proxy_runner.rb
+26
-1
No files found.
spec/support/app_runner.rb
View file @
c378c665
...
...
@@ -17,7 +17,6 @@ class AppRunner
def
initialize
(
fixture
,
proxy
=
nil
,
env
=
{},
debug
=
false
,
delete
=
true
)
@run
=
false
@debug
=
debug
@tmpdir
=
nil
@proxy
=
nil
@delete
=
delete
env
.
merge!
(
"STATIC_DEBUG"
=>
"true"
)
if
@debug
...
...
@@ -32,16 +31,7 @@ class AppRunner
}
if
proxy
if
proxy
.
is_a?
(
String
)
@tmpdir
=
Dir
.
mktmpdir
File
.
open
(
"
#{
@tmpdir
}
/config.ru"
,
"w"
)
do
|
file
|
file
.
puts
%q{require "sinatra"}
file
.
puts
proxy
file
.
puts
"run Sinatra::Application"
end
end
@proxy
=
ProxyRunner
.
new
(
@tmpdir
,
@delete
)
@proxy
=
ProxyRunner
.
new
(
proxy
,
@delete
)
app_options
[
"Links"
]
=
[
"
#{
@proxy
.
id
}
:proxy"
]
@proxy
.
start
...
...
@@ -107,8 +97,6 @@ class AppRunner
end
@router
.
destroy
@app
.
delete
(
force:
true
)
if
@delete
ensure
FileUtils
.
rm_rf
(
@tmpdir
)
if
@tmpdir
end
private
...
...
spec/support/proxy_runner.rb
View file @
c378c665
require
"tmpdir"
require_relative
"proxy_builder"
require_relative
"container_runner"
class
ProxyRunner
<
ContainerRunner
def
initialize
(
config_ru
=
nil
,
delete
=
true
)
@tmpdir
=
write_config_ru
(
config_ru
)
options
=
{
"Image"
=>
ProxyBuilder
::
TAG
}
options
[
"HostConfig"
]
=
{
"Binds"
=>
[
"
#{
config_ru
}
:/app/config/"
]
}
if
config_ru
options
[
"HostConfig"
]
=
{
"Binds"
=>
[
"
#{
@tmpdir
}
:/app/config/"
]
}
if
@tmpdir
super
(
options
,
delete
)
end
def
destroy
super
ensure
FileUtils
.
rm_rf
(
@tmpdir
)
if
@tmpdir
end
private
def
write_config_ru
(
config_ru
)
tmpdir
=
nil
if
config_ru
&&
config_ru
.
is_a?
(
String
)
tmpdir
=
Dir
.
mktmpdir
File
.
open
(
"
#{
tmpdir
}
/config.ru"
,
"w"
)
do
|
file
|
file
.
puts
%q{require "sinatra"}
file
.
puts
config_ru
file
.
puts
"run Sinatra::Application"
end
end
tmpdir
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment