Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Big Refactor
* Remove vault client caching for now * (TODO: check with original contributor to reimplement in a testable way) * Update docs * Move to k/v v2 * Remove references to generic * More test coverage * Update travis.yml build and get it green * Rubocop fixes * Add warning to README
- Loading branch information
Showing
9 changed files
with
511 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
--- | ||
AllCops: | ||
DisplayCopNames: true | ||
TargetRubyVersion: '2.3' | ||
Include: | ||
- "lib/**/*.rb" | ||
- "spec/**/*.rb" | ||
Exclude: | ||
- bin/* | ||
- "spec/spec_helper.rb" | ||
- ".vendor/**/*" | ||
- "**/Gemfile" | ||
- "**/Rakefile" | ||
- pkg/**/* | ||
- spec/fixtures/**/* | ||
- vendor/**/* | ||
- "**/Puppetfile" | ||
- "**/Vagrantfile" | ||
- "**/Guardfile" | ||
- spec/support/vault_server.rb | ||
Metrics/LineLength: | ||
Description: People have wide screens, use them. | ||
Max: 200 | ||
Style/BlockDelimiters: | ||
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to | ||
be consistent then. | ||
EnforcedStyle: braces_for_chaining | ||
Style/ClassAndModuleChildren: | ||
Description: Compact style reduces the required amount of indentation. | ||
EnforcedStyle: compact | ||
Style/EmptyElse: | ||
Description: Enforce against empty else clauses, but allow `nil` for clarity. | ||
EnforcedStyle: empty | ||
Style/FormatString: | ||
Description: Following the main puppet project's style, prefer the % format format. | ||
EnforcedStyle: percent | ||
Style/FormatStringToken: | ||
Description: Following the main puppet project's style, prefer the simpler template | ||
tokens over annotated ones. | ||
EnforcedStyle: template | ||
Style/Lambda: | ||
Description: Prefer the keyword for easier discoverability. | ||
EnforcedStyle: literal | ||
Style/RegexpLiteral: | ||
Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168 | ||
EnforcedStyle: percent_r | ||
Style/TernaryParentheses: | ||
Description: Checks for use of parentheses around ternary conditions. Enforce parentheses | ||
on complex expressions for better readability, but seriously consider breaking | ||
it up. | ||
EnforcedStyle: require_parentheses_when_complex | ||
Style/TrailingCommaInArguments: | ||
Description: Prefer always trailing comma on multiline argument lists. This makes | ||
diffs, and re-ordering nicer. | ||
EnforcedStyleForMultiline: comma | ||
Style/TrailingCommaInArrayLiteral: | ||
Description: Prefer always trailing comma on multiline literals. This makes diffs, | ||
and re-ordering nicer. | ||
EnforcedStyleForMultiline: comma | ||
Style/TrailingCommaInHashLiteral: | ||
Description: Prefer always trailing comma on multiline literals. This makes diffs, | ||
and re-ordering nicer. | ||
EnforcedStyleForMultiline: comma | ||
Style/SymbolArray: | ||
Description: Using percent style obscures symbolic intent of array's contents. | ||
EnforcedStyle: brackets | ||
Style/Documentation: | ||
Exclude: | ||
- lib/puppet/parser/functions/**/* | ||
- spec/**/* | ||
Style/WordArray: | ||
EnforcedStyle: brackets | ||
Style/CollectionMethods: | ||
Enabled: true | ||
Style/MethodCalledOnDoEndBlock: | ||
Enabled: true | ||
Style/StringMethods: | ||
Enabled: true | ||
Layout/EndOfLine: | ||
Enabled: false | ||
Layout/IndentHeredoc: | ||
Enabled: false | ||
Metrics/AbcSize: | ||
Enabled: false | ||
Metrics/BlockLength: | ||
Enabled: false | ||
Metrics/ClassLength: | ||
Enabled: false | ||
Metrics/CyclomaticComplexity: | ||
Enabled: false | ||
Metrics/MethodLength: | ||
Enabled: false | ||
Metrics/ModuleLength: | ||
Enabled: false | ||
Metrics/ParameterLists: | ||
Enabled: false | ||
Metrics/PerceivedComplexity: | ||
Enabled: false | ||
Style/AsciiComments: | ||
Enabled: false | ||
Style/IfUnlessModifier: | ||
Enabled: false | ||
Style/SymbolProc: | ||
Enabled: false | ||
Style/FrozenStringLiteralComment: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,28 @@ | ||
dist: trusty | ||
sudo: false | ||
language: ruby | ||
script: "bundle exec rake spec" | ||
cache: bundler | ||
|
||
env: | ||
- PUPPET_VERSION="~> 5" VAULT_VERSION=1.0.1 | ||
- PUPPET_VERSION="~> 5" VAULT_VERSION=0.11.6 | ||
- PUPPET_VERSION="~> 5" VAULT_VERSION=0.10.4 | ||
- PUPPET_VERSION="~> 6" VAULT_VERSION=1.0.1 | ||
- PUPPET_VERSION="~> 6" VAULT_VERSION=0.11.6 | ||
- PUPPET_VERSION="~> 6" VAULT_VERSION=0.10.4 | ||
|
||
before_install: | ||
- curl -sLo vault.zip https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip | ||
- unzip vault.zip | ||
- mkdir -p ~/bin | ||
- mv vault ~/bin | ||
- export PATH="~/bin:$PATH" | ||
- rm Gemfile.lock | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
rvm: | ||
- 2.1.9 | ||
- 2.4.1 | ||
- 2.4 | ||
- 2.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
This module has grown over time based on a range of contributions from | ||
people using it. If you follow these contributing guidelines your patch | ||
will likely make it into a release a little quicker. | ||
|
||
## Contributing | ||
|
||
1. Fork the repo. | ||
|
||
1. Create a separate branch for your change. | ||
|
||
1. Run the tests. We only take pull requests with passing tests, and | ||
documentation. | ||
|
||
1. Add a test for your change. Only refactoring and documentation | ||
changes require no new tests. If you are adding functionality | ||
or fixing a bug, please add a test. | ||
|
||
1. Squash your commits down into logical components. Make sure to rebase | ||
against the current master. | ||
|
||
1. Push the branch to your fork and submit a pull request. | ||
|
||
Please be prepared to repeat some of these steps as our contributors review | ||
your code. | ||
|
||
## Dependencies | ||
|
||
The testing and development tools have a bunch of dependencies, | ||
all managed by [bundler](http://bundler.io/). | ||
|
||
By default the tests use a baseline version of Puppet. | ||
|
||
Install the dependencies like so... | ||
|
||
bundle install | ||
|
||
## Syntax and style | ||
|
||
Run `rubocop` to detect style issues and perform fixes: | ||
|
||
bundle exec rubocop -a . | ||
|
||
## Running the unit tests | ||
|
||
The unit test suite covers most of the code, as mentioned above please | ||
add tests if you're adding new functionality. | ||
|
||
The unit tests currently run against a real vault instance running in `server -dev` mode. | ||
This can be seen in [./spec/support/vault_server.rb](vault_server.rb)). | ||
|
||
You will need Vault in your path for this to work. | ||
|
||
To run your all the unit tests | ||
|
||
bundle exec rake spec SPEC_OPTS='--format documentation' | ||
|
||
To run a specific spec test set the `SPEC` variable: | ||
|
||
bundle exec rake spec SPEC=spec/foo_spec.rb:123 | ||
|
||
|
||
|
||
## Integration tests | ||
|
||
The unit tests just check the code runs, not that it does exactly what | ||
we want on a real machine. For that we're using | ||
[beaker](https://github.com/puppetlabs/beaker). | ||
|
||
This fires up a simple Docker cluster and runs a series of | ||
simple tests against it after applying the module. You can run this | ||
with: | ||
|
||
bundle exec rake acceptance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,5 +26,7 @@ group :test do | |
gem 'simplecov-console' | ||
|
||
gem 'puppet-blacksmith' | ||
|
||
gem 'pry' | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.