kpm 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +66 -0
  3. data/Gemfile +2 -0
  4. data/README.adoc +111 -109
  5. data/Rakefile +2 -1
  6. data/bin/kpm +4 -2
  7. data/kpm.gemspec +8 -6
  8. data/lib/kpm.rb +3 -0
  9. data/lib/kpm/account.rb +267 -338
  10. data/lib/kpm/base_artifact.rb +33 -39
  11. data/lib/kpm/base_installer.rb +69 -83
  12. data/lib/kpm/blob.rb +29 -0
  13. data/lib/kpm/cli.rb +3 -1
  14. data/lib/kpm/coordinates.rb +6 -9
  15. data/lib/kpm/database.rb +90 -114
  16. data/lib/kpm/diagnostic_file.rb +126 -147
  17. data/lib/kpm/formatter.rb +74 -46
  18. data/lib/kpm/inspector.rb +22 -32
  19. data/lib/kpm/installer.rb +53 -46
  20. data/lib/kpm/kaui_artifact.rb +4 -3
  21. data/lib/kpm/killbill_plugin_artifact.rb +10 -7
  22. data/lib/kpm/killbill_server_artifact.rb +13 -12
  23. data/lib/kpm/migrations.rb +8 -7
  24. data/lib/kpm/nexus_helper/actions.rb +47 -8
  25. data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +87 -94
  26. data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
  27. data/lib/kpm/plugins_directory.rb +9 -8
  28. data/lib/kpm/plugins_directory.yml +8 -175
  29. data/lib/kpm/plugins_manager.rb +29 -24
  30. data/lib/kpm/sha1_checker.rb +31 -18
  31. data/lib/kpm/system.rb +105 -136
  32. data/lib/kpm/system_helpers/cpu_information.rb +56 -55
  33. data/lib/kpm/system_helpers/disk_space_information.rb +60 -63
  34. data/lib/kpm/system_helpers/entropy_available.rb +37 -39
  35. data/lib/kpm/system_helpers/memory_information.rb +52 -51
  36. data/lib/kpm/system_helpers/os_information.rb +45 -47
  37. data/lib/kpm/system_helpers/system_proxy.rb +10 -10
  38. data/lib/kpm/tasks.rb +364 -437
  39. data/lib/kpm/tenant_config.rb +68 -83
  40. data/lib/kpm/tomcat_manager.rb +9 -8
  41. data/lib/kpm/trace_logger.rb +18 -16
  42. data/lib/kpm/uninstaller.rb +81 -14
  43. data/lib/kpm/utils.rb +13 -14
  44. data/lib/kpm/version.rb +3 -1
  45. data/packaging/Gemfile +2 -0
  46. data/pom.xml +1 -1
  47. data/spec/kpm/remote/base_artifact_spec.rb +13 -15
  48. data/spec/kpm/remote/base_installer_spec.rb +30 -29
  49. data/spec/kpm/remote/installer_spec.rb +73 -73
  50. data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
  51. data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +19 -24
  52. data/spec/kpm/remote/killbill_server_artifact_spec.rb +17 -16
  53. data/spec/kpm/remote/migrations_spec.rb +12 -11
  54. data/spec/kpm/remote/nexus_facade_spec.rb +30 -26
  55. data/spec/kpm/remote/tenant_config_spec.rb +27 -26
  56. data/spec/kpm/remote/tomcat_manager_spec.rb +2 -1
  57. data/spec/kpm/unit/actions_spec.rb +52 -0
  58. data/spec/kpm/unit/base_artifact_spec.rb +17 -16
  59. data/spec/kpm/unit/cpu_information_spec.rb +67 -0
  60. data/spec/kpm/unit/disk_space_information_spec.rb +47 -0
  61. data/spec/kpm/unit/entropy_information_spec.rb +36 -0
  62. data/spec/kpm/unit/formatter_spec.rb +163 -0
  63. data/spec/kpm/unit/inspector_spec.rb +34 -42
  64. data/spec/kpm/unit/installer_spec.rb +5 -4
  65. data/spec/kpm/unit/memory_information_spec.rb +102 -0
  66. data/spec/kpm/unit/os_information_spec.rb +38 -0
  67. data/spec/kpm/unit/plugins_directory_spec.rb +34 -18
  68. data/spec/kpm/unit/plugins_manager_spec.rb +61 -65
  69. data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
  70. data/spec/kpm/unit/uninstaller_spec.rb +107 -61
  71. data/spec/kpm/unit_mysql/account_spec.rb +120 -135
  72. data/spec/spec_helper.rb +19 -17
  73. data/tasks/package.rake +18 -18
  74. metadata +17 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c651b2089fe9f33b3484e82dcdb4471980b6f4ad
