Sha256: 36ed87928a71437017d14a3068a1b1ca885ab042ca5285ee82c67f1505bb700f

Contents?: true

Size: 888 Bytes

Versions: 15

Compression:

Stored size: 888 Bytes

Contents

require 'fileutils'

module Oscar
  class Skeleton

    # @!attribute [r] provider
    #   @return [Symbol] The provider for the generated configuration
    attr_reader :provider

    # @!attribute [r]
    #   @return [Pathname] The path to the destination directory
    attr_reader :dest_dir

    # @param env      [Vagrant::Environment]
    # @param provider [Symbol]
    def initialize(env, provider = nil)
      @env      = env
      @provider = (provider || @env.default_provider)
      @dest_dir = Pathname.new(Dir.getwd)

      @template_root = File.join(Oscar.template_root, 'oscar-init-skeleton')
    end

    def generate
      vagrantfile = File.join(@template_root, 'Vagrantfile')
      config_dir  = File.join(@template_root, @provider.to_s, '.')

      FileUtils.cp   vagrantfile, @dest_dir
      FileUtils.cp_r config_dir,  File.join(@dest_dir, 'config')
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
oscar-0.6.0 lib/oscar/skeleton.rb
oscar-0.5.6 lib/oscar/skeleton.rb
oscar-0.5.5 lib/oscar/skeleton.rb
oscar-0.5.4 lib/oscar/skeleton.rb
oscar-0.5.3 lib/oscar/skeleton.rb
oscar-0.5.2 lib/oscar/skeleton.rb
oscar-0.5.1 lib/oscar/skeleton.rb
oscar-0.5.0 lib/oscar/skeleton.rb
oscar-0.4.3 lib/oscar/skeleton.rb
oscar-0.4.2 lib/oscar/skeleton.rb
oscar-0.4.1 lib/oscar/skeleton.rb
oscar-0.4.0 lib/oscar/skeleton.rb
oscar-0.3.2 lib/oscar/skeleton.rb
oscar-0.3.1 lib/oscar/skeleton.rb
oscar-0.3.0 lib/oscar/skeleton.rb