vagrant-fractal 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +13 -0
- data/Rakefile +20 -0
- data/Vagrantfile +3 -0
- data/cucumber.yml +1 -0
- data/fractal.yaml +29 -0
- data/lib/vagrant-fractal.rb +6 -0
- data/lib/vagrant-fractal/command.rb +43 -0
- data/lib/vagrant-fractal/config.rb +71 -0
- data/lib/vagrant-fractal/plugin.rb +15 -0
- data/lib/vagrant-fractal/version.rb +8 -0
- data/vagrant-fractal.gemspec +24 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ec7057cac82fb7f353fed5e0295bcd038b6fc049
|
4
|
+
data.tar.gz: 2b858ab3fc60983180391eaa9ffe9568b9e882f9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d50d9f74246db4abf77c370cb4110e43f3af3cc73d41ca9399a770067c62094cf27bb2372a7c4802f4fcba1c1a336fea64c20099cc39318676ab192bb4ccf585
|
7
|
+
data.tar.gz: 9b36afcae3d9dd750313aa15d6d957dc51eaf723c082de8c413eba885131db2d21b5190baacaa6f3cd41f49b86bd79e657eacc9ddef4aa9cf80f9c7de111783a
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.3
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
group :development do
|
4
|
+
# We depend on Vagrant for development, but we don't add it as a
|
5
|
+
# gem dependency because we expect to be installed within the
|
6
|
+
# Vagrant environment itself using `vagrant plugin`.
|
7
|
+
gem 'vagrant', git: 'git://github.com/mitchellh/vagrant.git'
|
8
|
+
gem 'pry'
|
9
|
+
end
|
10
|
+
|
11
|
+
group :plugins do
|
12
|
+
gemspec
|
13
|
+
end
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require 'cucumber/rake/task'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
namespace :features do
|
6
|
+
desc 'Downloads and adds vagrant box for testing.'
|
7
|
+
task(:bootstrap) do
|
8
|
+
system('bundle exec vagrant box add vagrant_exec http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box')
|
9
|
+
end
|
10
|
+
|
11
|
+
Cucumber::Rake::Task.new(:run) do |t|
|
12
|
+
t.cucumber_opts = %w(--format pretty)
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Removes testing vagrant box.'
|
16
|
+
task(:cleanup) do
|
17
|
+
system('bundle exec vagrant destroy -f')
|
18
|
+
system('bundle exec vagrant box remove vagrant_exec virtualbox')
|
19
|
+
end
|
20
|
+
end
|
data/Vagrantfile
ADDED
data/cucumber.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
default: --require features --format html --out results.html --format pretty
|
data/fractal.yaml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
coredb:
|
3
|
+
url: "https://s3.amazonaws.com/sci-devops/docker/images/latest/coredb.tar.gz"
|
4
|
+
network_mapping:
|
5
|
+
-
|
6
|
+
sport: "5000"
|
7
|
+
dport: "6000"
|
8
|
+
interface_ip: "127.0.0.1"
|
9
|
+
protocol: "udp"
|
10
|
+
-
|
11
|
+
sport: "5001"
|
12
|
+
dport: "6001"
|
13
|
+
-
|
14
|
+
sport: "5002"
|
15
|
+
dport: "6002"
|
16
|
+
athena:
|
17
|
+
url: "https://s3.amazonaws.com/sci-devops/docker/images/latest/athenaapp.tar.gz"
|
18
|
+
network_mapping:
|
19
|
+
-
|
20
|
+
sport: "5000"
|
21
|
+
dport: "6000"
|
22
|
+
interface_ip: "127.0.0.1"
|
23
|
+
protocol: "udp"
|
24
|
+
-
|
25
|
+
sport: "5001"
|
26
|
+
dport: "6001"
|
27
|
+
-
|
28
|
+
sport: "5002"
|
29
|
+
dport: "6002"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Plugin
|
3
|
+
module V2
|
4
|
+
# This is the base class for a CLI command.
|
5
|
+
class Command
|
6
|
+
protected
|
7
|
+
# Parses the options given an OptionParser instance.
|
8
|
+
#
|
9
|
+
# This is a convenience method that properly handles duping the
|
10
|
+
# originally argv array so that it is not destroyed.
|
11
|
+
#
|
12
|
+
# This method will also automatically detect "-h" and "--help"
|
13
|
+
# and print help. And if any invalid options are detected, the help
|
14
|
+
# will be printed, as well.
|
15
|
+
#
|
16
|
+
# If this method returns `nil`, then you should assume that help
|
17
|
+
# was printed and parsing failed.
|
18
|
+
def parse_options(opts=nil)
|
19
|
+
|
20
|
+
# Creating a shallow copy of the arguments so the OptionParser
|
21
|
+
# doesn't destroy the originals.
|
22
|
+
argv = @argv
|
23
|
+
# Default opts to a blank optionparser if none is given
|
24
|
+
opts ||= OptionParser.new
|
25
|
+
# Add the help option, which must be on every command.
|
26
|
+
opts.on_tail("-h", "--help", "Print this help") do
|
27
|
+
safe_puts(opts.help)
|
28
|
+
return nil
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on("-d DOCKER_BOXES", "--docker DOCKER_BOXES", "Allow only provided docker boxes") do |fractal_boxes|
|
32
|
+
ENV[VagrantPlugins::Fractal::ENVIRONMENT_VARIABLE] = fractal_boxes if !ENV.has_key?(VagrantPlugins::Fractal::ENVIRONMENT_VARIABLE) || ENV[VagrantPlugins::Fractal::ENVIRONMENT_VARIABLE].nil?
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.parse!(argv)
|
36
|
+
return argv
|
37
|
+
rescue OptionParser::InvalidOption
|
38
|
+
raise Errors::CLIInvalidOptions, help: opts.help.chomp
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module Fractal
|
5
|
+
class Config < Vagrant.plugin(2, :config)
|
6
|
+
attr_accessor :file
|
7
|
+
attr_reader :active
|
8
|
+
|
9
|
+
DEFAULT_SETTINGS = {
|
10
|
+
file: 'fractal.yaml'
|
11
|
+
}.freeze
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@file = UNSET_VALUE
|
15
|
+
@filter = UNSET_VALUE
|
16
|
+
@raw = nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def file=(path)
|
20
|
+
@file = path unless path.empty?
|
21
|
+
end
|
22
|
+
|
23
|
+
def active
|
24
|
+
validate(nil)
|
25
|
+
@filter == UNSET_VALUE ? raw.keys : @filter
|
26
|
+
end
|
27
|
+
|
28
|
+
def data
|
29
|
+
validate(nil)
|
30
|
+
raw.select { |key,_| active.include? key }
|
31
|
+
end
|
32
|
+
|
33
|
+
def validate(_)
|
34
|
+
finalize!
|
35
|
+
errors = _detected_errors
|
36
|
+
|
37
|
+
if File.file?(@file)
|
38
|
+
begin
|
39
|
+
unless @filter == UNSET_VALUE
|
40
|
+
@filter.each do |box|
|
41
|
+
errors.push("There is no #{box} box in #{@file}") unless raw.has_key?(box)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
rescue Exception
|
45
|
+
errors.push("file #{@file} have wrong format")
|
46
|
+
end
|
47
|
+
else
|
48
|
+
errors.push("file #{@file} does not exists")
|
49
|
+
end
|
50
|
+
|
51
|
+
{ 'fractal' => errors }
|
52
|
+
end
|
53
|
+
|
54
|
+
def finalize!
|
55
|
+
@file = DEFAULT_SETTINGS[:file] if @file == UNSET_VALUE
|
56
|
+
@filter = docker_boxes.split(',').map{|box| box.strip } unless docker_boxes == UNSET_VALUE
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def raw
|
62
|
+
@raw ||= YAML.load_file(@file)
|
63
|
+
end
|
64
|
+
|
65
|
+
def docker_boxes
|
66
|
+
ENV[VagrantPlugins::Fractal::ENVIRONMENT_VARIABLE].nil? ? UNSET_VALUE : ENV[VagrantPlugins::Fractal::ENVIRONMENT_VARIABLE];
|
67
|
+
end
|
68
|
+
|
69
|
+
end #Config
|
70
|
+
end #Envrionments
|
71
|
+
end # VagrantPlugins
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Fractal
|
3
|
+
class Plugin < Vagrant.plugin(2)
|
4
|
+
ENVIRONMENT_VARIABLE = 'VAGRANT_DOCKER_BOXES'
|
5
|
+
|
6
|
+
name 'vagrant-fractal'
|
7
|
+
description 'Vagrant plugin to config multiple docker boxes'
|
8
|
+
|
9
|
+
config :fractal do
|
10
|
+
require_relative 'config'
|
11
|
+
Config
|
12
|
+
end
|
13
|
+
end # Plugin
|
14
|
+
end # Fractal
|
15
|
+
end # VagrantPlugins
|
@@ -0,0 +1,24 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'vagrant-fractal/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'vagrant-fractal'
|
6
|
+
s.version = VagrantPlugins::Fractal::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.author = 'Igor Rodionov'
|
9
|
+
s.email = 'goruha@gmail.com'
|
10
|
+
s.homepage = 'http://github.com/goruha/vagrant-fractal'
|
11
|
+
s.summary = 'Allow to config Vagrant work with multiple docker boxes'
|
12
|
+
s.description = 'Vagrant plugin to config multiple docker boxes'
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
18
|
+
s.require_paths = %w(lib)
|
19
|
+
|
20
|
+
s.add_development_dependency 'aruba'
|
21
|
+
s.add_development_dependency 'rake'
|
22
|
+
s.add_development_dependency 'pry-byebug'
|
23
|
+
s.add_development_dependency 'cucumber'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-fractal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Igor Rodionov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aruba
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry-byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cucumber
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Vagrant plugin to config multiple docker boxes
|
70
|
+
email: goruha@gmail.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- ".gitignore"
|
76
|
+
- ".ruby-version"
|
77
|
+
- CHANGELOG.md
|
78
|
+
- Gemfile
|
79
|
+
- Rakefile
|
80
|
+
- Vagrantfile
|
81
|
+
- cucumber.yml
|
82
|
+
- fractal.yaml
|
83
|
+
- lib/vagrant-fractal.rb
|
84
|
+
- lib/vagrant-fractal/command.rb
|
85
|
+
- lib/vagrant-fractal/config.rb
|
86
|
+
- lib/vagrant-fractal/plugin.rb
|
87
|
+
- lib/vagrant-fractal/version.rb
|
88
|
+
- vagrant-fractal.gemspec
|
89
|
+
homepage: http://github.com/goruha/vagrant-fractal
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.2.2
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Allow to config Vagrant work with multiple docker boxes
|
113
|
+
test_files: []
|