4
- data.tar.gz: 8c746fc62e9332919f0082ffd25b96d450a91d64
3
+ metadata.gz: b5e6a90a07e3c6ccb7c452345ff8aa6069bcb5c9
4
+ data.tar.gz: 4ced3070cd3429d7cd66dde0da13e27b4c648d8e
5
5
  SHA512:
6
- metadata.gz: c0da2ef993caf070b2aaa3840e75220c1c9f26f4490bd3a2f5a3c4ca309de9a431e7198600733c2db317e2e2bff557438c447a753ddabc6f08f0c98f21ca4a09
7
- data.tar.gz: 859900d8b192dd29cdd7f0ecd925b527654e397baac2c0771e7c145876da58ef03ea0508cc4ac5b3fb3595e1017d7820e0203487e28dfbb13aaf1b17c7de05ad
6
+ metadata.gz: 86836cc4e73c7dd7b71c0310165a746316cb8785438cce365d0a146392fd66ae995781f9a6adcf746df20ac7345c11f72b1f9fd6d56ef71ae9208f76508f96bb
7
+ data.tar.gz: 6afade824831eb598506020d828e9b26baebeabc5d4f4096e839e504e969a1b526be3384df2def17bc1a4979c9b5269c07f54837da0faf0780c752a9bf68e17f
@@ -0,0 +1,66 @@
1
+ # RuboCop 0.69.0 dropped support for 2.2
2
+ #AllCops:
3
+ # TargetRubyVersion: 2.2
4
+ Gemspec/RequiredRubyVersion:
5
+ Enabled: false
6
+
7
+ # Alternative?
8
+ Gemspec/RubyVersionGlobalsUsage:
9
+ Enabled: false
10
+
11
+ Layout/DefEndAlignment:
12
+ AutoCorrect: true
13
+
14
+ Lint/HandleExceptions:
15
+ AllowComments: true
16
+
17
+ Metrics/AbcSize:
18
+ Enabled: false
19
+
20
+ Metrics/BlockLength:
21
+ Enabled: false
22
+
23
+ Metrics/BlockNesting:
24
+ Enabled: false
25
+
26
+ Metrics/ClassLength:
27
+ Enabled: false
28
+
29
+ Metrics/CyclomaticComplexity:
30
+ Enabled: false
31
+
32
+ Metrics/LineLength:
33
+ Enabled: false
34
+
35
+ Metrics/MethodLength:
36
+ Enabled: false
37
+
38
+ Metrics/ModuleLength:
39
+ Enabled: false
40
+
41
+ Metrics/ParameterLists:
42
+ Enabled: false
43
+
44
+ Metrics/PerceivedComplexity:
45
+ Enabled: false
46
+
47
+ Security/YAMLLoad:
48
+ Enabled: false
49
+
50
+ # We must support old Rubies
51
+ Style/BracesAroundHashParameters:
52
+ Enabled: false
53
+
54
+ Style/Documentation:
55
+ Enabled: false
56
+
57
+ Style/EmptyElse:
58
+ EnforcedStyle: empty
59
+
60
+ # We must support old Rubies
61
+ Style/HashSyntax:
62
+ Enabled: false
63
+
64
+ # Ruby 2.3+ only
65
+ Style/SafeNavigation:
66
+ Enabled: false
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
@@ -3,65 +3,44 @@
3
3
  :toclevels: 9
4
4
 
5
5
  [[kpm-the-kill-bill-package-manager]]
6
- # KPM: the Kill Bill Package Manager
6
+ = KPM: the Kill Bill Package Manager
7
7
 
8
- The goal of KPM is to facilitate the installation of Kill Bill, its plugins and Kaui.
9
-
10
- kpm can be used interactively to search and download individual artifacts (Kill Bill war, plugins, etc.) or to perform an automatic Kill Bill installation using a configuration file.
8
+ KPM is a command line utility which facilitates the installation of Kill Bill, its plugins and Kaui. It also provides utility helpers useful for the day-to-day management of a production system.
11
9
 
