kpm 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0168b3fb22a6c364cce6ce9e235a0025627da27
4
- data.tar.gz: 48cf7c666cb75d59208598a99b955c52eeb9800e
3
+ metadata.gz: 7d305f7283e154bd4021da4ed116009e87a2b126
4
+ data.tar.gz: bf57217f06ec10a49ceb65cf496853dbe92a23cb
5
5
  SHA512:
6
- metadata.gz: 52f9ff4a9a13d224c448da33c5ad909bcf6d25edd393aca71551dae61832b539dfa5d050f15b8f4807c956145a26cfbba2a8c62ab9590f4044d990cecd9c9573
7
- data.tar.gz: d1706d3f53df62ec452bf7791317525406b8409341474c5334ca24c070e4e30cabe453af216cd90a0687e7e22af312e66204eba6aa8bae601b3096ab2ee13898
6
+ metadata.gz: d4c8a285f34065509b140cacdef262f2cfd7abe37778dc3176ae550c3fcc0c900c9e91cf53ee023f2b0e354b7b60e431bac32cf720e44563d46edda4bf4b6e18
7
+ data.tar.gz: 6a93e71899e8a8b94b9357e6aaa6af1d996e78dd4751aa0bba2cada0e93dd165bb5ffd689097c7e6865f40cfda668c873b503176658d72c7996a04d403a7a9b2
data/README.md CHANGED
@@ -1,19 +1,16 @@
1
- KPM: the Kill Bill Package Manager
2
- ==================================
1
+ # KPM: the Kill Bill Package Manager
3
2
 
4
3
  The goal of KPM is to facilitate the installation of Kill Bill and its plugins.
5
4
 
6
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.
7
6
 
8
- Installation
9
- ------------
7
+ ## Installation
10
8
 
11
9
  gem install kpm
12
10
 
13
11
  Ruby 2.1+ or JRuby 1.7.11+ is recommended.
14
12
 
15
- Quick start
16
- -----------
13
+ ## Quick start
17
14
 
18
15
  Create a kpm.yml file as follows:
19
16
 
@@ -47,4 +44,23 @@ To help you with discovery of plugins, you can run
47
44
 
48
45
  This will list available (official) plugins. We maintain a list of recommended versions to use at https://github.com/killbill/killbill-cloud/blob/master/kpm/lib/kpm/plugins_directory.yml.
49
46
 
50
- There are more advanced commands and options available, just run `kpm --help` for details.
47
+ ## Internals and Advanced Commands
48
+
49
+
50
+ ### Caching
51
+
52
+ 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:
53
+ * For the kilbill artifact itself, kpm will first extract the sha1 from the remote repository and compare with the cuurent sha1 installed under the default `webapp_path`; if those are the same, the file is not downloaded again.
54
+ * 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.
55
+
56
+ Note that you can override that behavior with the `--force-download` switch.
57
+
58
+ ### Custom Downloads
59
+
60
+ Note that you can also download specific versions/artifacts directly with the followinhg commands -- bypassing the kpm.yml file:
61
+ * `kpm pull_kaui_war <version>`
62
+ * `kpm pull_kb_server_war <version>`
63
+ * `kpm pull_ruby_plugin <artifact_id>`
64
+
65
+ For more details see `kpm --help`.
66
+
@@ -35,9 +35,9 @@ module KPM
35
35
  KAUI_CLASSIFIER = nil
36
36
 
37
37
  class << self
38
- def pull(logger, group_id, artifact_id, packaging='jar', classifier=nil, version='LATEST', destination_path=nil, sha1_file=nil, force_download=false, overrides={}, ssl_verify=true)
38
+ def pull(logger, group_id, artifact_id, packaging='jar', classifier=nil, version='LATEST', destination_path=nil, sha1_file=nil, force_download=false, verify_sha1=true, overrides={}, ssl_verify=true)
39
39
  coordinates = build_coordinates(group_id, artifact_id, packaging, classifier, version)
