vagrant-masonry 0.13.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.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.yardopts +6 -0
- data/CHANGELOG +190 -0
- data/Gemfile +16 -0
- data/LICENSE +15 -0
- data/README.md +129 -0
- data/docs/GettingStarted.markdown +175 -0
- data/examples/Vagrantfile +1 -0
- data/examples/roles.yaml +29 -0
- data/examples/vms.yaml +12 -0
- data/lib/config_builder.rb +24 -0
- data/lib/config_builder/action/load_extensions.rb +14 -0
- data/lib/config_builder/class_registry.rb +72 -0
- data/lib/config_builder/extension_handler.rb +22 -0
- data/lib/config_builder/filter.rb +6 -0
- data/lib/config_builder/filter/boxes.rb +22 -0
- data/lib/config_builder/filter/roles.rb +149 -0
- data/lib/config_builder/filter_stack.rb +37 -0
- data/lib/config_builder/loader.rb +23 -0
- data/lib/config_builder/loader/yaml.rb +44 -0
- data/lib/config_builder/loader/yaml_erb.rb +24 -0
- data/lib/config_builder/model.rb +67 -0
- data/lib/config_builder/model/base.rb +101 -0
- data/lib/config_builder/model/network/forwarded_port.rb +37 -0
- data/lib/config_builder/model/network/private_network.rb +15 -0
- data/lib/config_builder/model/provider/azure.rb +66 -0
- data/lib/config_builder/model/provider/libvirt.rb +108 -0
- data/lib/config_builder/model/provider/virtualbox.rb +35 -0
- data/lib/config_builder/model/provider/vmware.rb +40 -0
- data/lib/config_builder/model/provider/vmware_fusion.rb +8 -0
- data/lib/config_builder/model/provider/vmware_workstation.rb +8 -0
- data/lib/config_builder/model/provider/vsphere.rb +30 -0
- data/lib/config_builder/model/provisioner/file.rb +24 -0
- data/lib/config_builder/model/provisioner/puppet.rb +37 -0
- data/lib/config_builder/model/provisioner/puppet_server.rb +27 -0
- data/lib/config_builder/model/provisioner/shell.rb +27 -0
- data/lib/config_builder/model/root.rb +69 -0
- data/lib/config_builder/model/ssh.rb +110 -0
- data/lib/config_builder/model/synced_folder.rb +43 -0
- data/lib/config_builder/model/vm.rb +235 -0
- data/lib/config_builder/model/winrm.rb +56 -0
- data/lib/config_builder/model_delegator.rb +30 -0
- data/lib/config_builder/plugin.rb +15 -0
- data/lib/config_builder/runner.rb +33 -0
- data/lib/config_builder/version.rb +3 -0
- data/lib/vagrant-masonry.rb +1 -0
- data/spec/config_builder/filter/boxes_spec.rb +87 -0
- data/spec/config_builder/filter/roles_spec.rb +287 -0
- data/spec/config_builder/loader/yaml_spec.rb +76 -0
- data/spec/config_builder/model/provider/vmware_fusion_spec.rb +29 -0
- data/spec/spec_helper.rb +4 -0
- data/templates/locales/en.yml +11 -0
- data/vagrant-masonry.gemspec +24 -0
- metadata +128 -0
| @@ -0,0 +1,76 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe ConfigBuilder::Loader::YAML do
         | 
| 4 | 
            +
              describe '#yamldir' do
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                before :each do
         | 
| 7 | 
            +
                  # Simulate directories of YAML files for the loader.
         | 
| 8 | 
            +
                  allow(File).to receive(:join).with('tst_dir_a', anything()).and_return('tst_dir_a')
         | 
| 9 | 
            +
                  allow(File).to receive(:join).with('tst_dir_b', anything()).and_return('tst_dir_b')
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  allow(Dir).to receive(:glob).with('tst_dir_a').and_return(['a/boxes.yaml', 'a/roles.yaml'])
         | 
| 12 | 
            +
                  allow(Dir).to receive(:glob).with('tst_dir_b').and_return(['b/boxes.yaml', 'b/roles.yaml'])
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  allow(::YAML).to receive(:load_file).with('a/boxes.yaml').and_return(::YAML.load <<-EOF)
         | 
| 15 | 
            +
            ---
         | 
| 16 | 
            +
            boxes:
         | 
| 17 | 
            +
              'box-a': 'http://puppet-vagrant-boxes.puppetlabs.com/'
         | 
| 18 | 
            +
                  EOF
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  allow(::YAML).to receive(:load_file).with('a/roles.yaml').and_return(::YAML.load <<-EOF)
         | 
| 21 | 
            +
            ---
         | 
