pdk-akerl 1.9.1.1 → 1.14.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +180 -0
  3. data/README.md +43 -4
  4. data/lib/pdk.rb +4 -2
  5. data/lib/pdk/analytics.rb +44 -0
  6. data/lib/pdk/analytics/client/google_analytics.rb +141 -0
  7. data/lib/pdk/analytics/client/noop.rb +23 -0
  8. data/lib/pdk/analytics/util.rb +17 -0
  9. data/lib/pdk/answer_file.rb +4 -1
  10. data/lib/pdk/cli.rb +50 -3
  11. data/lib/pdk/cli/build.rb +10 -4
  12. data/lib/pdk/cli/bundle.rb +10 -8
  13. data/lib/pdk/cli/config.rb +20 -0
  14. data/lib/pdk/cli/config/get.rb +24 -0
  15. data/lib/pdk/cli/console.rb +148 -0
  16. data/lib/pdk/cli/convert.rb +7 -2
  17. data/lib/pdk/cli/exec.rb +22 -190
  18. data/lib/pdk/cli/exec/command.rb +238 -0
  19. data/lib/pdk/cli/exec/interactive_command.rb +114 -0
  20. data/lib/pdk/cli/exec_group.rb +6 -6
  21. data/lib/pdk/cli/module/build.rb +0 -2
  22. data/lib/pdk/cli/module/generate.rb +4 -2
  23. data/lib/pdk/cli/new.rb +2 -0
  24. data/lib/pdk/cli/new/class.rb +2 -2
  25. data/lib/pdk/cli/new/defined_type.rb +4 -2
  26. data/lib/pdk/cli/new/module.rb +5 -0
  27. data/lib/pdk/cli/new/provider.rb +4 -2
  28. data/lib/pdk/cli/new/task.rb +4 -1
  29. data/lib/pdk/cli/new/test.rb +53 -0
  30. data/lib/pdk/cli/new/transport.rb +27 -0
  31. data/lib/pdk/cli/test.rb +0 -1
  32. data/lib/pdk/cli/test/unit.rb +18 -13
  33. data/lib/pdk/cli/update.rb +25 -3
  34. data/lib/pdk/cli/util.rb +111 -14
  35. data/lib/pdk/cli/util/interview.rb +10 -2
  36. data/lib/pdk/cli/util/option_validator.rb +4 -0
  37. data/lib/pdk/cli/util/spinner.rb +13 -0
  38. data/lib/pdk/cli/validate.rb +16 -5
  39. data/lib/pdk/config.rb +121 -0
  40. data/lib/pdk/config/analytics_schema.json +26 -0
  41. data/lib/pdk/config/errors.rb +5 -0
  42. data/lib/pdk/config/json.rb +34 -0
  43. data/lib/pdk/config/json_schema_namespace.rb +143 -0
  44. data/lib/pdk/config/json_schema_setting.rb +53 -0
  45. data/lib/pdk/config/json_with_schema.rb +50 -0
  46. data/lib/pdk/config/namespace.rb +332 -0
  47. data/lib/pdk/config/setting.rb +132 -0
  48. data/lib/pdk/config/yaml.rb +43 -0
  49. data/lib/pdk/config/yaml_with_schema.rb +59 -0
  50. data/lib/pdk/generate.rb +10 -3
  51. data/lib/pdk/generate/defined_type.rb +1 -0
  52. data/lib/pdk/generate/module.rb +62 -35
  53. data/lib/pdk/generate/provider.rb +0 -5
  54. data/lib/pdk/generate/puppet_class.rb +1 -0
  55. data/lib/pdk/generate/puppet_object.rb +88 -41
  56. data/lib/pdk/generate/transport.rb +87 -0
  57. data/lib/pdk/logger.rb +21 -1
  58. data/lib/pdk/module.rb +2 -2
  59. data/lib/pdk/module/build.rb +103 -10
  60. data/lib/pdk/module/convert.rb +85 -19
  61. data/lib/pdk/module/metadata.rb +17 -12
  62. data/lib/pdk/module/templatedir.rb +108 -40
  63. data/lib/pdk/module/update.rb +27 -15
  64. data/lib/pdk/module/update_manager.rb +23 -15
  65. data/lib/pdk/report.rb +4 -3
  66. data/lib/pdk/report/event.rb +8 -6
  67. data/lib/pdk/template_file.rb +1 -1
  68. data/lib/pdk/tests/unit.rb +48 -21
  69. data/lib/pdk/util.rb +29 -63
  70. data/lib/pdk/util/bundler.rb +19 -15
  71. data/lib/pdk/util/filesystem.rb +64 -1
  72. data/lib/pdk/util/git.rb +52 -1
  73. data/lib/pdk/util/puppet_strings.rb +123 -0
  74. data/lib/pdk/util/puppet_version.rb +27 -12
  75. data/lib/pdk/util/ruby_version.rb +30 -7
  76. data/lib/pdk/util/template_uri.rb +281 -0
  77. data/lib/pdk/util/vendored_file.rb +28 -24
  78. data/lib/pdk/util/version.rb +7 -8
  79. data/lib/pdk/util/windows.rb +1 -0
  80. data/lib/pdk/util/windows/api_types.rb +0 -7
  81. data/lib/pdk/util/windows/file.rb +1 -1
  82. data/lib/pdk/util/windows/string.rb +1 -1
  83. data/lib/pdk/validate/base_validator.rb +12 -14
  84. data/lib/pdk/validate/metadata/metadata_json_lint.rb +0 -4
  85. data/lib/pdk/validate/metadata/metadata_syntax.rb +5 -3
  86. data/lib/pdk/validate/metadata_validator.rb +0 -2
  87. data/lib/pdk/validate/puppet/puppet_epp.rb +137 -0
  88. data/lib/pdk/validate/puppet/puppet_lint.rb +0 -3
  89. data/lib/pdk/validate/puppet/puppet_syntax.rb +5 -5
  90. data/lib/pdk/validate/puppet_validator.rb +2 -3
  91. data/lib/pdk/validate/ruby/rubocop.rb +1 -6
  92. data/lib/pdk/validate/ruby_validator.rb +0 -2
  93. data/lib/pdk/validate/tasks/metadata_lint.rb +9 -5
  94. data/lib/pdk/validate/tasks/name.rb +5 -3
  95. data/lib/pdk/validate/tasks_validator.rb +0 -2
  96. data/lib/pdk/validate/yaml/syntax.rb +6 -4
  97. data/lib/pdk/validate/yaml_validator.rb +0 -2
  98. data/lib/pdk/version.rb +1 -1
  99. data/locales/pdk.pot +634 -307
  100. metadata +100 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39f58183065dc5b1f230bcffb0d5b9cb889b17c3a60185c824c34d2ab48e8787
