vagrant-conductor 0.1.0

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.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CODE_OF_CONDUCT.md +13 -0
  6. data/Gemfile +12 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +41 -0
  9. data/Rakefile +6 -0
  10. data/Vagrantfile +10 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +7 -0
  13. data/config.yml +20 -0
  14. data/lib/vagrant/conductor/configure.rb +97 -0
  15. data/lib/vagrant/conductor/modules/_base/_base.rb +38 -0
  16. data/lib/vagrant/conductor/modules/_base/config.yml +3 -0
  17. data/lib/vagrant/conductor/modules/_base/scripts/beanstalkd.sh +8 -0
  18. data/lib/vagrant/conductor/modules/_base/scripts/composer.sh +8 -0
  19. data/lib/vagrant/conductor/modules/_base/scripts/grub.sh +10 -0
  20. data/lib/vagrant/conductor/modules/_base/scripts/memcache.sh +4 -0
  21. data/lib/vagrant/conductor/modules/_base/scripts/mysql.sh +21 -0
  22. data/lib/vagrant/conductor/modules/_base/scripts/nginx.sh +45 -0
  23. data/lib/vagrant/conductor/modules/_base/scripts/nodejs.sh +14 -0
  24. data/lib/vagrant/conductor/modules/_base/scripts/php.sh +52 -0
  25. data/lib/vagrant/conductor/modules/_base/scripts/postgresql.sh +21 -0
  26. data/lib/vagrant/conductor/modules/_base/scripts/python-pip.sh +7 -0
  27. data/lib/vagrant/conductor/modules/_base/scripts/redis.sh +14 -0
  28. data/lib/vagrant/conductor/modules/_base/scripts/sqlite.sh +4 -0
  29. data/lib/vagrant/conductor/modules/_base/scripts/system.sh +48 -0
  30. data/lib/vagrant/conductor/modules/_base/scripts/xdebug.sh +22 -0
  31. data/lib/vagrant/conductor/modules/aws/aws.rb +38 -0
  32. data/lib/vagrant/conductor/modules/aws/config.yml +10 -0
  33. data/lib/vagrant/conductor/modules/aws/scripts/awscli.sh +16 -0
  34. data/lib/vagrant/conductor/modules/aws/scripts/awsconfig.sh +11 -0
  35. data/lib/vagrant/conductor/modules/aws/scripts/elasticbeanstalk.sh +8 -0
  36. data/lib/vagrant/conductor/modules/aws/templates/config.erb +5 -0
  37. data/lib/vagrant/conductor/modules/aws/templates/credentials.erb +5 -0
  38. data/lib/vagrant/conductor/modules/docker/config.yml +2 -0
  39. data/lib/vagrant/conductor/modules/docker/docker.rb +13 -0
  40. data/lib/vagrant/conductor/modules/docker/scripts/install.sh +3 -0
  41. data/lib/vagrant/conductor/modules/folders/config.yml +2 -0
  42. data/lib/vagrant/conductor/modules/folders/folders.rb +14 -0
  43. data/lib/vagrant/conductor/modules/git-config/config.yml +5 -0
  44. data/lib/vagrant/conductor/modules/git-config/git-config.rb +42 -0
  45. data/lib/vagrant/conductor/modules/known-hosts/config.yml +6 -0
  46. data/lib/vagrant/conductor/modules/known-hosts/known-hosts.rb +14 -0
  47. data/lib/vagrant/conductor/modules/known-hosts/scripts/add-domain.sh +8 -0
  48. data/lib/vagrant/conductor/modules/module.rb +31 -0
  49. data/lib/vagrant/conductor/modules/modules.rb +58 -0
  50. data/lib/vagrant/conductor/modules/oh-my-zsh/config.yml +6 -0
  51. data/lib/vagrant/conductor/modules/oh-my-zsh/oh-my-zsh.rb +27 -0
  52. data/lib/vagrant/conductor/modules/oh-my-zsh/scripts/install-oh-my-zsh.sh +19 -0
  53. data/lib/vagrant/conductor/modules/sites/config.yml +20 -0
  54. data/lib/vagrant/conductor/modules/sites/scripts/clone.sh +35 -0
  55. data/lib/vagrant/conductor/modules/sites/scripts/dotenv.sh +12 -0
  56. data/lib/vagrant/conductor/modules/sites/scripts/server.sh +8 -0
  57. data/lib/vagrant/conductor/modules/sites/sites.rb +193 -0
  58. data/lib/vagrant/conductor/modules/sites/templates/dotenv-array.erb +7 -0
  59. data/lib/vagrant/conductor/modules/sites/templates/server.erb +53 -0
  60. data/lib/vagrant/conductor/modules/ssh/config.yml +2 -0
  61. data/lib/vagrant/conductor/modules/ssh/ssh.rb +29 -0
  62. data/lib/vagrant/conductor/plugin.rb +14 -0
  63. data/lib/vagrant/conductor/provisioner.rb +48 -0
  64. data/lib/vagrant/conductor/util/hash.rb +19 -0
  65. data/lib/vagrant/conductor/version.rb +5 -0
  66. data/lib/vagrant/conductor.rb +48 -0
  67. data/vagrant-conductor.gemspec +33 -0
  68. metadata +152 -0
