coral_vagrant 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "vagrant", "~> 1.0"
4
3
  gem "coral_plan", "~> 0.1"
5
4
  gem "coral_cloud", "~> 0.1"
6
5
 
@@ -10,4 +9,5 @@ group :development do
10
9
  gem "rspec", "~> 2.10"
11
10
  gem "rdoc", "~> 3.12"
12
11
  gem "yard", "~> 0.8"
12
+ gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => 'v1.2.2'
13
13
  end
@@ -1,17 +1,32 @@
1
+ GIT
2
+ remote: git://github.com/mitchellh/vagrant.git
3
+ revision: 7e400d00a3c5a0fdf2809c8b5001a035415a607b
4
+ tag: v1.2.2
5
+ specs:
6
+ vagrant (1.2.2)
7
+ childprocess (~> 0.3.7)
8
+ erubis (~> 2.7.0)
9
+ i18n (~> 0.6.0)
10
+ json (>= 1.5.1, < 1.8.0)
11
+ log4r (~> 1.1.9)
12
+ net-scp (~> 1.1.0)
13
+ net-ssh (~> 2.6.6)
14
+
1
15
  GEM
2
16
  remote: http://rubygems.org/
3
17
  specs:
4
- archive-tar-minitar (0.5.2)
5
18
  childprocess (0.3.9)
6
19
  ffi (~> 1.0, >= 1.0.11)
7
20
  coral_cloud (0.1.3)
8
21
  coral_core (~> 0.1)
9
- coral_core (0.2.5)
22
+ coral_core (0.2.26)
23
+ deep_merge (~> 1.0)
10
24
  git (= 1.2.5)
11
25
  json (>= 1.4)
12
26
  log4r (~> 1.1)
13
27
  coral_plan (0.1.3)
14
28
  coral_core (~> 0.1)
29
+ deep_merge (1.0.0)
15
30
  diff-lcs (1.2.4)
16
31
  erubis (2.7.0)
17
32
  ffi (1.8.1)
@@ -24,9 +39,9 @@ GEM
24
39
  rdoc
25
40
  json (1.7.7)
26
41
  log4r (1.1.10)
27
- net-scp (1.0.4)
28
- net-ssh (>= 1.99.1)
29
- net-ssh (2.2.2)
42
+ net-scp (1.1.1)
43
+ net-ssh (>= 2.6.5)
44
+ net-ssh (2.6.7)
30
45
  rake (10.0.4)
31
46
  rdoc (3.12.2)
32
47
  json (~> 1.4)
@@ -38,15 +53,6 @@ GEM
38
53
  rspec-expectations (2.13.0)
39
54
  diff-lcs (>= 1.1.3, < 2.0)
40
55
  rspec-mocks (2.13.1)
41
- vagrant (1.0.7)
42
- archive-tar-minitar (= 0.5.2)
43
- childprocess (~> 0.3.1)
44
- erubis (~> 2.7.0)
45
- i18n (~> 0.6.0)
46
- json (>= 1.5.1, < 1.8.0)
47
- log4r (~> 1.1.9)
48
- net-scp (~> 1.0.4)
49
- net-ssh (~> 2.2.2)
50
56
  yard (0.8.6.1)
51
57
 
52
58
  PLATFORMS
@@ -59,5 +65,5 @@ DEPENDENCIES
59
65
  jeweler (~> 1.8)
60
66
  rdoc (~> 3.12)
61
67
  rspec (~> 2.10)
62
- vagrant (~> 1.0)
68
+ vagrant!
63
69
  yard (~> 0.8)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ vagrant coral $@
@@ -5,13 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "coral_vagrant"
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Adrian Webb"]
12
- s.date = "2013-05-10"
12
+ s.date = "2013-05-24"
13
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 {major}.{minor} branch to make sure the feature hasn't \n been implemented 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
14
  s.email = "adrian.webb@coraltech.net"
