killbill-kpm 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5860636c6cb6473ffdc32d5ad5c4a2e91bda42a
4
- data.tar.gz: 1364e392d7a9ccbffb5ff9a2f4dda014da3379bb
3
+ metadata.gz: bf312eaaf52cbc0a4cd5fc3bdbbfaafa53e3dabe
4
+ data.tar.gz: 886adff6649f40aef3ba0a6a74126e860de27abd
5
5
  SHA512:
6
- metadata.gz: 249e93822be2c99cecd08fb2a66b680db7f8b86607c54d27700cb2b0948f0dafc82e8403835d19f04c4c46bea8fedd415e4fb05018ad7b38a9b15d23553cc28a
7
- data.tar.gz: 9b9278b66d6e77d81483bd27960bdc66fc9f25b01a47c98f4bf07b969685857a414876be6c5d41d78262959d7e839a898d018c164780dba82efcdea15406651d
6
+ metadata.gz: 3719f03224e15bd5a2132a1b8582af474c7e7f2e1dd55b73bf0e6bfd1f69d0b61182c2a673bd15acad4eb89885314d2a0676c31a8a74d9d322730c9af3179db8
7
+ data.tar.gz: f8bdf8c19542f90a695b242effca8cc2b47e7380bea9f9939709838366f436fe629f3489a9b4ab7eb52a9980a24c9dbcd9eb11eb09678a9c8c926b0a2bf73526
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+ #gem 'kpm', :github => 'killbill/killbill-cloud'
5
+ #gem 'killbill', :github => 'killbill/killbill-plugin-framework-ruby'
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- killbill-kpm (0.0.2)
5
- killbill (~> 6.2)
6
- kpm (~> 0.1)
4
+ killbill-kpm (0.0.3)
5
+ killbill (~> 6.5.0)
6
+ kpm (~> 0.1.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -30,12 +30,12 @@ GEM
30
30
  json (1.8.3-java)
31
31
  jsonpath (0.5.8)
32
32
  multi_json
33
- killbill (6.2.0)
33
+ killbill (6.5.0)
34
34
  rack (>= 1.5.2)
35
35
  sinatra (~> 1.3.4)
36
36
  typhoeus (~> 0.6.9)
37
37
  tzinfo (~> 1.2.0)
38
- kpm (0.1.0)
38
+ kpm (0.1.2)
39
39
  highline (~> 1.6.21)
40
40
  nexus_cli (~> 4.1.0)
41
41
  thor (~> 0.19.1)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/killbill-kpm.gemspec CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.rdoc_options << '--exclude' << '.'
24
24
 
25
- s.add_dependency 'killbill', '~> 6.2'
26
- s.add_dependency 'kpm', '~> 0.1'
25
+ s.add_dependency 'killbill', '~> 6.5.0'
26
+ s.add_dependency 'kpm', '~> 0.1.2'
27
27
 
28
28
  s.add_development_dependency 'jbundler', '~> 0.4.3'
29
29
  s.add_development_dependency 'rake', '>= 10.0.0'
data/lib/kpm/listener.rb CHANGED
@@ -28,16 +28,14 @@ module KPM
28
28
 
29
29
  @logger.info "Received #{event.event_type} event: service=#{service} command=#{command} event=#{event_json}"
30
30
 
31
- return if !validate_inputs(command, properties, Proc.new { |command, properties, property_name|
32
- if properties[property_name].nil?
33
- @logger.info("Cannot run #{command}: missing property #{property_name}")
34
- return false
35
- end
36
- })
31
+ # pluginKey is the only mandatory property
32
+ if event_json['pluginKey'].nil?
33
+ @logger.info("Cannot run #{command}: missing pluginKey property")
34
+ return false
35
+ end
37
36
 
38
37
  handle_event(command,
39
- properties['pluginKey'],
40
- properties['pluginName'],
38
+ event_json['pluginKey'],
41
39
  properties['pluginArtifactId'],
42
40
  properties['pluginVersion'],
43
41
  properties['pluginGroupId'],
@@ -49,36 +47,18 @@ module KPM
49
47
 
50
48
  private
51
49
 
52
- # Check for mandatory properties
53
- def validate_inputs(command, properties, proc_validation)
54
- # For installation we allow either to pass the pluginKey (entry in plugins_directory.yml), or the full pluginGroupId/pluginArtifactId/pluginVersion/pluginType
55
- if command == 'INSTALL_PLUGIN'
56
- if properties['pluginKey'].nil?
57
- proc_validation.call(command, properties, 'pluginGroupId')
58
- proc_validation.call(command, properties, 'pluginArtifactId')
59
- proc_validation.call(command, properties, 'pluginVersion')
60
- proc_validation.call(command, properties, 'pluginType')
61
- end
62
- return true
63
- elsif command == 'UNINSTALL_PLUGIN'
64
- proc_validation.call(command, properties, 'pluginName')
65
- return true
66
- end
67
- end
68
-
69
- def handle_event(command, plugin_key, plugin_name, artifact_id, version=nil, group_id=nil, packaging=nil, classifier=nil, type=nil, force_download=false)
70
- @logger.info "handle_event command=#{command}, plugin_key=#{plugin_key}, plugin_name=#{plugin_name}, artifact_id=#{artifact_id}, version=#{version}, group_id=#{group_id}, packaging=#{packaging}, classifier=#{classifier}, type=#{type}, force_download=#{force_download}"
50
+ def handle_event(command, plugin_key, artifact_id, version=nil, group_id=nil, packaging=nil, classifier=nil, type=nil, force_download=false)
51
+ @logger.info "handle_event command=#{command}, plugin_key=#{plugin_key}, artifact_id=#{artifact_id}, version=#{version}, group_id=#{group_id}, packaging=#{packaging}, classifier=#{classifier}, type=#{type}, force_download=#{force_download}"
71
52
 
72
53
  if command == 'INSTALL_PLUGIN'
73
- plugin_key_or_artifact_id = plugin_key ? plugin_key : artifact_id
74
- ::KPM::PluginsInstaller.instance.install(plugin_key_or_artifact_id, version, group_id, packaging, classifier, type, force_download)
54
+ ::KPM::PluginsInstaller.instance.install(plugin_key, artifact_id, version, group_id, packaging, classifier, type, force_download)
75
55
  elsif command == 'UNINSTALL_PLUGIN'
76
- ::KPM::PluginsInstaller.instance.uninstall(plugin_name, version)
56
+ ::KPM::PluginsInstaller.instance.uninstall(plugin_key, version)
77
57
  else
78
58
  @logger.warn("Ignoring unsupported command #{command}")
79
59
  end
80
60
  rescue NexusCli::ArtifactNotFoundException
81
- @logger.warn("Unable to #{command} #{plugin_name}: artifact was not found in Nexus")
61
+ @logger.warn("Unable to #{command} for plugin_key=#{plugin_key}: artifact was not found in Nexus")
82
62
  end
83
63
 
84
64
  def properties_to_hash(properties)
@@ -21,33 +21,34 @@ module KPM
21
21
  end
22
22
 
23
23
  # If an earlier version of the plugin is installed, Kill Bill will only start the latest one (see org.killbill.billing.osgi.FileInstall)
24
- def install(specified_artifact_id, specified_version=nil, specified_group_id=nil, specified_packaging=nil, specified_classifier=nil, specified_type=nil, force_download=false)
24
+ def install(plugin_key, specified_artifact_id, specified_version=nil, specified_group_id=nil, specified_packaging=nil, specified_classifier=nil, specified_type=nil, force_download=false)
25
25
  @logger.info("Instructed to install artifact_id=#{specified_artifact_id} version=#{specified_version} group_id=#{specified_group_id} packaging=#{specified_packaging} classifier=#{specified_classifier} type=#{specified_type} force_download=#{force_download}")
26
- info = @installer.install_plugin(specified_group_id, specified_artifact_id, specified_packaging, specified_classifier, specified_version, @bundles_dir, specified_type, force_download, @glob_config[:kpm][:verify_sha1])
26
+ info = @installer.install_plugin(plugin_key, specified_group_id, specified_artifact_id, specified_packaging, specified_classifier, specified_version, @bundles_dir, specified_type, force_download, @glob_config[:kpm][:verify_sha1])
27
27
  if info.nil?
28
- @logger.warn("Error during installation of plugin #{artifact_id}")
28
+ @logger.warn("Error during installation of plugin #{specified_artifact_id}")
29
29
  else
30
- path = info[:bundle_dir] ? info[:bundle_dir] : info[:dir_name]
31
- notify_fs_change(path, :NEW_VERSION)
30
+ path = info[:bundle_dir] || info[:dir_name]
31
+ notify_fs_change(plugin_key, path, :NEW_VERSION)
32
32
  end
33
33
  info
34
34
  end
35
35
 
36
- def install_from_fs(file_path, name, version, type)
37
- @logger.info("Instructed to install file_path=#{file_path} name=#{name} version=#{version} type=#{type}")
38
- info = @installer.install_plugin_from_fs(file_path, name, version, @bundles_dir, type)
36
+ def install_from_fs(plugin_key, file_path, version, type)
37
+ @logger.info("Instructed to install file_path=#{file_path} plugin_key=#{plugin_key} version=#{version} type=#{type}")
38
+ info = @installer.install_plugin_from_fs(plugin_key, file_path, plugin_key, version, @bundles_dir, type)
39
39
  if info.nil?
40
- @logger.warn("Error during installation of plugin #{name}")
40
+ @logger.warn("Error during installation of plugin #{plugin_key}")
41
41
  else
42
- notify_fs_change(info[:bundle_dir], :NEW_VERSION)
42
+ path = info[:bundle_dir] || info[:dir_name]
43
+ notify_fs_change(plugin_key, path, :NEW_VERSION)
43
44
  end
44
45
  info
45
46
  end
46
47
 
47
- def uninstall(plugin_name, version=nil)
48
- modified = @manager.uninstall(plugin_name, version || :all)
48
+ def uninstall(plugin_key, version=nil)
49
+ modified = @installer.uninstall_plugin(plugin_key, version || :all, @bundles_dir)
49
50
  modified.each do |path|
50
- notify_fs_change(path, :DISABLED)
51
+ notify_fs_change(plugin_key, path, :DISABLED)
51
52
  end
52
53
  end
53
54
 
@@ -65,7 +66,7 @@ module KPM
65
66
 
66
67
  private
67
68
 
68
- def notify_fs_change(path, state)
69
+ def notify_fs_change(plugin_key, path, state)
69
70
  return if path.nil?
70
71
 
71
72
  # Plugin name should be the directory name (path is something like /var/tmp/bundles/plugins/ruby/killbill-stripe/2.0.0)
@@ -85,7 +86,7 @@ module KPM
85
86
  plugin_name = fs_info[-2]
86
87
  plugin_version = fs_info[-1]
87
88
  @logger.info("Notifying Kill Bill: state=#{state} plugin_name=#{plugin_name} plugin_version=#{plugin_version} plugin_type=#{plugin_type}")
88
- @kb_apis.plugins_info_api.notify_of_state_changed(state, plugin_name, plugin_version, plugin_type)
89
+ @kb_apis.plugins_info_api.notify_of_state_changed(state, plugin_key, plugin_name, plugin_version, plugin_type)
89
90
  end
90
91
 
91
92
  def configure!(config_file)
data/pom.xml CHANGED
@@ -25,7 +25,7 @@
25
25
  <groupId>org.kill-bill.billing.plugin.ruby</groupId>
26
26
  <artifactId>kpm-plugin</artifactId>
27
27
  <packaging>pom</packaging>
28
- <version>0.0.2</version>
28
+ <version>0.0.3</version>
29
29
  <name>kpm-plugin</name>
30
30
  <url>http://github.com/killbill/killbill-kpm-plugin</url>
31
31
  <description>Kill Bill KPM plugin</description>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-kpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Killbill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-12 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill
@@ -16,12 +16,12 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '6.2'
19
+ version: 6.5.0
20
20
  requirement: !ruby/object:Gem::Requirement
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: '6.2'
24
+ version: 6.5.0
25
25
  prerelease: false
26
26
  type: :runtime
27
27
  - !ruby/object:Gem::Dependency
@@ -30,12 +30,12 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: 0.1.2
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: '0.1'
38
+ version: 0.1.2
39
39
  prerelease: false
40
40
  type: :runtime
41
41
  - !ruby/object:Gem::Dependency