@@ -0,0 +1,29 @@
1
+ class SSH < StationModule
2
+
3
+ def authorize
4
+ if args.find?('authorize', false)
5
+ shell_provision(
6
+ "echo $1 | tee -a /home/vagrant/.ssh/authorized_keys",
7
+ [File.read(File.expand_path(args["authorize"]))]
8
+ )
9
+ end
10
+ end
11
+
12
+ def keys
13
+ args.find?('keys', []).each do |key|
14
+ shell_provision(
15
+ "echo \"$1\" > /home/vagrant/.ssh/$2 && chmod 600 /home/vagrant/.ssh/$2",
16
+ [File.read(File.expand_path(key)), key.split('/').last],
17
+ false
18
+ )
19
+ end
20
+ end
21
+
22
+ def provision
23
+ # Configure The Public Key For SSH Access
24
+ authorize
25
+ # Copy The SSH Private Keys To The Box
26
+ keys
27
+ end
28
+
29
+ end
@@ -0,0 +1,14 @@
1
+ module VagrantPlugins
2
+ module Conductor
3
+ class Plugin < Vagrant.plugin('2')
4
+
5
+ name "Conductor"
6
+
7
+ description <<-DESC
8
+ Provides support for provisioning your virtual machines with
9
+ module scripts.
10
+ DESC
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,48 @@
1
+ module VagrantPlugins
2
+ module Conductor
3
+
4
+ # This class implements provisioning via conductor modules.
5
+ class Provisioner
6
+
7
+ attr_reader :config
8
+ attr_reader :path
9
+ attr_reader :sync_path
10
+ attr_reader :initialized
11
+
12
+ # Initialize the provisioner
13
+ def initialize(config)
14
+ @config = config
15
+ @path = File.expand_path('modules', __dir__)
16
+ @sync_path = sync_folder
17
+ @initialized = Hash.new
18
+ end
19
+
20
+ def provision(args)
21
+ modules = VagrantPlugins::Conductor::Modules.new(available_modules(@path), args, @config, @sync_path)
22
+ @initialized = modules.init
23
+
24
+ if ENV.has_key?('MODULE') && @initialized.has_key?(ENV['MODULE'])
25
+ @initialized[ENV['MODULE']].provision
26
+ else
27
+ @initialized.each do |name, object|
28
+ object.provision
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ # set the sync folder
35
+ def sync_folder
36
+ sync_path = '/tmp/conductor/modules'
37
+ @config.vm.synced_folder @path, sync_path
38
+ sync_path
39
+ end
40
+
41
+ # Get a list of the available modules
42
+ def available_modules(path)
43
+ Dir.glob(path + '/*').select { |f| File.directory? f }
44
+ end
45
+
46
+ end # Provisioner
47
+ end # Conductor
48
+ end # VagrantPlugins
@@ -0,0 +1,19 @@
1
+ class Hash
2
+
3
+ # http://stackoverflow.com/questions/9381553/ruby-merge-nested-hash
4
+ def deep_merge(second)
5
+ merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
6
+ self.merge(second, &merger)
7
+ end
8
+
9
+ def find?(key, default=nil)
10
+ keys = key.split('.')
11
+ if keys.length > 1
12
+ key = keys.shift
13
+ self.has_key?(key) ? self[key].find?(keys.join('.'), default) : default
14
+ else
15
+ self[key] || default
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,5 @@
1
+ module Vagrant
2
+ module Conductor
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,48 @@
1
+ require "vagrant"
2
+ require "vagrant/conductor/version"
3
+ require "vagrant/conductor/util/hash"
4
+ require "vagrant/conductor/modules/module"
5
+ require "vagrant/conductor/modules/modules"
6
+ require "vagrant/conductor/plugin"
7
+ require "vagrant/conductor/configure"
8
+ require "vagrant/conductor/provisioner"
9
+
10
+ class VagrantConductor
11
+
12
+ attr_accessor :config
13
+
14
+ def initialize(config)
15
+ @config = config
16
+ end
17
+
18
+ def init(config, default = nil)
19
+ args = merge_args(config, default)
20
+ configure_environment(args)
21
+ provision_modules(args)
22
+ end
23
+
24
+ def configure_environment(args)
25
+ config = VagrantPlugins::Conductor::Configure.new(@config)
26
+ config.configure(args)
27
+ end
28
+
29
+ def provision_modules(args)
30
+ modules = VagrantPlugins::Conductor::Provisioner.new(@config)
31
+ modules.provision(args)
32
+ end
33
+
34
+ # Merge arguments from the default config
35
+ def merge_args(config, default = nil)
36
+ args = load(config)
37
+ if !default.nil? && File.exist?(default)
38
+ args.deep_merge(load(default))
39
+ end
40
+ args
41
+ end
42
+
43
+ # Load and read a YAML file
44
+ def load(path)
45
+ YAML::load(File.read(path))
46
+ end
47
+
48
+ end
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant/conductor/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-conductor"
8
+ spec.version = Vagrant::Conductor::VERSION
9
+ spec.authors = ["Matthew Cuyar"]
10
+ spec.email = ["matt@enctypeapparel.com"]
11
+
12
+ spec.summary = %q{Vagrant plugin for quick environment and box provisioning}
13
+ spec.description = spec.summary
14
+ spec.homepage = "https://github.com/mcuyar/conductor"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ # end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rspec"
33
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-conductor
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Cuyar
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-05 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
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
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
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
+ description: Vagrant plugin for quick environment and box provisioning
56
+ email:
57
+ - matt@enctypeapparel.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .rspec
64
+ - .travis.yml
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - Vagrantfile
71
+ - bin/console
72
+ - bin/setup
73
+ - config.yml
74
+ - lib/vagrant/conductor.rb
75
+ - lib/vagrant/conductor/configure.rb
76
+ - lib/vagrant/conductor/modules/_base/_base.rb
77
+ - lib/vagrant/conductor/modules/_base/config.yml
78
+ - lib/vagrant/conductor/modules/_base/scripts/beanstalkd.sh
79
+ - lib/vagrant/conductor/modules/_base/scripts/composer.sh
80
+ - lib/vagrant/conductor/modules/_base/scripts/grub.sh
81
+ - lib/vagrant/conductor/modules/_base/scripts/memcache.sh
82
+ - lib/vagrant/conductor/modules/_base/scripts/mysql.sh
83
+ - lib/vagrant/conductor/modules/_base/scripts/nginx.sh
84
+ - lib/vagrant/conductor/modules/_base/scripts/nodejs.sh
85
+ - lib/vagrant/conductor/modules/_base/scripts/php.sh
86
+ - lib/vagrant/conductor/modules/_base/scripts/postgresql.sh
87
+ - lib/vagrant/conductor/modules/_base/scripts/python-pip.sh
88
+ - lib/vagrant/conductor/modules/_base/scripts/redis.sh
89
+ - lib/vagrant/conductor/modules/_base/scripts/sqlite.sh
90
+ - lib/vagrant/conductor/modules/_base/scripts/system.sh
91
+ - lib/vagrant/conductor/modules/_base/scripts/xdebug.sh
92
+ - lib/vagrant/conductor/modules/aws/aws.rb
93
+ - lib/vagrant/conductor/modules/aws/config.yml
94
+ - lib/vagrant/conductor/modules/aws/scripts/awscli.sh
95
+ - lib/vagrant/conductor/modules/aws/scripts/awsconfig.sh
96
+ - lib/vagrant/conductor/modules/aws/scripts/elasticbeanstalk.sh
97
+ - lib/vagrant/conductor/modules/aws/templates/config.erb
98
+ - lib/vagrant/conductor/modules/aws/templates/credentials.erb
99
+ - lib/vagrant/conductor/modules/docker/config.yml
100
+ - lib/vagrant/conductor/modules/docker/docker.rb
101
+ - lib/vagrant/conductor/modules/docker/scripts/install.sh
102
+ - lib/vagrant/conductor/modules/folders/config.yml
103
+ - lib/vagrant/conductor/modules/folders/folders.rb
104
+ - lib/vagrant/conductor/modules/git-config/config.yml
105
+ - lib/vagrant/conductor/modules/git-config/git-config.rb
106
+ - lib/vagrant/conductor/modules/known-hosts/config.yml
107
+ - lib/vagrant/conductor/modules/known-hosts/known-hosts.rb
108
+ - lib/vagrant/conductor/modules/known-hosts/scripts/add-domain.sh
109
+ - lib/vagrant/conductor/modules/module.rb
110
+ - lib/vagrant/conductor/modules/modules.rb
111
+ - lib/vagrant/conductor/modules/oh-my-zsh/config.yml
112
+ - lib/vagrant/conductor/modules/oh-my-zsh/oh-my-zsh.rb
113
+ - lib/vagrant/conductor/modules/oh-my-zsh/scripts/install-oh-my-zsh.sh
114
+ - lib/vagrant/conductor/modules/sites/config.yml
115
+ - lib/vagrant/conductor/modules/sites/scripts/clone.sh
116
+ - lib/vagrant/conductor/modules/sites/scripts/dotenv.sh
117
+ - lib/vagrant/conductor/modules/sites/scripts/server.sh
118
+ - lib/vagrant/conductor/modules/sites/sites.rb
119
+ - lib/vagrant/conductor/modules/sites/templates/dotenv-array.erb
120
+ - lib/vagrant/conductor/modules/sites/templates/server.erb
121
+ - lib/vagrant/conductor/modules/ssh/config.yml
122
+ - lib/vagrant/conductor/modules/ssh/ssh.rb
123
+ - lib/vagrant/conductor/plugin.rb
124
+ - lib/vagrant/conductor/provisioner.rb
125
+ - lib/vagrant/conductor/util/hash.rb
126
+ - lib/vagrant/conductor/version.rb
127
+ - vagrant-conductor.gemspec
128
+ homepage: https://github.com/mcuyar/conductor
129
+ licenses:
130
+ - MIT
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 2.5.0
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Vagrant plugin for quick environment and box provisioning
152
+ test_files: []