dory 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dory/dnsmasq.rb +3 -2
- data/lib/dory/docker_service.rb +3 -3
- data/lib/dory/proxy.rb +3 -2
- data/lib/dory/resolv.rb +1 -1
- data/lib/dory/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24ed2be8a0779c79e065254bb945ec059a634311
|
4
|
+
data.tar.gz: 72ff9651d83a7c410e4da03c57b66aae256aab2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec1f1020ece19da5c743020935467144bbdbc82f88f5e691f00776a3756093f1e5164b8417f9e2c502b6ac82bf729abd239ccc14b40decbe68ee8ff720da3a50
|
7
|
+
data.tar.gz: 56942f8bfaaa25e2acf542a8b48f477b2ae348959bddff4585fb6585e51990701c693aba36d1026d87aedd8fa53e4fba6cd590eacfe1b0a4859d4d9607310bf3
|
data/lib/dory/dnsmasq.rb
CHANGED
@@ -21,8 +21,9 @@ module Dory
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.run_cmd(domain = self.domain, addr = self.addr)
|
24
|
-
"docker run -d -p 53:53/tcp -p 53:53/udp --name=#{self.container_name} " \
|
25
|
-
"--cap-add=NET_ADMIN #{self.dnsmasq_image_name}
|
24
|
+
"docker run -d -p 53:53/tcp -p 53:53/udp --name=#{Shellwords.escape(self.container_name)} " \
|
25
|
+
"--cap-add=NET_ADMIN #{Shellwords.escape(self.dnsmasq_image_name)} " \
|
26
|
+
"#{Shellwords.escape(self.domain)} #{Shellwords.escape(self.addr)}"
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
data/lib/dory/docker_service.rb
CHANGED
@@ -3,7 +3,7 @@ module Dory
|
|
3
3
|
def start
|
4
4
|
unless self.running?
|
5
5
|
success = if self.container_exists?
|
6
|
-
Sh.run_command("docker start #{self.container_name}")
|
6
|
+
Sh.run_command("docker start #{Shellwords.escape(self.container_name)}")
|
7
7
|
else
|
8
8
|
Sh.run_command(self.run_cmd).success?
|
9
9
|
end
|
@@ -39,14 +39,14 @@ module Dory
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def stop(container_name = self.container_name)
|
42
|
-
Sh.run_command("docker kill #{container_name}") if self.running?
|
42
|
+
Sh.run_command("docker kill #{Shellwords.escape(container_name)}") if self.running?
|
43
43
|
!self.running?
|
44
44
|
end
|
45
45
|
|
46
46
|
def delete(container_name = self.container_name)
|
47
47
|
if self.container_exists?
|
48
48
|
self.stop if self.running?
|
49
|
-
Sh.run_command("docker rm #{container_name}")
|
49
|
+
Sh.run_command("docker rm #{Shellwords.escape(container_name)}")
|
50
50
|
end
|
51
51
|
!self.container_exists?
|
52
52
|
end
|
data/lib/dory/proxy.rb
CHANGED
@@ -14,8 +14,9 @@ module Dory
|
|
14
14
|
|
15
15
|
def self.run_cmd
|
16
16
|
"docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock -e " \
|
17
|
-
|
18
|
-
|
17
|
+
"'CONTAINER_NAME=#{Shellwords.escape(self.container_name)}' --name " \
|
18
|
+
"'#{Shellwords.escape(self.container_name)}' " \
|
19
|
+
"#{Shellwords.escape(dinghy_http_proxy_image_name)}"
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
data/lib/dory/resolv.rb
CHANGED
@@ -69,7 +69,7 @@ module Dory
|
|
69
69
|
def self.write_to_file(contents)
|
70
70
|
# have to use this hack cuz we don't run as root :-(
|
71
71
|
puts "Requesting sudo to write to #{self.resolv_file}".green
|
72
|
-
Bash.run_command("echo -e '#{contents}' | sudo tee #{self.resolv_file} >/dev/null")
|
72
|
+
Bash.run_command("echo -e '#{contents}' | sudo tee #{Shellwords.escape(self.resolv_file)} >/dev/null")
|
73
73
|
end
|
74
74
|
|
75
75
|
def self.resolv_file_contents
|
data/lib/dory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Porter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|