4
- data.tar.gz: 32a54051654794a36a5de1a34980a469a5e0b11e9a6d1c5ad18407b764dc7728
3
+ metadata.gz: c49e589172a6958956aec6393c2db9fbaa3a9f6ad4e1c36e4a00dcd3d080268e
4
+ data.tar.gz: 89e6f4061d9de5e075479fd15e6a2e7a936c52313d2dce2c4d1546ca1d9e023b
5
5
  SHA512:
6
- metadata.gz: a5d3c027319d74685372a715a7ae858bc3ee219be81e4d26d31d60e8a89d68a9952f6547c4cd45c8ef23683dbf399a892cb75f11e41a755afaaf36deb9407cce
7
- data.tar.gz: 45a778d76f7d8ec4ff09082c0710c2a0b291dce8162287ca4ef7f705e4e8f34e5ad534664d3a23ca25ab0a1986b834f654f2c833559e3d8a36d824bba06877d2
6
+ metadata.gz: ce88ad0e0721c12a6de27ebd4ff6a628c44195f8d445a53782c840434c927609afddeefa0217e30a67e2d689919aaab8c9cf9ec1b8fb3f827b7749037e8a2b3f
7
+ data.tar.gz: cafedc051b152ea5baaf87c214fc7e1d66db02ec6af03fd6a7c36928e4e8652523c8e739fd1aeb0979e8f6af91e49388d42a5bf10c3a95591dd530a6d0d9a42a
data/CHANGELOG.md CHANGED
@@ -4,6 +4,185 @@ All changes to this repo will be documented in this file.
4
4
  See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) for a high-level summary.
5
5
 
6
6
 