| 22 | 
            +
            roles:
         | 
| 23 | 
            +
              base:
         | 
| 24 | 
            +
                private_networks:
         | 
| 25 | 
            +
                  - {ip: '0.0.0.0', auto_network: true}
         | 
| 26 | 
            +
                  EOF
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  allow(::YAML).to receive(:load_file).with('b/boxes.yaml').and_return(::YAML.load <<-EOF)
         | 
| 29 | 
            +
            ---
         | 
| 30 | 
            +
            boxes:
         | 
| 31 | 
            +
              'box-b': 'http://puppet-vagrant-boxes.puppetlabs.com/'
         | 
| 32 | 
            +
                  EOF
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                  allow(::YAML).to receive(:load_file).with('b/roles.yaml').and_return(::YAML.load <<-EOF)
         | 
| 35 | 
            +
            ---
         | 
| 36 | 
            +
            roles:
         | 
| 37 | 
            +
              base:
         | 
| 38 | 
            +
                private_networks:
         | 
| 39 | 
            +
                  - {ip: '10.0.0.1'}
         | 
| 40 | 
            +
                  EOF
         | 
| 41 | 
            +
                end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
             | 
| 44 | 
            +
                it 'loads from single directories' do
         | 
| 45 | 
            +
                  subject.yamldir('tst_dir_a')
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                  expect(::YAML).to have_received(:load_file).exactly(2).times
         | 
| 48 | 
            +
                end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                it 'loads from multiple directories' do
         | 
| 51 | 
            +
                  subject.yamldir(['tst_dir_a', 'tst_dir_b'])
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                  expect(::YAML).to have_received(:load_file).exactly(4).times
         | 
| 54 | 
            +
                end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                it 'merges separate hashes' do
         | 
| 57 | 
            +
                  config = subject.yamldir('tst_dir_a')
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                  expect(config).to have_key('boxes')
         | 
| 60 | 
            +
                  expect(config).to have_key('roles')
         | 
| 61 | 
            +
                end
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                describe 'when merging overlapping configs' do
         | 
| 64 | 
            +
                  let(:config) { subject.yamldir(['tst_dir_a', 'tst_dir_b']) }
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                  it 'merges subhashes' do
         | 
| 67 | 
            +
                    expect(config['boxes']).to have_key('box-a')
         | 
| 68 | 
            +
                    expect(config['boxes']).to have_key('box-b')
         | 
| 69 | 
            +
                  end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                  it 'concatenates subarrays' do
         | 
| 72 | 
            +
                    expect(config['roles']['base']['private_networks']).to have(2).items
         | 
| 73 | 
            +
                  end
         | 
| 74 | 
            +
                end
         | 
| 75 | 
            +
              end
         | 
| 76 | 
            +
            end
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
            require 'config_builder/model'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe ConfigBuilder::Model::Provider::VMwareFusion do
         | 
| 5 | 
            +
              describe "converting to a proc" do
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                let(:vmx) { Hash.new }
         | 
| 8 | 
            +
                let(:fusion_config) { double('fusion provider config', :vmx => vmx) }
         | 
| 9 | 
            +
                let(:vm_config) { double('vagrant VM config', :provider => fusion_config) }
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                before do
         | 
| 12 | 
            +
                  allow(vm_config).to receive(:provider).and_yield(fusion_config)
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                it "assigns the gui value to the fusion provider object" do
         | 
| 16 | 
            +
                  subject.attrs = {:gui => 'guivalue'}
         | 
| 17 | 
            +
                  expect(fusion_config).to receive(:gui=).with('guivalue')
         | 
| 18 | 
            +
                  p = subject.to_proc
         | 
| 19 | 
            +
                  p.call(vm_config)
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                it "assigns the vmx value to the fusion provider object" do
         | 
| 23 | 
            +
                  subject.attrs = {:vmx => {:hello => 'world'}}
         | 
| 24 | 
            +
                  allow(fusion_config).to receive(:gui=)
         | 
| 25 | 
            +
                  subject.call(vm_config)
         | 
| 26 | 
            +
                  expect(vmx).to eq({:hello => 'world'})
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    ADDED
    
    
| @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            en:
         | 
| 3 | 
            +
              config_builder:
         | 
| 4 | 
            +
                class_registry:
         | 
| 5 | 
            +
                  unknown_entry: |-
         | 
| 6 | 
            +
                    Unable to locate a class associated with the identifier %{identifier} in the registry
         | 
| 7 | 
            +
                    %{registry}. The relevant plugin may have not loaded the config_builder extension.
         | 
| 8 | 
            +
                    The identifiers registered with %{registry} are %{identifiers}.
         | 