12
10
  toc::[]
13
11
 
14
- [[installation]]
15
- ## Installation
12
+ [[kpm-installation]]
13
+ == KPM Installation
16
14
 
17
- [[pre-built-binaries-recommended-linux-and-macos-only]]
18
- ### Pre-built binaries (recommended, Linux and MacOS only)
15
+ [[pre-built-binaries-recommended]]
16
+ === Pre-built binaries (recommended)
19
17
 
20
- Note that this installation method assumes `/bin/bash` to be available on your system.
18
+ KPM self-contained builds are available on http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.installer%22%20AND%20a%3A%22kpm%22[Maven Central] with coordinates `org.kill-bill.billing.installer:kpm`.
21
19
 
22
- KPM builds are available on http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.installer%22%20AND%20a%3A%22kpm%22[Maven Central] with coordinates `org.kill-bill.billing.installer:kpm`.
20
+ Download the `.tar.gz` package matching your architecture (Linux and MacOS only).
23
21
 
24
- Download the package matching your architecture.
22
+ Note that this installation method assumes `/bin/bash` to be available on your system.
25
23
 
26
24
  [[through-rubygems]]
27
- ### Through Rubygems
28
-
29
- Ruby is required to run KPM itself (it is not a dependency of Kill Bill).
30
-
31
- Ruby 2.1+ or JRuby 1.7.20+ is recommended. If you don’t have a Ruby installation yet, use https://rvm.io/rvm/install[RVM]:
32
-
33
- ....
34
- gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
35
- \curl -sSL https://get.rvm.io | bash -s stable --ruby
36
- ....
37
-
38
- After following the post-installation instructions, you should have access to the `ruby` and `gem` executables.
25
+ === Through Rubygems
39
26
 
40
- You can then run:
41
-
42
- ....
43
- gem install kpm
44
- ....
27
+ KPM is also available on https://rubygems.org/gems/kpm[RubyGems.org].
45
28
 
46
- [[quick-start]]
47
- ## Quick start
29
+ [[kpm-commands]]
30
+ == KPM Commands
48
31
 
49
- The following commands
32
+ [[kill-bill-installation]]
33
+ === Kill Bill installation
50
34
 
51
- ....
52
- mkdir killbill
53
- cd killbill
54
- kpm install
55
- ....
35
+ [[kpm-install]]
36
+ ==== kpm install
56
37
 
57
- will setup https://github.com/killbill/killbill[Kill Bill] and https://github.com/killbill/killbill-admin-ui-standalone[Kaui], i.e.:
38
+ `kpm install` (with no argument) will setup https://github.com/killbill/killbill[Kill Bill] and https://github.com/killbill/killbill-admin-ui-standalone[Kaui] in your current directory, including:
58
39
 
59
- * http://tomcat.apache.org/[Tomcat] (open-source Java web server) is setup in the `killbill` directory
60
- * The Kill Bill application (war) is installed in the `killbill/webapps` directory
61
- * The Kill Bill UI (Kaui war) is installed in the `killbill/webapps` directory
62
- * Default plugins are installed in the `/var/tmp/bundles` directory, among them:
63
- * `jruby.jar`, required to run Ruby plugins
64
- * the https://github.com/killbill/killbill-kpm-plugin[KPM plugin], required to (un-)install plugins at runtime
40
+ * http://tomcat.apache.org/[Tomcat] (open-source Java web server)
41
+ * The Kill Bill application (war) is installed in the `./webapps` directory
42
+ * The Kill Bill UI (Kaui war) is installed in the `./webapps` directory
43
+ * Default OSGI bundles are installed in the `/var/tmp/bundles` directory
65
44
 
66
45
  To start Kill Bill, simply run
67
46
 
@@ -71,28 +50,23 @@ To start Kill Bill, simply run
71
50
 
72
51
  You can then verify Kill Bill is running by going to http://127.0.0.1:8080/kaui.
73
52
 
74
- [[using-kpm]]
75
- ## Using KPM
76
-
77
- [[custom-installation-through-kpm.yml-file]]
78
- ### Custom Installation Through `kpm.yml` File
53
+ [[kpm-install-using-a-kpm.yml-file]]
54
+ ==== kpm install Using A `kpm.yml` File
79
55
 