40
- pull_and_put_in_place(logger, coordinates, destination_path, is_ruby_plugin_and_should_skip_top_dir(group_id, artifact_id), sha1_file, force_download, overrides, ssl_verify)
40
+ pull_and_put_in_place(logger, coordinates, destination_path, is_ruby_plugin_and_should_skip_top_dir(group_id, artifact_id), sha1_file, force_download, verify_sha1, overrides, ssl_verify)
41
41
  end
42
42
 
43
43
  def nexus_remote(overrides={}, ssl_verify=true)
@@ -53,7 +53,7 @@ module KPM
53
53
 
54
54
  protected
55
55
 
56
- def pull_and_put_in_place(logger, coordinates, destination_path=nil, skip_top_dir=true, sha1_file=nil, force_download=false, overrides={}, ssl_verify=true)
56
+ def pull_and_put_in_place(logger, coordinates, destination_path=nil, skip_top_dir=true, sha1_file=nil, force_download=false, verify_sha1=true, overrides={}, ssl_verify=true)
57
57
  destination_path = KPM::root if destination_path.nil?
58
58
 
59
59
  # Create the destination directory
@@ -76,7 +76,7 @@ module KPM
76
76
  Dir.mktmpdir do |tmp_destination_dir|
77
77
  logger.info " Starting download of #{coordinates} to #{tmp_destination_dir}"
78
78
 
79
- downloaded_artifact_info = pull_and_verify(logger, artifact_info[:sha1], coordinates, tmp_destination_dir, sha1_file, overrides, ssl_verify)
79
+ downloaded_artifact_info = pull_and_verify(logger, artifact_info[:sha1], coordinates, tmp_destination_dir, sha1_file, verify_sha1, overrides, ssl_verify)
80
80
  if artifact_info[:is_tgz]
81
81
  Utils.unpack_tgz(downloaded_artifact_info[:file_path], destination_path, skip_top_dir)
82
82
  FileUtils.rm downloaded_artifact_info[:file_path]
@@ -140,9 +140,13 @@ module KPM
140
140
  end
141
141
 
142
142
 
143
- def pull_and_verify(logger, remote_sha1, coordinates, destination_dir, sha1_file, overrides={}, ssl_verify=true)
143
+ def pull_and_verify(logger, remote_sha1, coordinates, destination_dir, sha1_file, verify_sha1, overrides={}, ssl_verify=true)
144
144
  info = nexus_remote(overrides, ssl_verify).pull_artifact(coordinates, destination_dir)
145
- raise ArtifactCorruptedException unless verify(logger, info[:file_path], remote_sha1)
145
+ if verify_sha1
146
+ raise ArtifactCorruptedException unless verify(logger, coordinates, info[:file_path], remote_sha1)
147
+ else
148
+ logger.warn("Skip sha1 verification for #{coordinates}")
149
+ end
146
150
 
147
151
  if sha1_file
148
152
  sha1_checker = Sha1Checker.from_file(sha1_file)
@@ -152,15 +156,19 @@ module KPM
152
156
  info
153
157
  end
154
158
 
155
- def verify(logger, file_path, remote_sha1)
159
+ def verify(logger, coordinates, file_path, remote_sha1)
156
160
  # Can't check :(
157
161
  if remote_sha1.nil?
158
- logger.warn("Unable to verify sha1 for #{coordinates}. Artifact info: #{artifact_info.inspect}")
162
+ logger.warn("Unable to verify sha1 for #{coordinates}")
159
163
  return true
160
164
  end
161
165
 
162
166
  local_sha1 = Digest::SHA1.file(file_path).hexdigest
163
- local_sha1 == remote_sha1
167
+ res = local_sha1 == remote_sha1
168
+ if !res
169
+ logger.warn("Sha1 verification failed for #{coordinates} : local_sha1 = #{local_sha1}, remote_sha1 = #{remote_sha1}")
170
+ end
171
+ res
164
172
  end
165
173
 
166
174
  def build_coordinates(group_id, artifact_id, packaging, classifier, version=nil)
@@ -26,8 +26,9 @@ module KPM
26
26
  @nexus_ssl_verify = !@nexus_config.nil? ? @nexus_config['ssl_verify'] : true
27
27
  end
28
28
 
29
- def install(force_download=false)
29
+ def install(force_download=false, verify_sha1=true)
30
30
  @force_download = force_download