| 9 | 
            +
                  duplicate_entry: |-
         | 
| 10 | 
            +
                    The class registry %{registry} already has a class registered with identifier %{identifier}
         | 
| 11 | 
            +
                    and cannot replace the existing entry.
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            $LOAD_PATH << File.expand_path(File.join('..', 'lib'), __FILE__)
         | 
| 2 | 
            +
            require 'config_builder/version'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            Gem::Specification.new do |gem|
         | 
| 5 | 
            +
              gem.name    = 'vagrant-masonry'
         | 
| 6 | 
            +
              gem.version = ConfigBuilder::VERSION
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              gem.summary     = 'Generate Vagrant configurations from arbitrary data'
         | 
| 9 | 
            +
              gem.description = 'Use YAML configuration files to declaratively specify Vagrant configuration.'
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              gem.authors  = ['Jozef Izso', 'Adrien Thebo']
         | 
| 12 | 
            +
              gem.email    = ['jozef.izso@gmail.com', 'adrien@somethingsinistral.net']
         | 
| 13 | 
            +
              gem.homepage = 'https://github.com/goitsk/vagrant-masonry'
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              gem.has_rdoc = true
         | 
| 16 | 
            +
              gem.license  = 'Apache 2.0'
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              gem.files        = %x{git ls-files -z}.split("\0")
         | 
| 19 | 
            +
              gem.require_path = 'lib'
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              gem.add_runtime_dependency 'deep_merge', '~> 1.0.0'
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              gem.add_development_dependency 'rspec', '~> 2.14.0'
         | 
| 24 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,128 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: vagrant-masonry
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.13.0
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Jozef Izso
         | 
| 8 | 
            +
            - Adrien Thebo
         | 
| 9 | 
            +
            autorequire: 
         | 
| 10 | 
            +
            bindir: bin
         | 
| 11 | 
            +
            cert_chain: []
         | 
| 12 | 
            +
            date: 2014-12-06 00:00:00.000000000 Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            +
              name: deep_merge
         | 
| 16 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                requirements:
         | 
| 18 | 
            +
                - - "~>"
         | 
| 19 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 20 | 
            +
                    version: 1.0.0
         | 
| 21 | 
            +
              type: :runtime
         | 
| 22 | 
            +
              prerelease: false
         | 
| 23 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 24 | 
            +
                requirements:
         | 
| 25 | 
            +
                - - "~>"
         | 
| 26 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 27 | 
            +
                    version: 1.0.0
         | 
| 28 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 29 | 
            +
              name: rspec
         | 
| 30 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 31 | 
            +
                requirements:
         | 
| 32 | 
            +
                - - "~>"
         | 
| 33 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 34 | 
            +
                    version: 2.14.0
         | 
| 35 | 
            +
              type: :development
         | 
| 36 | 
            +
              prerelease: false
         | 
| 37 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 38 | 
            +
                requirements:
         | 
| 39 | 
            +
                - - "~>"
         | 
| 40 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 41 | 
            +
                    version: 2.14.0
         | 
| 42 | 
            +
            description: Use YAML configuration files to declaratively specify Vagrant configuration.
         | 
| 43 | 
            +
            email:
         | 
| 44 | 
            +
            - jozef.izso@gmail.com
         | 
| 45 | 
            +
            - adrien@somethingsinistral.net
         | 
| 46 | 
            +
            executables: []
         | 
| 47 | 
            +
            extensions: []
         | 
| 48 | 
            +
            extra_rdoc_files: []
         | 
| 49 | 
            +
            files:
         | 
| 50 | 
            +
            - ".gitignore"
         | 
| 51 | 
            +
            - ".yardopts"
         | 
| 52 | 
            +
            - CHANGELOG
         | 
| 53 | 
            +
            - Gemfile
         | 
| 54 | 
            +
            - LICENSE
         | 
| 55 | 
            +
            - README.md
         | 
| 56 | 
            +
            - docs/GettingStarted.markdown
         | 
| 57 | 
            +
            - examples/Vagrantfile
         | 
| 58 | 
            +
            - examples/roles.yaml
         | 
| 59 | 
            +
            - examples/vms.yaml
         | 
| 60 | 
            +
            - lib/config_builder.rb
         | 
| 61 | 
            +
            - lib/config_builder/action/load_extensions.rb
         | 
| 62 | 
            +
            - lib/config_builder/class_registry.rb
         | 
| 63 | 
            +
            - lib/config_builder/extension_handler.rb
         | 
| 64 | 
            +
            - lib/config_builder/filter.rb
         | 
| 65 | 
            +
            - lib/config_builder/filter/boxes.rb
         | 
