artifactory 2.5.2 → 2.6.0
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 +4 -4
- data/.travis.yml +3 -2
- data/CHANGELOG.md +6 -0
- data/Gemfile +9 -13
- data/README.md +10 -1
- data/Rakefile +16 -7
- data/appveyor.yml +4 -2
- data/artifactory.gemspec +14 -14
- data/lib/artifactory.rb +26 -26
- data/lib/artifactory/client.rb +25 -23
- data/lib/artifactory/configurable.rb +1 -0
- data/lib/artifactory/defaults.rb +24 -15
- data/lib/artifactory/errors.rb +2 -2
- data/lib/artifactory/resources/artifact.rb +34 -33
- data/lib/artifactory/resources/backup.rb +5 -5
- data/lib/artifactory/resources/base.rb +7 -7
- data/lib/artifactory/resources/build.rb +15 -15
- data/lib/artifactory/resources/build_component.rb +4 -4
- data/lib/artifactory/resources/group.rb +4 -4
- data/lib/artifactory/resources/layout.rb +3 -3
- data/lib/artifactory/resources/ldap_setting.rb +7 -6
- data/lib/artifactory/resources/mail_server.rb +3 -3
- data/lib/artifactory/resources/permission_target.rb +20 -20
- data/lib/artifactory/resources/plugin.rb +1 -1
- data/lib/artifactory/resources/repository.rb +20 -20
- data/lib/artifactory/resources/system.rb +6 -6
- data/lib/artifactory/resources/url_base.rb +4 -3
- data/lib/artifactory/resources/user.rb +4 -4
- data/lib/artifactory/util.rb +10 -10
- data/lib/artifactory/version.rb +1 -1
- data/spec/integration/resources/artifact_spec.rb +31 -31
- data/spec/integration/resources/backup.rb +7 -7
- data/spec/integration/resources/build_component_spec.rb +18 -18
- data/spec/integration/resources/build_spec.rb +15 -15
- data/spec/integration/resources/group_spec.rb +16 -16
- data/spec/integration/resources/layout_spec.rb +7 -7
- data/spec/integration/resources/ldap_setting_spec.rb +7 -7
- data/spec/integration/resources/mail_server_spec.rb +7 -7
- data/spec/integration/resources/permission_target_spec.rb +35 -35
- data/spec/integration/resources/repository_spec.rb +14 -14
- data/spec/integration/resources/system_spec.rb +20 -21
- data/spec/integration/resources/url_base_spec.rb +7 -7
- data/spec/integration/resources/user_spec.rb +16 -16
- data/spec/spec_helper.rb +11 -11
- data/spec/support/api_server.rb +13 -13
- data/spec/support/api_server/artifact_endpoints.rb +94 -94
- data/spec/support/api_server/build_component_endpoints.rb +18 -18
- data/spec/support/api_server/build_endpoints.rb +76 -76
- data/spec/support/api_server/group_endpoints.rb +24 -24
- data/spec/support/api_server/permission_target_endpoints.rb +24 -24
- data/spec/support/api_server/repository_endpoints.rb +82 -82
- data/spec/support/api_server/status_endpoints.rb +5 -5
- data/spec/support/api_server/system_endpoints.rb +17 -18
- data/spec/support/api_server/user_endpoints.rb +30 -30
- data/spec/unit/artifactory_spec.rb +17 -17
- data/spec/unit/client_spec.rb +43 -43
- data/spec/unit/resources/artifact_spec.rb +256 -256
- data/spec/unit/resources/backup_spec.rb +8 -8
- data/spec/unit/resources/base_spec.rb +51 -51
- data/spec/unit/resources/build_component_spec.rb +45 -45
- data/spec/unit/resources/build_spec.rb +98 -98
- data/spec/unit/resources/defaults_spec.rb +4 -4
- data/spec/unit/resources/group_spec.rb +36 -36
- data/spec/unit/resources/layout_spec.rb +8 -8
- data/spec/unit/resources/ldap_setting_spec.rb +8 -8
- data/spec/unit/resources/mail_server_spec.rb +8 -8
- data/spec/unit/resources/permission_target_spec.rb +79 -79
- data/spec/unit/resources/plugin_spec.rb +7 -7
- data/spec/unit/resources/repository_spec.rb +98 -98
- data/spec/unit/resources/system_spec.rb +30 -30
- data/spec/unit/resources/url_base_spec.rb +8 -8
- data/spec/unit/resources/user_spec.rb +40 -40
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b78870ce533114a24a58309118aa1371b8148e84
|
|
4
|
+
data.tar.gz: 70072323490ca5caa97a9f26c5ada37076df82a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: acb5a08f27fe3551f4b4bb97ce45720194295a71e9ed6123cb03d47784e38fae528a1b1de37a96efb6468dff407082e147a0e7f5b2eda6091ce57cad6312fe17
|
|
7
|
+
data.tar.gz: eda4087d4293e24272959d44d58b1673546c1b096fb7349384b3407cd3d60cb6154f6dc62b8e61ebb9144dccbd54b66fc4f6dbba1ad9df5e81c26e9089ec211b
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@ Artifactory Client CHANGELOG
|
|
|
3
3
|
This file is used to document the changes between releases of the Artifactory
|
|
4
4
|
Ruby client.
|
|
5
5
|
|
|
6
|
+
v2.6.0 (02-02-2017)
|
|
7
|
+
-------------------
|
|
8
|
+
- Add API Key authentication
|
|
9
|
+
- Add new Ruby versions to test matrix
|
|
10
|
+
- Add ChefStyle for linting
|
|
11
|
+
|
|
6
12
|
v2.5.2 (01-27-2017)
|
|
7
13
|
-------------------
|
|
8
14
|
- Update tests to run properly on Windows
|
data/Gemfile
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
source
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
gemspec
|
|
3
3
|
|
|
4
4
|
group :test do
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
7
|
-
gem
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
gem 'addressable', '<= 2.4.0'
|
|
11
|
-
# guard simplecov import of json gem
|
|
12
|
-
gem 'json', '<= 1.8.3'
|
|
13
|
-
end
|
|
5
|
+
gem "chefstyle"
|
|
6
|
+
gem "sinatra", "~> 1.4"
|
|
7
|
+
gem "rspec", "~> 3.0"
|
|
8
|
+
gem "webmock", "~> 2.3"
|
|
9
|
+
gem "rainbow", "< 2.2.1"
|
|
14
10
|
# rspec-mocks 3.4.1 breaks tests with 'System level too deep' errors.
|
|
15
|
-
gem
|
|
16
|
-
gem
|
|
17
|
-
gem
|
|
11
|
+
gem "rspec-mocks", "3.4.0"
|
|
12
|
+
gem "simplecov"
|
|
13
|
+
gem "simplecov-console"
|
|
18
14
|
end
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Artifactory Client
|
|
2
2
|
==================
|
|
3
|
-
[][gem] [][travis] [][appveyor]
|
|
4
4
|
|
|
5
5
|
A Ruby client and interface to the Artifactory API. **The majority of API endpoints are only exposed for Artifactory Pro customers!** As such, many of the resources and actions exposed by this gem also require Artifactory Pro.
|
|
6
6
|
|
|
@@ -56,6 +56,10 @@ Artifactory.configure do |config|
|
|
|
56
56
|
config.username = 'admin'
|
|
57
57
|
config.password = 'password'
|
|
58
58
|
|
|
59
|
+
# You can also use an API key for authentication, username and password
|
|
60
|
+
# take precedence so leave them off if you are using an API key.
|
|
61
|
+
config.api_key = 'XXXXXXXXXXXXXXXXXX'
|
|
62
|
+
|
|
59
63
|
# Speaking of SSL, you can specify the path to a pem file with your custom
|
|
60
64
|
# certificates and the gem will wire it all up for you (NOTE: it must be a
|
|
61
65
|
# valid PEM file).
|
|
@@ -86,6 +90,7 @@ Or, if you want to be really Unixy, these parameters are all configurable via en
|
|
|
86
90
|
export ARTIFACTORY_ENDPOINT=http://my.storage.server/artifactory
|
|
87
91
|
export ARTIFACTORY_USERNAME=admin
|
|
88
92
|
export ARTIFACTORY_PASSWORD=password
|
|
93
|
+
export ARTIFACTORY_API_KEY=XXXXXXXXXXXXXXXXXX
|
|
89
94
|
export ARTIFACTORY_SSL_PEM_FILE=/path/to/my.pem
|
|
90
95
|
```
|
|
91
96
|
|
|
@@ -275,3 +280,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
275
280
|
See the License for the specific language governing permissions and
|
|
276
281
|
limitations under the License.
|
|
277
282
|
```
|
|
283
|
+
|
|
284
|
+
[appveyor]: https://ci.appveyor.com/project/chef/artifactory-client
|
|
285
|
+
[gem]: https://rubygems.org/gems/artifactory
|
|
286
|
+
[travis]: https://travis-ci.org/chef/artifactory-client
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
2
|
|
|
3
|
-
require
|
|
3
|
+
require "rspec/core/rake_task"
|
|
4
4
|
RSpec::Core::RakeTask.new(:integration) do |t|
|
|
5
5
|
t.rspec_opts = "--tag integration"
|
|
6
6
|
end
|
|
@@ -8,12 +8,21 @@ RSpec::Core::RakeTask.new(:unit) do |t|
|
|
|
8
8
|
t.rspec_opts = "--tag ~integration"
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
require "chefstyle"
|
|
12
|
+
require "rubocop/rake_task"
|
|
13
|
+
desc "Run ChefStyle"
|
|
14
|
+
RuboCop::RakeTask.new(:chefstyle) do |task|
|
|
15
|
+
task.options << "--display-cop-names"
|
|
14
16
|
end
|
|
15
17
|
|
|
16
|
-
desc
|
|
18
|
+
desc "Generate coverage report"
|
|
17
19
|
RSpec::Core::RakeTask.new(:coverage) do |t|
|
|
18
|
-
ENV[
|
|
20
|
+
ENV["COVERAGE"] = "true"
|
|
19
21
|
end
|
|
22
|
+
|
|
23
|
+
namespace :travis do
|
|
24
|
+
desc "Run tests on Travis"
|
|
25
|
+
task ci: %w{chefstyle unit integration}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
task default: %w{travis:ci}
|
data/appveyor.yml
CHANGED
|
@@ -6,8 +6,10 @@ environment:
|
|
|
6
6
|
matrix:
|
|
7
7
|
- RUBY_VERSION: 21
|
|
8
8
|
- RUBY_VERSION: 21-x64
|
|
9
|
-
- RUBY_VERSION:
|
|
10
|
-
- RUBY_VERSION:
|
|
9
|
+
- RUBY_VERSION: 22
|
|
10
|
+
- RUBY_VERSION: 22-x64
|
|
11
|
+
- RUBY_VERSION: 23
|
|
12
|
+
- RUBY_VERSION: 23-x64
|
|
11
13
|
|
|
12
14
|
install:
|
|
13
15
|
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
data/artifactory.gemspec
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
|
-
lib = File.expand_path(
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require
|
|
4
|
+
require "artifactory/version"
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name =
|
|
7
|
+
spec.name = "artifactory"
|
|
8
8
|
spec.version = Artifactory::VERSION
|
|
9
|
-
spec.author =
|
|
10
|
-
spec.email =
|
|
11
|
-
spec.description =
|
|
12
|
-
spec.summary =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
spec.homepage =
|
|
16
|
-
spec.license =
|
|
9
|
+
spec.author = "Seth Vargo"
|
|
10
|
+
spec.email = "sethvargo@gmail.com"
|
|
11
|
+
spec.description = "A Ruby client for Artifactory"
|
|
12
|
+
spec.summary = "Artifactory is a simple, lightweight Ruby client for " \
|
|
13
|
+
"interacting with the Artifactory and Artifactory Pro " \
|
|
14
|
+
"APIs."
|
|
15
|
+
spec.homepage = "https://github.com/opscode/artifactory-client"
|
|
16
|
+
spec.license = "Apache 2.0"
|
|
17
17
|
|
|
18
18
|
spec.files = `git ls-files`.split($/)
|
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
21
|
-
spec.require_paths = [
|
|
21
|
+
spec.require_paths = ["lib"]
|
|
22
22
|
|
|
23
|
-
spec.add_development_dependency
|
|
24
|
-
spec.add_development_dependency
|
|
23
|
+
spec.add_development_dependency "bundler"
|
|
24
|
+
spec.add_development_dependency "rake"
|
|
25
25
|
end
|
data/lib/artifactory.rb
CHANGED
|
@@ -14,38 +14,38 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
16
|
|
|
17
|
-
require
|
|
18
|
-
require
|
|
17
|
+
require "pathname"
|
|
18
|
+
require "artifactory/version"
|
|
19
19
|
|
|
20
20
|
module Artifactory
|
|
21
|
-
autoload :Client,
|
|
22
|
-
autoload :Configurable,
|
|
23
|
-
autoload :Defaults,
|
|
24
|
-
autoload :Error,
|
|
25
|
-
autoload :Util,
|
|
21
|
+
autoload :Client, "artifactory/client"
|
|
22
|
+
autoload :Configurable, "artifactory/configurable"
|
|
23
|
+
autoload :Defaults, "artifactory/defaults"
|
|
24
|
+
autoload :Error, "artifactory/errors"
|
|
25
|
+
autoload :Util, "artifactory/util"
|
|
26
26
|
|
|
27
27
|
module Collection
|
|
28
|
-
autoload :Artifact,
|
|
29
|
-
autoload :Base,
|
|
30
|
-
autoload :Build,
|
|
28
|
+
autoload :Artifact, "artifactory/collections/artifact"
|
|
29
|
+
autoload :Base, "artifactory/collections/base"
|
|
30
|
+
autoload :Build, "artifactory/collections/build"
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
module Resource
|
|
34
|
-
autoload :Artifact,
|
|
35
|
-
autoload :Backup,
|
|
36
|
-
autoload :Base,
|
|
37
|
-
autoload :Build,
|
|
38
|
-
autoload :BuildComponent,
|
|
39
|
-
autoload :Group,
|
|
40
|
-
autoload :Layout,
|
|
41
|
-
autoload :LDAPSetting,
|
|
42
|
-
autoload :MailServer,
|
|
43
|
-
autoload :PermissionTarget,
|
|
44
|
-
autoload :Plugin,
|
|
45
|
-
autoload :Repository,
|
|
46
|
-
autoload :System,
|
|
47
|
-
autoload :URLBase,
|
|
48
|
-
autoload :User,
|
|
34
|
+
autoload :Artifact, "artifactory/resources/artifact"
|
|
35
|
+
autoload :Backup, "artifactory/resources/backup"
|
|
36
|
+
autoload :Base, "artifactory/resources/base"
|
|
37
|
+
autoload :Build, "artifactory/resources/build"
|
|
38
|
+
autoload :BuildComponent, "artifactory/resources/build_component"
|
|
39
|
+
autoload :Group, "artifactory/resources/group"
|
|
40
|
+
autoload :Layout, "artifactory/resources/layout"
|
|
41
|
+
autoload :LDAPSetting, "artifactory/resources/ldap_setting"
|
|
42
|
+
autoload :MailServer, "artifactory/resources/mail_server"
|
|
43
|
+
autoload :PermissionTarget, "artifactory/resources/permission_target"
|
|
44
|
+
autoload :Plugin, "artifactory/resources/plugin"
|
|
45
|
+
autoload :Repository, "artifactory/resources/repository"
|
|
46
|
+
autoload :System, "artifactory/resources/system"
|
|
47
|
+
autoload :URLBase, "artifactory/resources/url_base"
|
|
48
|
+
autoload :User, "artifactory/resources/user"
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
class << self
|
|
@@ -58,7 +58,7 @@ module Artifactory
|
|
|
58
58
|
# @return [Pathname]
|
|
59
59
|
#
|
|
60
60
|
def root
|
|
61
|
-
@root ||= Pathname.new(File.expand_path(
|
|
61
|
+
@root ||= Pathname.new(File.expand_path("../../", __FILE__))
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
#
|
data/lib/artifactory/client.rb
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
16
|
|
|
17
|
-
require
|
|
18
|
-
require
|
|
19
|
-
require
|
|
20
|
-
require
|
|
17
|
+
require "cgi"
|
|
18
|
+
require "json"
|
|
19
|
+
require "net/http"
|
|
20
|
+
require "uri"
|
|
21
21
|
|
|
22
22
|
module Artifactory
|
|
23
23
|
#
|
|
@@ -31,7 +31,7 @@ module Artifactory
|
|
|
31
31
|
# @private
|
|
32
32
|
#
|
|
33
33
|
def proxy(klass)
|
|
34
|
-
namespace = klass.name.split(
|
|
34
|
+
namespace = klass.name.split("::").last.downcase
|
|
35
35
|
klass.singleton_methods(false).each do |name|
|
|
36
36
|
define_method("#{namespace}_#{name}") do |*args|
|
|
37
37
|
if args.last.is_a?(Hash)
|
|
@@ -69,10 +69,10 @@ module Artifactory
|
|
|
69
69
|
# Use any options given, but fall back to the defaults set on the module
|
|
70
70
|
Artifactory::Configurable.keys.each do |key|
|
|
71
71
|
value = if options[key].nil?
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
Artifactory.instance_variable_get(:"@#{key}")
|
|
73
|
+
else
|
|
74
|
+
options[key]
|
|
75
|
+
end
|
|
76
76
|
|
|
77
77
|
instance_variable_set(:"@#{key}", value)
|
|
78
78
|
end
|
|
@@ -193,6 +193,8 @@ module Artifactory
|
|
|
193
193
|
# Add basic authentication
|
|
194
194
|
if username && password
|
|
195
195
|
request.basic_auth(username, password)
|
|
196
|
+
elsif api_key
|
|
197
|
+
request.add_field("X-JFrog-Art-Api", api_key)
|
|
196
198
|
end
|
|
197
199
|
|
|
198
200
|
# Setup PATCH/POST/PUT
|
|
@@ -219,8 +221,8 @@ module Artifactory
|
|
|
219
221
|
connection.read_timeout = read_timeout
|
|
220
222
|
|
|
221
223
|
# Apply SSL, if applicable
|
|
222
|
-
if uri.scheme ==
|
|
223
|
-
require
|
|
224
|
+
if uri.scheme == "https"
|
|
225
|
+
require "net/https" unless defined?(Net::HTTPS)
|
|
224
226
|
|
|
225
227
|
# Turn on SSL
|
|
226
228
|
connection.use_ssl = true
|
|
@@ -247,7 +249,7 @@ module Artifactory
|
|
|
247
249
|
|
|
248
250
|
case response
|
|
249
251
|
when Net::HTTPRedirection
|
|
250
|
-
redirect = URI.parse(response[
|
|
252
|
+
redirect = URI.parse(response["location"])
|
|
251
253
|
request(verb, redirect, data, headers)
|
|
252
254
|
when Net::HTTPSuccess
|
|
253
255
|
success(response)
|
|
@@ -267,9 +269,9 @@ module Artifactory
|
|
|
267
269
|
#
|
|
268
270
|
def default_headers
|
|
269
271
|
{
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
"Connection" => "keep-alive",
|
|
273
|
+
"Keep-Alive" => "30",
|
|
274
|
+
"User-Agent" => user_agent,
|
|
273
275
|
}
|
|
274
276
|
end
|
|
275
277
|
|
|
@@ -294,7 +296,7 @@ module Artifactory
|
|
|
294
296
|
def build_uri(verb, path, params = {})
|
|
295
297
|
# Add any query string parameters
|
|
296
298
|
if [:delete, :get].include?(verb)
|
|
297
|
-
path = [path, to_query_string(params)].compact.join(
|
|
299
|
+
path = [path, to_query_string(params)].compact.join("?")
|
|
298
300
|
end
|
|
299
301
|
|
|
300
302
|
# Parse the URI
|
|
@@ -333,7 +335,7 @@ module Artifactory
|
|
|
333
335
|
def to_query_string(hash)
|
|
334
336
|
hash.map do |key, value|
|
|
335
337
|
"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"
|
|
336
|
-
end.join(
|
|
338
|
+
end.join("&")[/.+/]
|
|
337
339
|
end
|
|
338
340
|
|
|
339
341
|
#
|
|
@@ -348,7 +350,7 @@ module Artifactory
|
|
|
348
350
|
# the parsed response, as an object
|
|
349
351
|
#
|
|
350
352
|
def success(response)
|
|
351
|
-
if (response.content_type ||
|
|
353
|
+
if (response.content_type || "").include?("json")
|
|
352
354
|
JSON.parse(response.body)
|
|
353
355
|
else
|
|
354
356
|
response.body
|
|
@@ -365,20 +367,20 @@ module Artifactory
|
|
|
365
367
|
# the response object from the request
|
|
366
368
|
#
|
|
367
369
|
def error(response)
|
|
368
|
-
if (response.content_type ||
|
|
370
|
+
if (response.content_type || "").include?("json")
|
|
369
371
|
# Attempt to parse the error as JSON
|
|
370
372
|
begin
|
|
371
373
|
json = JSON.parse(response.body)
|
|
372
374
|
|
|
373
|
-
if json[
|
|
374
|
-
raise Error::HTTPError.new(json[
|
|
375
|
+
if json["errors"] && json["errors"].first
|
|
376
|
+
raise Error::HTTPError.new(json["errors"].first)
|
|
375
377
|
end
|
|
376
378
|
rescue JSON::ParserError; end
|
|
377
379
|
end
|
|
378
380
|
|
|
379
381
|
raise Error::HTTPError.new(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
+
"status" => response.code,
|
|
383
|
+
"message" => response.body
|
|
382
384
|
)
|
|
383
385
|
end
|
|
384
386
|
end
|
data/lib/artifactory/defaults.rb
CHANGED
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
16
|
|
|
17
|
-
require
|
|
17
|
+
require "artifactory/version"
|
|
18
18
|
|
|
19
19
|
module Artifactory
|
|
20
20
|
module Defaults
|
|
21
21
|
# Default API endpoint
|
|
22
|
-
ENDPOINT =
|
|
22
|
+
ENDPOINT = "http://localhost:8080/artifactory".freeze
|
|
23
23
|
|
|
24
24
|
# Default User Agent header string
|
|
25
25
|
USER_AGENT = "Artifactory Ruby Gem #{Artifactory::VERSION}".freeze
|
|
@@ -40,7 +40,7 @@ module Artifactory
|
|
|
40
40
|
# @return [String]
|
|
41
41
|
#
|
|
42
42
|
def endpoint
|
|
43
|
-
ENV[
|
|
43
|
+
ENV["ARTIFACTORY_ENDPOINT"] || ENDPOINT
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
#
|
|
@@ -49,7 +49,7 @@ module Artifactory
|
|
|
49
49
|
# @return [String]
|
|
50
50
|
#
|
|
51
51
|
def user_agent
|
|
52
|
-
ENV[
|
|
52
|
+
ENV["ARTIFACTORY_USER_AGENT"] || USER_AGENT
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
#
|
|
@@ -58,7 +58,7 @@ module Artifactory
|
|
|
58
58
|
# @return [String, nil]
|
|
59
59
|
#
|
|
60
60
|
def username
|
|
61
|
-
ENV[
|
|
61
|
+
ENV["ARTIFACTORY_USERNAME"]
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
#
|
|
@@ -67,7 +67,16 @@ module Artifactory
|
|
|
67
67
|
# @return [String, nil]
|
|
68
68
|
#
|
|
69
69
|
def password
|
|
70
|
-
ENV[
|
|
70
|
+
ENV["ARTIFACTORY_PASSWORD"]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
#
|
|
74
|
+
# The API Key for authentication
|
|
75
|
+
#
|
|
76
|
+
# @return [String, nil]
|
|
77
|
+
#
|
|
78
|
+
def api_key
|
|
79
|
+
ENV["ARTIFACTORY_API_KEY"]
|
|
71
80
|
end
|
|
72
81
|
|
|
73
82
|
#
|
|
@@ -76,7 +85,7 @@ module Artifactory
|
|
|
76
85
|
# @return [String, nil]
|
|
77
86
|
#
|
|
78
87
|
def proxy_address
|
|
79
|
-
ENV[
|
|
88
|
+
ENV["ARTIFACTORY_PROXY_ADDRESS"]
|
|
80
89
|
end
|
|
81
90
|
|
|
82
91
|
#
|
|
@@ -85,7 +94,7 @@ module Artifactory
|
|
|
85
94
|
# @return [String, nil]
|
|
86
95
|
#
|
|
87
96
|
def proxy_password
|
|
88
|
-
ENV[
|
|
97
|
+
ENV["ARTIFACTORY_PROXY_PASSWORD"]
|
|
89
98
|
end
|
|
90
99
|
|
|
91
100
|
#
|
|
@@ -94,7 +103,7 @@ module Artifactory
|
|
|
94
103
|
# @return [String, nil]
|
|
95
104
|
#
|
|
96
105
|
def proxy_port
|
|
97
|
-
ENV[
|
|
106
|
+
ENV["ARTIFACTORY_PROXY_PORT"]
|
|
98
107
|
end
|
|
99
108
|
|
|
100
109
|
#
|
|
@@ -103,7 +112,7 @@ module Artifactory
|
|
|
103
112
|
# @return [String, nil]
|
|
104
113
|
#
|
|
105
114
|
def proxy_username
|
|
106
|
-
ENV[
|
|
115
|
+
ENV["ARTIFACTORY_PROXY_USERNAME"]
|
|
107
116
|
end
|
|
108
117
|
|
|
109
118
|
#
|
|
@@ -112,7 +121,7 @@ module Artifactory
|
|
|
112
121
|
# @return [String, nil]
|
|
113
122
|
#
|
|
114
123
|
def ssl_pem_file
|
|
115
|
-
ENV[
|
|
124
|
+
ENV["ARTIFACTORY_SSL_PEM_FILE"]
|
|
116
125
|
end
|
|
117
126
|
|
|
118
127
|
#
|
|
@@ -121,10 +130,10 @@ module Artifactory
|
|
|
121
130
|
# @return [true, false]
|
|
122
131
|
#
|
|
123
132
|
def ssl_verify
|
|
124
|
-
if ENV[
|
|
133
|
+
if ENV["ARTIFACTORY_SSL_VERIFY"].nil?
|
|
125
134
|
true
|
|
126
135
|
else
|
|
127
|
-
%w
|
|
136
|
+
%w{t y}.include?(ENV["ARTIFACTORY_SSL_VERIFY"].downcase[0])
|
|
128
137
|
end
|
|
129
138
|
end
|
|
130
139
|
|
|
@@ -134,8 +143,8 @@ module Artifactory
|
|
|
134
143
|
# @return [Integer]
|
|
135
144
|
#
|
|
136
145
|
def read_timeout
|
|
137
|
-
if ENV[
|
|
138
|
-
ENV[
|
|
146
|
+
if ENV["ARTIFACTORY_READ_TIMEOUT"]
|
|
147
|
+
ENV["ARTIFACTORY_READ_TIMEOUT"].to_i
|
|
139
148
|
else
|
|
140
149
|
120
|
|
141
150
|
end
|