80
- KPM allows you to specify a configuration file, `kpm.yml`, to describe what should be installed. The configuration file is a `yml`. The following shows the syntax of the `kpm.yml` file:
56
+ KPM also lets you specify a configuration file, `kpm.yml`, to describe what should be installed. For example:
81
57
 
82
58
  ....
83
59
  killbill:
84
- version: 0.18.0
60
+ version: 0.20.12
85
61
  plugins:
86
62
  java:
87
63
  - name: analytics
88
- ruby:
89
- - name: stripe
90
64
  ....
91
65
 
92
66
  This instructs kpm to:
93
67
 
94
- * Download Kill Bill version 0.18.0
95
- * Setup the https://github.com/killbill/killbill-analytics-plugin[Analytics] (Java) plugin and the https://github.com/killbill/killbill-stripe-plugin[Stripe] (Ruby) plugin
68
+ * Download Kill Bill version 0.20.12
69
+ * Setup the https://github.com/killbill/killbill-analytics-plugin[Analytics] (Java) plugin (you would still need to manually install the plugin https://github.com/killbill/killbill-analytics-plugin/blob/master/src/main/resources/org/killbill/billing/plugin/analytics/ddl.sql[DDL file])
96
70
 
97
71
  To start the installation:
98
72
 
@@ -100,14 +74,11 @@ To start the installation:
100
74
  kpm install kpm.yml
101
75
  ....
102
76
 
103
- Here is a more advanced example:
77
+ Here is a more advanced example, specifying a custom Nexus repository and non-standard deployment directories:
104
78
 
105
79
  ....
106
80
  killbill:
107
- group_id: org.kill-bill.billing
108
- artifact_id: killbill-profiles-killbill
109
- version: 0.18.10
110
- default_bundles_version: 0.36.11
81
+ version: 0.20.12
111
82
  nexus:
112
83
  ssl_verify: false
113
84
  url: http://nexus.acme
@@ -118,70 +89,45 @@ killbill:
118
89
  - name: acme:custom
119
90
  artifact_id: custom-plugin
120
91
  version: 0.0.1-SNAPSHOT
121
- ruby:
122
- - name: kpm
123
92
  plugins_dir: /var/tmp/bundles
124
93
  webapp_path: /var/lib/tomcat/webapps/ROOT.war
125
94
  ....
126
95
 
127
- [[custom-downloads]]
128
- ### Custom Downloads
96
+ [[artifacts-downloads]]
97
+ ==== Artifacts Downloads
129
98
 
130
- You can also download specific versions/artifacts directly with the following commands – bypassing the kpm.yml file:
99
+ You can download specific artifacts with the following commands:
131
100
 
132
- * `kpm pull_kaui_war <version>`
133
- * `kpm pull_kb_server_war <version>`
134
- * `kpm install_ruby_plugin plugin-key <kb-version>`
135
- * `kpm install_java_plugin plugin-key <kb-version>`
101
+ * `kpm pull_kaui_war <version>`: downloads the Kaui war
102
+ * `kpm pull_kb_server_war <version>`: downloads the Kill Bill war
103
+ * `kpm install_java_plugin plugin-key <kb-version>`: downloads a Java plugin identified by `plugin-key`
104
+ * `kpm install_ruby_plugin plugin-key <kb-version>`: downloads a Ruby plugin identified by `plugin-key`
105
+ * `kpm pull_defaultbundles <kb-version>`: downloads the default Kill Bill OSGI bundles
136
106
 
137
- For more details see `kpm help`.
107
+ This is especially useful when scripting deployments.
138
108
 
139
- [[dev-mode]]
140
- ### Dev Mode
109
+ Note: previous plugin versions aren't cleaned up by default to facilitate rollbacks. If your deployment is stateful, unused, old plugin versions will slow the Kill Bill startup time. To cleanup these entries, use `kpm cleanup` which will delete all non-default plugin versions, or `kpm uninstall`.
141
110
 
142
- If you are a developer and either modifying an existing plugin or creating a new plugin, KPM can be used to install the code of your plugin. Before going further, make sure you read the http://docs.killbill.io/latest/plugin_development.html[Plugin Development Documentation] first.
111
+ [[kpm-uninstall]]
112
+ ==== kpm uninstall
143
113
 