7
+ ## [v1.14.0](https://github.com/puppetlabs/pdk/tree/v1.14.0) (2019-10-09)
8
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.13.0...v1.14.0)
9
+
10
+ **Implemented enhancements:**
11
+
12
+ - Add new "pdk console" command [\#758](https://github.com/puppetlabs/pdk/pull/758) ([logicminds](https://github.com/logicminds))
13
+ - \(PDK-1495\) Update pdk new test UX [\#749](https://github.com/puppetlabs/pdk/pull/749) ([rodjek](https://github.com/rodjek))
14
+ - \(PDK-680\) Make `pdk test unit` interactive by default [\#748](https://github.com/puppetlabs/pdk/pull/748) ([rodjek](https://github.com/rodjek))
15
+ - \(PDK-1047\) Add --add-tests to pdk convert [\#746](https://github.com/puppetlabs/pdk/pull/746) ([rodjek](https://github.com/rodjek))
16
+
17
+ **Merged pull requests:**
18
+
19
+ - \(fixup\) Fix Bundle CLI lazy load [\#767](https://github.com/puppetlabs/pdk/pull/767) ([glennsarti](https://github.com/glennsarti))
20
+ - \(fixup\) Missing require from lazy load PR [\#766](https://github.com/puppetlabs/pdk/pull/766) ([rodjek](https://github.com/rodjek))
21
+ - \(maint\) Loosen tests for puppet-dev [\#765](https://github.com/puppetlabs/pdk/pull/765) ([glennsarti](https://github.com/glennsarti))
22
+ - \(PDK-680\) Update package tests for interactive `pdk test unit` [\#756](https://github.com/puppetlabs/pdk/pull/756) ([rodjek](https://github.com/rodjek))
23
+ - \(maint\) - Add new utility method for fixtures dir [\#755](https://github.com/puppetlabs/pdk/pull/755) ([logicminds](https://github.com/logicminds))
24
+ - \(maint\) Lazy load dependencies [\#754](https://github.com/puppetlabs/pdk/pull/754) ([rodjek](https://github.com/rodjek))
25
+ - \(maint\) - Allow no output when reading puppet\_from\_opts [\#753](https://github.com/puppetlabs/pdk/pull/753) ([logicminds](https://github.com/logicminds))
26
+ - \(maint\) Refactors method to use block assignment [\#752](https://github.com/puppetlabs/pdk/pull/752) ([logicminds](https://github.com/logicminds))
27
+ - \(maint\) Add CODEOWNERS file [\#751](https://github.com/puppetlabs/pdk/pull/751) ([glennsarti](https://github.com/glennsarti))
28
+ - \(PDK-1367\) Deprecation warning for Puppet \< 5.0.0 [\#747](https://github.com/puppetlabs/pdk/pull/747) ([rodjek](https://github.com/rodjek))
29
+ - \(PDK-1112\) Create json schema to validate pdk config file [\#742](https://github.com/puppetlabs/pdk/pull/742) ([glennsarti](https://github.com/glennsarti))
30
+ - \(MAINT\) Bump version to 1.14.0.pre [\#741](https://github.com/puppetlabs/pdk/pull/741) ([scotje](https://github.com/scotje))
31
+
32
+ ## [v1.13.0](https://github.com/puppetlabs/pdk/tree/v1.13.0) (2019-08-29)
33
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.12.0...v1.13.0)
34
+
35
+ **Implemented enhancements:**
36
+
37
+ - Don't buffer output from bundle commands [\#364](https://github.com/puppetlabs/pdk/issues/364)
38
+ - Provide official docker image with pdk [\#336](https://github.com/puppetlabs/pdk/issues/336)
39
+ - \(PDK-1175\) pdk new unit\_test [\#735](https://github.com/puppetlabs/pdk/pull/735) ([rodjek](https://github.com/rodjek))
40
+ - \(PDK-871\) Relax dependencies on tty-\* gems [\#730](https://github.com/puppetlabs/pdk/pull/730) ([rodjek](https://github.com/rodjek))
41
+ - \(PDK-1363\) Apply init templates during module convert [\#729](https://github.com/puppetlabs/pdk/pull/729) ([rodjek](https://github.com/rodjek))
42
+ - \(PDK-1107\) Add pdk config get CLI command [\#715](https://github.com/puppetlabs/pdk/pull/715) ([glennsarti](https://github.com/glennsarti))
43
+
44
+ **Fixed bugs:**
45
+
46
+ - Problem running "pdk validate manifests/" with pdk 1.12.0 [\#722](https://github.com/puppetlabs/pdk/issues/722)
47
+ - Windows MSI installer fails with PDK 1.12.0 [\#721](https://github.com/puppetlabs/pdk/issues/721)
48
+ - Handle deleted template files for new module [\#725](https://github.com/puppetlabs/pdk/pull/725) ([seanmil](https://github.com/seanmil))
49
+ - \(GH-722\) Do not emit nil targets for validators against a directory [\#724](https://github.com/puppetlabs/pdk/pull/724) ([glennsarti](https://github.com/glennsarti))
50
+ - \(maint\) avoid interfering with local ruby configs [\#86](https://github.com/puppetlabs/pdk/pull/86) ([DavidS](https://github.com/DavidS))
51
+
52
+ **Merged pull requests:**
53
+
54
+ - \(FIXUP\) Remove nokogiri version pin from package-testing [\#738](https://github.com/puppetlabs/pdk/pull/738) ([scotje](https://github.com/scotje))
55
+ - \(PDK-1464\) Update nokogiri due to CVE-2019-5477 [\#733](https://github.com/puppetlabs/pdk/pull/733) ([glennsarti](https://github.com/glennsarti))
56
+ - \(PDK-1465\) Remove net-ssh from gemspec [\#732](https://github.com/puppetlabs/pdk/pull/732) ([glennsarti](https://github.com/glennsarti))
57
+ - \(PDK-1384\) Updates to be compatible with latest Cri [\#731](https://github.com/puppetlabs/pdk/pull/731) ([scotje](https://github.com/scotje))
58
+ - \(docs\) minor fixups to README [\#727](https://github.com/puppetlabs/pdk/pull/727) ([jbondpdx](https://github.com/jbondpdx))
59
+ - \(PDK-1107\) Config fetch and \[\] should have no side effects [\#726](https://github.com/puppetlabs/pdk/pull/726) ([glennsarti](https://github.com/glennsarti))
60
+ - \(MAINT\) Bump version to 1.13.0.pre [\#720](https://github.com/puppetlabs/pdk/pull/720) ([scotje](https://github.com/scotje))
61
+ - \(MAINT\) Allow use of RSPEC\_PATTERN env var when running package tests [\#719](https://github.com/puppetlabs/pdk/pull/719) ([scotje](https://github.com/scotje))
62
+ - \(maint\) Remove Hipchat notifications [\#716](https://github.com/puppetlabs/pdk/pull/716) ([glennsarti](https://github.com/glennsarti))
63
+ - \(PDK-1432\) Autogenerate PowerShell modules from code [\#701](https://github.com/puppetlabs/pdk/pull/701) ([glennsarti](https://github.com/glennsarti))
64
+
65
+ ## [v1.12.0](https://github.com/puppetlabs/pdk/tree/v1.12.0) (2019-07-31)
66
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.11.1...v1.12.0)
67
+
68
+ **Implemented enhancements:**
69
+
70
+ - \(PDK-421\) Validate EPP syntax [\#680](https://github.com/puppetlabs/pdk/pull/680) ([raphink](https://github.com/raphink))
71
+ - \(FM-8081\) pdk new transport [\#666](https://github.com/puppetlabs/pdk/pull/666) ([DavidS](https://github.com/DavidS))
72
+
73
+ **Fixed bugs:**
74
+
75
+ - Checking Ruby code style fails [\#697](https://github.com/puppetlabs/pdk/issues/697)
76
+ - template-url does not properly match ssh URI [\#653](https://github.com/puppetlabs/pdk/issues/653)
77
+ - pdk build should fix file + directory rights for tar file [\#618](https://github.com/puppetlabs/pdk/issues/618)
78
+
79
+ **Merged pull requests:**
80
+
81
+ - \(FIXUP\) Bypass shell invocation for PDK::CLI::Exec::InteractiveCommand [\#717](https://github.com/puppetlabs/pdk/pull/717) ([scotje](https://github.com/scotje))
82
+ - \(maint\) Expect pdk test unit to run more than 1 test [\#714](https://github.com/puppetlabs/pdk/pull/714) ([rodjek](https://github.com/rodjek))
83
+ - \(PDK-1309\) Ensure file modes in built modules are sane [\#713](https://github.com/puppetlabs/pdk/pull/713) ([rodjek](https://github.com/rodjek))
84
+ - \(PDK-641\) Make `pdk bundle` fully interactive [\#712](https://github.com/puppetlabs/pdk/pull/712) ([scotje](https://github.com/scotje))
85
+ - \(PDK-1366\) Update default operatingsystem versions [\#711](https://github.com/puppetlabs/pdk/pull/711) ([rodjek](https://github.com/rodjek))
86
+ - \(PDK-421\) Update acceptance tests for EPP Validation [\#709](https://github.com/puppetlabs/pdk/pull/709) ([glennsarti](https://github.com/glennsarti))
87
+ - \(PDK-1434\) Gracefully handle unparsable bolt analytics config [\#705](https://github.com/puppetlabs/pdk/pull/705) ([rodjek](https://github.com/rodjek))
88
+ - \(MAINT\) Add debug logging of yaml files being validated [\#704](https://github.com/puppetlabs/pdk/pull/704) ([npwalker](https://github.com/npwalker))
89
+ - \(maint\) Fix typo in gitignore [\#700](https://github.com/puppetlabs/pdk/pull/700) ([glennsarti](https://github.com/glennsarti))
90
+ - \(PDK-1333\) Fix command\_spec rake task for newer CRI versions [\#699](https://github.com/puppetlabs/pdk/pull/699) ([glennsarti](https://github.com/glennsarti))
91
+ - \(PDK-1429\) Bump version to 1.11.2.pre [\#698](https://github.com/puppetlabs/pdk/pull/698) ([scotje](https://github.com/scotje))
92
+ - \(FM-8081\) pdk new transport [\#696](https://github.com/puppetlabs/pdk/pull/696) ([DavidS](https://github.com/DavidS))
93
+ - \(maint\) Update beaker in package tests [\#695](https://github.com/puppetlabs/pdk/pull/695) ([rodjek](https://github.com/rodjek))
94
+ - Revert "Merge pull request \#666 from DavidS/fm-8081-pdk-new-transport" [\#693](https://github.com/puppetlabs/pdk/pull/693) ([DavidS](https://github.com/DavidS))
95
+ - \(maint\) Message and string fixes [\#676](https://github.com/puppetlabs/pdk/pull/676) ([DavidS](https://github.com/DavidS))
96
+ - \(PDK-1333\) command\_spec rake task [\#644](https://github.com/puppetlabs/pdk/pull/644) ([rodjek](https://github.com/rodjek))
97
+
98
+ ## [v1.11.1](https://github.com/puppetlabs/pdk/tree/v1.11.1) (2019-07-01)
99
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.11.0...v1.11.1)
100
+
101
+ **Closed issues:**
102
+
103
+ - PDK explicitly asking for consent to collect anonymous usage information [\#690](https://github.com/puppetlabs/pdk/issues/690)
104
+
105
+ **Merged pull requests:**
106
+
107
+ - \(PDK-1423\) Release 1.11.1 [\#692](https://github.com/puppetlabs/pdk/pull/692) ([rodjek](https://github.com/rodjek))
108
+ - \(PDK-1415\) Allow analytics opt-out prompt to be disabled via ENV [\#691](https://github.com/puppetlabs/pdk/pull/691) ([scotje](https://github.com/scotje))
109
+ - \(PDK-1414\) Detect common CI environments and set non-interactive [\#689](https://github.com/puppetlabs/pdk/pull/689) ([glennsarti](https://github.com/glennsarti))
110
+ - \(PDK-1409\) Bump PDK version to 1.11.1.pre [\#688](https://github.com/puppetlabs/pdk/pull/688) ([rodjek](https://github.com/rodjek))
111
+
112
+ ## [v1.11.0](https://github.com/puppetlabs/pdk/tree/v1.11.0) (2019-06-27)
113
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.10.0...v1.11.0)
114
+
115
+ **Fixed bugs:**
116
+
117
+ - \(PDK-1348\) remove unused constants throwing warns [\#656](https://github.com/puppetlabs/pdk/pull/656) ([tphoney](https://github.com/tphoney))
118
+
119
+ **Closed issues:**
120
+
121
+ - template-ref behaviour in PDK 1.10.0 breaks backwards compatibility [\#661](https://github.com/puppetlabs/pdk/issues/661)
122
+ - pdk validate reports error on is\_to\_s [\#642](https://github.com/puppetlabs/pdk/issues/642)
123
+ - pdk 1.9.1.0 on windows does not set path env variable [\#641](https://github.com/puppetlabs/pdk/issues/641)
124
+ - default\_facts.yml does not override values from facterdb [\#628](https://github.com/puppetlabs/pdk/issues/628)
125
+ - PDK and beaker [\#622](https://github.com/puppetlabs/pdk/issues/622)
126
+ - Configure 'ordering' for rspec-puppet in PDK [\#511](https://github.com/puppetlabs/pdk/issues/511)
127
+ - Cannot override module Hiera 5 config for unit tests [\#487](https://github.com/puppetlabs/pdk/issues/487)
128
+
129
+ **Merged pull requests:**
130
+
131
+ - \(PDK-1403\) Release 1.11.0 [\#687](https://github.com/puppetlabs/pdk/pull/687) ([rodjek](https://github.com/rodjek))
132
+ - \(FIXUP\) Avoid attempting to append nokogiri pin to nil in package tests [\#686](https://github.com/puppetlabs/pdk/pull/686) ([scotje](https://github.com/scotje))
133
+ - Revert "\(PDK-1366\) Update default operatingsystem versions" [\#685](https://github.com/puppetlabs/pdk/pull/685) ([rodjek](https://github.com/rodjek))
134
+ - \(maint\) Clear Gemfile overrides before pdk update test [\#684](https://github.com/puppetlabs/pdk/pull/684) ([rodjek](https://github.com/rodjek))
135
+ - \(PDK-1366\) Update default operatingsystem versions [\#682](https://github.com/puppetlabs/pdk/pull/682) ([rodjek](https://github.com/rodjek))
136
+ - \(PDK-1362\) Warn user if updating module with older PDK version [\#681](https://github.com/puppetlabs/pdk/pull/681) ([rodjek](https://github.com/rodjek))
137
+ - \(PDK-1365\) Use dynamic ruby detection for default ruby instance [\#678](https://github.com/puppetlabs/pdk/pull/678) ([glennsarti](https://github.com/glennsarti))
138
+ - \(PDK-1354\) Default template ref for custom templates should always be master [\#677](https://github.com/puppetlabs/pdk/pull/677) ([rodjek](https://github.com/rodjek))
139
+ - \(maint\) Pin cri to \<= 2.15.6 [\#675](https://github.com/puppetlabs/pdk/pull/675) ([rodjek](https://github.com/rodjek))
140
+ - \(MAINT\) Fix issues related to Cri behavior change with options hash [\#672](https://github.com/puppetlabs/pdk/pull/672) ([scotje](https://github.com/scotje))
141
+ - \(PDK-1337\) Warn and unset any of the legacy \*\_GEM\_VERSION env vars [\#671](https://github.com/puppetlabs/pdk/pull/671) ([rodjek](https://github.com/rodjek))
142
+ - \(PDK-1345\) Disable analytics during package tests [\#670](https://github.com/puppetlabs/pdk/pull/670) ([rodjek](https://github.com/rodjek))
143
+ - \(MAINT\) Fix MSYS2 update on Appveyor [\#669](https://github.com/puppetlabs/pdk/pull/669) ([rodjek](https://github.com/rodjek))
144
+ - \(PDK-1342\) Submit PDK analytics events [\#668](https://github.com/puppetlabs/pdk/pull/668) ([rodjek](https://github.com/rodjek))
145
+ - \(PDK-1336\) Update rubocop to 0.57.2 [\#667](https://github.com/puppetlabs/pdk/pull/667) ([scotje](https://github.com/scotje))
146
+ - \(PDK-1341\) Hook up PDK analytics to Google Analytics [\#665](https://github.com/puppetlabs/pdk/pull/665) ([rodjek](https://github.com/rodjek))
147
+ - \(MAINT\) Add "needs-triage" default labels to issue templates [\#664](https://github.com/puppetlabs/pdk/pull/664) ([scotje](https://github.com/scotje))
148
+ - \(PDK-1264\) Display a nicer error when tarring long paths [\#663](https://github.com/puppetlabs/pdk/pull/663) ([rodjek](https://github.com/rodjek))
149
+ - \(maint\) Add spawned process stdout & stderr to debug log [\#662](https://github.com/puppetlabs/pdk/pull/662) ([rodjek](https://github.com/rodjek))
150
+ - \(PDK-1300\) Ensure `test unit --list` uses correct Puppet/Ruby env [\#660](https://github.com/puppetlabs/pdk/pull/660) ([scotje](https://github.com/scotje))
151
+ - \(MAINT\) Fixup package acceptance tests for 'pdk-default' template URL [\#658](https://github.com/puppetlabs/pdk/pull/658) ([scotje](https://github.com/scotje))
152
+ - \(PDK-1339\) Read or interview for analytics config [\#657](https://github.com/puppetlabs/pdk/pull/657) ([rodjek](https://github.com/rodjek))
153
+ - \(PDK-1350\) Handle SCP style URLs in metadata.json [\#655](https://github.com/puppetlabs/pdk/pull/655) ([rodjek](https://github.com/rodjek))
154
+ - \(PDK-1338\) Initial import of analytics code from Bolt [\#652](https://github.com/puppetlabs/pdk/pull/652) ([rodjek](https://github.com/rodjek))
155
+ - \(MAINT\) Bump version to 1.11.0.pre [\#651](https://github.com/puppetlabs/pdk/pull/651) ([scotje](https://github.com/scotje))
156
+ - \(PDK-1335\) Add development note when on Windows [\#649](https://github.com/puppetlabs/pdk/pull/649) ([glennsarti](https://github.com/glennsarti))
157
+ - \(maint\) Allow developers to add additional gems [\#648](https://github.com/puppetlabs/pdk/pull/648) ([glennsarti](https://github.com/glennsarti))
158
+ - \(PDK-1167\) Validator should honor case sensitive of the file system [\#646](https://github.com/puppetlabs/pdk/pull/646) ([glennsarti](https://github.com/glennsarti))
159
+ - \(PDK-1193\) Saves packaged template-url in metadata as a keyword [\#639](https://github.com/puppetlabs/pdk/pull/639) ([bmjen](https://github.com/bmjen))
160
+
161
+ ## [v1.10.0](https://github.com/puppetlabs/pdk/tree/v1.10.0) (2019-04-02)
162
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.9.1...v1.10.0)
163
+
164
+ **Implemented enhancements:**
165
+
166
+ - \(PDK-1086\) Change `pdk build --force` to warn if missing module metadata and continue [\#643](https://github.com/puppetlabs/pdk/pull/643) ([rodjek](https://github.com/rodjek))
167
+ - \(PDK-1308\) Ensure PDK-written non-templated files have trailing newline [\#640](https://github.com/puppetlabs/pdk/pull/640) ([scotje](https://github.com/scotje))
168
+ - \(PDK-718\) Add --template-ref argument for upstream template repo tags [\#434](https://github.com/puppetlabs/pdk/pull/434) ([hunner](https://github.com/hunner))
169
+
170
+ **Closed issues:**
171
+
172
+ - `pdk update` is not idempotent for deletion of CI config files [\#593](https://github.com/puppetlabs/pdk/issues/593)
173
+ - Rspec tests for CRLF line endings fail [\#587](https://github.com/puppetlabs/pdk/issues/587)
174
+ - class params feature in class object template not documented or useable [\#557](https://github.com/puppetlabs/pdk/issues/557)
175
+ - Disabling puppet-lint checks in PDK [\#538](https://github.com/puppetlabs/pdk/issues/538)
176
+
177
+ **Merged pull requests:**
178
+
179
+ - \(PDK-1324\) Release 1.10.0 [\#650](https://github.com/puppetlabs/pdk/pull/650) ([rodjek](https://github.com/rodjek))
180
+ - \(maint\) Fix package specs for template-ref changes [\#647](https://github.com/puppetlabs/pdk/pull/647) ([rodjek](https://github.com/rodjek))
181
+ - \(maint\) Enforce LF line endings in Rubocop [\#645](https://github.com/puppetlabs/pdk/pull/645) ([glennsarti](https://github.com/glennsarti))
182
+ - \(FM-7579, PDK-1236\) bump the version of CRI used [\#638](https://github.com/puppetlabs/pdk/pull/638) ([tphoney](https://github.com/tphoney))
183
+ - \(PDK-1294\) Update version post-release [\#637](https://github.com/puppetlabs/pdk/pull/637) ([bmjen](https://github.com/bmjen))
184
+ - \(PDK-1298\) acceptance:local test suite optimisation [\#633](https://github.com/puppetlabs/pdk/pull/633) ([rodjek](https://github.com/rodjek))
185
+
7
186
  ## [v1.9.1](https://github.com/puppetlabs/pdk/tree/v1.9.1) (2019-03-01)
8
187
  [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.9.0...v1.9.1)
9
188
 
@@ -17,6 +196,7 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
17
196
 
18
197
  **Merged pull requests:**
19
198
 
199
+ - \(PDK-1289\) Release 1.9.1 [\#632](https://github.com/puppetlabs/pdk/pull/632) ([bmjen](https://github.com/bmjen))
20
200
  - \(maint\) Pin parallel gem to 1.13.0 [\#631](https://github.com/puppetlabs/pdk/pull/631) ([rodjek](https://github.com/rodjek))
21
201
  - \(PDK-1260\) Bump to 1.10.0.pre for new dev work [\#621](https://github.com/puppetlabs/pdk/pull/621) ([bmjen](https://github.com/bmjen))
22
202
 
data/README.md CHANGED
@@ -31,6 +31,7 @@ puppet-syntax | Checks for correct syntax in Puppet manifests, templates, and Hi
31
31
  puppetlabs_spec_helper | Provides classes, methods, and Rake tasks to help with spec testing Puppet code.
32
32
  rspec-puppet | Tests the behavior of Puppet when it compiles your manifests into a catalog of Puppet resources.
33
33
  rspec-puppet-facts | Adds support for running rspec-puppet tests against the facts for your supported operating systems.
34
+ puppet-debugger | Provides a REPL based debugger console.
34
35
 
35
36
 
36
37
  ## Installation
@@ -114,15 +115,53 @@ This command runs all available unit tests.
114
115
 
115
116
  ## Experimental features
116
117
 
117
- ### `pdk bundle` command
118
+ ### `pdk console` command
119
+ The pdk console command executes a session of the puppet debugger when inside a module and allows for exploration of puppet code. See the official [puppet debugger site](https://www.puppet-debugger.com) for more info and the official docs [site here.](https://docs.puppet-debugger.com)
120
+
121
+ To use, execute `pdk console` from inside your module directory. You can also supply the `--puppet-version` or `--pe-version` or `--puppet-dev` to swap out the puppet version when using the console.
122
+
123
+ Example (from within a module):
124
+
125
+ * `pdk console --puppet-version=5`
126
+ * `pdk console --pe-version=2018.1`
127
+
128
+ The `pdk console` command will also pass through any puppet debugger arguments you wish to use.
129
+
130
+ Example:
131
+
132
+ * `pdk console --no-facterdb`
133
+ * `pdk console --play https://gist.github.com/logicminds/4f6bcfd723c92aad1f01f6a800319fa4`
134
+ * `pdk console -e "md5('sdfasdfasdf')" --run-once --quiet`
135
+
136
+ Use `pdk console -h` for a further explanation of pass through arguments.
137
+
138
+ If you receive the following error you do not have the puppet-debugger gem installed.
118
139
 
119
- This command executes arbitrary commands in a bundler context within the module you're currently working on. Arguments to this command are passed straight through to bundler. This command is experimental and can lead to errors that can't be resolved by the pdk itself.
140
+ ```
141
+ pdk console -h
142
+ Error: Unknown Puppet subcommand 'debugger'
143
+ See 'puppet help' for help on available puppet subcommands
144
+ ```
145
+
146
+ To fix this you will need to add the following entry to your .sync.yml file and run pdk update:
147
+
148
+ ```
149
+ Gemfile:
150
+ required:
151
+ ":development":
152
+ - gem: puppet-debugger
153
+ version: "~> 0.14"
154
+ ```
155
+
156
+ **NOTE**: The puppet-debugger gem has been added to the [puppet-module-* gems](https://github.com/puppetlabs/puppet-module-gems/pull/117), so once you get the gem update you no longer need the .sync.yml entry.
157
+
158
+ ### `pdk bundle` command
120
159
 
121
- Note that for most uses, you must use the `--` to separate bundler options from pdk options. Compare the following two commands:
160
+ This command executes arbitrary commands in a bundler context within the module you're currently working on. Arguments to this command are passed straight through to bundler. This command is experimental and can lead to errors that can't be resolved by PDK itself.
122
161
 
123
162
  ## Module Compatibility
124
163
 
125
- **PDK Version Compatibility:** Modules created with PDK version validate against and run on all Puppet and Ruby version combinations currently under maintenance (see https://docs.puppet.com/puppet/latest/about_agent.html and https://puppet.com/misc/puppet-enterprise-lifecycle)
164
+ **PDK Version Compatibility:** Modules created with PDK validate against and run on all Puppet and Ruby version combinations currently under maintenance (see https://docs.puppet.com/puppet/latest/about_agent.html and https://puppet.com/misc/puppet-enterprise-lifecycle)
126
165
 
127
166
  ## Contributing
128
167
 
data/lib/pdk.rb CHANGED
@@ -1,10 +1,12 @@
1
+ require 'pdk/analytics'
1
2
  require 'pdk/answer_file'
3
+ require 'pdk/config'
2
4
  require 'pdk/generate'
3
5
  require 'pdk/i18n'
4
6
  require 'pdk/logger'
5
7
  require 'pdk/report'
6
- require 'pdk/template_file'
7
8
  require 'pdk/validate'
8
9
  require 'pdk/version'
9
10
 
10
- module PDK; end
11
+ module PDK
12
+ end
@@ -0,0 +1,44 @@
1
+ require 'pdk/analytics/client/google_analytics'
2
+ require 'pdk/analytics/client/noop'
3
+
4
+ module PDK
5
+ def self.analytics
6
+ require 'pdk/config'
7
+ require 'pdk/logger'
8
+ require 'pdk/util'
9
+ require 'pdk/version'
10
+
11
+ @analytics ||= PDK::Analytics.build_client(
12
+ logger: PDK.logger,
13
+ disabled: ENV['PDK_DISABLE_ANALYTICS'] || PDK.config.user['analytics']['disabled'],
14
+ user_id: PDK.config.user['analytics']['user-id'],
15
+ app_id: "UA-139917834-#{PDK::Util.development_mode? ? '2' : '1'}",
16
+ client: :google_analytics,
17
+ app_name: 'pdk',
18
+ app_version: PDK::VERSION,
19
+ app_installer: PDK::Util.package_install? ? 'package' : 'gem',
20
+ )
21
+ end
22
+
23
+ module Analytics
24
+ CLIENTS = {
25
+ noop: Client::Noop,
26
+ google_analytics: Client::GoogleAnalytics,
27
+ }.freeze
28
+
29
+ def self.build_client(opts = {})
30
+ opts[:logger] ||= ::Logger.new(STDERR)
31
+ opts[:client] ||= :noop
32
+
33
+ if opts[:disabled]
34
+ opts[:logger].debug 'Analytics opt-out is set, analytics will be disabled'
35
+ CLIENTS[:noop].new(opts)
36
+ else
37
+ CLIENTS[opts[:client]].new(opts)
38
+ end
39
+ rescue StandardError => e
40
+ opts[:logger].debug "Failed to initialize analytics client, analytics will be disabled: #{e}"
41
+ CLIENTS[:noop].new(opts)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,141 @@
1
+ module PDK
2
+ module Analytics
3
+ module Client
4
+ class GoogleAnalytics
5
+ PROTOCOL_VERSION = 1
6
+ TRACKING_URL = 'https://google-analytics.com/collect'.freeze
7
+ CUSTOM_DIMENSIONS = {
8
+ operating_system: :cd1,
9
+ output_format: :cd2,
10
+ ruby_version: :cd3,
11
+ cli_options: :cd4,
12
+ env_vars: :cd5,
13
+ }.freeze
14
+
15
+ attr_reader :user_id
16
+ attr_reader :logger
17
+ attr_reader :app_name
18
+ attr_reader :app_id
19
+ attr_reader :app_version
20
+ attr_reader :app_installer
21
+
22
+ def initialize(opts)
23
+ # lazy-load expensive gem code
24
+ require 'concurrent/configuration'
25
+ require 'concurrent/future'
26
+ require 'httpclient'
27
+ require 'locale'
28
+ require 'pdk/analytics/util'
29
+
30
+ @http = HTTPClient.new
31
+ @user_id = opts[:user_id]
32
+ @executor = Concurrent.global_io_executor
33
+ @os = PDK::Analytics::Util.fetch_os_async
34
+ @logger = opts[:logger]
35
+ @app_name = opts[:app_name]
36
+ @app_id = opts[:app_id]
37
+ @app_version = opts[:app_version]
38
+ @app_installer = opts[:app_installer]
39
+ end
40
+
41
+ def screen_view(screen, **kwargs)
42
+ custom_dimensions = walk_keys(kwargs) do |k|
43
+ CUSTOM_DIMENSIONS[k] || raise(_("Unknown analytics key '%{key}'") % { key: k })
44
+ end
45
+
46
+ screen_view_params = {
47
+ # Type
48
+ t: 'screenview',
49
+ # Screen Name
50
+ cd: screen,
51
+ }.merge(custom_dimensions)
52
+
53
+ submit(base_params.merge(screen_view_params))
54
+ end
55
+
56
+ def event(category, action, label: nil, value: nil, **kwargs)
57
+ custom_dimensions = walk_keys(kwargs) do |k|
58
+ CUSTOM_DIMENSIONS[k] || raise(_("Unknown analytics key '%{key}'") % { key: k })
59
+ end
60
+
61
+ event_params = {
62
+ # Type
63
+ t: 'event',
64
+ # Event Category
65
+ ec: category,
66
+ # Event Action
67
+ ea: action,
68
+ }.merge(custom_dimensions)
69
+
70
+ # Event Label
71
+ event_params[:el] = label if label
72
+ # Event Value
73
+ event_params[:ev] = value if value
74
+
75
+ submit(base_params.merge(event_params))
76
+ end
77
+
78
+ def submit(params)
79
+ # Handle analytics submission in the background to avoid blocking the
80
+ # app or polluting the log with errors
81
+ Concurrent::Future.execute(executor: @executor) do
82
+ require 'json'
83
+
84
+ logger.debug "Submitting analytics: #{JSON.pretty_generate(params)}"
85
+ @http.post(TRACKING_URL, params)
86
+ logger.debug 'Completed analytics submission'
87
+ end
88
+ end
89
+
90
+ # These parameters have terrible names. See this page for complete documentation:
91
+ # https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
92
+ def base_params
93
+ {
94
+ v: PROTOCOL_VERSION,
95
+ # Client ID
96
+ cid: user_id,
97
+ # Tracking ID
98
+ tid: app_id,
99
+ # Application Name
100
+ an: app_name,
101
+ # Application Version
102
+ av: app_version,
103
+ # Application Installer ID
104
+ aiid: app_installer,
105
+ # Anonymize IPs
106
+ aip: true,
107
+ # User locale
108
+ ul: Locale.current.to_rfc,
109
+ # Custom Dimension 1 (Operating System)
110
+ cd1: @os.value,
111
+ }
112
+ end
113
+
114
+ # If the user is running a very fast command, there may not be time for
115
+ # analytics submission to complete before the command is finished. In
116
+ # that case, we give a little buffer for any stragglers to finish up.
117
+ # 250ms strikes a balance between accomodating slower networks while not
118
+ # introducing a noticeable "hang".
119
+ def finish
120
+ @executor.shutdown
121
+ @executor.wait_for_termination(0.25)
122
+ end
123
+
124
+ private
125
+
126
+ def walk_keys(data, &block)
127
+ if data.is_a?(Hash)
128
+ data.each_with_object({}) do |(k, v), acc|
129
+ v = walk_keys(v, &block)
130
+ acc[yield(k)] = v
131
+ end
132
+ elsif data.is_a?(Array)
133
+ data.map { |v| walk_keys(v, &block) }
134
+ else
135
+ data
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end