15
+ s.executables = ["coral"]
15
16
  s.extra_rdoc_files = [
16
17
  "LICENSE.txt",
17
18
  "README.rdoc"
@@ -25,13 +26,21 @@ Gem::Specification.new do |s|
25
26
  "Rakefile",
26
27
  "VERSION",
27
28
  "Vagrantfile",
29
+ "bin/coral",
28
30
  "coral_vagrant.gemspec",
29
31
  "lib/coral_vagrant.rb",
32
+ "lib/coral_vagrant/commands/coral/add.rb",
33
+ "lib/coral_vagrant/commands/coral/config.rb",
34
+ "lib/coral_vagrant/commands/coral/create.rb",
35
+ "lib/coral_vagrant/commands/coral/image.rb",
36
+ "lib/coral_vagrant/commands/coral/init.rb",
37
+ "lib/coral_vagrant/commands/coral/push.rb",
38
+ "lib/coral_vagrant/commands/coral/rm.rb",
39
+ "lib/coral_vagrant/commands/coral/run.rb",
40
+ "lib/coral_vagrant/commands/coral/send.rb",
41
+ "lib/coral_vagrant/commands/coral/update.rb",
30
42
  "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",
43
+ "lib/plugin.rb",
35
44
  "spec/coral_test_kernel.rb",
36
45
  "spec/spec_helper.rb"
37
46
  ]
@@ -41,14 +50,13 @@ Gem::Specification.new do |s|
41
50
  s.require_paths = ["lib"]
42
51
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.1")
43
52
  s.rubyforge_project = "coral_vagrant"
44
- s.rubygems_version = "1.8.15"
53
+ s.rubygems_version = "1.8.11"
45
54
  s.summary = "Provides a data model and various Coral commands for Vagrant"
46
55
 
47
56
  if s.respond_to? :specification_version then
48
57
  s.specification_version = 3
49
58
 
50
59
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
- s.add_runtime_dependency(%q<vagrant>, ["~> 1.0"])
52
60
  s.add_runtime_dependency(%q<coral_plan>, ["~> 0.1"])
53
61
  s.add_runtime_dependency(%q<coral_cloud>, ["~> 0.1"])
54
62
  s.add_development_dependency(%q<bundler>, ["~> 1.2"])
@@ -56,8 +64,8 @@ Gem::Specification.new do |s|
56
64
  s.add_development_dependency(%q<rspec>, ["~> 2.10"])
57
65
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
58
66
  s.add_development_dependency(%q<yard>, ["~> 0.8"])
67
+ s.add_development_dependency(%q<vagrant>, [">= 0"])
59
68
  else
60
- s.add_dependency(%q<vagrant>, ["~> 1.0"])
61
69
  s.add_dependency(%q<coral_plan>, ["~> 0.1"])
62
70
  s.add_dependency(%q<coral_cloud>, ["~> 0.1"])
63
71
  s.add_dependency(%q<bundler>, ["~> 1.2"])
@@ -65,9 +73,9 @@ Gem::Specification.new do |s|
65
73
  s.add_dependency(%q<rspec>, ["~> 2.10"])
66
74
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
67
75
  s.add_dependency(%q<yard>, ["~> 0.8"])
76
+ s.add_dependency(%q<vagrant>, [">= 0"])
68
77
  end
69
78
  else
70
- s.add_dependency(%q<vagrant>, ["~> 1.0"])
71
79
  s.add_dependency(%q<coral_plan>, ["~> 0.1"])
72
80
  s.add_dependency(%q<coral_cloud>, ["~> 0.1"])
73
81
  s.add_dependency(%q<bundler>, ["~> 1.2"])
@@ -75,6 +83,7 @@ Gem::Specification.new do |s|
75
83
  s.add_dependency(%q<rspec>, ["~> 2.10"])
76
84
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
77
85
  s.add_dependency(%q<yard>, ["~> 0.8"])
86
+ s.add_dependency(%q<vagrant>, [">= 0"])
78
87
  end
79
88
  end
80
89
 
@@ -1,11 +1,10 @@
1
-
2
1
  home = File.dirname(__FILE__)
3
2
 
4
3
  $:.unshift(home) unless
5
- $:.include?(home) || $:.include?(File.expand_path(home))
6
-
4
+ $:.include?(home) || $:.include?(File.expand_path(home))
5
+
7
6
  #-------------------------------------------------------------------------------
8
-
7
+
9
8
  require 'rubygems'
10
9
  require 'optparse'
11
10
  require 'vagrant'
