Sha256: 137c522f5e401908034a39931eff5f9fa4bc62780d74d3a517be61978aae8dde

Contents?: true

Size: 589 Bytes

Versions: 4

Compression:

Stored size: 589 Bytes

Contents

module Stevenson
  module Template
    class Local < Base
      attr_reader :template_path, :options

      def initialize(template_path, options)
        @template_path, @options = template_path, options
      end

      def local_directory
        raise InvalidTemplateException.new('The given path is not a directory') unless File.directory?(template_path)

        @_local_directory ||= Dir.mktmpdir.tap do |dir|
          directories = [template_path, options[:subdirectory], '.'].compact

          FileUtils.cp_r File.join(*directories), dir
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stevenson-2.2.1 lib/stevenson/templates/local.rb
stevenson-2.2.0 lib/stevenson/templates/local.rb
stevenson-2.1.0 lib/stevenson/templates/local.rb
stevenson-2.0.0 lib/stevenson/templates/local.rb