File: plugin.rb

package info (click to toggle)
vagrant 2.2.14%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,800 kB
  • sloc: ruby: 97,301; sh: 375; makefile: 16; lisp: 1
file content (86 lines) | stat: -rw-r--r-- 2,211 bytes parent folder | download | duplicates (4)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
module VagrantPlugins
  module DockerProvider
    autoload :Action, File.expand_path("../action", __FILE__)
    autoload :Driver, File.expand_path("../driver", __FILE__)
    autoload :Errors, File.expand_path("../errors", __FILE__)

    module Executor
      autoload :Local, File.expand_path("../executor/local", __FILE__)
      autoload :Vagrant, File.expand_path("../executor/vagrant", __FILE__)
    end

    class Plugin < Vagrant.plugin("2")
      name "docker-provider"
      description <<-EOF
      The Docker provider allows Vagrant to manage and control
      Docker containers.
      EOF

      provider(:docker, box_optional: true, parallel: true, defaultable: false) do
        require_relative 'provider'
        init!
        Provider
      end

      command("docker-exec", primary: false) do
        require_relative "command/exec"
        init!
        Command::Exec
      end

      command("docker-logs", primary: false) do
        require_relative "command/logs"
        init!
        Command::Logs
      end

      command("docker-run", primary: false) do
        require_relative "command/run"
        init!
        Command::Run
      end

      communicator(:docker_hostvm) do
        require_relative "communicator"
        init!
        Communicator
      end

      config(:docker, :provider) do
        require_relative 'config'
        init!
        Config
      end

      synced_folder(:docker) do
        require File.expand_path("../synced_folder", __FILE__)
        SyncedFolder
      end

      provider_capability("docker", "public_address") do
        require_relative "cap/public_address"
        Cap::PublicAddress
      end

      provider_capability("docker", "proxy_machine") do
        require_relative "cap/proxy_machine"
        Cap::ProxyMachine
      end

      provider_capability("docker", "has_communicator") do
        require_relative "cap/has_communicator"
        Cap::HasCommunicator
      end

      protected

      def self.init!
        return if defined?(@_init)
        I18n.load_path << File.expand_path(
          "templates/locales/providers_docker.yml", Vagrant.source_root)
        I18n.reload!
        @_init = true
      end
    end
  end
end