@@ -14,14 +13,18 @@ require 'coral_plan'
14
13
 
15
14
  #---
16
15
 
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')
16
+ # Include top level Vagrant commands
17
+ [ :coral_base ].each do |name|
18
+ require File.join('coral_vagrant', 'commands', name.to_s + '.rb')
19
+ end
20
+
21
+ require 'plugin.rb'
22
+
23
+ #---
24
+
25
+ # Include Coral Vagrant commands
26
+ Dir.glob(File.join(home, 'coral_vagrant', 'commands', 'coral', '*.rb')).each do |file|
27
+ require file
25
28
  end
26
29
 
27
30
  #*******************************************************************************
@@ -32,43 +35,41 @@ end
32
35
  # Author:: Adrian Webb (mailto:adrian.webb@coraltech.net)
33
36
  # License:: GPLv3
34
37
  module Coral
35
-
38
+
36
39
  #-----------------------------------------------------------------------------
37
40
  # Constructor / Destructor
38
-
39
41
  def self.init_vagrant(directory, submodule = '', config_file = [ 'config', 'cloud.json' ])
40
42
  return Coral::Vagrant.init(directory, submodule, config_file)
41
43
  end
42
-
44
+
43
45
  #-----------------------------------------------------------------------------
44
46
  # Accessors / Modifiers
45
-
47
+
46
48
  def self.vagrant
47
49
  return Coral::Vagrant.get
48
- end
50
+ end
49
51
 
50
- #*******************************************************************************
52
+ #*******************************************************************************
51
53
 
52
- module Vagrant
53
-
54
- VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
55
-
56
- #-----------------------------------------------------------------------------
57
- # Constructor / Destructor
54
+ module Vagrant
55
+
56
+ VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
58
57
 
59
- def self.init(directory, submodule = '', config_file = [ 'config', 'cloud.json' ])
60
- return Coral.create_cloud(:vagrant, {
61
- :directory => directory,
62
- :submodule => submodule,
63
- :config_file => config_file,
64
- })
58
+ #-----------------------------------------------------------------------------
59
+ # Constructor / Destructor
60
+ def self.init(directory, submodule = '', config_file = [ 'config', 'cloud.json' ])
61
+ return Coral.create_cloud(:vagrant, {
62
+ :directory => directory,
63
+ :submodule => submodule,
64
+ :config_file => config_file,
65
+ })
66
+ end
67
+
68
+ #-----------------------------------------------------------------------------
69
+ # Accessors / Modifiers
70
+
71
+ def self.get
72
+ return Coral.cloud(:vagrant)
73
+ end
65
74
  end
66
-
67
- #-----------------------------------------------------------------------------
68
- # Accessors / Modifiers
69
-
70
- def self.get
71
- return Coral.cloud(:vagrant)
72
- end
73
- end
74
75
  end