| 66 | 
            +
            - lib/config_builder/filter/roles.rb
         | 
| 67 | 
            +
            - lib/config_builder/filter_stack.rb
         | 
| 68 | 
            +
            - lib/config_builder/loader.rb
         | 
| 69 | 
            +
            - lib/config_builder/loader/yaml.rb
         | 
| 70 | 
            +
            - lib/config_builder/loader/yaml_erb.rb
         | 
| 71 | 
            +
            - lib/config_builder/model.rb
         | 
| 72 | 
            +
            - lib/config_builder/model/base.rb
         | 
| 73 | 
            +
            - lib/config_builder/model/network/forwarded_port.rb
         | 
| 74 | 
            +
            - lib/config_builder/model/network/private_network.rb
         | 
| 75 | 
            +
            - lib/config_builder/model/provider/azure.rb
         | 
| 76 | 
            +
            - lib/config_builder/model/provider/libvirt.rb
         | 
| 77 | 
            +
            - lib/config_builder/model/provider/virtualbox.rb
         | 
| 78 | 
            +
            - lib/config_builder/model/provider/vmware.rb
         | 
| 79 | 
            +
            - lib/config_builder/model/provider/vmware_fusion.rb
         | 
| 80 | 
            +
            - lib/config_builder/model/provider/vmware_workstation.rb
         | 
| 81 | 
            +
            - lib/config_builder/model/provider/vsphere.rb
         | 
| 82 | 
            +
            - lib/config_builder/model/provisioner/file.rb
         | 
| 83 | 
            +
            - lib/config_builder/model/provisioner/puppet.rb
         | 
| 84 | 
            +
            - lib/config_builder/model/provisioner/puppet_server.rb
         | 
| 85 | 
            +
            - lib/config_builder/model/provisioner/shell.rb
         | 
| 86 | 
            +
            - lib/config_builder/model/root.rb
         | 
| 87 | 
            +
            - lib/config_builder/model/ssh.rb
         | 
| 88 | 
            +
            - lib/config_builder/model/synced_folder.rb
         | 
| 89 | 
            +
            - lib/config_builder/model/vm.rb
         | 
| 90 | 
            +
            - lib/config_builder/model/winrm.rb
         | 
| 91 | 
            +
            - lib/config_builder/model_delegator.rb
         | 
| 92 | 
            +
            - lib/config_builder/plugin.rb
         | 
| 93 | 
            +
            - lib/config_builder/runner.rb
         | 
| 94 | 
            +
            - lib/config_builder/version.rb
         | 
| 95 | 
            +
            - lib/vagrant-masonry.rb
         | 
| 96 | 
            +
            - spec/config_builder/filter/boxes_spec.rb
         | 
| 97 | 
            +
            - spec/config_builder/filter/roles_spec.rb
         | 
| 98 | 
            +
            - spec/config_builder/loader/yaml_spec.rb
         | 
| 99 | 
            +
            - spec/config_builder/model/provider/vmware_fusion_spec.rb
         | 
| 100 | 
            +
            - spec/spec_helper.rb
         | 
| 101 | 
            +
            - templates/locales/en.yml
         | 
| 102 | 
            +
            - vagrant-masonry.gemspec
         | 
| 103 | 
            +
            homepage: https://github.com/goitsk/vagrant-masonry
         | 
| 104 | 
            +
            licenses:
         | 
| 105 | 
            +
            - Apache 2.0
         | 
| 106 | 
            +
            metadata: {}
         | 
| 107 | 
            +
            post_install_message: 
         | 
| 108 | 
            +
            rdoc_options: []
         | 
| 109 | 
            +
            require_paths:
         | 
| 110 | 
            +
            - lib
         | 
| 111 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 112 | 
            +
              requirements:
         | 
| 113 | 
            +
              - - ">="
         | 
| 114 | 
            +
                - !ruby/object:Gem::Version
         | 
| 115 | 
            +
                  version: '0'
         | 
| 116 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 117 | 
            +
              requirements:
         | 
| 118 | 
            +
              - - ">="
         | 
| 119 | 
            +
                - !ruby/object:Gem::Version
         | 
| 120 | 
            +
                  version: '0'
         | 
| 121 | 
            +
            requirements: []
         | 
| 122 | 
            +
            rubyforge_project: 
         | 
| 123 | 
            +
            rubygems_version: 2.4.5
         | 
| 124 | 
            +
            signing_key: 
         | 
| 125 | 
            +
            specification_version: 4
         | 
| 126 | 
            +
            summary: Generate Vagrant configurations from arbitrary data
         | 
| 127 | 
            +
            test_files: []
         | 
| 128 | 
            +
            has_rdoc: true
         |