144
- Let’s assume you are modifying the code for the (Ruby) CyberSource plugin. You would have to first build the plugin package, and then you could use KPM to install the plugin. We suggest you specify a `plugin_key` with a namespace `dev:` to make it clear this is not a released version.
114
+ `kpm uninstall plugin-key` will uninstall a plugin identified by `plugin-key` (all versions are uninstalled by default).
145
115
 
146
- ....
147
- kpm install_ruby_plugin 'dev:cybersource' --from-source-file="<PATH_TO>/killbill-cybersource-3.3.0.tar.gz"
148
- ....
116
+ [[kpm-migrations]]
117
+ ==== kpm migrations
149
118
 
150
- Let’s assume now that you are modifying the code for the (Java) Adyen plugin. The plugin first needs to be built using the `maven-bundle-plugin` to produce the OSGI jar under the `target` directory. Then, this `jar` can be installed using KPM (you would also need to specify a version here since the archive does not embed any metadata, unlike Ruby plugins packages). The same applies with regard to the `plugin_key` where we suggest to specify a namespace `dev:`.
119
+ `kpm migrations` is used to download database migration files when upgrading Kill Bill or plugins. See our http://docs.killbill.io/0.20/database_migrations.html[database migrations guief] for more details.
151
120
 
152
- ....
153
- kpm install_java_plugin 'dev:adyen' --from-source-file="<PATH_TO>/adyen-plugin-0.3.2-SNAPSHOT.jar" --version="0.3.2"
154
- ....
121
+ [[operations]]
122
+ === Operations
155
123
 
156
- The command `kpm inspect` can be used to see what has been installed. In the case of `dev` plugins, most of the infofrmation related to `GROUP ID`, `ARTIFACT ID`, `PACKAGING` and `SHA1` will be missing because no real download occured.
124
+ [[kpm-inspect]]
125
+ ==== kpm inspect
157
126
 
158
- Finally, when it is time to use a released version of a plugin, we first recommend to uninstall the `dev` version, by using the `kpm uninstall` command and using the `plugin_key`, and then installing the released version. For instance the following sequence could happen:
127
+ The command `kpm inspect` can be used to see which plugins have been installed:
159
128
 
160
129
  ....
161
- > kpm inspect
162
- ___________________________________________________________________________________________________________________________
163
- | PLUGIN NAME | PLUGIN KEY | TYPE | GROUP ID | ARTIFACT ID | PACKAGING | VERSIONS sha1=[], def=(*), del=(x) |
164
- ___________________________________________________________________________________________________________________________
165
- | killbill-cybersource | dev:cybersource | ruby | ??? | ??? | ??? | 3.3.0[???](*) |
166
- | adyen | dev:adyen | java | ??? | ??? | ??? | 0.3.2[???](*) |
167
- ___________________________________________________________________________________________________________________________
168
-
169
- > kpm uninstall 'dev:cybersource'
170
- Removing the following versions of the killbill-cybersource plugin: 3.3.0
171
- Done!
172
-
173
- > kpm inspect
174
-
175
- _____________________________________________________________________________________________________________
176
- | PLUGIN NAME | PLUGIN KEY | TYPE | GROUP ID | ARTIFACT ID | PACKAGING | VERSIONS sha1=[], def=(*), del=(x) |
177
- _____________________________________________________________________________________________________________
178
- | adyen | dev:adyen | java | ??? | ??? | ??? | 0.3.2[???](*) |
179
- _____________________________________________________________________________________________________________
180
-
181
- > kpm install_ruby_plugin cybersource
182
- [...]
183
-
184
- > kpm inspect
130
+ kpm inspect --destination=/var/tmp/bundles
185
131
  _______________________________________________________________________________________________________________________________________________________
186
132
  | PLUGIN NAME | PLUGIN KEY | TYPE | GROUP ID | ARTIFACT ID | PACKAGING | VERSIONS sha1=[], def=(*), del=(x) |
187
133
  _______________________________________________________________________________________________________________________________________________________
@@ -190,6 +136,56 @@ ________________________________________________________________________________
190
136
  _______________________________________________________________________________________________________________________________________________________
191
137
  ....
192
138
 