31
+ @verify_sha1 = verify_sha1
31
32
  @bundles_dir = @config['plugins_dir']
32
33
  @sha1_file = "#{@bundles_dir}/#{SHA1_FILENAME}"
33
34
 
@@ -51,7 +52,7 @@ module KPM
51
52
  version = @config['version'] || LATEST_VERSION
52
53
  webapp_path = @config['webapp_path'] || KPM::root
53
54
 
54
- KPM::KillbillServerArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, webapp_path, nil, @force_download, @nexus_config, @nexus_ssl_verify)
55
+ KPM::KillbillServerArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, webapp_path, nil, @force_download, @verify_sha1, @nexus_config, @nexus_ssl_verify)
55
56
  end
56
57
 
57
58
  def install_plugins
@@ -71,7 +72,7 @@ module KPM
71
72
  version = plugin['version'] || LATEST_VERSION
72
73
  destination = "#{@bundles_dir}/plugins/java/#{artifact_id}/#{version}"
73
74
 
74
- infos << KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @sha1_file, @force_download, @nexus_config, @nexus_ssl_verify)
75
+ infos << KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @sha1_file, @force_download, @verify_sha1, @nexus_config, @nexus_ssl_verify)
75
76
  end
76
77
 
77
78
  infos
@@ -89,7 +90,7 @@ module KPM
89
90
  version = plugin['version'] || LATEST_VERSION
90
91
  destination = "#{@bundles_dir}/plugins/ruby"
91
92
 
92
- infos << KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @sha1_file, @force_download, @nexus_config, @nexus_ssl_verify)
93
+ infos << KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @sha1_file, @force_download, @verify_sha1, @nexus_config, @nexus_ssl_verify)
93
94
  end
94
95
 
95
96
  infos
@@ -105,7 +106,7 @@ module KPM
105
106
  version = @config['default_bundles_version'] || LATEST_VERSION
106
107
  destination = "#{@config['plugins_dir']}/platform"
107
108
 
108
- info = KPM::BaseArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @sha1_file, @force_download, @nexus_config, @nexus_ssl_verify)
109
+ info = KPM::BaseArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @sha1_file, @force_download, @verify_sha1, @nexus_config, @nexus_ssl_verify)
109
110
 
110
111
  # The special JRuby bundle needs to be called jruby.jar
111
112
  # TODO .first - code smell
@@ -124,7 +125,7 @@ module KPM
124
125
  version = @kaui_config['version'] || LATEST_VERSION
125
126
  webapp_path = @kaui_config['webapp_path'] || KPM::root
126
127
 
127
- KPM::KauiArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, webapp_path, nil, @force_download, @nexus_config, @nexus_ssl_verify)
128
+ KPM::KauiArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, webapp_path, nil, @force_download, @verify_sha1, @nexus_config, @nexus_ssl_verify)
128
129
  end
129
130
  end
130
131
  end
@@ -31,4 +31,12 @@
31
31
  :artifact_id: stripe-plugin
32
32
  :stable_version: 0.2.1
33
33
  :require:
34
- - :api_secret_key
34
+ - :api_secret_key
35
+ :braintree_blue:
36
+ :type: :ruby
37
+ :artifact_id: braintree_blue-plugin
38
+ :stable_version: 0.0.1
39
+ :require:
40
+ - :merchant_id
41
+ - :public_key
42
+ - :private_key
@@ -24,8 +24,12 @@ module KPM
24
24
  :type => :boolean,
25
25
  :default => false,
26
26
  :desc => 'Force download of the artifact even if it exists'
27
+ method_option :verify_sha1,
28
+ :type => :boolean,
29
+ :default => true,
30
+ :desc => 'Validates sha1 sum'
27
31
  def install(config_file)
28
- Installer.from_file(config_file).install(options[:force_download])
32
+ Installer.from_file(config_file).install(options[:force_download], options[:verify_sha1])
29
33
  end
30
34
 
31
35
  method_option :destination,
@@ -36,6 +40,10 @@ module KPM
36
40
  :type => :boolean,
37
41
  :default => false,
38
42
  :desc => 'Force download of the artifact even if it exists'
