coral_vagrant 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,31 @@
1
+ = coral_vagrant
2
+
3
+ This library contains various commands and exposes a data model to Vagrant
4
+ that allows for tightly integrated management of Virtual machines that are
5
+ linked to remote servers.
6
+
7
+ This also allows for custom execution plans.
8
+
9
+ Note: This library is still very early in development!
10
+
11
+ == Contributing to coral_vagrant
12
+
13
+ * Check out the latest master to make sure the feature hasn't been implemented
14
+ or the bug hasn't been fixed yet.
15
+ * Check out the issue tracker to make sure someone already hasn't requested
16
+ it and/or contributed it.
17
+ * Fork the project.
18
+ * Start a feature/bugfix branch.
19
+ * Commit and push until you are happy with your contribution.
20
+ * Make sure to add tests for it. This is important so I don't break it in a
21
+ future version unintentionally.
22
+ * Please try not to mess with the Rakefile, version, or history. If you want
23
+ to have your own version, or is otherwise necessary, that is fine, but
24
+ please isolate to its own commit so I can cherry-pick around it.
25
+
26
+ == Copyright
27
+
28
+ Licensed under GPLv3. See LICENSE.txt for further details.
29
+
30
+ Copyright (c) 2013 Adrian Webb <adrian.webb@coraltech.net>
31
+ Coral Technology Group LLC
data/Rakefile ADDED
@@ -0,0 +1,68 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ require 'rake'
6
+ require 'rake/testtask'
7
+ require 'rdoc/task'
8
+ require 'jeweler'
9
+
10
+ require './lib/coral_vagrant.rb'
11
+
12
+ #-------------------------------------------------------------------------------
13
+ # Dependencies
14
+
15
+ begin
16
+ Bundler.setup(:default, :development)
17
+ rescue Bundler::BundlerError => e
18
+ $stderr.puts e.message
19
+ $stderr.puts "Run `bundle install` to install missing gems"
20
+ exit e.status_code
21
+ end
22
+
23
+ #-------------------------------------------------------------------------------
24
+ # Gem specification
25
+
26
+ Jeweler::Tasks.new do |gem|
27
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
28
+ gem.name = "coral_vagrant"
29
+ gem.homepage = "http://github.com/coraltech/ruby-coral_vagrant"
30
+ gem.rubyforge_project = 'coral_vagrant'
31
+ gem.license = "GPLv3"
32
+ gem.email = "adrian.webb@coraltech.net"
33
+ gem.authors = ["Adrian Webb"]
34
+ gem.summary = %Q{Provides a data model and various Coral commands for Vagrant}
35
+ gem.description = File.read('README.rdoc')
36
+ gem.required_ruby_version = '>= 1.8.1'
37
+ gem.has_rdoc = true
38
+ gem.rdoc_options << '--title' << 'Coral Vagrant library' <<
39
+ '--main' << 'README.rdoc' <<
40
+ '--line-numbers'
41
+
42
+ # Dependencies defined in Gemfile
43
+ end
44
+
45
+ Jeweler::RubygemsDotOrgTasks.new
46
+
47
+ #-------------------------------------------------------------------------------
48
+ # Testing
49
+
50
+ Rake::TestTask.new(:test) do |test|
51
+ test.libs << 'lib' << 'test'
52
+ test.pattern = 'test/**/test_*.rb'
53
+ test.verbose = true
54
+ end
55
+
56
+ task :default => :test
57
+
58
+ #-------------------------------------------------------------------------------
59
+ # Documentation
60
+
61
+ Rake::RDocTask.new do |rdoc|
62
+ version = Coral::Vagrant::VERSION
63
+
64
+ rdoc.rdoc_dir = 'rdoc'
65
+ rdoc.title = "coral_vagrant #{version}"
66
+ rdoc.rdoc_files.include('README*')
67
+ rdoc.rdoc_files.include('lib/**/*.rb')
68
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
data/Vagrantfile ADDED
@@ -0,0 +1,69 @@
1
+ #
2
+ # Configurable Vagrant server environment (development platform)
3
+ #-------------------------------------------------------------------------------
4
+ #
5
+ # This Vagrantfile is designed to test server components
6
+ #
7
+ # => "puppet" directory should be a submodule with a bootstrap capable Puppet library.
8
+ # => "config" directory should be a submodule with a JSON configuration repository.
9
+ #
10
+
11
+ require 'coral_vagrant'
12
+
13
+ Vagrant::Config.run do |config|
14
+
15
+ #-----------------------------------------------------------------------------
16
+ # Server definitions (managed by ./config/cloud.json)
17
+
18
+ cloud = Coral.init_vagrant(File.dirname(__FILE__))
19
+
20
+ cloud.servers.each do |server_name, server|
21
+ config.vm.define server_name do |machine|
22
+ # Basic server settings
23
+ machine.vm.host_name = server.hostname
24
+
25
+ machine.vm.box = cloud.get('vm_box')
26
+ machine.vm.box_url = cloud.get('vm_box_url')
27
+
28
+ # Network interfaces
29
+ if cloud.get('vm_network_bridged', false, :test)
30
+ machine.vm.network :bridged
31
+ else
32
+ machine.vm.network :hostonly, server.public_ip
33
+
34
+ unless server.virtual_ip.empty?
35
+ machine.vm.network :hostonly, server.virtual_ip
36
+ end
37
+ end
38
+
39
+ # Server NFS shares
40
+ cloud.servers[server_name].shares.each do |name, share|
41
+ unless share.directory.empty? || share.remote_dir.empty?
42
+ machine.vm.share_folder name, share.remote_dir, share.directory, :nfs => true
43
+ end
44
+ end
45
+
46
+ # Server settings
47
+ vm_cpus = cloud.search(server_name, 'vm_cpus', '1')
48
+ vm_memory = cloud.search(server_name, 'vm_memory', '512')
49
+
50
+ machine.vm.customize [ "modifyvm", :id, "--cpus", vm_cpus, "--memory", vm_memory ]
51
+
52
+ # Puppet configuration
53
+ puppet_manifest_path = cloud.get('puppet_manifest_path')
54
+ puppet_module_path = []
55
+ cloud.get('puppet_module_path', [], :array).each do |module_path|
56
+ puppet_module_path << File.join(puppet_manifest_path, module_path)
57
+ end
58
+
59
+ # Puppet provisioning
60
+ machine.vm.provision :puppet do |puppet|
61
+ puppet.module_path = puppet_module_path
62
+ puppet.manifests_path = puppet_manifest_path
63
+ puppet.manifest_file = cloud.get('puppet_manifest_file')
64
+ puppet.options = cloud.search(server_name, 'puppet_options')
65
+ puppet.facter = cloud.search(server_name, 'facts')
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,78 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "coral_vagrant"
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Adrian Webb"]
12
+ s.date = "2013-02-07"
13
+ s.description = "= coral_vagrant\n\nThis library contains various commands and exposes a data model to Vagrant\nthat allows for tightly integrated management of Virtual machines that are\nlinked to remote servers. \n\nThis also allows for custom execution plans.\n\nNote: This library is still very early in development!\n\n== Contributing to coral_vagrant\n \n* Check out the latest master to make sure the feature hasn't been implemented \n or the bug hasn't been fixed yet.\n* Check out the issue tracker to make sure someone already hasn't requested \n it and/or contributed it.\n* Fork the project.\n* Start a feature/bugfix branch.\n* Commit and push until you are happy with your contribution.\n* Make sure to add tests for it. This is important so I don't break it in a \n future version unintentionally.\n* Please try not to mess with the Rakefile, version, or history. If you want \n to have your own version, or is otherwise necessary, that is fine, but \n please isolate to its own commit so I can cherry-pick around it.\n\n== Copyright\n\nLicensed under GPLv3. See LICENSE.txt for further details.\n\nCopyright (c) 2013 Adrian Webb <adrian.webb@coraltech.net>\nCoral Technology Group LLC"
14
+ s.email = "adrian.webb@coraltech.net"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "Vagrantfile",
28
+ "coral_vagrant.gemspec",
29
+ "lib/coral_vagrant.rb",
30
+ "lib/coral_vagrant/commands/coral_base.rb",
31
+ "lib/coral_vagrant/commands/coral_init.rb",
32
+ "lib/coral_vagrant/commands/coral_push.rb",
33
+ "lib/coral_vagrant/commands/coral_run.rb",
34
+ "lib/coral_vagrant/commands/coral_update.rb"
35
+ ]
36
+ s.homepage = "http://github.com/coraltech/ruby-coral_vagrant"
37
+ s.licenses = ["GPLv3"]
38
+ s.rdoc_options = ["--title", "Coral Vagrant library", "--main", "README.rdoc", "--line-numbers"]
39
+ s.require_paths = ["lib"]
40
+ s.required_ruby_version = Gem::Requirement.new(">= 1.8.1")
41
+ s.rubyforge_project = "coral_vagrant"
42
+ s.rubygems_version = "1.8.15"
43
+ s.summary = "Provides a data model and various Coral commands for Vagrant"
44
+
45
+ if s.respond_to? :specification_version then
46
+ s.specification_version = 3
47
+
48
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
+ s.add_runtime_dependency(%q<vagrant>, ["~> 1.0"])
50
+ s.add_runtime_dependency(%q<coral_plan>, ["~> 0.1"])
51
+ s.add_runtime_dependency(%q<coral_cloud>, ["~> 0.1"])
52
+ s.add_development_dependency(%q<bundler>, ["~> 1.2"])
53
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8"])
54
+ s.add_development_dependency(%q<rspec>, ["~> 2.10"])
55
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
56
+ s.add_development_dependency(%q<yard>, ["~> 0.8"])
57
+ else
58
+ s.add_dependency(%q<vagrant>, ["~> 1.0"])
59
+ s.add_dependency(%q<coral_plan>, ["~> 0.1"])
60
+ s.add_dependency(%q<coral_cloud>, ["~> 0.1"])
61
+ s.add_dependency(%q<bundler>, ["~> 1.2"])
62
+ s.add_dependency(%q<jeweler>, ["~> 1.8"])
63
+ s.add_dependency(%q<rspec>, ["~> 2.10"])
64
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
65
+ s.add_dependency(%q<yard>, ["~> 0.8"])
66
+ end
67
+ else
68
+ s.add_dependency(%q<vagrant>, ["~> 1.0"])
69
+ s.add_dependency(%q<coral_plan>, ["~> 0.1"])
70
+ s.add_dependency(%q<coral_cloud>, ["~> 0.1"])
71
+ s.add_dependency(%q<bundler>, ["~> 1.2"])
72
+ s.add_dependency(%q<jeweler>, ["~> 1.8"])
73
+ s.add_dependency(%q<rspec>, ["~> 2.10"])
74
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
75
+ s.add_dependency(%q<yard>, ["~> 0.8"])
76
+ end
77
+ end
78
+
@@ -0,0 +1,79 @@
1
+
2
+ module Vagrant
3
+ module Command
4
+ module Coral
5
+ class Base < Base
6
+
7
+ #-----------------------------------------------------------------------------
8
+ # Constructor / Destructor
9
+
10
+ def initialize(argv, env)
11
+ super
12
+
13
+ @main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
14
+
15
+ @subcommands = Registry.new
16
+ @subcommands.register(:init) { Vagrant::Command::Coral::Init }
17
+ @subcommands.register(:update) { Vagrant::Command::Coral::Update }
18
+ @subcommands.register(:push) { Vagrant::Command::Coral::Push }
19
+ @subcommands.register(:run) { Vagrant::Command::Coral::Run }
20
+ end
21
+
22
+ #-----------------------------------------------------------------------------
23
+ # Help
24
+
25
+ def help
26
+ opts = OptionParser.new do |opts|
27
+ opts.banner = "Usage: vagrant coral <command> [<args>]"
28
+ opts.separator ""
29
+ opts.separator "Available subcommands:"
30
+
31
+ # Add the available subcommands as separators in order to print them
32
+ # out as well.
33
+ keys = []
34
+ @subcommands.each { |key, value| keys << key.to_s }
35
+
36
+ keys.sort.each do |key|
37
+ opts.separator " #{key}"
38
+ end
39
+
40
+ opts.separator ""
41
+ opts.separator "For help on any individual command run `vagrant coral COMMAND -h`"
42
+ end
43
+
44
+ @env.ui.info(opts.help, :prefix => false)
45
+ end
46
+
47
+ #-----------------------------------------------------------------------------
48
+ # Execution
49
+
50
+ def execute
51
+ if @main_args.include?("-h") || @main_args.include?("--help")
52
+ # Print the help for all the cluster commands.
53
+ return help
54
+ end
55
+
56
+ # If we reached this far then we must have a subcommand. If not,
57
+ # then we also just print the help and exit.
58
+ command_class = @subcommands.get(@sub_command.to_sym) if @sub_command
59
+
60
+ if ! command_class && @sub_command
61
+ command_class = @subcommands.get(:run)
62
+ @sub_args.unshift(@sub_command)
63
+ end
64
+
65
+ return help if !command_class || !@sub_command
66
+ @logger.debug("Invoking command class: #{command_class} #{@sub_args.inspect}")
67
+
68
+ # Initialize and execute the command class
69
+ command_class.new(@sub_args, @env).execute
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+
76
+ #-------------------------------------------------------------------------------
77
+
78
+ Vagrant.commands.register(:coral) { Vagrant::Command::Coral::Base }
79
+
@@ -0,0 +1,78 @@
1
+
2
+ module Vagrant
3
+ module Command
4
+ module Coral
5
+ class Init < Base
6
+
7
+ #-----------------------------------------------------------------------------
8
+ # Execution
9
+
10
+ def execute
11
+ options = {}
12
+ success = true
13
+
14
+ opts = OptionParser.new do |opts|
15
+ opts.banner = "Usage: vagrant coral init [server-name]... [-h] ..."
16
+ opts.separator ""
17
+
18
+ opts.on("-d", "--destroy", "Remove existing servers and start from scratch") do |d|
19
+ options[:destroy] = d
20
+ end
21
+
22
+ opts.on("-f", "--force", "Destroy without confirmation") do |f|
23
+ options[:force] = f
24
+ end
25
+
26
+ #---
27
+
28
+ options[:min] = 1
29
+ opts.on("-m", "--min TRIES", "Minimum number of provision runs") do |m|
30
+ options[:min] = m
31
+ end
32
+
33
+ options[:tries] = 5
34
+ opts.on("-t", "--tries TRIES", "Number of provision attempts before stopping with an error") do |t|
35
+ options[:tries] = t
36
+ end
37
+
38
+ options[:exit] = ''
39
+ opts.on("-e", "--exit CONDITIONS", "Conditions on which to exit in the format (separated by comma): 'User[git]:ensure:created'") do |e|
40
+ options[:exit] = e
41
+ end
42
+
43
+ options[:repos] = ''
44
+ opts.on("-r", "--repos REPO_DIRS,...'", "Local directories of repositories to syncronize remotes (relative to the Vagrantfile root)") do |r|
45
+ options[:repos] = r
46
+ end
47
+ end
48
+
49
+ options[:min] = 1
50
+ options[:auth] = true
51
+
52
+ #---
53
+
54
+ servers = parse_options(opts)
55
+ return if ! servers
56
+
57
+ with_target_vms(servers) do |vm|
58
+ @env.ui.info("Starting initialization run for: #{vm.name}")
59
+
60
+ server = Coral::Server.new({
61
+ :cloud => Coral.vagrant,
62
+ :machine => vm,
63
+ :logger => @logger,
64
+ :ui => @env.ui,
65
+ })
66
+
67
+ if options[:destroy]
68
+ success = server.destroy(options) if success
69
+ end
70
+ success = server.start(options) if success
71
+ success = server.update(options) if success
72
+ end
73
+ exit success ? 0 : 1
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,84 @@
1
+
2
+ module Vagrant
3
+ module Command
4
+ module Coral
5
+ class Push < Base
6
+
7
+ #-----------------------------------------------------------------------------
8
+ # Execution
9
+
10
+ def execute
11
+ options = {}
12
+ success = true
13
+
14
+ opts = OptionParser.new do |opts|
15
+ opts.banner = "Usage: vagrant coral push [server-name]... [-h] ..."
16
+ opts.separator ""
17
+
18
+ opts.on("-c", "--commit", "Commit any uncommitted changes before pushing to remotes") do |c|
19
+ options[:commit] = c
20
+ end
21
+
22
+ opts.on("-e", "--allow_empty", "Allow commits with no changes") do |e|
23
+ options[:allow_empty] = e
24
+ end
25
+
26
+ opts.on("-t", "--tags", "Push all local tags with selected branch") do |t|
27
+ options[:tags] = t
28
+ end
29
+
30
+ #---
31
+
32
+ options[:message] = ''
33
+ opts.on("-m", "--message MESSAGE", "Commit message") do |m|
34
+ options[:message] = m
35
+ end
36
+
37
+ options[:author] = ''
38
+ opts.on("-a", "--author AUTHOR", "Author of the changes being committed if different from the committer") do |a|
39
+ options[:author] = a
40
+ end
41
+
42
+ options[:branch] = ''
43
+ opts.on("-b", "--branch BRANCH", "Local branch of the remotes to push") do |b|
44
+ options[:branch] = b
45
+ end
46
+
47
+ options[:repos] = ''
48
+ opts.on("-r", "--repos REPO_DIRS,...", "Local directories of repositories to push (relative to the Vagrantfile root)") do |r|
49
+ options[:repos] = r
50
+ end
51
+ end
52
+
53
+ options[:auth] = true
54
+
55
+ #---
56
+
57
+ remotes = parse_options(opts)
58
+ return if ! remotes
59
+
60
+ if remotes.empty?
61
+ remotes = [ 'all' ]
62
+ end
63
+
64
+ remotes.each do |remote_name|
65
+ @env.ui.info("Starting push for: #{remote_name}")
66
+
67
+ server = Coral::Server.new({
68
+ :cloud => Coral.vagrant,
69
+ :machine => remote_name,
70
+ :logger => @logger,
71
+ :ui => @env.ui,
72
+ })
73
+
74
+ if options[:commit]
75
+ success = server.commit(options) if success
76
+ end
77
+ success = server.push(options) if success
78
+ end
79
+ exit success ? 0 : 1
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,53 @@
1
+
2
+ module Vagrant
3
+ module Command
4
+ module Coral
5
+ class Run < Base
6
+
7
+ #-----------------------------------------------------------------------------
8
+ # Execution
9
+
10
+ def execute
11
+ options = {}
12
+ success = true
13
+
14
+ opts = OptionParser.new do |opts|
15
+ opts.banner = "Usage: vagrant cloud run [plan-name]... [-h] ..."
16
+ opts.separator ""
17
+
18
+ options[:repo] = 'config'
19
+ opts.on("-r", "--repo REPO_DIR", "Local directories of repositories (relative to the Vagrantfile root)") do |r|
20
+ options[:repo] = r
21
+ end
22
+
23
+ options[:directory] = 'plans'
24
+ opts.on("-d", "--directory DIR", "Local directory that contains the plan(s) being executed") do |d|
25
+ options[:directory] = d
26
+ end
27
+ end
28
+
29
+ #---
30
+
31
+ plans = parse_options(opts)
32
+ return if ! plans
33
+
34
+ plans.each do |plan_name|
35
+ @logger.debug("Running plan: #{plan_name}")
36
+
37
+ success = Coral.create_plan(plan_name, {
38
+ :home => Coral.vagrant,
39
+ :submodule => options[:repo],
40
+ :config_file => "#{options[:directory]}/#{plan_name}.json",
41
+ :logger => @logger,
42
+ :ui => @env.ui,
43
+ }).run(options)
44
+
45
+ break unless success
46
+ end
47
+
48
+ exit success ? 0 : 1
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,61 @@
1
+
2
+ module Vagrant
3
+ module Command
4
+ module Coral
5
+ class Update < Base
6
+
7
+ #-----------------------------------------------------------------------------
8
+ # Execution
9
+
10
+ def execute
11
+ options = {}
12
+ success = true
13
+
14
+ opts = OptionParser.new do |opts|
15
+ opts.banner = "Usage: vagrant coral update [server-name]... [-h] ..."
16
+ opts.separator ""
17
+
18
+ options[:min] = 1
19
+ opts.on("-m", "--min TRIES", "Minimum number of provision runs") do |m|
20
+ options[:min] = m
21
+ end
22
+
23
+ options[:tries] = 5
24
+ opts.on("-t", "--tries TRIES", "Number of provision attempts before stopping with an error.") do |t|
25
+ options[:tries] = t
26
+ end
27
+
28
+ options[:exit] = ''
29
+ opts.on("-e", "--exit CONDITIONS", "Conditions on which to exit in the format (separated by comma): 'User[git]:ensure:created'") do |e|
30
+ options[:exit] = e
31
+ end
32
+
33
+ options[:repos] = ''
34
+ opts.on("-r", "--repos REPO_DIRS,...'", "Local directories of repositories to push (relative to the Vagrantfile root)") do |r|
35
+ options[:repos] = r
36
+ end
37
+ end
38
+
39
+ options[:auth] = true
40
+
41
+ #---
42
+
43
+ servers = parse_options(opts)
44
+ return if ! servers
45
+
46
+ with_target_vms(servers) do |vm|
47
+ @env.ui.info("Starting update run for: #{vm.name}")
48
+
49
+ success = Coral::Server.new({
50
+ :cloud => Coral.vagrant,
51
+ :machine => vm,
52
+ :logger => @logger,
53
+ :ui => @env.ui,
54
+ }).update(options) if success
55
+ end
56
+ exit success ? 0 : 1
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,74 @@
1
+
2
+ home = File.dirname(__FILE__)
3
+
4
+ $:.unshift(home) unless
5
+ $:.include?(home) || $:.include?(File.expand_path(home))
6
+
7
+ #-------------------------------------------------------------------------------
8
+
9
+ require 'rubygems'
10
+ require 'optparse'
11
+ require 'vagrant'
12
+ require 'coral_cloud'
13
+ require 'coral_plan'
14
+
15
+ #---
16
+
17
+ # Include Vagrant commands
18
+ [ :coral_base,
19
+ :coral_init,
20
+ :coral_update,
21
+ :coral_push,
22
+ :coral_run,
23
+ ].each do |name|
24
+ require File.join('coral_vagrant', 'commands', name.to_s + '.rb')
25
+ end
26
+
27
+ #*******************************************************************************
28
+ # Coral Vagrant Library
29
+ #
30
+ # This provides a data model and commands that interface with Vagrant.
31
+ #
32
+ # Author:: Adrian Webb (mailto:adrian.webb@coraltech.net)
33
+ # License:: GPLv3
34
+ module Coral
35
+
36
+ #-----------------------------------------------------------------------------
37
+ # Constructor / Destructor
38
+
39
+ def self.init_vagrant(directory, submodule = 'config', config_file = 'cloud.json')
40
+ return Coral::Vagrant.init(directory, submodule, config_file)
41
+ end
42
+
43
+ #-----------------------------------------------------------------------------
44
+ # Accessors / Modifiers
45
+
46
+ def self.vagrant
47
+ return Coral::Vagrant.get
48
+ end
49
+
50
+ #*******************************************************************************
51
+
52
+ module Vagrant
53
+
54
+ VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
55
+
56
+ #-----------------------------------------------------------------------------
57
+ # Constructor / Destructor
58
+
59
+ def init(directory, submodule = 'config', config_file = 'cloud.json')
60
+ return Coral.create_cloud(:vagrant, {
61
+ :directory => directory,
62
+ :submodule => submodule,
63
+ :config_file => config_file,
64
+ })
65
+ end
66
+
67
+ #-----------------------------------------------------------------------------
68
+ # Accessors / Modifiers
69
+
70
+ def self.get
71
+ return Coral.cloud(:vagrant)
72
+ end
73
+ end
74
+ end