139
+ Note: `GROUP ID`, `ARTIFACT ID`, `PACKAGING` and `SHA1` can be missing (`???`) when installing plugins which aren't hosted in a Nexus repository. This isn't an issue.
140
+
141
+ [[kpm-system]]
142
+ ==== kpm system
143
+
144
+ The command `kpm system` is a superset of the `inspect` command. In addition to plugins information, the command will return details about the Kill Bill and Kaui installation, Java and Ruby environment, details about the OS, CPU, Memory and disks, entropy available, etc.
145
+
146
+ Note: for non-standard deployments, you will need to tell KPM the location of the Kill Bill and Kaui webapp (see `kpm help system`).
147
+
148
+ [[kpm-diagnostic]]
149
+ ==== kpm diagnostic
150
+
151
+ The command `kpm diagnostic` is a superset of the `system` command. It will connect to your Kill Bill instance to gather tenant configuration information and account data (if a specific account is specified) and will gather all log files.
152
+
153
+ You will need to instruct KPM how to connect to your Kill Bill instance (see `kpm help diagnostic`).
154
+
155
+ [[kpm-account]]
156
+ ==== kpm account
157
+
158
+ `kpm account` exports all account data from a running system and re-imports it in another Kill Bill installation. This is an advanced command and is usually run as part of `kpm agnostic`.
159
+
160
+ [[kpm-tenant_config]]
161
+ ==== kpm tenant_config
162
+
163
+ `kpm tenant_config` exports tenant specific data from a running system. This is an advanced command and is usually run as part of `kpm agnostic`.
164
+
165
+ [[kpm-cleanup]]
166
+ ==== kpm cleanup
167
+
168
+ `kpm cleanup` which will delete all non-default plugin versions. The `--dry-run` option can be used to double check first what would be deleted.
169
+
170
+ [[plugins-development]]
171
+ === Plugins development
172
+
173
+ [[kpm-info]]
174
+ ==== kpm info
175
+
176
+ `kpm info` lists the libraries to use when writing a plugin for a specific Kill Bill version. It also lists all of the official plugins for that specific version.
177
+
178
+ [[installing-custom-plugins]]
179
+ ==== Installing Custom Plugins
180
+
181
+ If you are a developer and either modifying an existing plugin or creating a new plugin, KPM can be used to install the code of your plugin. Before going further, make sure you read the http://docs.killbill.io/latest/plugin_development.html[Plugin Development Documentation] first.
182
+
183
+ Let’s assume now that you are modifying the code for the (Java) Adyen plugin. The plugin first needs to be built using the `maven-bundle-plugin` to produce the OSGI jar under the `target` directory. Then, this `jar` can be installed using KPM. We suggest you specify a `plugin_key` with a namespace `dev:` to make it clear this is not a released version:
184
+
185
+ ....
186
+ kpm install_java_plugin 'dev:adyen' --from-source-file="<PATH_TO>/adyen-plugin-0.3.2-SNAPSHOT.jar" --version="0.3.2"
187
+ ....
188
+
193
189
  [[internals]]
194
190
  ## Internals
195
191
 
@@ -225,14 +221,17 @@ Test suite that requires an instance of `mysql` running and verifies the followi
225
221
  [[plugin-keys]]
226
222
  ### Plugin Keys
227
223
 
228
- In the `kpm.yml` example provided above, the plugins are named using their `pluginKey` (the value for the `name` in the `kpm.yml`) . The `pluginKey` is the identifier for the plugin: * For plugins maintained by the Kill Bill team, this identifier matches the key in the https://github.com/killbill/killbill-cloud/blob/master/kpm/lib/kpm/plugins_directory.yml[file based repository] of well-known plugins * For other plugins, this key is either specified when installing the plugin through api call, or default to the `pluginName`. For more information, please refer to the Plugin Developer Guide.
224
+ Plugins are named using their `pluginKey` (the value for the `name` entry in the `kpm.yml`) . The `pluginKey` is the identifier for the plugin:
225
+
226
+ * For plugins maintained by the Kill Bill team, this identifier matches the key in the https://github.com/killbill/killbill-cloud/blob/master/kpm/lib/kpm/plugins_directory.yml[file based repository] of well-known plugins
227
+ * For other plugins, this key is either specified when installing the plugin through api call, or default to the `pluginName`. For more information, please refer to the http://docs.killbill.io/latest/plugin_development.html[Plugin Development guide].
229
228
 
230
229
  [[caching]]
231
230
  ### Caching
232
231
 
233
232
  KPM relies on the `kpm.yml` file to know what to install, and as it installs the pieces, it keeps track of what was installed so that if it is invoked again, it does not download again the same binaries. The generic logic associated with that file is the following:
234
233
 
