docker-spoon 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +55 -0
- data/LICENSE.txt +22 -0
- data/README.md +22 -0
- data/README.rdoc +19 -0
- data/Rakefile +61 -0
- data/bin/spoon +5 -0
- data/docker/Dockerfile +53 -0
- data/docker/resources/log/run +2 -0
- data/docker/resources/run +3 -0
- data/docker/resources/zshrc.default +23 -0
- data/docker/runit/1 +5 -0
- data/docker/runit/2 +4 -0
- data/docker/runit/3 +3 -0
- data/features/spoon.feature +13 -0
- data/features/step_definitions/spoon_steps.rb +1 -0
- data/features/support/env.rb +16 -0
- data/lib/spoon.rb +230 -0
- data/lib/spoon/version.rb +3 -0
- data/spoon.gemspec +28 -0
- data/test/tc_something.rb +7 -0
- metadata +185 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
spoon (0.0.1)
|
5
|
+
docker-api (~> 1.11)
|
6
|
+
methadone (~> 1.4.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
archive-tar-minitar (0.5.2)
|
12
|
+
aruba (0.5.4)
|
13
|
+
childprocess (>= 0.3.6)
|
14
|
+
cucumber (>= 1.1.1)
|
15
|
+
rspec-expectations (>= 2.7.0)
|
16
|
+
builder (3.2.2)
|
17
|
+
childprocess (0.5.3)
|
18
|
+
ffi (~> 1.0, >= 1.0.11)
|
19
|
+
cucumber (1.3.15)
|
20
|
+
builder (>= 2.1.2)
|
21
|
+
diff-lcs (>= 1.1.3)
|
22
|
+
gherkin (~> 2.12)
|
23
|
+
multi_json (>= 1.7.5, < 2.0)
|
24
|
+
multi_test (>= 0.1.1)
|
25
|
+
diff-lcs (1.2.5)
|
26
|
+
docker-api (1.11.2)
|
27
|
+
archive-tar-minitar
|
28
|
+
excon (>= 0.37.0)
|
29
|
+
json
|
30
|
+
excon (0.37.0)
|
31
|
+
ffi (1.9.3)
|
32
|
+
gherkin (2.12.2)
|
33
|
+
multi_json (~> 1.3)
|
34
|
+
json (1.8.1)
|
35
|
+
methadone (1.4.0)
|
36
|
+
bundler
|
37
|
+
multi_json (1.10.1)
|
38
|
+
multi_test (0.1.1)
|
39
|
+
rake (0.9.6)
|
40
|
+
rdoc (4.1.1)
|
41
|
+
json (~> 1.4)
|
42
|
+
rspec-expectations (3.0.2)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.0.0)
|
45
|
+
rspec-support (3.0.2)
|
46
|
+
|
47
|
+
PLATFORMS
|
48
|
+
ruby
|
49
|
+
|
50
|
+
DEPENDENCIES
|
51
|
+
aruba
|
52
|
+
bundler (~> 1.6)
|
53
|
+
rake (~> 0.9.2)
|
54
|
+
rdoc
|
55
|
+
spoon!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Aaron Nichols
|
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,22 @@
|
|
1
|
+
# Spoon
|
2
|
+
|
3
|
+
Spoon with another developer using Docker & tmux. This is being ported
|
4
|
+
from another project and is functionaly incomplete right now
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
```
|
9
|
+
$ gem install spoon
|
10
|
+
```
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
Coming soon
|
15
|
+
|
16
|
+
## Contributing
|
17
|
+
|
18
|
+
1. Fork it ( https://github.com/adnichols/spoon/fork )
|
19
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
20
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
21
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
22
|
+
5. Create a new Pull Request
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= spoon - DESCRIBE YOUR GEM
|
2
|
+
|
3
|
+
Author:: YOUR NAME (YOUR EMAIL)
|
4
|
+
Copyright:: Copyright (c) 2014 YOUR NAME
|
5
|
+
|
6
|
+
|
7
|
+
DESCRIBE YOUR GEM HERE
|
8
|
+
|
9
|
+
== Links
|
10
|
+
|
11
|
+
* {Source on Github}[LINK TO GITHUB]
|
12
|
+
* RDoc[LINK TO RDOC.INFO]
|
13
|
+
|
14
|
+
== Install
|
15
|
+
|
16
|
+
== Examples
|
17
|
+
|
18
|
+
== Contributing
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
def dump_load_path
|
2
|
+
puts $LOAD_PATH.join("\n")
|
3
|
+
found = nil
|
4
|
+
$LOAD_PATH.each do |path|
|
5
|
+
if File.exists?(File.join(path,"rspec"))
|
6
|
+
puts "Found rspec in #{path}"
|
7
|
+
if File.exists?(File.join(path,"rspec","core"))
|
8
|
+
puts "Found core"
|
9
|
+
if File.exists?(File.join(path,"rspec","core","rake_task"))
|
10
|
+
puts "Found rake_task"
|
11
|
+
found = path
|
12
|
+
else
|
13
|
+
puts "!! no rake_task"
|
14
|
+
end
|
15
|
+
else
|
16
|
+
puts "!!! no core"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
if found.nil?
|
21
|
+
puts "Didn't find rspec/core/rake_task anywhere"
|
22
|
+
else
|
23
|
+
puts "Found in #{path}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
require 'bundler'
|
27
|
+
require 'rake/clean'
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
|
31
|
+
require 'cucumber'
|
32
|
+
require 'cucumber/rake/task'
|
33
|
+
gem 'rdoc' # we need the installed RDoc gem, not the system one
|
34
|
+
require 'rdoc/task'
|
35
|
+
|
36
|
+
include Rake::DSL
|
37
|
+
|
38
|
+
Bundler::GemHelper.install_tasks
|
39
|
+
|
40
|
+
|
41
|
+
Rake::TestTask.new do |t|
|
42
|
+
t.pattern = 'test/tc_*.rb'
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
CUKE_RESULTS = 'results.html'
|
47
|
+
CLEAN << CUKE_RESULTS
|
48
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
49
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
|
50
|
+
t.fork = false
|
51
|
+
end
|
52
|
+
|
53
|
+
Rake::RDocTask.new do |rd|
|
54
|
+
|
55
|
+
rd.main = "README.rdoc"
|
56
|
+
|
57
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
58
|
+
end
|
59
|
+
|
60
|
+
task :default => [:test,:features]
|
61
|
+
|
data/bin/spoon
ADDED
data/docker/Dockerfile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
FROM ubuntu:14.04
|
2
|
+
|
3
|
+
RUN locale-gen en_US.UTF-8
|
4
|
+
RUN apt-get update
|
5
|
+
RUN apt-get install -y python-software-properties
|
6
|
+
RUN apt-get install -y software-properties-common
|
7
|
+
RUN apt-get install -y python-setuptools
|
8
|
+
RUN add-apt-repository ppa:webupd8team/java
|
9
|
+
RUN apt-get update
|
10
|
+
RUN apt-get install -y zip
|
11
|
+
RUN apt-get install -y openssl
|
12
|
+
RUN apt-get install -y git
|
13
|
+
RUN apt-get install -y emacs24
|
14
|
+
RUN apt-get install -y tmux
|
15
|
+
RUN apt-get install -y ack-grep
|
16
|
+
RUN apt-get install -y python
|
17
|
+
RUN apt-get install -y wget
|
18
|
+
RUN apt-get install -y xsel
|
19
|
+
RUN apt-get install -y python-pip
|
20
|
+
RUN apt-get install -y zsh
|
21
|
+
RUN apt-get install -y curl
|
22
|
+
RUN apt-get install -y build-essential
|
23
|
+
RUN apt-get install -y runit
|
24
|
+
RUN apt-get install -y openssh-server
|
25
|
+
RUN apt-get install -y ruby
|
26
|
+
RUN apt-get install -y tree
|
27
|
+
RUN apt-get install -y vim
|
28
|
+
|
29
|
+
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
|
30
|
+
RUN echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
|
31
|
+
|
32
|
+
RUN apt-get -y install oracle-java7-installer
|
33
|
+
|
34
|
+
RUN easy_install httpie
|
35
|
+
RUN pip install https://github.com/Lokaltog/powerline/tarball/develop
|
36
|
+
|
37
|
+
RUN mkdir -p /etc/service
|
38
|
+
ADD resources /etc/service/ssh
|
39
|
+
ADD runit /etc/runit
|
40
|
+
|
41
|
+
RUN mkdir -p /var/run/sshd
|
42
|
+
|
43
|
+
RUN useradd -s /bin/zsh -m -d /home/pairing -g root pairing
|
44
|
+
RUN echo "pairing:pairing" | chpasswd
|
45
|
+
RUN echo "pairing ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
46
|
+
|
47
|
+
ADD resources/zshrc.default /home/pairing/.zshrc
|
48
|
+
|
49
|
+
RUN mkdir /home/pairing/projects
|
50
|
+
|
51
|
+
EXPOSE 22
|
52
|
+
|
53
|
+
ENTRYPOINT "/usr/sbin/runit"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Path to your oh-my-zsh configuration.
|
2
|
+
ZSH=$HOME/.oh-my-zsh
|
3
|
+
|
4
|
+
# Set name of the theme to load.
|
5
|
+
# Look in ~/.oh-my-zsh/themes/
|
6
|
+
# Optionally, if you set this to "random", it'll load a random theme each
|
7
|
+
# time that oh-my-zsh is loaded.
|
8
|
+
ZSH_THEME="git-taculous"
|
9
|
+
|
10
|
+
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
11
|
+
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
12
|
+
# Example format: plugins=(rails git textmate ruby lighthouse)
|
13
|
+
plugins=(bundler git)
|
14
|
+
|
15
|
+
source $ZSH/oh-my-zsh.sh
|
16
|
+
|
17
|
+
# Customize to your needs...
|
18
|
+
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin://bin
|
19
|
+
|
20
|
+
export LANGUAGE=en_US.UTF-8
|
21
|
+
export LC_ALL=en_US.UTF-8
|
22
|
+
export LANG=en_US.UTF-8
|
23
|
+
export LC_TYPE=en_US.UTF-8
|
data/docker/runit/1
ADDED
data/docker/runit/2
ADDED
data/docker/runit/3
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: My bootstrapped app kinda works
|
2
|
+
In order to get going on coding my awesome app
|
3
|
+
I want to have aruba and cucumber setup
|
4
|
+
So I don't have to do it myself
|
5
|
+
|
6
|
+
Scenario: App just runs
|
7
|
+
When I get help for "spoon"
|
8
|
+
Then the exit status should be 0
|
9
|
+
And the banner should be present
|
10
|
+
And the banner should document that this app takes options
|
11
|
+
And the following options should be documented:
|
12
|
+
|--version|
|
13
|
+
And the banner should document that this app takes no arguments
|
@@ -0,0 +1 @@
|
|
1
|
+
# Put your step definitions here
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
require 'methadone/cucumber'
|
3
|
+
|
4
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
5
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
6
|
+
|
7
|
+
Before do
|
8
|
+
# Using "announce" causes massive warnings on 1.9.2
|
9
|
+
@puts = true
|
10
|
+
@original_rubylib = ENV['RUBYLIB']
|
11
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
12
|
+
end
|
13
|
+
|
14
|
+
After do
|
15
|
+
ENV['RUBYLIB'] = @original_rubylib
|
16
|
+
end
|
data/lib/spoon.rb
ADDED
@@ -0,0 +1,230 @@
|
|
1
|
+
require "spoon/version"
|
2
|
+
require 'docker'
|
3
|
+
require 'json'
|
4
|
+
require 'pp'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
module Spoon
|
8
|
+
include Methadone::Main
|
9
|
+
include Methadone::CLILogging
|
10
|
+
include Methadone::SH
|
11
|
+
version(Spoon::VERSION)
|
12
|
+
|
13
|
+
main do |instance|
|
14
|
+
parse_config(options[:config])
|
15
|
+
pp options
|
16
|
+
if options[:list]
|
17
|
+
instance_list
|
18
|
+
elsif options["list-containers"]
|
19
|
+
# container_list
|
20
|
+
elsif options[:build]
|
21
|
+
image_build
|
22
|
+
elsif options[:destroy]
|
23
|
+
instance_destroy(apply_prefix(options[:destroy]))
|
24
|
+
elsif instance
|
25
|
+
instance_connect(apply_prefix(instance), options[:command])
|
26
|
+
else
|
27
|
+
help_now!("You either need to provide an action or an instance to connect to")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
description "Create & Connect to pairing environments in Docker"
|
33
|
+
|
34
|
+
# Actions
|
35
|
+
on("-l", "--list", "List available spoon instances")
|
36
|
+
on("-d", "--destroy NAME", "Destroy spoon instance with NAME")
|
37
|
+
on("-b", "--build", "Build image from Dockerfile using name passed to --image")
|
38
|
+
|
39
|
+
# Configurables
|
40
|
+
on("--builddir", "Directory containing Dockerfile")
|
41
|
+
on("--pre-build-commands", "List of commands to run locally before building image")
|
42
|
+
on("-u", "--url URL", "Docker url to connect to")
|
43
|
+
on("-L", "--list-containers", "List available spoon container images")
|
44
|
+
options[:image] = "spoon-pairing"
|
45
|
+
on("-i", "--image NAME", "Use image for spoon instance")
|
46
|
+
options[:prefix] = 'spoon-'
|
47
|
+
on("-p", "--prefix PREFIX", "Prefix for container names")
|
48
|
+
options[:command] = ''
|
49
|
+
options[:config] = "#{ENV['HOME']}/.spoonrc"
|
50
|
+
on("-c", "--config FILE", "Config file to use for spoon options")
|
51
|
+
on("--debug", "Enable debug")
|
52
|
+
|
53
|
+
arg(:instance, :optional, "Spoon instance to connect to")
|
54
|
+
|
55
|
+
use_log_level_option
|
56
|
+
|
57
|
+
def self.parse_config(config_file)
|
58
|
+
eval(File.open(config_file).read)
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.apply_prefix(name)
|
62
|
+
"spoon-#{name}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.remove_prefix(name)
|
66
|
+
if name.start_with? "/"
|
67
|
+
name[7..-1]
|
68
|
+
else
|
69
|
+
name[6..-1]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.image_build
|
74
|
+
# Run pre-build commands
|
75
|
+
options["pre-build-commands"].each do |command|
|
76
|
+
sh command
|
77
|
+
end
|
78
|
+
D "pre-build commands complete, building Docker image"
|
79
|
+
|
80
|
+
build_opts = { 't' => options[:image], 'rm' => true }
|
81
|
+
Docker::Image.build_from_dir(options[:build], build_opts) do |chunk|
|
82
|
+
print_docker_response(chunk)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.print_parsed_response(response)
|
87
|
+
case response
|
88
|
+
when Hash
|
89
|
+
response.each do |key, value|
|
90
|
+
case key
|
91
|
+
when 'stream'
|
92
|
+
puts value
|
93
|
+
else
|
94
|
+
puts "#{key}: #{value}"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
when Array
|
98
|
+
response.each do |hash|
|
99
|
+
print_parsed_response(hash)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.print_docker_response(json)
|
105
|
+
print_parsed_response(JSON.parse(json))
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.instance_connect(name, command='')
|
109
|
+
docker_url
|
110
|
+
if not instance_exists? name
|
111
|
+
puts "The `#{name}` container doesn't exist, creating..."
|
112
|
+
instance_create(name)
|
113
|
+
end
|
114
|
+
|
115
|
+
puts "Connecting to `#{name}`"
|
116
|
+
instance_ssh(name, command)
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.instance_list
|
120
|
+
docker_url
|
121
|
+
puts "List of available spoon containers:"
|
122
|
+
container_list = Docker::Container.all
|
123
|
+
container_list.each do |container|
|
124
|
+
name = container.info["Names"].first.to_s
|
125
|
+
if name.start_with? "/#{options[:prefix]}"
|
126
|
+
puts remove_prefix(name)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def self.instance_destroy(name)
|
132
|
+
docker_url
|
133
|
+
puts "destroy: #{name}"
|
134
|
+
container = get_container(name)
|
135
|
+
|
136
|
+
if container
|
137
|
+
puts "Destroying #{name}"
|
138
|
+
begin
|
139
|
+
container.kill
|
140
|
+
rescue
|
141
|
+
puts "Failed to kill container #{container.id}"
|
142
|
+
end
|
143
|
+
|
144
|
+
container.wait(10)
|
145
|
+
|
146
|
+
begin
|
147
|
+
container.delete(:force => true)
|
148
|
+
rescue
|
149
|
+
puts "Failed to remove container #{container.id}"
|
150
|
+
end
|
151
|
+
puts "Done!"
|
152
|
+
else
|
153
|
+
puts "No container named: #{name}"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def self.instance_exists?(name)
|
158
|
+
get_container(name)
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.instance_ssh(name, command='')
|
162
|
+
container = get_container(name)
|
163
|
+
host = URI.parse(options[:url]).host
|
164
|
+
if container
|
165
|
+
ssh_command = "\"#{command}\"" if not command.empty?
|
166
|
+
ssh_port = get_port('22', container)
|
167
|
+
puts "Waiting for #{name}:#{ssh_port}..." until host_available?(host, ssh_port)
|
168
|
+
exec("ssh -t -o StrictHostKeyChecking=no -p #{ssh_port} pairing@#{host} #{ssh_command}")
|
169
|
+
else
|
170
|
+
puts "No container named: #{container.inspect}"
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def self.get_container(name)
|
175
|
+
docker_url
|
176
|
+
container_list = Docker::Container.all
|
177
|
+
|
178
|
+
container_list.each do |container|
|
179
|
+
if container.info["Names"].first.to_s == "/#{name}"
|
180
|
+
return container
|
181
|
+
end
|
182
|
+
end
|
183
|
+
return nil
|
184
|
+
end
|
185
|
+
|
186
|
+
def self.instance_create(name)
|
187
|
+
docker_url
|
188
|
+
container = Docker::Container.create({
|
189
|
+
'Image' => options[:image],
|
190
|
+
'name' => name,
|
191
|
+
'Entrypoint' => 'runit',
|
192
|
+
'Hostname' => remove_prefix(name)
|
193
|
+
})
|
194
|
+
container = container.start({ 'PublishAllPorts' => true })
|
195
|
+
end
|
196
|
+
|
197
|
+
def self.host_available?(hostname, port)
|
198
|
+
socket = TCPSocket.new(hostname, port)
|
199
|
+
IO.select([socket], nil, nil, 5)
|
200
|
+
rescue SocketError, Errno::ECONNREFUSED,
|
201
|
+
Errno::EHOSTUNREACH, Errno::ENETUNREACH, IOError
|
202
|
+
sleep(0.25)
|
203
|
+
false
|
204
|
+
rescue Errno::EPERM, Errno::ETIMEDOUT
|
205
|
+
false
|
206
|
+
ensure
|
207
|
+
socket && socket.close
|
208
|
+
end
|
209
|
+
|
210
|
+
def self.docker_url
|
211
|
+
Docker.url = options[:url]
|
212
|
+
end
|
213
|
+
|
214
|
+
def self.get_port(port, container)
|
215
|
+
container.json['NetworkSettings']['Ports']["#{port}/tcp"].first['HostPort']
|
216
|
+
end
|
217
|
+
|
218
|
+
def self.D(message)
|
219
|
+
if options[:debug]
|
220
|
+
puts "D: #{message}"
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
go!
|
225
|
+
end
|
226
|
+
|
227
|
+
# option :debug, :type => :boolean, :default => true
|
228
|
+
|
229
|
+
|
230
|
+
# private
|
data/spoon.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'spoon/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "docker-spoon"
|
8
|
+
spec.version = Spoon::VERSION
|
9
|
+
spec.authors = ["Aaron Nichols"]
|
10
|
+
spec.email = ["anichols@trumped.org"]
|
11
|
+
spec.summary = %q{Create on-demand pairing environments in Docker}
|
12
|
+
spec.description = %q{Create on-demand pairing environments in Docker}
|
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.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency('rdoc')
|
24
|
+
spec.add_development_dependency('aruba')
|
25
|
+
spec.add_development_dependency('rake', '~> 0.9.2')
|
26
|
+
spec.add_dependency('methadone', '~> 1.4.0')
|
27
|
+
spec.add_dependency('docker-api', '~> 1.11')
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: docker-spoon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Aaron Nichols
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-06-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.6'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.6'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rdoc
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: aruba
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.9.2
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.9.2
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: methadone
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 1.4.0
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.4.0
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: docker-api
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.11'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '1.11'
|
126
|
+
description: Create on-demand pairing environments in Docker
|
127
|
+
email:
|
128
|
+
- anichols@trumped.org
|
129
|
+
executables:
|
130
|
+
- spoon
|
131
|
+
extensions: []
|
132
|
+
extra_rdoc_files: []
|
133
|
+
files:
|
134
|
+
- .gitignore
|
135
|
+
- Gemfile
|
136
|
+
- Gemfile.lock
|
137
|
+
- LICENSE.txt
|
138
|
+
- README.md
|
139
|
+
- README.rdoc
|
140
|
+
- Rakefile
|
141
|
+
- bin/spoon
|
142
|
+
- docker/Dockerfile
|
143
|
+
- docker/resources/log/run
|
144
|
+
- docker/resources/run
|
145
|
+
- docker/resources/zshrc.default
|
146
|
+
- docker/runit/1
|
147
|
+
- docker/runit/2
|
148
|
+
- docker/runit/3
|
149
|
+
- features/spoon.feature
|
150
|
+
- features/step_definitions/spoon_steps.rb
|
151
|
+
- features/support/env.rb
|
152
|
+
- lib/spoon.rb
|
153
|
+
- lib/spoon/version.rb
|
154
|
+
- spoon.gemspec
|
155
|
+
- test/tc_something.rb
|
156
|
+
homepage: ''
|
157
|
+
licenses:
|
158
|
+
- MIT
|
159
|
+
post_install_message:
|
160
|
+
rdoc_options: []
|
161
|
+
require_paths:
|
162
|
+
- lib
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
165
|
+
requirements:
|
166
|
+
- - ! '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ! '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
requirements: []
|
176
|
+
rubyforge_project:
|
177
|
+
rubygems_version: 1.8.23
|
178
|
+
signing_key:
|
179
|
+
specification_version: 3
|
180
|
+
summary: Create on-demand pairing environments in Docker
|
181
|
+
test_files:
|
182
|
+
- features/spoon.feature
|
183
|
+
- features/step_definitions/spoon_steps.rb
|
184
|
+
- features/support/env.rb
|
185
|
+
- test/tc_something.rb
|