Skip to content

Commit

Permalink
(maint) Update puppetfile-resolver to 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
glennsarti committed Mar 20, 2020
1 parent 8f012e9 commit 7caf1a7
Show file tree
Hide file tree
Showing 22 changed files with 296 additions and 149 deletions.
5 changes: 3 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ task :gem_revendor do
},
{
:directory => 'puppetfile-resolver',
:github_repo => 'https://github.com/lingua-pupuli/puppetfile-resolver.git',
:github_ref => '0.0.3',
:github_repo => 'https://github.com/glennsarti/puppetfile-resolver.git',
:github_ref => '0.2.0',
},
{
:directory => 'molinillo',
Expand Down Expand Up @@ -91,6 +91,7 @@ task :gem_revendor do
FileUtils.rm_rf(File.join(gem_dir,'.git'))
FileUtils.rm_rf(File.join(gem_dir,'spec'))
FileUtils.rm_rf(File.join(gem_dir,'features'))
FileUtils.rm_rf(File.join(gem_dir,'docs'))
end

# Generate the README
Expand Down
2 changes: 1 addition & 1 deletion vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Gem List

* puppet-lint (https://github.com/rodjek/puppet-lint.git ref 2.4.2)
* hiera-eyaml (https://github.com/voxpupuli/hiera-eyaml ref v2.1.0)
* puppetfile-resolver (https://github.com/lingua-pupuli/puppetfile-resolver.git ref 0.0.3)
* puppetfile-resolver (https://github.com/glennsarti/puppetfile-resolver.git ref 0.2.0)
* molinillo (https://github.com/CocoaPods/Molinillo.git ref 0.6.6)

3 changes: 3 additions & 0 deletions vendor/puppetfile-resolver/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ Gemfile.lock
tmp/
vendor/
.DS_Store

# Gem building
puppetfile-resolver*.gem
2 changes: 1 addition & 1 deletion vendor/puppetfile-resolver/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Style/SymbolProc:
Style/HashSyntax:
Enabled: false

Layout/AlignHash:
Layout/HashAlignment:
EnforcedHashRocketStyle: table

Naming/RescuedExceptionsVariableName:
Expand Down
10 changes: 10 additions & 0 deletions vendor/puppetfile-resolver/.yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--exclude /vendor
--exclude /docs
--exclude /spec
--markup-provider=redcarpet
--markup=markdown
--charset utf-8
--output-dir docs/reference
--title "Puppetfile Resolver"

lib/**/*.rb
41 changes: 41 additions & 0 deletions vendor/puppetfile-resolver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Change Log

All notable changes to the "puppet-editor-services" repository will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## Unreleased

## 0.2.0 - 2020-03-20

### Added

- ([Commit](https://github.com/glennsarti/puppetfile-resolver/commit/6f267240b387d8399c5821415243c2ab426446f2)) Add flag to ignore :latest validation errors

## 0.1.0 - 2020-03-04

### Added

- ([Commit](https://github.com/glennsarti/puppetfile-resolver/commit/67678ff4d5b52f5afabe6c141167fc10e582f86e)) Add magic comments for Puppetfile parser

## 0.0.3 - 2019-11-25

### Fixed

- ([Commit](https://github.com/glennsarti/puppetfile-resolver/commit/0793b9e4fa0acefd6c52aff7fb170c96b09a0311)) OpenSSL errors cause resolution to fail

## 0.0.2 - 2019-11-21

### Added

- ([Commit](https://github.com/glennsarti/puppetfile-resolver/commit/522a22a7d7715822212704807486b8954ee64ce3)) Added support for Ruby 2.1.9

### Fixed

- ([Commit](https://github.com/glennsarti/puppetfile-resolver/commit/5bd5253873e012c6a4d0b4474a3a90c8feaaeafc)) Use plain version range

## 0.0.1 - 2019-11-04

### Added

- Initial release of the puppetfile-resolver
6 changes: 5 additions & 1 deletion vendor/puppetfile-resolver/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ group :development do
gem "rubocop", "<= 0.57.2", :require => false, :platforms => [:ruby, :x64_mingw]
gem 'rake', '~> 12.3', :require => false
else
gem "rubocop", ">= 0.60.0", :require => false, :platforms => [:ruby, :x64_mingw]
gem "rubocop", ">= 0.80.1", :require => false, :platforms => [:ruby, :x64_mingw]
gem 'rake', '>= 10.4', :require => false
end

gem "yard", :require => false
gem 'redcarpet', :require => false
gem 'github-markup', :require => false
end

# Evaluate Gemfile.local and ~/.gemfile if they exist
Expand Down
2 changes: 1 addition & 1 deletion vendor/puppetfile-resolver/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2020 Glenn Sarti

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
127 changes: 8 additions & 119 deletions vendor/puppetfile-resolver/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.com/lingua-pupuli/puppetfile-resolver.svg?branch=master)](https://travis-ci.com/lingua-pupuli/puppetfile-resolver)
[![Build Status](https://travis-ci.com/glennsarti/puppetfile-resolver.svg?branch=master)](https://travis-ci.com/glennsarti/puppetfile-resolver)
[![Gem Version](https://img.shields.io/gem/v/puppetfile-resolver)](https://rubygems.org/gems/puppetfile-resolver)

# Puppetfile Resolver

Expand All @@ -12,122 +13,10 @@ This library includes all of the code to parse a Puppetfile and then calculate a

**Note** This is still in active development. Git history may be re-written until an initial version is released

## To Do
## Documentation

- Could do with more tests
- Add YARD documentation

## Why a library and not a CLI tool?

Due to all of the different needs of tool developers, this is offered as a library instead of full blown CLI tool. For example, the needs of a VSCode Extensions developer are very different than that of the Puppet Developer Kit developer.

Therefore this is a library which is intended to be used by tool developers to create useful tools for users, and not really for direct use by users.

Note that a CLI is included (`puppetfile-cli.rb`) only as an example of how to create a tool using this library.

## Architecture

``` text
+-----------------+ +-----------------+ +-----------------+
| Forge Searcher | | Github Searcher | | Local Searcher |
+-------+---------+ +--------+--------+ +-------+---------+
| | |
+----------------------+--------------------+
|
|
V
+--------+ +----------+ +-------------------+
-- Text --> | Parser | -- Document Model -+-> | Resolver | -- Dependency Graph -+-> | Resolution Result |
+--------+ | +----------+ | +-------------------+
| |
| |
V V
+-----------+ +------------+
| Document | | Resolution |
| Validator | | Validator |
+-----------+ +------------+
```

### Puppetfile Parser

The parser converts the content of a Puppetfile into a document model (`PuppetfileResolver::Puppetfile`).

Currently only one Parser is available, `R10KEval`, which uses the same parsing logic as the [R10K Parser](https://github.com/puppetlabs/r10k/blob/master/lib/r10k/puppetfile.rb). In the future other parsers may be added, such as a [Ruby AST based parser](https://github.com/puppetlabs/r10k/pull/885).

### Puppetfile Document Validation

Even though a Puppetfile can be parsed, doesn't mean it's valid. For example, defining a module twice.

### Puppetfile Resolution

Given a Puppetfile document model, the library can attempt to recursively resolve all of the modules and their dependencies. The resolver be default will not be strict, that is, missing dependencies will not throw an error, and will attempt to also be resolved. When in strict mode, any missing dependencies will throw errors.

### Module Searchers

The Puppetfile resolution needs information about all of the available modules and versions, and does this through calling various Specification Searchers. Currently Puppet Forge, Github and Local FileSystem searchers are implemented. Additional searchers could be added, for example GitLab or SVN.

The result is a dependency graph listing all of the modules, dependencies and version information.

### Resolution validation

Even though a Puppetfile can be resolved, doesn't mean it is valid. For example, missing module dependencies are not considered valid.

### Dependency Graph

The resolver uses the [Molinillo](https://github.com/CocoaPods/Molinillo) ruby gem for dependency resolution. Molinillo is used in Bundler, among other gems, so it's well used and maintained project.

### Example workflow

1. Load the contents of a Puppetfile from disk

2. Parse the Puppetfile into a document model

3. Verify that the document model is valid

4. Create a resolver object with the document model, and the required Puppet version (optional)

5. Start the resolution

6. Validate the resolution against the document model

### Example usage

``` ruby
puppetfile_path = '/path/to/Puppetfile'

# Parse the Puppetfile into an object model
content = File.open(puppetfile_path, 'rb') { |f| f.read }
require 'puppetfile-resolver/puppetfile/parser/r10k_eval'
puppetfile = ::PuppetfileResolver::Puppetfile::Parser::R10KEval.parse(content)

# Make sure the Puppetfile is valid
unless puppetfile.valid?
puts 'Puppetfile is not valid'
puppetfile.validation_errors.each { |err| puts err }
exit 1
end

# Create the resolver
# - Use the document we just parsed (puppetfile)
# - Don't restrict by Puppet version (nil)
resolver = PuppetfileResolver::Resolver.new(puppetfile, nil)

# Configure the resolver
cache = nil # Use the default inmemory cache
ui = nil # Don't output any information
module_paths = [] # List of paths to search for modules on the local filesystem
allow_missing_modules = true # Allow missing dependencies to be resolved
opts = { cache: cache, ui: ui, module_paths: module_paths, allow_missing_modules: allow_missing_modules }

# Resolve
result = resolver.resolve(opts)

# Output resolution validation errors
result.validation_errors.each { |err| puts "Resolution Validation Error: #{err}\n"}
```

## Known issues

- The Forge module searcher will only use the internet facing forge ([https://forge.puppet.com](https://forge.puppet.com/)). Self-hosted forges are not supported

- The Git module searcher will only search public Github based modules. Private repositories or other VCS systems are not supported
- [About](https://glennsarti.github.io/puppetfile-resolver/)
- [Architecture](https://glennsarti.github.io/puppetfile-resolver/architecture)
- [Parsers](https://glennsarti.github.io/puppetfile-resolver/parsers)
- [Example Usage](https://glennsarti.github.io/puppetfile-resolver/example_usage)
- [Known Issues](https://glennsarti.github.io/puppetfile-resolver/known_issues)
46 changes: 46 additions & 0 deletions vendor/puppetfile-resolver/RELEASE_PROCES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# An overview on how to release the puppetfile-resolver gem

1. Generate and merge a release prep

* Move the Unreleased parts of the changelog to the released section

* Modify `lib/puppetfile-resolver/version.rb` with the new version number

* Update the YARD Reference documentation using `bundle exec rake generate:docs`

* Update the SSL Certs File using `bundle exec rake ssl:vendor_ca_certs`

2. Once merged, get the commit id of the preparation

3. Tag the commit

`git tag -a '<version>' -m '<version>' <commit id>`

For example;
`git tag -a '0.11.0' -m '0.11.0' 8766a5dd5e476bb10c164962e8d9185810e96a17`

4. Push the commit

`git push <remote> <version>`

For example;
`git push upstream 0.11.0`

5. Checkout and reset the repo for the new tag

For example;

``` text
> git checkout 0.11.0
> git reset --hard 0.11.0
```

6. Build the artefacts

`gem build puppetfile-resolver`

7. Upload the artefacts to ruby gems

``` text
> git push puppetfile-resolver-0.11.0.gem
```
9 changes: 8 additions & 1 deletion vendor/puppetfile-resolver/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@ namespace :ssl do
File.open(ca_cert_file, 'wb') { |f| f.write response.body }
puts "Ruby CA Certs file has been written to #{ca_cert_file}"
end
end
end

namespace :generate do
desc 'Generate YARD docs for Github Pages'
task :docs do
`yard doc`
end
end
1 change: 1 addition & 0 deletions vendor/puppetfile-resolver/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-midnight
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
##
## Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Wed Oct 16 03:12:09 2019 GMT
## Certificate data from Mozilla as of: Wed Jan 1 04:12:10 2020 GMT
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
Expand All @@ -14,7 +14,7 @@
## Just configure this file as the SSLCACertificateFile.
##
## Conversion done with mk-ca-bundle.pl version 1.27.
## SHA256: c979c6f35714a0fedb17d9e5ba37adecbbc91a8faf4186b4e23d6f9ca44fd6cb
## SHA256: f3bdcd74612952da8476a9d4147f50b29ad0710b7dd95b4c8690500209986d70
##


Expand Down Expand Up @@ -3430,3 +3430,37 @@ hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
dBb9HxEGmpv0
-----END CERTIFICATE-----

Entrust Root Certification Authority - G4
=========================================
-----BEGIN C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