235
- 1. When installing a binary (`war`, `jar`, `tar.gz`..), KPM will download both the binary and the `sha1` from the server, compute the `sha1` for the binary and compare the two (verify that binary indeed matches its remote `sha1`). Then, binary is installed and `sha1.yml` file is updated. The `sha1` entry in that `sha1.yml` file will now represent the local `sha1` version (note that for `tar.gz` binaries which have been uncompressed, the local `sha1` is not anymore easily recomputable).
234
+ 1. When installing a binary (`war`, `jar`, `tar.gz`, ...), KPM will download both the binary and the `sha1` from the server, compute the `sha1` for the binary and compare the two (verify that binary indeed matches its remote `sha1`). Then, the binary is installed and `sha1.yml` file is updated. The `sha1` entry in that `sha1.yml` file will now represent the local `sha1` version (note that for `tar.gz` binaries which have been uncompressed, the local `sha1` is not anymore easily recomputable).
236
235
  2. When attempting to download again the same binary, KPM will compare the value in the `sha1.yml` and the one on the remote server and if those match, it will not download the binary again.
237
236
 
238
237
  There are some non standard scenario that could occur in case of users tampering with the data (or remove server unavailable):
@@ -242,4 +241,7 @@ There are some non standard scenario that could occur in case of users tampering
242
241
  * `sha1` entry in the `sha1.yml` exists but has the special value `SKIP` : Binary will _not_ be downloaded again
243
242
  * Binary does not exist on the file system (or has been replaced with something else): KPM will ignore. Note that correct way to remove plugins is to use the `KPM uninstall` command.
244
243
 
245
- Note that you can override that behavior with the `--force-download` switch.
244
+ Notes:
245
+
246
+ * You can override that behavior with the `--force-download` switch
247
+ * When `--force-download` is specified (`false` by default), network access to a Nexus instance is required. Otherwise, downloads are idempotent even if no outbound networking is allowed (on initial download, the Nexus metadata is cached in the `sha1.yml` file which is re-used on subsequent installation if no outbound networking is allowed -- by default, KPM will try to get the latest metadata from Nexus though)
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env rake
2
+ # frozen_string_literal: true
2
3
 
3
4
  Dir.glob('tasks/*.rake').each { |r| import r }
4
5
 
@@ -33,4 +34,4 @@ namespace :test do
33
34
  end
34
35
 
35
36
  # Run tests by default
36
- task :default => 'test:spec'
37
+ task default: 'test:spec'
data/bin/kpm CHANGED
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
- $:.push File.expand_path("../../lib", __FILE__)
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.push File.expand_path('../lib', __dir__)
3
5
  require 'kpm'
4
6
 
5
7
  begin
6
8
  KPM::Cli.start
7
- rescue => e
9
+ rescue StandardError => e
8
10
  KPM.ui.say "#{e.message}\n#{e.backtrace.join("\n")}", :red
9
11
  exit 1
10
12
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Copyright 2014 The Billing Project, LLC
3
5
  #
@@ -14,7 +16,7 @@
14
16
  # under the License.
15
17
  #
16
18
 
17
- $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
19
+ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
18
20
  require 'kpm/version'
19
21
 
20
22
  Gem::Specification.new do |s|
@@ -34,17 +36,17 @@ Gem::Specification.new do |s|
34
36
  s.files = `git ls-files`.split("\n")
35
37
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
36
38
  s.bindir = 'bin'
37
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
38
- s.require_paths = ["lib"]
39
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
40
+ s.require_paths = ['lib']
39
41
 
40
42
  s.rdoc_options << '--exclude' << '.'
41
43
 
42
44
  s.add_dependency 'highline', '~> 1.6.21'
43
- s.add_dependency 'thor', '~> 0.19.1'
45
+ s.add_dependency 'killbill-client', '~> 3.2'
44
46
  s.add_dependency 'rubyzip', '~>1.2.0'
45
- s.add_dependency 'killbill-client', '~> 2.5.0'
47
+ s.add_dependency 'thor', '~> 0.19.1'
46
48
 
47
49
  s.add_development_dependency 'rake', '>= 10.0.0', '< 11.0.0'
48
50
  s.add_development_dependency 'rspec', '~> 2.12.0'
51
+ s.add_development_dependency 'rubocop', '~> 0.74.0' if RUBY_VERSION >= '2.3'
49
52
  end
50
-