puppetlabs-translate-2.2.00040755005276200011600000000000013636134706012607 5ustar00puppetlabs-translate-2.2.0/CHANGELOG.md0100644005276200011600000000762613636134650014505 0ustar00# Change log All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). ## [v2.2.0](https://github.com/puppetlabs/puppetlabs-translate/tree/v2.2.0) (2020-03-23) [Full Changelog](https://github.com/puppetlabs/puppetlabs-translate/compare/v2.1.0...v2.2.0) ### Added - Add CentOS 5-7 and Ubuntu 18.04 [\#70](https://github.com/puppetlabs/puppetlabs-translate/pull/70) ([ekohl](https://github.com/ekohl)) - \[FM-7939\] Puppet Strings [\#41](https://github.com/puppetlabs/puppetlabs-translate/pull/41) ([carabasdaniel](https://github.com/carabasdaniel)) ## [v2.1.0](https://github.com/puppetlabs/puppetlabs-translate/tree/v2.1.0) (2019-11-29) [Full Changelog](https://github.com/puppetlabs/puppetlabs-translate/compare/v2.0.0...v2.1.0) ### Added - \(FM-8682\) - Addition of Support for CentOS 8 [\#59](https://github.com/puppetlabs/puppetlabs-translate/pull/59) ([david22swan](https://github.com/david22swan)) - FM-8414 - Add support on Debian 10 [\#52](https://github.com/puppetlabs/puppetlabs-translate/pull/52) ([lionce](https://github.com/lionce)) ## [v2.0.0](https://github.com/puppetlabs/puppetlabs-translate/tree/v2.0.0) (2019-06-13) [Full Changelog](https://github.com/puppetlabs/puppetlabs-translate/compare/1.2.0...v2.0.0) ### Changed - pdksync - \(MODULES-8444\) - Raise lower Puppet bound [\#39](https://github.com/puppetlabs/puppetlabs-translate/pull/39) ([david22swan](https://github.com/david22swan)) - \(FM-7711\) - Remove Debian 7 testing/support for Translate module [\#31](https://github.com/puppetlabs/puppetlabs-translate/pull/31) ([david22swan](https://github.com/david22swan)) ### Added - \(FM-8034\) Add RedHat 8 support [\#42](https://github.com/puppetlabs/puppetlabs-translate/pull/42) ([eimlav](https://github.com/eimlav)) - \(FM-7720/FM-7722/FM-7723\) - Update to windows support [\#33](https://github.com/puppetlabs/puppetlabs-translate/pull/33) ([david22swan](https://github.com/david22swan)) ### Fixed - pdksync - \(FM-7655\) Fix rubygems-update for ruby \< 2.3 [\#28](https://github.com/puppetlabs/puppetlabs-translate/pull/28) ([tphoney](https://github.com/tphoney)) ## [1.2.0](https://github.com/puppetlabs/puppetlabs-translate/tree/1.2.0) (2018-09-27) [Full Changelog](https://github.com/puppetlabs/puppetlabs-translate/compare/1.1.0...1.2.0) ### Added - Update metadata.json for Puppet 6 support [\#23](https://github.com/puppetlabs/puppetlabs-translate/pull/23) ([eimlav](https://github.com/eimlav)) - pdksync - \(FM-7392\) - Puppet 6 Testing Changes [\#22](https://github.com/puppetlabs/puppetlabs-translate/pull/22) ([pmcmaw](https://github.com/pmcmaw)) ### Fixed - \(MODULES-7728\) - Reading beaker-hostgenerator and nokogiri gem [\#20](https://github.com/puppetlabs/puppetlabs-translate/pull/20) ([pmcmaw](https://github.com/pmcmaw)) ## 1.1.0 ### Summary A small addition release including a bump to the Puppet version requirements. #### Changed - Updated the Puppet version to correctly reflect which version of Puppet includes the translation updates. #### Added - Adding acceptance test directory along with several nodesets for testing. - Addition of several files including maintainers, contributing and an update to existing Rakefiles and .travis files. ## Supported Release [1.0.0] ### Summary This is a feature release that includes support for interpolated strings. #### Added - support for passing strings that use interpolation to the `translate` function #### Removed - Debian 6 support ## Supported Release [0.1.0] ### Summary This is the initial release. [1.0.0]:https://github.com/puppetlabs/puppetlabs-translate/compare/0.1.0...1.0.0 [0.1.0]:https://github.com/puppetlabs/puppetlabs-translate/commits/0.1.0 \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* puppetlabs-translate-2.2.0/CONTRIBUTING.md0100644005276200011600000002306013636134650015113 0ustar00# Contributing to Puppet modules So you want to contribute to a Puppet module: Great! Below are some instructions to get you started doing that very thing while setting expectations around code quality as well as a few tips for making the process as easy as possible. ### Table of Contents 1. [Getting Started](#getting-started) 1. [Commit Checklist](#commit-checklist) 1. [Submission](#submission) 1. [More about commits](#more-about-commits) 1. [Testing](#testing) - [Running Tests](#running-tests) - [Writing Tests](#writing-tests) 1. [Get Help](#get-help) ## Getting Started - Fork the module repository on GitHub and clone to your workspace - Make your changes! ## Commit Checklist ### The Basics - [x] my commit is a single logical unit of work - [x] I have checked for unnecessary whitespace with "git diff --check" - [x] my commit does not include commented out code or unneeded files ### The Content - [x] my commit includes tests for the bug I fixed or feature I added - [x] my commit includes appropriate documentation changes if it is introducing a new feature or changing existing functionality - [x] my code passes existing test suites ### The Commit Message - [x] the first line of my commit message includes: - [x] an issue number (if applicable), e.g. "(MODULES-xxxx) This is the first line" - [x] a short description (50 characters is the soft limit, excluding ticket number(s)) - [x] the body of my commit message: - [x] is meaningful - [x] uses the imperative, present tense: "change", not "changed" or "changes" - [x] includes motivation for the change, and contrasts its implementation with the previous behavior ## Submission ### Pre-requisites - Make sure you have a [GitHub account](https://github.com/join) - [Create a ticket](https://tickets.puppet.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppet.com/browse/) you are patching for. ### Push and PR - Push your changes to your fork - [Open a Pull Request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) against the repository in the puppetlabs organization ## More about commits 1. Make separate commits for logically separate changes. Please break your commits down into logically consistent units which include new or changed tests relevant to the rest of the change. The goal of doing this is to make the diff easier to read for whoever is reviewing your code. In general, the easier your diff is to read, the more likely someone will be happy to review it and get it into the code base. If you are going to refactor a piece of code, please do so as a separate commit from your feature or bug fix changes. We also really appreciate changes that include tests to make sure the bug is not re-introduced, and that the feature is not accidentally broken. Describe the technical detail of the change(s). If your description starts to get too long, that is a good sign that you probably need to split up your commit into more finely grained pieces. Commits which plainly describe the things which help reviewers check the patch and future developers understand the code are much more likely to be merged in with a minimum of bike-shedding or requested changes. Ideally, the commit message would include information, and be in a form suitable for inclusion in the release notes for the version of Puppet that includes them. Please also check that you are not introducing any trailing whitespace or other "whitespace errors". You can do this by running "git diff --check" on your changes before you commit. 2. Sending your patches To submit your changes via a GitHub pull request, we _highly_ recommend that you have them on a topic branch, instead of directly on "master". It makes things much easier to keep track of, especially if you decide to work on another thing before your first change is merged in. GitHub has some pretty good [general documentation](http://help.github.com/) on using their site. They also have documentation on [creating pull requests](https://help.github.com/articles/creating-a-pull-request-from-a-fork/). In general, after pushing your topic branch up to your repository on GitHub, you can switch to the branch in the GitHub UI and click "Pull Request" towards the top of the page in order to open a pull request. 3. Update the related JIRA issue. If there is a JIRA issue associated with the change you submitted, then you should update the ticket to include the location of your branch, along with any other commentary you may wish to make. # Testing ## Getting Started Our Puppet modules provide [`Gemfile`](./Gemfile)s, which can tell a Ruby package manager such as [bundler](http://bundler.io/) what Ruby packages, or Gems, are required to build, develop, and test this software. Please make sure you have [bundler installed](http://bundler.io/#getting-started) on your system, and then use it to install all dependencies needed for this project in the project root by running ```shell % bundle install --path .bundle/gems Fetching gem metadata from https://rubygems.org/........ Fetching gem metadata from https://rubygems.org/.. Using rake (10.1.0) Using builder (3.2.2) -- 8><-- many more --><8 -- Using rspec-system-puppet (2.2.0) Using serverspec (0.6.3) Using rspec-system-serverspec (1.0.0) Using bundler (1.3.5) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. ``` NOTE: some systems may require you to run this command with sudo. If you already have those gems installed, make sure they are up-to-date: ```shell % bundle update ``` ## Running Tests With all dependencies in place and up-to-date, run the tests: ### Unit Tests ```shell % bundle exec rake spec ``` This executes all the [rspec tests](http://rspec-puppet.com/) in the directories defined [here](https://github.com/puppetlabs/puppetlabs_spec_helper/blob/699d9fbca1d2489bff1736bb254bb7b7edb32c74/lib/puppetlabs_spec_helper/rake_tasks.rb#L17) and so on. rspec tests may have the same kind of dependencies as the module they are testing. Although the module defines these dependencies in its [metadata.json](./metadata.json), rspec tests define them in [.fixtures.yml](./fixtures.yml). ### Acceptance Tests Some Puppet modules also come with acceptance tests, which use [beaker][]. These tests spin up a virtual machine under [VirtualBox](https://www.virtualbox.org/), controlled with [Vagrant](http://www.vagrantup.com/), to simulate scripted test scenarios. In order to run these, you need both Virtualbox and Vagrant installed on your system. Run the tests by issuing the following command ```shell % bundle exec rake spec_clean % bundle exec rspec spec/acceptance ``` This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml), install Puppet, copy this module, and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb) and then run all the tests under [spec/acceptance](./spec/acceptance). ## Writing Tests ### Unit Tests When writing unit tests for Puppet, [rspec-puppet][] is your best friend. It provides tons of helper methods for testing your manifests against a catalog (e.g. contain_file, contain_package, with_params, etc). It would be ridiculous to try and top rspec-puppet's [documentation][rspec-puppet_docs] but here's a tiny sample: Sample manifest: ```puppet file { "a test file": ensure => present, path => "/etc/sample", } ``` Sample test: ```ruby it 'does a thing' do expect(subject).to contain_file("a test file").with({:path => "/etc/sample"}) end ``` ### Acceptance Tests Writing acceptance tests for Puppet involves [beaker][] and its cousin [beaker-rspec][]. A common pattern for acceptance tests is to create a test manifest, apply it twice to check for idempotency or errors, then run expectations. ```ruby it 'does an end-to-end thing' do pp = <<-EOF file { 'a test file': ensure => present, path => "/etc/sample", content => "test string", } apply_manifest(pp, :catch_failures => true) apply_manifest(pp, :catch_changes => true) end describe file("/etc/sample") do it { is_expected.to contain "test string" } end ``` # If you have commit access to the repository Even if you have commit access to the repository, you still need to go through the process above, and have someone else review and merge in your changes. The rule is that **all changes must be reviewed by a project developer that did not write the code to ensure that all changes go through a code review process.** The record of someone performing the merge is the record that they performed the code review. Again, this should be someone other than the author of the topic branch. # Get Help ### On the web * [Puppet help messageboard](http://puppet.com/community/get-help) * [Writing tests](https://docs.puppet.com/guides/module_guides/bgtm.html#step-three-module-testing) * [General GitHub documentation](http://help.github.com/) * [GitHub pull request documentation](http://help.github.com/send-pull-requests/) ### On chat * Slack (slack.puppet.com) #forge-modules, #puppet-dev, #windows, #voxpupuli * IRC (freenode) #puppet-dev, #voxpupuli [rspec-puppet]: http://rspec-puppet.com/ [rspec-puppet_docs]: http://rspec-puppet.com/documentation/ [beaker]: https://github.com/puppetlabs/beaker [beaker-rspec]: https://github.com/puppetlabs/beaker-rspec puppetlabs-translate-2.2.0/Gemfile0100644005276200011600000000726413636134650014165 0ustar00source ENV['GEM_SOURCE'] || 'https://rubygems.org' def location_for(place_or_version, fake_version = nil) git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} file_url_regex = %r{\Afile:\/\/(?.*)} if place_or_version && (git_url = place_or_version.match(git_url_regex)) [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] else [place_or_version, { require: false }] end end ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments minor_version = ruby_version_segments[0..1].join('.') group :development do gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') end puppet_version = ENV['PUPPET_GEM_VERSION'] facter_version = ENV['FACTER_GEM_VERSION'] hiera_version = ENV['HIERA_GEM_VERSION'] gems = {} gems['puppet'] = location_for(puppet_version) # If facter or hiera versions have been specified via the environment # variables gems['facter'] = location_for(facter_version) if facter_version gems['hiera'] = location_for(hiera_version) if hiera_version if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} # If we're using a Puppet gem on Windows which handles its own win32-xxx gem # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). gems['win32-dir'] = ['<= 0.4.9', require: false] gems['win32-eventlog'] = ['<= 0.6.5', require: false] gems['win32-process'] = ['<= 0.7.5', require: false] gems['win32-security'] = ['<= 0.2.5', require: false] gems['win32-service'] = ['0.8.8', require: false] end gems.each do |gem_name, gem_params| gem gem_name, *gem_params end # Evaluate Gemfile.local and ~/.gemfile if they exist extra_gemfiles = [ "#{__FILE__}.local", File.join(Dir.home, '.gemfile'), ] extra_gemfiles.each do |gemfile| if File.file?(gemfile) && File.readable?(gemfile) eval(File.read(gemfile), binding) end end # vim: syntax=ruby puppetlabs-translate-2.2.0/HISTORY.md0100644005276200011600000000160113636134650014342 0ustar00## 1.1.0 ### Summary A small addition release including a bump to the Puppet version requirements. #### Changed - Updated the Puppet version to correctly reflect which version of Puppet includes the translation updates. #### Added - Adding acceptance test directory along with several nodesets for testing. - Addition of several files including maintainers, contributing and an update to existing Rakefiles and .travis files. ## Supported Release [1.0.0] ### Summary This is a feature release that includes support for interpolated strings. #### Added - support for passing strings that use interpolation to the `translate` function #### Removed - Debian 6 support ## Supported Release [0.1.0] ### Summary This is the initial release. [1.0.0]:https://github.com/puppetlabs/puppetlabs-translate/compare/0.1.0...1.0.0 [0.1.0]:https://github.com/puppetlabs/puppetlabs-translate/commits/0.1.0 puppetlabs-translate-2.2.0/LICENSE0100644005276200011600000002613613636134650013676 0ustar00 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. puppetlabs-translate-2.2.0/MAINTAINERS.md0100644005276200011600000000030113636134650014747 0ustar00## Maintenance Maintainers: - Puppet Forge Modules Team `forge-modules |at| puppet |dot| com` Tickets: https://tickets.puppet.com/browse/MODULES. Make sure to set component to `translate`. puppetlabs-translate-2.2.0/NOTICE0100644005276200011600000000111613636134650013564 0ustar00Puppet Module - puppetlabs-translate Copyright 2017 Puppet, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.puppetlabs-translate-2.2.0/README.md0100644005276200011600000000374713636134650014153 0ustar00# translate #### Table of Contents 1. [Module Description - What the module does and why it is useful](#module-description) 2. [Setup - The basics of getting started with translate](#setup) 3. [Usage - Configuration options and additional functionality](#usage) 4. [Reference - An under-the-hood peek at what the module is doing and how](#reference) 5. [Limitations - OS compatibility, etc.](#limitations) 6. [Development - Guide for contributing to the module](#development) 7. [Contributors](#contributors) ## Module description This module provides the `translate` function for Puppet. Wrapping a string in this function will mark it to be picked up by gettext and put into the .pot file for translation purposes. Currently, we are **only marking failures, errors, and warnings** in Puppet Supported modules. Feel free to do what you like with your own. ## Setup Install this module with the Puppet Module Tool: ```shell puppet module install puppetlabs-translate ``` ## Reference For information on the classes and types, see the [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-translate/blob/master/REFERENCE.md) ## Limitations We do not yet support pluralization. ## Development Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. For more information, see our [module contribution guide.](https://puppet.com/docs/puppet/latest/contributing.html) ## Contributors The list of contributors can be found at: [https://github.com/puppetlabs/puppetlabs-translate/graphs/contributors](https://github.com/puppetlabs/puppetlabs-translate/graphs/contributors). puppetlabs-translate-2.2.0/REFERENCE.md0100644005276200011600000000277713636134650014516 0ustar00# Reference ## Table of Contents **Functions** * [`translate`](#translate): A function that calls the _() function in gettext. This is because _ is protected in the puppet language ## Functions ### translate Type: Ruby 4.x API A function that calls the _() function in gettext. This is because _ is protected in the puppet language * **Note** Translate with simple strings: - Takes in a string and passes it to fast_gettext's _() function. Primarily used for 'marking' a string to be added to a .pot file. Translate with interpolation: - Takes in a string and a hash. Please note that variables in the message are wrapped with %{VAR} not ${VAR}. - The hash contains key value pairs with marker and the variable it will be assigned to. - The translate module passes it to fast_gettext's _() function. Primarily used for 'marking' a string to be added to a .pot file. #### Examples ##### ```puppet fail(translate("Failure message")) ``` ##### ```puppet fail(translate('message is %{color}'), {'color' => 'green'}) ``` #### `translate(String $message, Optional[Hash] $interpolation_values)` The translate function. Returns: `String` translated message. ##### Examples ###### ```puppet fail(translate("Failure message")) ``` ###### ```puppet fail(translate('message is %{color}'), {'color' => 'green'}) ``` ##### `message` Data type: `String` Message to translate ##### `interpolation_values` Data type: `Optional[Hash]` Optional. puppetlabs-translate-2.2.0/Rakefile0100644005276200011600000000702513636134650014332 0ustar00# frozen_string_literal: true require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? def changelog_user return unless Rake.application.top_level_tasks.include? "changelog" returnVal = nil || JSON.load(File.read('metadata.json'))['author'] raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil? puts "GitHubChangelogGenerator user:#{returnVal}" returnVal end def changelog_project return unless Rake.application.top_level_tasks.include? "changelog" returnVal = nil returnVal ||= begin metadata_source = JSON.load(File.read('metadata.json'))['source'] metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) metadata_source_match && metadata_source_match[1] end raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil? puts "GitHubChangelogGenerator project:#{returnVal}" returnVal end def changelog_future_release return unless Rake.application.top_level_tasks.include? "changelog" returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version'] raise "unable to find the future_release (version) in metadata.json" if returnVal.nil? puts "GitHubChangelogGenerator future_release:#{returnVal}" returnVal end PuppetLint.configuration.send('disable_relative') if Bundler.rubygems.find_name('github_changelog_generator').any? GitHubChangelogGenerator::RakeTask.new :changelog do |config| raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? config.user = "#{changelog_user}" config.project = "#{changelog_project}" config.future_release = "#{changelog_future_release}" config.exclude_labels = ['maintenance'] config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)." config.add_pr_wo_labels = true config.issues = false config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM" config.configure_sections = { "Changed" => { "prefix" => "### Changed", "labels" => ["backwards-incompatible"], }, "Added" => { "prefix" => "### Added", "labels" => ["feature", "enhancement"], }, "Fixed" => { "prefix" => "### Fixed", "labels" => ["bugfix"], }, } end else desc 'Generate a Changelog from GitHub' task :changelog do raise <= Gem::Version.new('2.2.2')" EOM end end puppetlabs-translate-2.2.0/checksums.json0100644005276200011600000000225113636134706015543 0ustar00{ "CHANGELOG.md": "91963930ea01826eb422b155a3c8a818", "CONTRIBUTING.md": "4d17f3c942e7c93d1577cc4438a231e4", "Gemfile": "55c434e6783c00517da77f00f5bb80d6", "HISTORY.md": "bc835a1a781369ba8c24681bdeab99f1", "LICENSE": "3b83ef96387f14655fc854ddc3c6bd57", "MAINTAINERS.md": "86bc26eb48e3994809990c1b49907550", "NOTICE": "002a2b26ef50234b43afb62fa62a7b97", "README.md": "09280f1b45c4250155d52a18aed02f37", "REFERENCE.md": "57ac27e3762372254a0096f6fbf896e4", "Rakefile": "2c0640724b348d5f97771732766e398f", "lib/puppet/functions/translate.rb": "6b42a479316b1565dfe94760160e92b6", "locales/config.yaml": "b291ec1700c36f3b902b5b135b841260", "metadata.json": "6e59b8650a2b644af2e4caf874d38544", "provision.yaml": "7fb54badfc87771beefa8e42c30e3b73", "spec/acceptance/spec_helper_acceptance.rb": "9681de54bf44c9c507adc13d12bada2a", "spec/acceptance/translate_spec.rb": "55bdb32fe0a766b66c27d4fcc6551897", "spec/default_facts.yml": "973bd7e9b429cde3c8d45d57c2fa21ed", "spec/functions/translate_spec.rb": "8f12d2a05773d09fea17a064f16b4cf9", "spec/spec_helper.rb": "8e26c049074cbd15499bbb32641b3906", "spec/spec_helper_local.rb": "be320849409fd3a6ae2a21c04701d88a" }puppetlabs-translate-2.2.0/lib0040755005276200011600000000000013636134706013355 5ustar00puppetlabs-translate-2.2.0/lib/puppet0040755005276200011600000000000013636134706014672 5ustar00puppetlabs-translate-2.2.0/lib/puppet/functions0040755005276200011600000000000013636134706016702 5ustar00puppetlabs-translate-2.2.0/lib/puppet/functions/translate.rb0100644005276200011600000000254213636134650021301 0ustar00# @summary A function that calls the _() function in gettext. This is because _ is protected in the puppet language # # @note # Translate with simple strings: # - Takes in a string and passes it to fast_gettext's _() function. Primarily used for 'marking' a string to be added to a .pot file. # Translate with interpolation: # - Takes in a string and a hash. Please note that variables in the message are wrapped with %{VAR} not ${VAR}. # - The hash contains key value pairs with marker and the variable it will be assigned to. # - The translate module passes it to fast_gettext's _() function. Primarily used for 'marking' a string to be added to a .pot file. # # @example # fail(translate("Failure message")) # @example # fail(translate('message is %{color}'), {'color' => 'green'}) # Puppet::Functions.create_function(:translate) do # @param message Message to translate # @param interpolation_values Optional. # @return [String] translated message. dispatch :translate do param 'String', :message optional_param 'Hash', :interpolation_values end def translate(message, interpolation_values = nil) if interpolation_values.nil? _(message) else # convert keys to symbols interpolation_values = Hash[interpolation_values.map { |k, v| [k.to_sym, v] }] _(message) % interpolation_values end end end puppetlabs-translate-2.2.0/locales0040755005276200011600000000000013636134706014231 5ustar00puppetlabs-translate-2.2.0/locales/config.yaml0100644005276200011600000000205213636134650016433 0ustar00--- # This is the project-specific configuration file for setting up # fast_gettext for your project. gettext: # This is used for the name of the .pot and .po files; they will be # called .pot? project_name: puppetlabs-translate # This is used in comments in the .pot and .po files to indicate what # project the files belong to and should bea little more desctiptive than # package_name: puppetlabs-translate # The locale that the default messages in the .pot file are in default_locale: en # The email used for sending bug reports. bugs_address: docs@puppet.com # The holder of the copyright. copyright_holder: Puppet, Inc. # This determines which comments in code should be eligible for translation. # Any comments that start with this string will be externalized. (Leave # empty to include all.) comments_tag: TRANSLATOR # Patterns for +Dir.glob+ used to find all files that might contain # translatable content, relative to the project root directory source_files: - './lib/**/*.rb' puppetlabs-translate-2.2.0/metadata.json0100644005276200011600000000266513636134706015347 0ustar00{ "name": "puppetlabs-translate", "version": "2.2.0", "author": "puppetlabs", "summary": "Puppet module that provides the translate() function for internationalization.", "license": "Apache-2.0", "source": "https://github.com/puppetlabs/puppetlabs-translate", "project_page": "https://github.com/puppetlabs/puppetlabs-translate", "issues_url": "https://github.com/puppetlabs/puppetlabs-translate/issues", "dependencies": [ ], "data_provider": null, "operatingsystem_support": [ { "operatingsystem": "Debian", "operatingsystemrelease": [ "8", "9", "10" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ "5", "6", "7", "8" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ "5", "6", "7", "8" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "14.04", "16.04", "18.04" ] }, { "operatingsystem": "Windows", "operatingsystemrelease": [ "2012", "2016", "2018", "10" ] } ], "requirements": [ { "name": "puppet", "version_requirement": ">= 5.5.10 < 7.0.0" } ], "pdk-version": "1.17.0", "template-url": "https://github.com/puppetlabs/pdk-templates#master", "template-ref": "1.17.0-0-gd3a4319" } puppetlabs-translate-2.2.0/provision.yaml0100644005276200011600000000202713636134650015576 0ustar00default: provisioner: vmpooler images: ['redhat-8-x86_64'] vagrant: provisioner: vagrant images: ['centos/7', 'generic/ubuntu1804', 'gusztavvargadr/windows-server'] travis_deb: provisioner: docker images: ['waffleimage/debian8', 'waffleimage/debian9', 'waffleimage/debian10'] travis_ub: provisioner: docker images: ['waffleimage/ubuntu14.04', 'waffleimage/ubuntu16.04', 'waffleimage/ubuntu18.04'] travis_el6: provisioner: docker images: ['waffleimage/centos6', 'waffleimage/oraclelinux6', 'waffleimage/scientificlinux6'] travis_el7: provisioner: docker images: ['waffleimage/centos7', 'waffleimage/oraclelinux7', 'waffleimage/scientificlinux7'] release_checks: provisioner: vmpooler images: ['debian-8-x86_64', 'debian-9-x86_64', 'debian-10-x86_64', 'ubuntu-1404-x86_64', 'ubuntu-1604-x86_64', 'redhat-5-x86_64', 'redhat-6-x86_64', 'redhat-7-x86_64', 'redhat-8-x86_64', 'centos-8-x86_64', 'sles-11-x86_64', 'sles-12-x86_64', 'win-2008r2-x86_64', 'win-2016-core-x86_64', 'win-2012r2-core-x86_64', 'win-10-ent-x86_64'] puppetlabs-translate-2.2.0/spec0040755005276200011600000000000013636134706013541 5ustar00puppetlabs-translate-2.2.0/spec/acceptance0040755005276200011600000000000013636134706015627 5ustar00puppetlabs-translate-2.2.0/spec/acceptance/spec_helper_acceptance.rb0100644005276200011600000000431213636134650022665 0ustar00# frozen_string_literal: true require 'serverspec' require 'puppet_litmus' require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb')) include PuppetLitmus if ENV['TARGET_HOST'].nil? || ENV['TARGET_HOST'] == 'localhost' puts 'Running tests against this machine !' if Gem.win_platform? set :backend, :cmd else set :backend, :exec end else # load inventory inventory_hash = inventory_hash_from_inventory_file node_config = config_from_node(inventory_hash, ENV['TARGET_HOST']) if target_in_group(inventory_hash, ENV['TARGET_HOST'], 'docker_nodes') host = ENV['TARGET_HOST'] set :backend, :docker set :docker_container, host elsif target_in_group(inventory_hash, ENV['TARGET_HOST'], 'ssh_nodes') set :backend, :ssh options = Net::SSH::Config.for(host) options[:user] = node_config.dig('ssh', 'user') unless node_config.dig('ssh', 'user').nil? options[:port] = node_config.dig('ssh', 'port') unless node_config.dig('ssh', 'port').nil? options[:keys] = node_config.dig('ssh', 'private-key') unless node_config.dig('ssh', 'private-key').nil? options[:password] = node_config.dig('ssh', 'password') unless node_config.dig('ssh', 'password').nil? options[:verify_host_key] = Net::SSH::Verifiers::Null.new unless node_config.dig('ssh', 'host-key-check').nil? host = if ENV['TARGET_HOST'].include?(':') ENV['TARGET_HOST'].split(':').first else ENV['TARGET_HOST'] end set :host, options[:host_name] || host set :ssh_options, options set :request_pty, true elsif target_in_group(inventory_hash, ENV['TARGET_HOST'], 'winrm_nodes') require 'winrm' set :backend, :winrm set :os, family: 'windows' user = node_config.dig('winrm', 'user') unless node_config.dig('winrm', 'user').nil? pass = node_config.dig('winrm', 'password') unless node_config.dig('winrm', 'password').nil? endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman" opts = { user: user, password: pass, endpoint: endpoint, operation_timeout: 300, } winrm = WinRM::Connection.new opts Specinfra.configuration.winrm = winrm end end puppetlabs-translate-2.2.0/spec/acceptance/translate_spec.rb0100644005276200011600000000007113636134650021233 0ustar00describe 'an example' do it 'is a pending example' end puppetlabs-translate-2.2.0/spec/default_facts.yml0100644005276200011600000000041213636134650017137 0ustar00# Use default_module_facts.yml for module specific facts. # # Facts specified here will override the values provided by rspec-puppet-facts. --- ipaddress: "172.16.254.254" ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" is_pe: false macaddress: "AA:AA:AA:AA:AA:AA" puppetlabs-translate-2.2.0/spec/functions0040755005276200011600000000000013636134706015551 5ustar00puppetlabs-translate-2.2.0/spec/functions/translate_spec.rb0100644005276200011600000000074513636134650021165 0ustar00require 'spec_helper' describe 'translate' do it { is_expected.not_to eq nil } it { is_expected.to run.with_params('test string') } it { is_expected.to run.with_params(123).and_raise_error(ArgumentError) } it { is_expected.to run.with_params('test string', 123).and_raise_error(ArgumentError) } it { is_expected.to run.with_params('test %{interpolate_this}', 'interpolate_this' => 'ok').and_return('test ok') } it { is_expected.to run.and_raise_error(ArgumentError) } end puppetlabs-translate-2.2.0/spec/spec_helper.rb0100644005276200011600000000330513636134650016432 0ustar00# frozen_string_literal: true RSpec.configure do |c| c.mock_with :rspec end require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) include RspecPuppetFacts default_facts = { puppetversion: Puppet.version, facterversion: Facter.version, } default_fact_files = [ File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')), ] default_fact_files.each do |f| next unless File.exist?(f) && File.readable?(f) && File.size?(f) begin default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) rescue => e RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" end end # read default_facts and merge them over what is provided by facterdb default_facts.each do |fact, value| add_custom_fact fact, value end RSpec.configure do |c| c.default_facts = default_facts c.before :each do # set to strictest setting for testing # by default Puppet runs at warning level Puppet.settings[:strict] = :warning end c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] c.after(:suite) do RSpec::Puppet::Coverage.report!(0) end end # Ensures that a module is defined # @param module_name Name of the module def ensure_module_defined(module_name) module_name.split('::').reduce(Object) do |last_module, next_module| last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) last_module.const_get(next_module, false) end end # 'spec_overrides' from sync.yml will appear below this line puppetlabs-translate-2.2.0/spec/spec_helper_local.rb0100644005276200011600000000133213636134650017602 0ustar00if ENV['COVERAGE'] == 'yes' require 'simplecov' require 'simplecov-console' require 'codecov' SimpleCov.formatters = [ SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::Console, SimpleCov::Formatter::Codecov, ] SimpleCov.start do track_files 'lib/**/*.rb' add_filter '/spec' # do not track vendored files add_filter '/vendor' add_filter '/.vendor' # do not track gitignored files # this adds about 4 seconds to the coverage check # this could definitely be optimized add_filter do |f| # system returns true if exit status is 0, which with git-check-ignore means file is ignored system("git check-ignore --quiet #{f.filename}") end end end