Module: Sidedock
- Defined in:
- lib/sidedock/configuration.rb,
lib/sidedock.rb,
lib/sidedock/cli.rb,
lib/sidedock/base.rb,
lib/sidedock/image.rb,
lib/sidedock/ports.rb,
lib/sidedock/machine.rb,
lib/sidedock/container.rb,
lib/sidedock/cli/docker_cli.rb,
lib/sidedock/cli/machine_cli.rb,
lib/sidedock/port_configuration.rb
Overview
Allow gem users to do:
Sidedock.configure do |config|
config.debug = true
end
Defined Under Namespace
Classes: Base, CLI, Configuration, Container, DockerCLI, Image, Machine, MachineCLI, PortConfiguration, Ports
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
Class Method Summary collapse
- .base_directory ⇒ Object
- .configure {|configuration| ... } ⇒ Object
- .path_to_dockerfile(name) ⇒ Object
- .with_docker_image(image, options = {}) {|container| ... } ⇒ Object
- .with_dockerfile(name, options = {}, &block) ⇒ Object
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
9 10 11 |
# File 'lib/sidedock/configuration.rb', line 9 def configuration @configuration end |
Class Method Details
.base_directory ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/sidedock.rb', line 30 def base_directory case ENV['RAILS_ENV'] when 'test' 'spec' else 'app' end end |
.configure {|configuration| ... } ⇒ Object
13 14 15 |
# File 'lib/sidedock/configuration.rb', line 13 def self.configure yield configuration end |
.path_to_dockerfile(name) ⇒ Object
24 25 26 27 28 |
# File 'lib/sidedock.rb', line 24 def path_to_dockerfile(name) path = Rails.root.join base_directory, 'docker', name raise "Dockerfile path `#{path}` not found" unless File.exist? path path end |
.with_docker_image(image, options = {}) {|container| ... } ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/sidedock.rb', line 6 def with_docker_image(image, = {}, &block) container = Sidedock::Container.create image, container.start yield container container.stop container.remove unless [:keep_image] end |
.with_dockerfile(name, options = {}, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/sidedock.rb', line 14 def with_dockerfile(name, = {}, &block) image = Sidedock::Image.build path_to_dockerfile(name) with_docker_image image.id, do |container| yield container end image.remove end |