kpm 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -8
- data/lib/kpm/base_installer.rb +69 -23
- data/lib/kpm/installer.rb +2 -2
- data/lib/kpm/plugins_directory.rb +4 -4
- data/lib/kpm/plugins_directory.yml +1 -1
- data/lib/kpm/plugins_manager.rb +27 -0
- data/lib/kpm/version.rb +1 -1
- data/spec/kpm/remote/installer_spec.rb +32 -6
- data/spec/kpm/unit/plugins_manager_spec.rb +23 -0
- metadata +16 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6819019089d4dd3219f4e68c7a55323addf194fe
|
4
|
+
data.tar.gz: 47f1774f8355f87424fab114b6bad542159a9beb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e383b778cb444ede8ec0b1e4172f600fea63c47ee8b24e7f015727f68ff220cdb0fcdcca2dbd8f420f7c7e7b68909874155923bfb1c941bb7426a1b8d1b29db0
|
7
|
+
data.tar.gz: ee4fb38ad9686232f9302c892b7c1583698faee0c2cd582929bba9e0c5c0e55c26feb888b4f9eb66e0f8c8f27de1e6dc576b2996b3b27138922feff8b64b1e38
|
data/README.md
CHANGED
@@ -4,12 +4,29 @@ The goal of KPM is to facilitate the installation of Kill Bill, its plugins and
|
|
4
4
|
|
5
5
|
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.
|
6
6
|
|
7
|
+
## Prerequisites
|
8
|
+
|
9
|
+
### Ruby
|
10
|
+
|
11
|
+
Ruby is required to run KPM itself (it is not a dependency of Kill Bill).
|
12
|
+
|
13
|
+
Ruby 2.1+ or JRuby 1.7.20+ is recommended. If you don't have a Ruby installation yet, use [RVM](https://rvm.io/rvm/install):
|
14
|
+
|
15
|
+
```
|
16
|
+
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
|
17
|
+
\curl -sSL https://get.rvm.io | bash -s stable --ruby
|
18
|
+
```
|
19
|
+
|
20
|
+
After following the post-installation instructions, you should have access to the `ruby` and `gem` executables.
|
21
|
+
|
22
|
+
### Java
|
23
|
+
|
24
|
+
Kill Bill runs on the [Java](https://www.java.com/en/download/) platform, version 6 and above (8 is recommended).
|
25
|
+
|
7
26
|
## Installation
|
8
27
|
|
9
28
|
gem install kpm
|
10
29
|
|
11
|
-
Ruby 2.1+ or JRuby 1.7.11+ is recommended.
|
12
|
-
|
13
30
|
## Quick start
|
14
31
|
|
15
32
|
The following commands
|
@@ -18,9 +35,9 @@ The following commands
|
|
18
35
|
cd killbill
|
19
36
|
kpm install
|
20
37
|
|
21
|
-
will setup Kill Bill and Kaui, i.e.:
|
38
|
+
will setup [Kill Bill](https://github.com/killbill/killbill) and [Kaui](https://github.com/killbill/killbill-admin-ui-standalone), i.e.:
|
22
39
|
|
23
|
-
* Tomcat (open-source Java web server) is setup in the `killbill` directory
|
40
|
+
* [Tomcat](http://tomcat.apache.org/) (open-source Java web server) is setup in the `killbill` directory
|
24
41
|
* The Kill Bill application (war) is installed in the `killbill/webapps` directory
|
25
42
|
* The Kill Bill UI (Kaui war) is installed in the `killbill/webapps` directory
|
26
43
|
* Default plugins are installed in the `/var/tmp/bundles` directory, among them:
|
@@ -50,7 +67,7 @@ For example:
|
|
50
67
|
This instructs kpm to:
|
51
68
|
|
52
69
|
* Download Kill Bill version 0.14.0
|
53
|
-
* Setup the Analytics (Java) plugin and the Stripe (Ruby) plugin
|
70
|
+
* Setup the [Analytics](https://github.com/killbill/killbill-analytics-plugin) (Java) plugin and the [Stripe](https://github.com/killbill/killbill-stripe-plugin) (Ruby) plugin
|
54
71
|
|
55
72
|
To start the installation:
|
56
73
|
|
@@ -69,16 +86,16 @@ There are many more options you can specify. Take a look at the configuration fi
|
|
69
86
|
|
70
87
|
### Caching
|
71
88
|
|
72
|
-
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:
|
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:
|
73
90
|
|
74
91
|
* For the Kill Bill artifact itself, kpm will first extract the sha1 from the remote repository and compare with the current sha1 installed under the default `webapp_path`; if those are the same, the file is not downloaded again.
|
75
|
-
* For the plugins, since those are downloaded as an archive (*.tgz) and then decompressed/expanded, kpm will use an internal file, `<plugins_dir>/sha1.yml` to keep track of the sha1 archive. If there is an entry and the sha1 matches, then the file is not downloaded again.
|
92
|
+
* For the plugins, since some of those are downloaded as an archive (*.tgz) and then decompressed/expanded, kpm will use an internal file, `<plugins_dir>/sha1.yml` to keep track of the sha1 archive. If there is an entry and the sha1 matches, then the file is not downloaded again.
|
76
93
|
|
77
94
|
Note that you can override that behavior with the `--force-download` switch.
|
78
95
|
|
79
96
|
### Custom Downloads
|
80
97
|
|
81
|
-
|
98
|
+
You can also download specific versions/artifacts directly with the following commands -- bypassing the kpm.yml file:
|
82
99
|
|
83
100
|
* `kpm pull_kaui_war <version>`
|
84
101
|
* `kpm pull_kb_server_war <version>`
|
data/lib/kpm/base_installer.rb
CHANGED
@@ -7,6 +7,9 @@ module KPM
|
|
7
7
|
SHA1_FILENAME = 'sha1.yml'
|
8
8
|
DEFAULT_BUNDLES_DIR = Pathname.new('/var').join('tmp').join('bundles').to_s
|
9
9
|
|
10
|
+
|
11
|
+
|
12
|
+
|
10
13
|
def initialize(logger, nexus_config, nexus_ssl_verify)
|
11
14
|
@logger = logger
|
12
15
|
@nexus_config = nexus_config
|
@@ -20,7 +23,6 @@ module KPM
|
|
20
23
|
classifier = specified_classifier || KPM::BaseArtifact::KILLBILL_CLASSIFIER
|
21
24
|
version = specified_version || LATEST_VERSION
|
22
25
|
webapp_path = specified_webapp_path || KPM::root
|
23
|
-
|
24
26
|
@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
27
|
KPM::KillbillServerArtifact.pull(@logger,
|
26
28
|
group_id,
|
@@ -59,33 +61,60 @@ module KPM
|
|
59
61
|
@nexus_ssl_verify)
|
60
62
|
end
|
61
63
|
|
62
|
-
def install_plugin(specified_group_id, specified_artifact_id, specified_packaging=nil, specified_classifier=nil, specified_version=nil, bundles_dir=nil, specified_type='java', force_download=false, verify_sha1=true)
|
63
|
-
looked_up_group_id, looked_up_artifact_id, looked_up_packaging, looked_up_classifier, looked_up_version, looked_up_type = KPM::PluginsDirectory.lookup(specified_artifact_id, true)
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
if
|
68
|
-
@logger.warn("Aborting installation:
|
65
|
+
def install_plugin(plugin_key, specified_group_id, specified_artifact_id, specified_packaging=nil, specified_classifier=nil, specified_version=nil, bundles_dir=nil, specified_type='java', force_download=false, verify_sha1=true)
|
66
|
+
|
67
|
+
if plugin_key.nil?
|
68
|
+
@logger.warn("Aborting installation: User needs to specify a pluginKey")
|
69
69
|
return nil
|
70
70
|
end
|
71
71
|
|
72
|
+
# Since we allow to only specify a the artifact_id to identify a given plugin we set the default on the other fields
|
73
|
+
specified_group_id = specified_group_id || (specified_type.to_s == 'java' ? KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID : KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID)
|
74
|
+
specified_packaging = specified_packaging || (specified_type.to_s == 'java' ? KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING : KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING)
|
75
|
+
specified_classifier = specified_classifier || (specified_type.to_s == 'java' ? KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER : KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER)
|
76
|
+
|
77
|
+
# Create a Proc to validate and resolve arguments
|
78
|
+
resolve_and_validate_args_proc = Proc.new { |plugin_key, arg_type, specified_arg, lookup_arg|
|
79
|
+
|
80
|
+
# There is an entry in plugin_directory.yml but does not match with input
|
81
|
+
if lookup_arg && specified_arg && lookup_arg.to_s != specified_arg.to_s
|
82
|
+
@logger.warn("Aborting installation: User specified #{arg_type}=#{specified_arg} for pluginKey = #{plugin_key}, but plugin_directory.yml resolves with #{lookup_arg}")
|
83
|
+
return nil
|
84
|
+
end
|
85
|
+
|
86
|
+
# There is no entry and user did not specify anything (or we did not have any default)
|
87
|
+
if lookup_arg.nil? && specified_arg.nil?
|
88
|
+
@logger.warn("Aborting installation: need to specify an #{arg_type} for pluginKey = #{plugin_key}")
|
89
|
+
return nil
|
90
|
+
end
|
91
|
+
# If validation is successful we return resolved value
|
92
|
+
specified_arg || lookup_arg
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
# Lookup entry (will come with null everywhere if entry does not exist in plugin_directory.yml)
|
97
|
+
looked_up_group_id, looked_up_artifact_id, looked_up_packaging, looked_up_classifier, looked_up_version, looked_up_type = KPM::PluginsDirectory.lookup(plugin_key, true)
|
98
|
+
|
99
|
+
# If there is no entry in plugins_directory.yml, the key provided must be a user key and must have a namespace
|
100
|
+
if looked_up_artifact_id.nil? && plugin_key.split(':').size == 1
|
101
|
+
@logger.warn("Aborting installation: pluginKey = #{plugin_key} does not exist in plugin_directory.yml so format of the key must have a user namespace (e.g namespace:key)")
|
102
|
+
return nil
|
103
|
+
end
|
104
|
+
|
105
|
+
# Validate and resolve the value to use (user input has precedence)
|
106
|
+
group_id = resolve_and_validate_args_proc.call(plugin_key, 'group_id', specified_group_id, looked_up_group_id)
|
107
|
+
artifact_id = resolve_and_validate_args_proc.call(plugin_key, 'artifact_id', specified_artifact_id, looked_up_artifact_id)
|
108
|
+
packaging = resolve_and_validate_args_proc.call(plugin_key, 'packaging', specified_packaging, looked_up_packaging)
|
109
|
+
classifier = specified_classifier || looked_up_classifier
|
110
|
+
type = resolve_and_validate_args_proc.call(plugin_key, 'type', specified_type, looked_up_type).to_s
|
111
|
+
version = specified_version || looked_up_version || LATEST_VERSION
|
112
|
+
|
72
113
|
bundles_dir = Pathname.new(bundles_dir || DEFAULT_BUNDLES_DIR).expand_path
|
73
114
|
plugins_dir = bundles_dir.join('plugins')
|
74
115
|
|
75
|
-
|
76
|
-
|
77
|
-
group_id = specified_group_id || looked_up_group_id || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID
|
78
|
-
packaging = specified_packaging || looked_up_packaging || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING
|
79
|
-
classifier = specified_classifier || looked_up_classifier || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER
|
80
|
-
version = specified_version || looked_up_version || LATEST_VERSION
|
81
|
-
destination = plugins_dir.join('java').join(artifact_id).join(version)
|
82
|
-
else
|
83
|
-
group_id = specified_group_id || looked_up_group_id || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID
|
84
|
-
packaging = specified_packaging || looked_up_packaging || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING
|
85
|
-
classifier = specified_classifier || looked_up_classifier || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER
|
86
|
-
version = specified_version || looked_up_version || LATEST_VERSION
|
87
|
-
destination = plugins_dir.join('ruby')
|
88
|
-
end
|
116
|
+
destination = type == 'java' ? plugins_dir.join('java').join(artifact_id).join(version) : plugins_dir.join('ruby')
|
117
|
+
|
89
118
|
sha1_file = "#{bundles_dir}/#{SHA1_FILENAME}"
|
90
119
|
|
91
120
|
@logger.debug("Installing plugin: group_id=#{group_id} artifact_id=#{artifact_id} packaging=#{packaging} classifier=#{classifier} version=#{version} destination=#{destination}")
|
@@ -101,13 +130,15 @@ module KPM
|
|
101
130
|
verify_sha1,
|
102
131
|
@nexus_config,
|
103
132
|
@nexus_ssl_verify)
|
104
|
-
|
105
133
|
mark_as_active(plugins_dir, artifact_info, artifact_id)
|
134
|
+
update_plugin_identifier(plugins_dir, plugin_key, artifact_info)
|
106
135
|
|
107
136
|
artifact_info
|
108
137
|
end
|
109
138
|
|
110
|
-
|
139
|
+
|
140
|
+
|
141
|
+
def install_plugin_from_fs(plugin_key, file_path, name, version, bundles_dir=nil, type='java')
|
111
142
|
bundles_dir = Pathname.new(bundles_dir || DEFAULT_BUNDLES_DIR).expand_path
|
112
143
|
plugins_dir = bundles_dir.join('plugins')
|
113
144
|
|
@@ -121,6 +152,7 @@ module KPM
|
|
121
152
|
artifact_info[:version] ||= version
|
122
153
|
|
123
154
|
mark_as_active(plugins_dir, artifact_info)
|
155
|
+
update_plugin_identifier(plugins_dir, plugin_key, artifact_info)
|
124
156
|
|
125
157
|
artifact_info
|
126
158
|
end
|
@@ -167,6 +199,20 @@ module KPM
|
|
167
199
|
|
168
200
|
private
|
169
201
|
|
202
|
+
def update_plugin_identifier(plugins_dir, plugin_key, artifact_info)
|
203
|
+
# In case the artifact on disk already existed and the installation is skipped, we don't try to update the pluginKey mapping
|
204
|
+
# (of course if the install is retried with a different pluginKey that may be confusing for the user)
|
205
|
+
if artifact_info[:bundle_dir].nil?
|
206
|
+
@logger.info("Skipping updating plugin identifier for already installed plugin")
|
207
|
+
return
|
208
|
+
end
|
209
|
+
|
210
|
+
# The plugin_name needs to be computed after the fact (after the installation) because some plugin archive embed their directory structure
|
211
|
+
plugin_name = Pathname.new(artifact_info[:bundle_dir]).parent.split[1].to_s
|
212
|
+
plugins_manager = PluginsManager.new(plugins_dir, @logger)
|
213
|
+
plugins_manager.update_plugin_identifier(plugin_key, plugin_name)
|
214
|
+
end
|
215
|
+
|
170
216
|
def mark_as_active(plugins_dir, artifact_info, artifact_id=nil)
|
171
217
|
# Mark this bundle as active
|
172
218
|
plugins_manager = PluginsManager.new(plugins_dir, @logger)
|
data/lib/kpm/installer.rb
CHANGED
@@ -79,7 +79,7 @@ module KPM
|
|
79
79
|
|
80
80
|
infos = []
|
81
81
|
@config['plugins']['java'].each do |plugin|
|
82
|
-
infos << install_plugin(plugin['
|
82
|
+
infos << install_plugin(plugin['name'], plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], @config['plugins_dir'], 'java', force_download, verify_sha1)
|
83
83
|
end
|
84
84
|
|
85
85
|
infos
|
@@ -90,7 +90,7 @@ module KPM
|
|
90
90
|
|
91
91
|
infos = []
|
92
92
|
@config['plugins']['ruby'].each do |plugin|
|
93
|
-
infos << install_plugin(plugin['
|
93
|
+
infos << install_plugin(plugin['name'], plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], @config['plugins_dir'], 'ruby', force_download, verify_sha1)
|
94
94
|
end
|
95
95
|
|
96
96
|
infos
|
@@ -15,16 +15,16 @@ module KPM
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# Note: this API is used in Docker images (see kpm_generator.rb, careful when changing it!)
|
18
|
-
def self.lookup(
|
19
|
-
|
20
|
-
plugin = all(latest)[
|
18
|
+
def self.lookup(raw_plugin_key, latest=false, raw_kb_version=nil)
|
19
|
+
plugin_key = raw_plugin_key.to_s.downcase
|
20
|
+
plugin = all(latest)[plugin_key.to_sym]
|
21
21
|
return nil if plugin.nil?
|
22
22
|
|
23
23
|
type = plugin[:type]
|
24
24
|
is_ruby = type == :ruby
|
25
25
|
|
26
26
|
group_id = plugin[:group_id] || (is_ruby ? KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID : KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID)
|
27
|
-
artifact_id = plugin[:artifact_id] || "#{
|
27
|
+
artifact_id = plugin[:artifact_id] || "#{plugin_key}-plugin"
|
28
28
|
packaging = plugin[:packaging] || (is_ruby ? KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING : KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING)
|
29
29
|
classifier = plugin[:classifier] || (is_ruby ? KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER : KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER)
|
30
30
|
|
data/lib/kpm/plugins_manager.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pathname'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module KPM
|
4
5
|
class PluginsManager
|
@@ -53,6 +54,32 @@ module KPM
|
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
57
|
+
def update_plugin_identifier(plugin_key, plugin_name)
|
58
|
+
path = Pathname.new(@plugins_dir).join('plugin_identifiers.json')
|
59
|
+
backup_path = Pathname.new(path.to_s + ".back")
|
60
|
+
|
61
|
+
identifiers = {}
|
62
|
+
begin
|
63
|
+
identifiers = File.open(path, 'r') do |f|
|
64
|
+
JSON.parse(f.read)
|
65
|
+
end
|
66
|
+
# Move file in case something happens until we complete the operation
|
67
|
+
FileUtils.mv(path, backup_path)
|
68
|
+
rescue Errno::ENOENT
|
69
|
+
end
|
70
|
+
|
71
|
+
identifiers[plugin_key] = plugin_name
|
72
|
+
File.open(path, 'w') do |f|
|
73
|
+
f.write(identifiers.to_json)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Cleanup backup entry
|
77
|
+
FileUtils.rm(backup_path, :force => true)
|
78
|
+
|
79
|
+
identifiers
|
80
|
+
end
|
81
|
+
|
82
|
+
|
56
83
|
def guess_plugin_name(artifact_id)
|
57
84
|
return nil if artifact_id.nil?
|
58
85
|
captures = artifact_id.scan(/(.*)-plugin/)
|
data/lib/kpm/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
describe KPM::Installer do
|
4
5
|
|
@@ -16,21 +17,34 @@ describe KPM::Installer do
|
|
16
17
|
'killbill' => {
|
17
18
|
'webapp_path' => kb_webapp_path,
|
18
19
|
'plugins_dir' => plugins_dir,
|
19
|
-
'plugins'
|
20
|
+
'plugins' => {
|
20
21
|
'java' => [{
|
21
|
-
'name'
|
22
|
+
'name' => 'analytics',
|
23
|
+
'version' => '0.7.1'
|
24
|
+
},
|
25
|
+
# Re-add a second time the same plugin to validate the idempotency of installation
|
26
|
+
{
|
27
|
+
'name' => 'analytics',
|
22
28
|
'version' => '0.7.1'
|
23
29
|
}],
|
24
30
|
'ruby' => [{
|
25
|
-
'name'
|
31
|
+
'name' => 'killbill:payment-test-plugin',
|
32
|
+
'artifact_id' => 'payment-test-plugin',
|
26
33
|
'version' => '1.8.7'
|
27
34
|
},
|
28
35
|
{
|
29
|
-
'name'
|
30
|
-
}
|
36
|
+
'name' => 'stripe'
|
37
|
+
},
|
38
|
+
# Re-add a second time the same plugin to validate the idempotency of installation
|
39
|
+
{
|
40
|
+
'name' => 'killbill:payment-test-plugin',
|
41
|
+
'artifact_id' => 'payment-test-plugin',
|
42
|
+
'version' => '1.8.7'
|
43
|
+
}
|
44
|
+
]
|
31
45
|
},
|
32
46
|
},
|
33
|
-
'kaui'
|
47
|
+
'kaui' => {
|
34
48
|
'webapp_path' => kaui_webapp_path
|
35
49
|
}
|
36
50
|
|
@@ -49,6 +63,7 @@ describe KPM::Installer do
|
|
49
63
|
private
|
50
64
|
|
51
65
|
def check_installation(plugins_dir, kb_webapp_path, kaui_webapp_path)
|
66
|
+
|
52
67
|
[
|
53
68
|
plugins_dir,
|
54
69
|
plugins_dir + '/platform',
|
@@ -68,10 +83,21 @@ describe KPM::Installer do
|
|
68
83
|
kb_webapp_path,
|
69
84
|
kaui_webapp_path,
|
70
85
|
plugins_dir + '/platform/jruby.jar',
|
86
|
+
plugins_dir + '/plugins/plugin_identifiers.json',
|
71
87
|
plugins_dir + '/plugins/java/analytics-plugin/0.7.1/analytics-plugin-0.7.1.jar',
|
72
88
|
plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7/killbill.properties'
|
73
89
|
].each do |file|
|
74
90
|
File.file?(file).should be_true
|
75
91
|
end
|
92
|
+
|
93
|
+
plugin_identifiers = File.open(plugins_dir + '/plugins/plugin_identifiers.json', 'r') do |f|
|
94
|
+
JSON.parse(f.read)
|
95
|
+
end
|
96
|
+
|
97
|
+
plugin_identifiers.size.should == 3
|
98
|
+
plugin_identifiers['killbill:payment-test-plugin'].should == 'killbill-payment-test'
|
99
|
+
plugin_identifiers['stripe'].should == 'killbill-stripe'
|
100
|
+
plugin_identifiers['analytics'].should == 'analytics-plugin'
|
101
|
+
|
76
102
|
end
|
77
103
|
end
|
@@ -21,6 +21,29 @@ describe KPM::PluginsManager do
|
|
21
21
|
FileUtils.remove_entry_secure @plugins_dir
|
22
22
|
end
|
23
23
|
|
24
|
+
|
25
|
+
it 'it creates a plugin identifiers file and add entries' do
|
26
|
+
# Verifies file gets created if does not exist
|
27
|
+
identifiers = @manager.update_plugin_identifier('foo', 'foo_name')
|
28
|
+
identifiers.size.should == 1
|
29
|
+
identifiers['foo'].should == 'foo_name'
|
30
|
+
|
31
|
+
# Verify file was created from previous entry (prev value was read)
|
32
|
+
identifiers = @manager.update_plugin_identifier('bar', 'bar_name')
|
33
|
+
identifiers.size.should == 2
|
34
|
+
identifiers['foo'].should == 'foo_name'
|
35
|
+
identifiers['bar'].should == 'bar_name'
|
36
|
+
|
37
|
+
|
38
|
+
# Verify file was created from previous entry (prev value was read)
|
39
|
+
identifiers = @manager.update_plugin_identifier('zoe', 'zoe_name')
|
40
|
+
identifiers.size.should == 3
|
41
|
+
identifiers['bar'].should == 'bar_name'
|
42
|
+
identifiers['foo'].should == 'foo_name'
|
43
|
+
identifiers['zoe'].should == 'zoe_name'
|
44
|
+
end
|
45
|
+
|
46
|
+
|
24
47
|
it 'sets a path as active' do
|
25
48
|
@manager.set_active(@plugin_dir.join('1.0.0'))
|
26
49
|
File.exists?(@plugin_dir.join('ACTIVE')).should be_true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -145,8 +145,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
148
|
+
rubygems_version: 2.4.6
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: Kill Bill package manager.
|
152
|
-
test_files:
|
152
|
+
test_files:
|
153
|
+
- spec/kpm/remote/base_artifact_spec.rb
|
154
|
+
- spec/kpm/remote/installer_spec.rb
|
155
|
+
- spec/kpm/remote/kaui_artifact_spec.rb
|
156
|
+
- spec/kpm/remote/killbill_plugin_artifact_spec.rb
|
157
|
+
- spec/kpm/remote/killbill_server_artifact_spec.rb
|
158
|
+
- spec/kpm/remote/tomcat_manager_spec.rb
|
159
|
+
- spec/kpm/unit/base_artifact_spec.rb
|
160
|
+
- spec/kpm/unit/plugins_directory_spec.rb
|
161
|
+
- spec/kpm/unit/plugins_manager_spec.rb
|
162
|
+
- spec/kpm/unit/sha1_checker_spec.rb
|
163
|
+
- spec/kpm/unit/sha1_test.yml
|
164
|
+
- spec/spec_helper.rb
|