vagrant-docker-env 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5febafe7cc6c4d36b48ba03c45aa764a196ebb8d
4
+ data.tar.gz: 343d104431879ed4dd30903dda3c25364b8bcbdf
5
+ SHA512:
6
+ metadata.gz: 060552838b521bf21c326a47d0fe9c5fc7ceff1577e3b389ebe39bcfcedd15ac8651b026f26a2b65051f6d6d39aa66fc351459b583531529a09d26cc506a7562
7
+ data.tar.gz: 9d150dde148591cedcf50fe9721592855a17b25e9dc95e53c6c5d877f4024a56d4aa45bc421ecb22e4177e044ef2bd7f4e1d2509ba1defd10b7288963c2bbe8c
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
5
+ end
6
+
7
+ group :plugins do
8
+ gem 'vagrant-docker-env', path: '.'
9
+ end
10
+
11
+ # Specify your gem's dependencies in vagrant-docker-env.gemspec
12
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Kenneth Ballenegger
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # Vagrant::Docker::Env
2
+
3
+ This gem is super ghetto... it should not be used by anybody except for me. The
4
+ unfortunate sitation is that Vagrant requires a real RubyGem in order to use a
5
+ plugin, and for that reason this is published publically.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'vagrant-docker-env'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install vagrant-docker-env
22
+
23
+ ## Usage
24
+
25
+ If you insist on using this, it’s pretty simple. Add this snippet to your
26
+ Vagrantfile:
27
+
28
+ ```ruby
29
+ $DOCKER_ENV = {
30
+ DOCKER_TLS_VERIFY: '',
31
+ DOCKER_HOST: 'tcp://...',
32
+ }
33
+ ```
34
+
35
+ Then, this plugin makes the `docker-env` command available, which you can use in
36
+ one of two ways:
37
+
38
+ eval $(vagrant docker-env)
39
+
40
+ This will add those environment variables to your current shell.
41
+
42
+ vagrant docker-env -- docker ps
43
+ vagrant docker-env -- fig up
44
+
45
+ Any commands typed after `vagrant docker-env --` will be run with those
46
+ variables set in their environment.
47
+
48
+ The purpose of this plugin is to facilitate running Docker containers on OS X.
49
+ The Docker-Vagrant integration is not used. Instead, Vagrant is used to run
50
+ a VM which contains the Docker host, after which Docker is used natively with
51
+ the help of this `docker-env` command.
52
+
53
+ With this command, it’s easy to use multiple Docker hosts simultaneously, which
54
+ is useful when working with more than one project.
55
+
56
+ ## Contributing
57
+
58
+ 1. Fork it ( https://github.com/[my-github-username]/vagrant-docker-env/fork )
59
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
60
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
61
+ 4. Push to the branch (`git push origin my-new-feature`)
62
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/Vagrantfile ADDED
@@ -0,0 +1,5 @@
1
+ STDERR.puts 'REQUIRED'
2
+ $DOCKER_ENV = {
3
+ DOCKER_TLS_VERIFY: '',
4
+ DOCKER_HOST: 'tcp://...',
5
+ }
@@ -0,0 +1 @@
1
+ require 'vagrant/docker/env'
@@ -0,0 +1,10 @@
1
+ require 'vagrant/docker/env/version'
2
+
3
+ class DockerEnv < Vagrant.plugin('2')
4
+ name 'My Plugin'
5
+
6
+ command 'docker-env' do
7
+ require 'vagrant/docker/env/command'
8
+ DockerEnvCommand
9
+ end
10
+ end
@@ -0,0 +1,40 @@
1
+
2
+ # Reads the docker env from the global $DOCKER_ENV
3
+ #
4
+ class DockerEnvCommand < Vagrant.plugin(2, :command)
5
+
6
+ def execute
7
+ marker_found = false
8
+ subcommand, _ = ARGV.partition do |e|
9
+ marker_found.tap do |_|
10
+ marker_found = true if e == '--'
11
+ end
12
+ end
13
+ load_config
14
+ if subcommand.empty?
15
+ print_env
16
+ else
17
+ execute_subcommand(subcommand)
18
+ end
19
+ 0
20
+ end
21
+
22
+ def load_config
23
+ loader = @env.config_loader
24
+ loader.load([])
25
+ end
26
+
27
+ def execute_subcommand(subcommand)
28
+ ($DOCKER_ENV || {}).each do |k,v|
29
+ ENV[k.to_s] = v
30
+ end
31
+ system(*subcommand)
32
+ end
33
+
34
+ def print_env
35
+ str = ($DOCKER_ENV || {}).map do |k,v|
36
+ "export #{k}=\"#{v}\""
37
+ end.join("\n")
38
+ STDOUT.puts str
39
+ end
40
+ end
@@ -0,0 +1,7 @@
1
+ module Vagrant
2
+ module Docker
3
+ module Env
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant/docker/env/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'vagrant-docker-env'
8
+ spec.version = Vagrant::Docker::Env::VERSION
9
+ spec.authors = ['Kenneth Ballenegger']
10
+ spec.email = ['kenneth@ballenegger.com']
11
+ spec.summary = %q{Don't use this, or read the README.}
12
+ spec.description = %q{Don't use this, or read the README.}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.7'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-docker-env
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kenneth Ballenegger
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Don't use this, or read the README.
42
+ email:
43
+ - kenneth@ballenegger.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - Vagrantfile
54
+ - lib/vagrant-docker-env.rb
55
+ - lib/vagrant/docker/env.rb
56
+ - lib/vagrant/docker/env/command.rb
57
+ - lib/vagrant/docker/env/version.rb
58
+ - vagrant-docker-env.gemspec
59
+ homepage: ''
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.2.2
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Don't use this, or read the README.
83
+ test_files: []
84
+ has_rdoc: