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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 728ff696590cecbe3c4a340d55e4c7bf1ffba8d8
4
- data.tar.gz: 3579c8d0f9270e0a57d7cf964728371ab890f14c
3
+ metadata.gz: 24ed2be8a0779c79e065254bb945ec059a634311
4
+ data.tar.gz: 72ff9651d83a7c410e4da03c57b66aae256aab2c
5
5
  SHA512:
6
- metadata.gz: 57821f82dbe7f75ce71bb6d8f023301a9d4f288cf6bd9513471e9d95c2ff76d12e8f80468eb5ea28b76aaa82325cb8c814d6feced4a8a5bc017b2b24392bcdeb
7
- data.tar.gz: 5766c5e38ba39d3c05abd9fc28aa958c8aa574fbc6dfe2dedd4ab5ed82363e949524ffca8c5c9b4b688dcf34c8b7a2dc0ce1adf29906a5613c31ca7420d88f46
6
+ metadata.gz: ec1f1020ece19da5c743020935467144bbdbc82f88f5e691f00776a3756093f1e5164b8417f9e2c502b6ac82bf729abd239ccc14b40decbe68ee8ff720da3a50
7
+ data.tar.gz: 56942f8bfaaa25e2acf542a8b48f477b2ae348959bddff4585fb6585e51990701c693aba36d1026d87aedd8fa53e4fba6cd590eacfe1b0a4859d4d9607310bf3
@@ -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} #{self.domain} #{self.addr}"
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
@@ -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
@@ -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
- "'CONTAINER_NAME=#{self.container_name}' --name " \
18
- "'#{self.container_name}' #{dinghy_http_proxy_image_name}"
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Dory
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
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-08 00:00:00.000000000 Z
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize