Sha256: c0b90bb9287a79b12ba4e5bd5d2d660752c3da2534ff4bd8888b5a364cd44fde

Contents?: true

Size: 1.48 KB

Versions: 10

Compression:

Stored size: 1.48 KB

Contents

module Librarian
  module Puppet
    module Source
      module Local

        def install!(manifest)
          manifest.source == self or raise ArgumentError

          debug { "Installing #{manifest}" }

          name, version = manifest.name, manifest.version
          found_path = found_path(name)

          if name.include? '/'
            new_name = name.split('/').last
            debug { "Invalid module name '#{name}', guessing you meant '#{new_name}'" }
            name = new_name
          end

          install_path = environment.install_path.join(name)
          if install_path.exist?
            debug { "Deleting #{relative_path_to(install_path)}" }
            install_path.rmtree
          end

          install_perform_step_copy!(found_path, install_path)
        end

        def fetch_version(name, extra)
          cache!
          found_path = found_path(name)
          '0.0.1'
        end

        def fetch_dependencies(name, version, extra)
          {}
        end

      private

        def install_perform_step_copy!(found_path, install_path)
          debug { "Copying #{relative_path_to(found_path)} to #{relative_path_to(install_path)}" }
          FileUtils.cp_r(found_path, install_path)
        end

        def manifest?(name, path)
          return true if path.join('manifests').exist?
          return true if path.join('lib').join('puppet').exist?
          return true if path.join('lib').join('facter').exist?
          false
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
librarian-puppet-0.9.10 lib/librarian/puppet/source/local.rb
librarian-puppet-0.9.9 lib/librarian/puppet/source/local.rb
librarian-puppet-0.9.8 lib/librarian/puppet/source/local.rb
librarian-puppet-0.9.7 lib/librarian/puppet/source/local.rb
librarian-puppet-0.9.6 lib/librarian/puppet/source/local.rb
librarian-puppet-0.9.5 lib/librarian/puppet/source/local.rb
librarian-puppet-0.9.4 lib/librarian/puppet/source/local.rb
librarian-puppet-0.9.3 lib/librarian/puppet/source/local.rb
librarian-puppet-0.9.2 lib/librarian/puppet/source/local.rb
librarian-puppet-0.9.2.pre lib/librarian/puppet/source/local.rb