43
+ method_option :verify_sha1,
44
+ :type => :boolean,
45
+ :default => true,
46
+ :desc => 'Validates sha1 sum'
39
47
  desc 'pull_kb_server_war version', 'Pulls Kill Bill server war from Sonatype and places it on your machine.'
40
48
  def pull_kb_server_war(version='LATEST')
41
49
  response = KillbillServerArtifact.pull(logger,
@@ -47,6 +55,7 @@ module KPM
47
55
  options[:destination],
48
56
  nil,
49
57
  options[:force_download],
58
+ options[:verify_sha1],
50
59
  options[:overrides],
51
60
  options[:ssl_verify])
52
61
  say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
@@ -69,6 +78,10 @@ module KPM
69
78
  :type => :boolean,
70
79
  :default => false,
71
80
  :desc => 'Force download of the artifact even if it exists'
81
+ method_option :verify_sha1,
82
+ :type => :boolean,
83
+ :default => true,
84
+ :desc => 'Validates sha1 sum'
72
85
  desc 'pull_kp_server_war version', 'Pulls Kill Pay server war from Sonatype and places it on your machine.'
73
86
  def pull_kp_server_war(version='LATEST')
74
87
  response = KillbillServerArtifact.pull(logger,
@@ -80,6 +93,7 @@ module KPM
80
93
  options[:destination],
81
94
  nil,
82
95
  options[:force_download],
96
+ options[:verify_sha1],
83
97
  options[:overrides],
84
98
  options[:ssl_verify])
85
99
  say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
@@ -106,6 +120,10 @@ module KPM
106
120
  :type => :string,
107
121
  :default => nil,
108
122
  :desc => 'Location of the sha1 file'
123
+ method_option :verify_sha1,
124
+ :type => :boolean,
125
+ :default => true,
126
+ :desc => 'Validates sha1 sum'
109
127
  desc 'pull_java_plugin artifact_id', 'Pulls a java plugin from Sonatype and places it on your machine.'
110
128
  def pull_java_plugin(artifact_id, version='LATEST')
111
129
  response = KillbillPluginArtifact.pull(logger,
@@ -117,6 +135,7 @@ module KPM
117
135
  options[:destination],
118
136
  options[:sha1_file],
119
137
  options[:force_download],
138
+ options[:verify_sha1],
120
139
  options[:overrides],
121
140
  options[:ssl_verify])
122
141
  say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
@@ -134,6 +153,10 @@ module KPM
134
153
  :type => :string,
135
154
  :default => nil,
136
155
  :desc => 'Location of the sha1 file'
156
+ method_option :verify_sha1,
157
+ :type => :boolean,
158
+ :default => true,
159
+ :desc => 'Validates sha1 sum'
137
160
  desc 'pull_ruby_plugin artifact_id', 'Pulls a ruby plugin from Sonatype and places it on your machine.'
138
161
  def pull_ruby_plugin(artifact_id, version='LATEST')
139
162
  response = KillbillPluginArtifact.pull(logger,
@@ -145,6 +168,7 @@ module KPM
145
168
  options[:destination],
146
169
  options[:sha1_file],
147
170
  options[:force_download],
171
+ options[:verify_sha1],
148
172
  options[:overrides],
149
173
  options[:ssl_verify])
150
174
  say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
@@ -177,6 +201,10 @@ module KPM
177
201
  :type => :string,
178
202
  :default => nil,
179
203
  :desc => 'Location of the sha1 file'
204
+ method_option :verify_sha1,
205
+ :type => :boolean,
206
+ :default => true,
207
+ :desc => 'Validates sha1 sum'
180
208
  desc 'pull_kaui_war version', 'Pulls Kaui war from Sonatype and places it on your machine.'
181
209
  def pull_kaui_war(version='LATEST')
182
210
  response = KauiArtifact.pull(logger,
@@ -188,6 +216,7 @@ module KPM
188
216
  options[:destination],
189
217
  options[:sha1_file],
190
218
  options[:force_download],
219
+ options[:verify_sha1],
191
220
  options[:overrides],
192
221
  options[:ssl_verify])
193
222
  say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
@@ -1,3 +1,3 @@
1
1
  module KPM