@@ -0,0 +1,41 @@
1
+ module Coral
2
+ module Vagrant
3
+ module SubCommand
4
+ class CoralAdd < ::Vagrant.plugin('2', :command)
5
+
6
+ #-----------------------------------------------------------------------
7
+ # Execution
8
+
9
+ def execute
10
+ options = {}
11
+ success = true
12
+
13
+ opts = OptionParser.new do |opts|
14
+ opts.banner = 'Usage: coral add -h --repo={repository} {name} [ {type} ]'
15
+ opts.separator ''
16
+
17
+ options[:repo] = ''
18
+ opts.on('-r', '--repo REPOSITORY', "Git repository URL of sub-project to add to project type") do |r|
19
+ options[:repo] = r
20
+ end
21
+ end
22
+
23
+ #---
24
+
25
+ args = parse_options(opts)
26
+ return unless args
27
+
28
+ raise ::Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if args.length < 1
29
+
30
+ project_name = args[0]
31
+ project_type = ( args.size < 2 ? 'module' : args[1] )
32
+
33
+ #---------
34
+ # Start
35
+
36
+ exit success ? 0 : 1
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,61 @@
1
+ module Coral
2
+ module Vagrant
3
+ module SubCommand
4
+ class CoralConfig < ::Vagrant.plugin('2', :command)
5
+
6
+ #-----------------------------------------------------------------------
7
+ # Execution
8
+
9
+ def execute
10
+ options = {}
11
+ success = true
12
+
13
+ opts = OptionParser.new do |opts|
14
+ opts.banner = 'Usage: coral config -ha --dir={config_dir} {config_name} [ {value} ]'
15
+ opts.separator ''
16
+
17
+ opts.on('-a', '--add', 'Add configuration value to existing values instead of overriding') do |a|
18
+ options[:add] = a
19
+ end
20
+
21
+ options[:repo] = '.'
22
+ opts.on('-r', '--repo REPO_DIR', 'Local directory of repository relative to the Vagrantfile root (.)') do |r|
23
+ options[:repo] = r
24
+ end
25
+
26
+ options[:directory] = 'config'
27
+ opts.on('-d', '--dir DIRECTORY', 'Root directory of configuration files (config)') do |d|
28
+ options[:directory] = d
29
+ end
30
+
31
+ options[:ext] = 'json'
32
+ opts.on('-e', '--ext FILE_EXTENSION', 'Configuration file extension (json)') do |e|
33
+ options[:ext] = e
34
+ end
35
+ end
36
+
37
+ #---
38
+
39
+ args = parse_options(opts)
40
+ return unless args
41
+
42
+ raise ::Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if args.length < 1
43
+
44
+ config_elements = args[0].gsub(/\s+/, '').split(/\@/)
45
+ property = config_elements.pop
46
+ config_file = File.join(config_elements)
47
+
48
+ raise ::Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp unless property && config_file
49
+
50
+ config_file = "#{config_file}." + options[:ext]
51
+ value = ( args.size < 2 ? nil : args[1] )
52
+
53
+ #---------
54
+ # Start
55
+
56
+ exit success ? 0 : 1
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,41 @@
1
+ module Coral
2
+ module Vagrant
3
+ module SubCommand
4
+ class CoralCreate < ::Vagrant.plugin('2', :command)
5
+
6
+ #-----------------------------------------------------------------------
7
+ # Execution
8
+
9
+ def execute
10
+ options = {}
11
+ success = true
12
+ default_repo = 'git://github.com/coralnexus/cluster-core.git'
13
+
14
+ #---
15
+
16
+ opts = OptionParser.new do |opts|
17
+ opts.banner = 'Usage: coral create -h --repo={cluster_repository} [ {project_path} ]'
18
+ opts.separator ""
19
+
20
+ options[:repo] = default_repo
21
+ opts.on('-r', '--repo REPOSITORY', "Git repository URL of Coral cluster to start project from (#{default_repo})") do |r|
22
+ options[:repo] = r
23
+ end
24
+ end
25
+
26
+ #---
27
+
28
+ args = parse_options(opts)
29
+ return unless args
30
+
31
+ project_path = ( project_path.empty? ? '.' : args[0] )
32
+
33
+ #---------
34
+ # Start
35
+
36
+ exit success ? 0 : 1
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,47 @@
1
+ module Coral
2
+ module Vagrant
3
+ module SubCommand
4
+ class CoralImage < ::Vagrant.plugin('2', :command)
5
+
6
+ #-----------------------------------------------------------------------
7
+ # Execution
8
+
9
+ def execute
10
+ options = {}
11
+ success = true
12
+
13
+ opts = OptionParser.new do |opts|
14
+ opts.banner = 'Usage: coral image --servers={server_name},... {provider} ...'
15
+ opts.separator ''
16
+
17
+ options[:tries] = 1
18
+ opts.on('-t', '--tries TRIES', 'Number of times to try imaging the servers before stopping with an error (1)') do |t|
19
+ options[:tries] = t
20
+ end
21
+
22
+ options[:servers] = ''
23
+ opts.on('-s', '--servers SERVER_NAME,...', 'Server names of servers to image on the specified providers') do |r|
24
+ options[:servers] = r
25
+ end
26
+ end
27
+
28
+ options[:auth] = true
29
+
30
+ #---
31
+
32
+ providers = parse_options(opts)
33
+ return unless providers
34
+
35
+ raise ::Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if providers.length < 1
36
+
37
+ #---------
38
+ # Start
39
+
40
+
41
+
42
+ exit success ? 0 : 1
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end