kpm 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +85 -14
- data/bin/kpm +2 -2
- data/lib/kpm/base_artifact.rb +15 -27
- data/lib/kpm/base_installer.rb +11 -5
- data/lib/kpm/installer.rb +22 -20
- data/lib/kpm/plugins_directory.yml +5 -5
- data/lib/kpm/sha1_checker.rb +11 -2
- data/lib/kpm/tasks.rb +58 -32
- data/lib/kpm/version.rb +1 -1
- data/spec/kpm/remote/base_artifact_spec.rb +4 -4
- data/spec/kpm/remote/migrations_spec.rb +3 -3
- metadata +51 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5c4a2af61cc4abb65b686a98e4cced0845bc310
|
4
|
+
data.tar.gz: 376118a4f0b8110189a67314b827967bcf895b97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad9acead1e4809fe5d06765cbf3d0d85cc33954a61883ffc929b55fc979c331f441a6630505f0d70a1cdb859b9d3b7ec23f2742415c4e40fcb9282aff468f6c6
|
7
|
+
data.tar.gz: a02faaf79cf0eb6ba9228f7683eaef41702085b5193d3eb32011959db29a2b26d8ef3efb8a7a526dbc46ccedfe4c4bde0e8c1739b86941ede714b72b50b3745f
|
data/README.md
CHANGED
@@ -50,11 +50,11 @@ To start Kill Bill, simply run
|
|
50
50
|
|
51
51
|
You can then verify Kill Bill is running by going to http://127.0.0.1:8080/kaui.
|
52
52
|
|
53
|
-
##
|
53
|
+
## Using KPM
|
54
54
|
|
55
|
-
|
55
|
+
### Custom Installation Through `kpm.yml` File
|
56
56
|
|
57
|
-
|
57
|
+
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:
|
58
58
|
|
59
59
|
killbill:
|
60
60
|
version: 0.14.0
|
@@ -82,23 +82,94 @@ Common configuration options:
|
|
82
82
|
|
83
83
|
There are many more options you can specify. Take a look at the configuration file used in the [Docker](https://github.com/killbill/killbill-cloud/blob/master/docker/templates/killbill/latest/kpm.yml.erb) image for example.
|
84
84
|
|
85
|
-
|
85
|
+
### Custom Downloads
|
86
|
+
|
87
|
+
You can also download specific versions/artifacts directly with the following commands -- bypassing the kpm.yml file:
|
88
|
+
|
89
|
+
* `kpm pull_kaui_war <version>`
|
90
|
+
* `kpm pull_kb_server_war <version>`
|
91
|
+
* `kpm install_ruby_plugin plugin-key <kb-version>`
|
92
|
+
* `kpm install_java_plugin plugin-key <kb-version>`
|
93
|
+
|
94
|
+
For more details see `kpm help`.
|
95
|
+
|
96
|
+
### Dev Mode
|
97
|
+
|
98
|
+
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 we look at KPM commands, make sure you read the [Plugin Development Documentation](http://docs.killbill.io/0.16/plugin_development.html).
|
99
|
+
|
100
|
+
Let 's assume we 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. Also in the case of `ruby`, the package already contains all the directory structure including the version, so only the location of the `tar.gz` needs to be specified.
|
101
|
+
|
102
|
+
```
|
103
|
+
> kpm install_ruby_plugin 'dev:cybersource' --from-source-file="<PATH_TO>/killbill-cybersource-3.3.0.tar.gz"
|
104
|
+
```
|
105
|
+
|
106
|
+
Let 's assume now that we 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 but here we also need to specify a version since the archive does not embed any filesystem structure but only contains the binary (jar). The same applies with regard to the `plugin_key` where we suggest to specify a namespace `dev:`.
|
107
|
+
|
108
|
+
```
|
109
|
+
> kpm install_java_plugin 'dev:adyen' --from-source-file="<PATH_TO>/adyen-plugin-0.3.2-SNAPSHOT.jar" --version="0.3.2"
|
110
|
+
```
|
111
|
+
|
112
|
+
The command `kpm inspect` can be used to see what has been installed. In the case of `dev` plugin most info related to `GROUP ID`, `ARTIFACT ID`, `PACKAGING` and `SHA1` will be missing because no real download occured.
|
113
|
+
|
114
|
+
|
115
|
+
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:
|
116
|
+
|
117
|
+
```
|
118
|
+
> kpm inspect
|
119
|
+
___________________________________________________________________________________________________________________________
|
120
|
+
| PLUGIN NAME | PLUGIN KEY | TYPE | GROUP ID | ARTIFACT ID | PACKAGING | VERSIONS sha1=[], def=(*), del=(x) |
|
121
|
+
___________________________________________________________________________________________________________________________
|
122
|
+
| killbill-cybersource | dev:cybersource | ruby | ??? | ??? | ??? | 3.3.0[???](*) |
|
123
|
+
| adyen | dev:adyen | java | ??? | ??? | ??? | 0.3.2[???](*) |
|
124
|
+
___________________________________________________________________________________________________________________________
|
125
|
+
|
126
|
+
> kpm uninstall 'dev:cybersource'
|
127
|
+
Removing the following versions of the killbill-cybersource plugin: 3.3.0
|
128
|
+
Done!
|
129
|
+
|
130
|
+
> kpm inspect
|
131
|
+
|
132
|
+
_____________________________________________________________________________________________________________
|
133
|
+
| PLUGIN NAME | PLUGIN KEY | TYPE | GROUP ID | ARTIFACT ID | PACKAGING | VERSIONS sha1=[], def=(*), del=(x) |
|
134
|
+
_____________________________________________________________________________________________________________
|
135
|
+
| adyen | dev:adyen | java | ??? | ??? | ??? | 0.3.2[???](*) |
|
136
|
+
_____________________________________________________________________________________________________________
|
137
|
+
|
138
|
+
> kpm install_ruby_plugin cybersource
|
139
|
+
[...]
|
140
|
+
|
141
|
+
> kpm inspect
|
142
|
+
_______________________________________________________________________________________________________________________________________________________
|
143
|
+
| PLUGIN NAME | PLUGIN KEY | TYPE | GROUP ID | ARTIFACT ID | PACKAGING | VERSIONS sha1=[], def=(*), del=(x) |
|
144
|
+
_______________________________________________________________________________________________________________________________________________________
|
145
|
+
| killbill-cybersource | cybersource | ruby | org.kill-bill.billing.plugin.ruby | cybersource-plugin | tar.gz | 4.0.2[e0901f..](*) |
|
146
|
+
| adyen | dev:adyen | java | ??? | ??? | ??? | 0.3.2[???](*) |
|
147
|
+
_______________________________________________________________________________________________________________________________________________________
|
148
|
+
|
149
|
+
```
|
150
|
+
|
151
|
+
## Internals
|
152
|
+
|
153
|
+
### Plugin Keys
|
154
|
+
|
155
|
+
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:
|
156
|
+
* For plugins maintained by the Kill Bill team, this identifier matches the key in the [file based repository](https://github.com/killbill/killbill-cloud/blob/master/kpm/lib/kpm/plugins_directory.yml) of well-known plugins
|
157
|
+
* 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.
|
86
158
|
|
87
159
|
### Caching
|
88
160
|
|
89
|
-
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:
|
161
|
+
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:
|
90
162
|
|
91
|
-
|
92
|
-
|
163
|
+
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).
|
164
|
+
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.
|
93
165
|
|
94
|
-
|
166
|
+
There are some non standard scenario that could occur in case of users tampering with the data (or remove server unavailable):
|
95
167
|
|
96
|
-
|
168
|
+
* Remote `sha1` is not available: Binary will be downloaded again (and no `sha1` check can be performed)
|
169
|
+
* `sha1.yml` does not exist: Binary will be downloaded again
|
170
|
+
* `sha1` entry in the `sha1.yml` exists but has the special value `SKIP` : Binary will *not* be downloaded again
|
171
|
+
* 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.
|
97
172
|
|
98
|
-
You can also download specific versions/artifacts directly with the following commands -- bypassing the kpm.yml file:
|
99
173
|
|
100
|
-
|
101
|
-
* `kpm pull_kb_server_war <version>`
|
102
|
-
* `kpm pull_ruby_plugin <artifact_id>`
|
174
|
+
Note that you can override that behavior with the `--force-download` switch.
|
103
175
|
|
104
|
-
For more details see `kpm --help`.
|
data/bin/kpm
CHANGED
data/lib/kpm/base_artifact.rb
CHANGED
@@ -140,37 +140,25 @@ module KPM
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def skip_if_exists(artifact_info, coordinates, sha1_file)
|
143
|
-
|
143
|
+
|
144
|
+
# If there is no sha1 from the binary server, we don't skip
|
145
|
+
# (Unclear if this is even possible)
|
144
146
|
return false if artifact_info[:sha1].nil?
|
145
147
|
|
146
|
-
# If
|
147
|
-
if
|
148
|
-
artifact_path = Pathname.new(artifact_info[:file_path])
|
149
|
-
if artifact_info[:plugin_name]
|
150
|
-
artifact_path = artifact_path.join(artifact_info[:plugin_name]).join(artifact_info[:version])
|
151
|
-
end
|
152
|
-
return false if !artifact_path.exist?
|
153
|
-
# Else, exit early if file_path does not exist or is a directory
|
154
|
-
elsif !File.exists?(artifact_info[:file_path]) ||
|
155
|
-
File.directory?(artifact_info[:file_path])
|
156
|
-
return false
|
157
|
-
end
|
148
|
+
# If there is no such sha1_file, we don't skip
|
149
|
+
return false if sha1_file.nil? || !File.exists?(sha1_file)
|
158
150
|
|
159
|
-
#
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
end
|
151
|
+
#
|
152
|
+
# At this point we have a valid sha1_file and a remote sha1
|
153
|
+
#
|
154
|
+
sha1_checker = Sha1Checker.from_file(sha1_file)
|
155
|
+
local_sha1 = sha1_checker.sha1(coordinates)
|
165
156
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
local_sha1 = Digest::SHA1.file(artifact_info[:file_path]).hexdigest
|
172
|
-
local_sha1 == artifact_info[:sha1]
|
173
|
-
end
|
157
|
+
# If there is an entry in the sha1_file and it matches the remote, we can skip
|
158
|
+
# Also support convenient 'SKIP' keyword for allowing hacking deployments (dev mode)
|
159
|
+
return true if local_sha1 == artifact_info[:sha1] || local_sha1 == 'SKIP'
|
160
|
+
|
161
|
+
false
|
174
162
|
end
|
175
163
|
|
176
164
|
def artifact_info(logger, coordinate_map, overrides={}, ssl_verify=true)
|
data/lib/kpm/base_installer.rb
CHANGED
@@ -14,13 +14,16 @@ module KPM
|
|
14
14
|
@nexus_ssl_verify = nexus_ssl_verify
|
15
15
|
end
|
16
16
|
|
17
|
-
def install_killbill_server(specified_group_id=nil, specified_artifact_id=nil, specified_packaging=nil, specified_classifier=nil, specified_version=nil, specified_webapp_path=nil, force_download=false, verify_sha1=true)
|
17
|
+
def install_killbill_server(specified_group_id=nil, specified_artifact_id=nil, specified_packaging=nil, specified_classifier=nil, specified_version=nil, specified_webapp_path=nil, bundles_dir=nil, force_download=false, verify_sha1=true)
|
18
18
|
group_id = specified_group_id || KPM::BaseArtifact::KILLBILL_GROUP_ID
|
19
19
|
artifact_id = specified_artifact_id || KPM::BaseArtifact::KILLBILL_ARTIFACT_ID
|
20
20
|
packaging = specified_packaging || KPM::BaseArtifact::KILLBILL_PACKAGING
|
21
21
|
classifier = specified_classifier || KPM::BaseArtifact::KILLBILL_CLASSIFIER
|
22
22
|
version = specified_version || LATEST_VERSION
|
23
23
|
webapp_path = specified_webapp_path || KPM::root
|
24
|
+
bundles_dir = Pathname.new(bundles_dir || DEFAULT_BUNDLES_DIR).expand_path
|
25
|
+
sha1_file = "#{bundles_dir}/#{SHA1_FILENAME}"
|
26
|
+
|
24
27
|
@logger.debug("Installing Kill Bill server: group_id=#{group_id} artifact_id=#{artifact_id} packaging=#{packaging} classifier=#{classifier} version=#{version} webapp_path=#{webapp_path}")
|
25
28
|
KPM::KillbillServerArtifact.pull(@logger,
|
26
29
|
group_id,
|
@@ -29,20 +32,22 @@ module KPM
|
|
29
32
|
classifier,
|
30
33
|
version,
|
31
34
|
webapp_path,
|
32
|
-
|
35
|
+
sha1_file,
|
33
36
|
force_download,
|
34
37
|
verify_sha1,
|
35
38
|
@nexus_config,
|
36
39
|
@nexus_ssl_verify)
|
37
40
|
end
|
38
41
|
|
39
|
-
def install_kaui(specified_group_id=nil, specified_artifact_id=nil, specified_packaging=nil, specified_classifier=nil, specified_version=nil, specified_webapp_path=nil, force_download=false, verify_sha1=true)
|
42
|
+
def install_kaui(specified_group_id=nil, specified_artifact_id=nil, specified_packaging=nil, specified_classifier=nil, specified_version=nil, specified_webapp_path=nil, bundles_dir=nil, force_download=false, verify_sha1=true)
|
40
43
|
group_id = specified_group_id || KPM::BaseArtifact::KAUI_GROUP_ID
|
41
44
|
artifact_id = specified_artifact_id || KPM::BaseArtifact::KAUI_ARTIFACT_ID
|
42
45
|
packaging = specified_packaging || KPM::BaseArtifact::KAUI_PACKAGING
|
43
46
|
classifier = specified_classifier || KPM::BaseArtifact::KAUI_CLASSIFIER
|
44
47
|
version = specified_version || LATEST_VERSION
|
45
48
|
webapp_path = specified_webapp_path || KPM::root
|
49
|
+
bundles_dir = Pathname.new(bundles_dir || DEFAULT_BUNDLES_DIR).expand_path
|
50
|
+
sha1_file = "#{bundles_dir}/#{SHA1_FILENAME}"
|
46
51
|
|
47
52
|
@logger.debug("Installing Kaui: group_id=#{group_id} artifact_id=#{artifact_id} packaging=#{packaging} classifier=#{classifier} version=#{version} webapp_path=#{webapp_path}")
|
48
53
|
KPM::KauiArtifact.pull(@logger,
|
@@ -52,7 +57,7 @@ module KPM
|
|
52
57
|
classifier,
|
53
58
|
version,
|
54
59
|
webapp_path,
|
55
|
-
|
60
|
+
sha1_file,
|
56
61
|
force_download,
|
57
62
|
verify_sha1,
|
58
63
|
@nexus_config,
|
@@ -153,7 +158,8 @@ module KPM
|
|
153
158
|
plugins_dir = bundles_dir.join('plugins')
|
154
159
|
|
155
160
|
if type.to_s == 'java'
|
156
|
-
|
161
|
+
plugin_name = name.nil? ? Pathname.new(file_path).basename.to_s.split('-')[0] : name
|
162
|
+
destination = plugins_dir.join('java').join(plugin_name).join(version)
|
157
163
|
else
|
158
164
|
destination = plugins_dir.join('ruby')
|
159
165
|
end
|
data/lib/kpm/installer.rb
CHANGED
@@ -31,15 +31,17 @@ module KPM
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def install(force_download=false, verify_sha1=true)
|
34
|
+
|
35
|
+
bundles_dir = @config['plugins_dir'] || DEFAULT_BUNDLES_DIR
|
34
36
|
help = nil
|
35
37
|
unless @config.nil?
|
36
38
|
help = install_tomcat if @config['webapp_path'].nil?
|
37
|
-
install_killbill_server(@config['group_id'], @config['artifact_id'], @config['packaging'], @config['classifier'], @config['version'], @config['webapp_path'], force_download, verify_sha1)
|
38
|
-
install_plugins(force_download, verify_sha1)
|
39
|
+
install_killbill_server(@config['group_id'], @config['artifact_id'], @config['packaging'], @config['classifier'], @config['version'], @config['webapp_path'], bundles_dir, force_download, verify_sha1)
|
40
|
+
install_plugins(bundles_dir, force_download, verify_sha1)
|
39
41
|
unless @config['default_bundles'] == false
|
40
|
-
install_default_bundles(
|
42
|
+
install_default_bundles(bundles_dir, @config['default_bundles_version'], @config['version'], force_download, verify_sha1)
|
41
43
|
end
|
42
|
-
clean_up_descriptors
|
44
|
+
clean_up_descriptors(bundles_dir)
|
43
45
|
end
|
44
46
|
|
45
47
|
unless @kaui_config.nil?
|
@@ -48,7 +50,7 @@ module KPM
|
|
48
50
|
return
|
49
51
|
end
|
50
52
|
|
51
|
-
install_kaui(@kaui_config['group_id'], @kaui_config['artifact_id'], @kaui_config['packaging'], @kaui_config['classifier'], @kaui_config['version'], @kaui_config['webapp_path'], force_download, verify_sha1)
|
53
|
+
install_kaui(@kaui_config['group_id'], @kaui_config['artifact_id'], @kaui_config['packaging'], @kaui_config['classifier'], @kaui_config['version'], @kaui_config['webapp_path'], bundles_dir, force_download, verify_sha1)
|
52
54
|
end
|
53
55
|
|
54
56
|
help
|
@@ -72,45 +74,45 @@ module KPM
|
|
72
74
|
manager.help
|
73
75
|
end
|
74
76
|
|
75
|
-
def install_plugins(force_download, verify_sha1)
|
76
|
-
install_java_plugins(force_download, verify_sha1)
|
77
|
-
install_ruby_plugins(force_download, verify_sha1)
|
77
|
+
def install_plugins(bundles_dir, force_download, verify_sha1)
|
78
|
+
install_java_plugins(bundles_dir, force_download, verify_sha1)
|
79
|
+
install_ruby_plugins(bundles_dir, force_download, verify_sha1)
|
78
80
|
end
|
79
81
|
|
80
|
-
def install_java_plugins(force_download, verify_sha1)
|
82
|
+
def install_java_plugins(bundles_dir, force_download, verify_sha1)
|
81
83
|
return if @config['plugins'].nil? or @config['plugins']['java'].nil?
|
82
84
|
|
83
85
|
infos = []
|
84
86
|
@config['plugins']['java'].each do |plugin|
|
85
|
-
infos << install_plugin(plugin['name'], nil, plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'],
|
87
|
+
infos << install_plugin(plugin['name'], nil, plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], bundles_dir, 'java', force_download, verify_sha1, false)
|
86
88
|
end
|
87
89
|
|
88
90
|
infos
|
89
91
|
end
|
90
92
|
|
91
|
-
def install_ruby_plugins(force_download, verify_sha1)
|
93
|
+
def install_ruby_plugins(bundles_dir, force_download, verify_sha1)
|
92
94
|
return if @config['plugins'].nil? or @config['plugins']['ruby'].nil?
|
93
95
|
|
94
96
|
verify_jruby_jar=true
|
95
97
|
infos = []
|
96
98
|
@config['plugins']['ruby'].each do |plugin|
|
97
|
-
infos << install_plugin(plugin['name'], nil, plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'],
|
99
|
+
infos << install_plugin(plugin['name'], nil, plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], bundles_dir, 'ruby', force_download, verify_sha1, verify_jruby_jar)
|
98
100
|
verify_jruby_jar=false
|
99
101
|
end
|
100
102
|
|
101
103
|
infos
|
102
104
|
end
|
103
105
|
|
104
|
-
def clean_up_descriptors
|
105
|
-
removed_plugins = clean_up_plugin_identifiers
|
106
|
-
clean_up_sha1s(removed_plugins)
|
106
|
+
def clean_up_descriptors(bundles_dir)
|
107
|
+
removed_plugins = clean_up_plugin_identifiers(bundles_dir)
|
108
|
+
clean_up_sha1s(removed_plugins, bundles_dir)
|
107
109
|
end
|
108
110
|
|
109
|
-
def clean_up_plugin_identifiers
|
111
|
+
def clean_up_plugin_identifiers(bundles_dir)
|
110
112
|
inspector = KPM::Inspector.new
|
111
|
-
installed_plugins = inspector.inspect(
|
113
|
+
installed_plugins = inspector.inspect(bundles_dir)
|
112
114
|
|
113
|
-
plugins_installation_path = File.join(
|
115
|
+
plugins_installation_path = File.join(bundles_dir, 'plugins')
|
114
116
|
plugins_manager = KPM::PluginsManager.new(plugins_installation_path, @logger)
|
115
117
|
|
116
118
|
plugin_identifiers = plugins_manager.read_plugin_identifiers
|
@@ -126,8 +128,8 @@ module KPM
|
|
126
128
|
removed_identifiers
|
127
129
|
end
|
128
130
|
|
129
|
-
def clean_up_sha1s(removed_plugins)
|
130
|
-
sha1checker = KPM::Sha1Checker.from_file(File.join(
|
131
|
+
def clean_up_sha1s(removed_plugins, plugins_dir)
|
132
|
+
sha1checker = KPM::Sha1Checker.from_file(File.join(plugins_dir, KPM::BaseInstaller::SHA1_FILENAME))
|
131
133
|
removed_plugins.each do |removed|
|
132
134
|
coordinates = KPM::Coordinates.build_coordinates(group_id: removed['group_id'],
|
133
135
|
artifact_id: removed['artifact_id'],
|
@@ -24,7 +24,7 @@
|
|
24
24
|
:versions:
|
25
25
|
:0.14: 1.0.3
|
26
26
|
:0.15: 2.0.1
|
27
|
-
:0.16: 3.0.
|
27
|
+
:0.16: 3.0.2
|
28
28
|
:stable_version: 2.0.2
|
29
29
|
:avatax:
|
30
30
|
:type: :java
|
@@ -41,7 +41,7 @@
|
|
41
41
|
:type: :ruby
|
42
42
|
:versions:
|
43
43
|
:0.14: 0.0.1
|
44
|
-
:0.16: 0.2.
|
44
|
+
:0.16: 0.2.1
|
45
45
|
:stable_version: 0.1.0
|
46
46
|
:require:
|
47
47
|
- :merchant_id
|
@@ -57,7 +57,7 @@
|
|
57
57
|
:versions:
|
58
58
|
:0.14: 1.0.0
|
59
59
|
:0.15: 3.3.0
|
60
|
-
:0.16: 4.0.
|
60
|
+
:0.16: 4.0.6
|
61
61
|
:stable_version: 0.0.4
|
62
62
|
:require:
|
63
63
|
- :login
|
@@ -119,7 +119,7 @@
|
|
119
119
|
:versions:
|
120
120
|
:0.14: 2.0.0
|
121
121
|
:0.15: 3.0.0
|
122
|
-
:0.16: 4.1.
|
122
|
+
:0.16: 4.1.3
|
123
123
|
:stable_version: 2.0.0
|
124
124
|
:require:
|
125
125
|
- :signature
|
@@ -147,7 +147,7 @@
|
|
147
147
|
:versions:
|
148
148
|
:0.14: 1.0.0
|
149
149
|
:0.15: 2.0.0
|
150
|
-
:0.16: 3.0.
|
150
|
+
:0.16: 3.0.3
|
151
151
|
:stable_version: 2.0.0
|
152
152
|
:require:
|
153
153
|
- :api_secret_key
|
data/lib/kpm/sha1_checker.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'logger'
|
2
2
|
require 'yaml'
|
3
|
+
require 'pathname'
|
3
4
|
|
4
5
|
module KPM
|
5
6
|
class Sha1Checker
|
@@ -28,8 +29,8 @@ module KPM
|
|
28
29
|
@sha1_config['sha1']
|
29
30
|
end
|
30
31
|
|
31
|
-
def add_or_modify_entry!(coordinates,
|
32
|
-
@sha1_config['sha1'][coordinates] =
|
32
|
+
def add_or_modify_entry!(coordinates, remote_sha1)
|
33
|
+
@sha1_config['sha1'][coordinates] = remote_sha1
|
33
34
|
save!
|
34
35
|
end
|
35
36
|
|
@@ -53,6 +54,7 @@ module KPM
|
|
53
54
|
|
54
55
|
def init!
|
55
56
|
if !File.exists?(@sha1_file)
|
57
|
+
create_sha1_directory_if_missing
|
56
58
|
init_config = {}
|
57
59
|
init_config['sha1'] = {}
|
58
60
|
File.open(@sha1_file, 'w') do |file|
|
@@ -62,6 +64,13 @@ module KPM
|
|
62
64
|
reload!
|
63
65
|
end
|
64
66
|
|
67
|
+
def create_sha1_directory_if_missing
|
68
|
+
sha1_dir = Pathname(@sha1_file).dirname
|
69
|
+
if ! File.directory?(sha1_dir)
|
70
|
+
Dir.mkdir(sha1_dir)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
65
74
|
def reload!
|
66
75
|
@sha1_config = YAML::load_file(@sha1_file)
|
67
76
|
end
|
data/lib/kpm/tasks.rb
CHANGED
@@ -142,6 +142,10 @@ module KPM
|
|
142
142
|
:type => :string,
|
143
143
|
:default => KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER,
|
144
144
|
:desc => 'The plugin artifact classifier'
|
145
|
+
method_option :from_source_file,
|
146
|
+
:type => :string,
|
147
|
+
:default => nil,
|
148
|
+
:desc => 'Specify the plugin jar that should be used for the installation.'
|
145
149
|
method_option :destination,
|
146
150
|
:type => :string,
|
147
151
|
:default => nil,
|
@@ -158,23 +162,31 @@ module KPM
|
|
158
162
|
:type => :boolean,
|
159
163
|
:default => true,
|
160
164
|
:desc => 'Validates sha1 sum'
|
161
|
-
desc '
|
162
|
-
def
|
165
|
+
desc 'install_java_plugin plugin-key <kb-version>', 'Pulls a java plugin from Sonatype and installs it under the specified destination. If the kb-version has been specified, it is used to download the matching plugin artifact version; if not, it uses the specified plugin version or if null, the LATEST one.'
|
166
|
+
def install_java_plugin(plugin_key, kb_version='LATEST')
|
167
|
+
|
168
|
+
|
169
|
+
installer = BaseInstaller.new(logger,
|
170
|
+
options[:overrides],
|
171
|
+
options[:ssl_verify])
|
172
|
+
|
173
|
+
if options[:from_source_file].nil?
|
174
|
+
response = installer.install_plugin(plugin_key,
|
175
|
+
kb_version,
|
176
|
+
options[:group_id],
|
177
|
+
options[:artifact_id],
|
178
|
+
options[:packaging],
|
179
|
+
options[:classifier],
|
180
|
+
options[:version],
|
181
|
+
options[:destination],
|
182
|
+
'java',
|
183
|
+
options[:force_download],
|
184
|
+
options[:verify_sha1],
|
185
|
+
false)
|
186
|
+
else
|
187
|
+
response = installer.install_plugin_from_fs(plugin_key, options[:from_source_file], nil, options[:version], options[:destination], 'java')
|
188
|
+
end
|
163
189
|
|
164
|
-
response = BaseInstaller.new(logger,
|
165
|
-
options[:overrides],
|
166
|
-
options[:ssl_verify]).install_plugin(plugin_key,
|
167
|
-
kb_version,
|
168
|
-
options[:group_id],
|
169
|
-
options[:artifact_id],
|
170
|
-
options[:packaging],
|
171
|
-
options[:classifier],
|
172
|
-
options[:version],
|
173
|
-
options[:destination],
|
174
|
-
'java',
|
175
|
-
options[:force_download],
|
176
|
-
options[:verify_sha1],
|
177
|
-
false)
|
178
190
|
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
179
191
|
end
|
180
192
|
|
@@ -201,6 +213,10 @@ module KPM
|
|
201
213
|
:type => :string,
|
202
214
|
:default => KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER,
|
203
215
|
:desc => 'The plugin artifact classifier'
|
216
|
+
method_option :from_source_file,
|
217
|
+
:type => :string,
|
218
|
+
:default => nil,
|
219
|
+
:desc => 'Specify the ruby plugin archive that should be used for the installation.'
|
204
220
|
method_option :destination,
|
205
221
|
:type => :string,
|
206
222
|
:default => nil,
|
@@ -217,22 +233,29 @@ module KPM
|
|
217
233
|
:type => :boolean,
|
218
234
|
:default => true,
|
219
235
|
:desc => 'Validates sha1 sum'
|
220
|
-
desc '
|
221
|
-
def
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
+
desc 'install_ruby_plugin plugin-key <kb-version>', 'Pulls a ruby plugin from Sonatype and installs it under the specified destination. If the kb-version has been specified, it is used to download the matching plugin artifact version; if not, it uses the specified plugin version or if null, the LATEST one.'
|
237
|
+
def install_ruby_plugin(plugin_key, kb_version='LATEST')
|
238
|
+
installer = BaseInstaller.new(logger,
|
239
|
+
options[:overrides],
|
240
|
+
options[:ssl_verify])
|
241
|
+
|
242
|
+
if options[:from_source_file].nil?
|
243
|
+
response = installer.install_plugin(plugin_key,
|
244
|
+
kb_version,
|
245
|
+
options[:group_id],
|
246
|
+
options[:artifact_id],
|
247
|
+
options[:packaging],
|
248
|
+
options[:classifier],
|
249
|
+
options[:version],
|
250
|
+
options[:destination],
|
251
|
+
'ruby',
|
252
|
+
options[:force_download],
|
253
|
+
options[:verify_sha1],
|
254
|
+
true)
|
255
|
+
else
|
256
|
+
response = installer.install_plugin_from_fs(plugin_key, options[:from_source_file], nil, nil, options[:destination], 'ruby')
|
257
|
+
end
|
258
|
+
|
236
259
|
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
237
260
|
|
238
261
|
end
|
@@ -365,6 +388,9 @@ module KPM
|
|
365
388
|
inspector.format(all_plugins)
|
366
389
|
end
|
367
390
|
|
391
|
+
map :pull_ruby_plugin => :install_ruby_plugin,
|
392
|
+
:pull_java_plugin => :install_java_plugin
|
393
|
+
|
368
394
|
private
|
369
395
|
|
370
396
|
def logger
|
data/lib/kpm/version.rb
CHANGED
@@ -10,16 +10,16 @@ describe KPM::BaseArtifact do
|
|
10
10
|
it 'should be able to download and verify regular artifacts' do
|
11
11
|
Dir.mktmpdir do |dir|
|
12
12
|
test_download dir, 'foo-oss.pom.xml'
|
13
|
-
# Verify we skip the second time
|
14
|
-
test_download dir, 'foo-oss.pom.xml',
|
13
|
+
# Verify we still don't skip the second time (sha1_file is null)
|
14
|
+
test_download dir, 'foo-oss.pom.xml', false
|
15
15
|
# Verify the download happens when we set force_download
|
16
16
|
test_download dir, 'foo-oss.pom.xml', false, true
|
17
17
|
end
|
18
18
|
|
19
19
|
Dir.mktmpdir do |dir|
|
20
20
|
test_download dir, nil
|
21
|
-
# Verify we skip the second time
|
22
|
-
test_download dir, nil,
|
21
|
+
# Verify we still don't skip the second time (sha1_file is null)
|
22
|
+
test_download dir, nil, false
|
23
23
|
# Verify the download happens when we set force_download
|
24
24
|
test_download dir, nil, false, true
|
25
25
|
end
|
@@ -4,7 +4,7 @@ describe KPM::Migrations do
|
|
4
4
|
|
5
5
|
context 'plugins' do
|
6
6
|
it 'should be able to find migrations for a java plugin' do
|
7
|
-
migrations = KPM::Migrations.new('
|
7
|
+
migrations = KPM::Migrations.new('analytics-plugin-3.0.2', nil, 'killbill/killbill-analytics-plugin', ENV['TOKEN']).migrations
|
8
8
|
# No migration yet
|
9
9
|
migrations.size.should == 0
|
10
10
|
end
|
@@ -12,13 +12,13 @@ describe KPM::Migrations do
|
|
12
12
|
it 'should be able to find migrations for a ruby plugin' do
|
13
13
|
migrations = KPM::Migrations.new('master', nil, 'killbill/killbill-cybersource-plugin', ENV['TOKEN']).migrations
|
14
14
|
# No migration yet
|
15
|
-
migrations.size.should ==
|
15
|
+
migrations.size.should == 1
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
context 'killbill' do
|
20
20
|
it 'should be able to find migrations between two versions' do
|
21
|
-
migrations = KPM::Migrations.new('
|
21
|
+
migrations = KPM::Migrations.new('work-for-release-0.16.3', 'work-for-release-0.16.4', 'killbill/killbill', ENV['TOKEN']).migrations
|
22
22
|
|
23
23
|
migrations.size.should == 1
|
24
24
|
migrations.first[:name].should == 'V20160324060345__revisit_payment_methods_indexes_509.sql'
|
metadata
CHANGED
@@ -1,105 +1,105 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
15
|
-
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.6.21
|
20
|
-
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
23
21
|
requirements:
|
24
|
-
- -
|
22
|
+
- - ~>
|
25
23
|
- !ruby/object:Gem::Version
|
26
24
|
version: 1.6.21
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nexus_cli
|
29
|
-
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 4.1.0
|
34
|
-
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
37
35
|
requirements:
|
38
|
-
- -
|
36
|
+
- - ~>
|
39
37
|
- !ruby/object:Gem::Version
|
40
38
|
version: 4.1.0
|
39
|
+
prerelease: false
|
40
|
+
type: :runtime
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thor
|
43
|
-
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.19.1
|
48
|
-
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
51
49
|
requirements:
|
52
|
-
- -
|
50
|
+
- - ~>
|
53
51
|
- !ruby/object:Gem::Version
|
54
52
|
version: 0.19.1
|
53
|
+
prerelease: false
|
54
|
+
type: :runtime
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubyzip
|
57
|
-
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.2.0
|
62
|
-
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
65
63
|
requirements:
|
66
|
-
- -
|
64
|
+
- - ~>
|
67
65
|
- !ruby/object:Gem::Version
|
68
66
|
version: 1.2.0
|
67
|
+
prerelease: false
|
68
|
+
type: :runtime
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
|
-
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 10.0.0
|
76
|
-
- -
|
76
|
+
- - <
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: 11.0.0
|
79
|
-
|
80
|
-
prerelease: false
|
81
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirement: !ruby/object:Gem::Requirement
|
82
80
|
requirements:
|
83
|
-
- -
|
81
|
+
- - '>='
|
84
82
|
- !ruby/object:Gem::Version
|
85
83
|
version: 10.0.0
|
86
|
-
- -
|
84
|
+
- - <
|
87
85
|
- !ruby/object:Gem::Version
|
88
86
|
version: 11.0.0
|
87
|
+
prerelease: false
|
88
|
+
type: :development
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rspec
|
91
|
-
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ~>
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: 2.12.0
|
96
|
-
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
99
97
|
requirements:
|
100
|
-
- -
|
98
|
+
- - ~>
|
101
99
|
- !ruby/object:Gem::Version
|
102
100
|
version: 2.12.0
|
101
|
+
prerelease: false
|
102
|
+
type: :development
|
103
103
|
description: A package manager for Kill Bill.
|
104
104
|
email: killbilling-users@googlegroups.com
|
105
105
|
executables:
|
@@ -107,8 +107,8 @@ executables:
|
|
107
107
|
extensions: []
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
|
-
-
|
111
|
-
-
|
110
|
+
- .gemrelease
|
111
|
+
- .gitignore
|
112
112
|
- Gemfile
|
113
113
|
- README.md
|
114
114
|
- Rakefile
|
@@ -156,26 +156,26 @@ homepage: http://kill-bill.org
|
|
156
156
|
licenses:
|
157
157
|
- Apache License (2.0)
|
158
158
|
metadata: {}
|
159
|
-
post_install_message:
|
159
|
+
post_install_message:
|
160
160
|
rdoc_options:
|
161
|
-
-
|
162
|
-
-
|
161
|
+
- --exclude
|
162
|
+
- .
|
163
163
|
require_paths:
|
164
164
|
- lib
|
165
165
|
required_ruby_version: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
|
-
- -
|
167
|
+
- - '>='
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: 1.8.6
|
170
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
|
-
- -
|
172
|
+
- - '>='
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
175
|
requirements: []
|
176
|
-
rubyforge_project:
|
177
|
-
rubygems_version: 2.
|
178
|
-
signing_key:
|
176
|
+
rubyforge_project:
|
177
|
+
rubygems_version: 2.4.6
|
178
|
+
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: Kill Bill package manager.
|
181
181
|
test_files:
|