2
- VERSION = '0.0.13'
2
+ VERSION = '0.0.14'
3
3
  end
@@ -70,7 +70,8 @@ describe KPM::BaseArtifact do
70
70
 
71
71
  def test_download(dir, filename=nil, verify_is_skipped=false, force_download=false)
72
72
  path = filename.nil? ? dir : dir + '/' + filename
73
- info = KPM::BaseArtifact.pull(@logger, 'org.kill-bill.billing', 'killbill-oss-parent', 'pom', nil, 'LATEST', path, nil, force_download, {}, true)
73
+
74
+ info = KPM::BaseArtifact.pull(@logger, 'org.kill-bill.billing', 'killbill-oss-parent', 'pom', nil, 'LATEST', path, nil, force_download, true, {}, true)
74
75
  info[:file_name].should == (filename.nil? ? "killbill-oss-parent-#{info[:version]}.pom" : filename)
75
76
  info[:skipped].should == verify_is_skipped
76
77
  if !info[:skipped]
metadata CHANGED
@@ -1,85 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
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: 2014-12-01 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
15
- version_requirements: !ruby/object:Gem::Requirement
15
+ requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.6.21
20
- requirement: !ruby/object:Gem::Requirement
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
21
23
  requirements:
22
- - - ~>
24
+ - - "~>"
23
25
  - !ruby/object:Gem::Version
24
26
  version: 1.6.21
25
- prerelease: false
26
- type: :runtime
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nexus_cli
29
- version_requirements: !ruby/object:Gem::Requirement
29
+ requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 4.1.0
34
- requirement: !ruby/object:Gem::Requirement
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
35
37
  requirements:
36
- - - ~>
38
+ - - "~>"
37
39
  - !ruby/object:Gem::Version
38
40
  version: 4.1.0
39
- prerelease: false
40
- type: :runtime
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
- version_requirements: !ruby/object:Gem::Requirement
43
+ requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.19.1
48
- requirement: !ruby/object:Gem::Requirement
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
49
51
  requirements:
50
- - - ~>
52
+ - - "~>"
51
53
  - !ruby/object:Gem::Version
52
54
  version: 0.19.1
53
- prerelease: false
54
- type: :runtime
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
- version_requirements: !ruby/object:Gem::Requirement
57
+ requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 10.0.0
62
- requirement: !ruby/object:Gem::Requirement
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
63
65
  requirements:
64
- - - '>='
66
+ - - ">="
65
67
  - !ruby/object:Gem::Version
66
68
  version: 10.0.0
67
- prerelease: false
68
- type: :development
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- version_requirements: !ruby/object:Gem::Requirement
71
+ requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 2.12.0
76
- requirement: !ruby/object:Gem::Requirement
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
77
79
  requirements:
78
- - - ~>
80
+ - - "~>"
79
81
  - !ruby/object:Gem::Version
80
82
  version: 2.12.0
81
- prerelease: false
82
- type: :development
83
83
  description: A package manager for Kill Bill.
84
84
  email: killbilling-users@googlegroups.com
85
85
  executables:
@@ -87,8 +87,8 @@ executables:
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gemrelease
91
- - .gitignore
90
+ - ".gemrelease"
91
+ - ".gitignore"
92
92
  - Gemfile
93
93
  - README.md
94
94
  - Rakefile
@@ -120,26 +120,26 @@ homepage: http://kill-bill.org
120
120
  licenses:
121
121
  - Apache License (2.0)
122
122
  metadata: {}
123
- post_install_message:
123
+ post_install_message:
124
124
  rdoc_options:
125
- - --exclude
126
- - .
125
+ - "--exclude"
126
+ - "."
127
127
  require_paths:
128
128
  - lib
129
129
  required_ruby_version: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - '>='
131
+ - - ">="
132
132
  - !ruby/object:Gem::Version
133
133
  version: 1.8.6
134
134
  required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
- rubyforge_project:
140
+ rubyforge_project:
141
141
  rubygems_version: 2.2.2
142
- signing_key:
142
+ signing_key:
143
143
  specification_version: 4
144
144
  summary: Kill Bill package manager.
145
145
  test_files: