artifactory 2.8.2 → 3.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/artifactory.rb +3 -2
- data/lib/artifactory/client.rb +16 -7
- data/lib/artifactory/collections/artifact.rb +1 -1
- data/lib/artifactory/collections/base.rb +1 -1
- data/lib/artifactory/collections/build.rb +1 -1
- data/lib/artifactory/configurable.rb +15 -15
- data/lib/artifactory/defaults.rb +2 -2
- data/lib/artifactory/errors.rb +6 -6
- data/lib/artifactory/resources/artifact.rb +17 -19
- data/lib/artifactory/resources/backup.rb +3 -1
- data/lib/artifactory/resources/base.rb +17 -7
- data/lib/artifactory/resources/build.rb +6 -6
- data/lib/artifactory/resources/build_component.rb +1 -0
- data/lib/artifactory/resources/certificate.rb +90 -0
- data/lib/artifactory/resources/group.rb +2 -1
- data/lib/artifactory/resources/layout.rb +2 -1
- data/lib/artifactory/resources/ldap_setting.rb +3 -1
- data/lib/artifactory/resources/mail_server.rb +2 -1
- data/lib/artifactory/resources/permission_target.rb +18 -2
- data/lib/artifactory/resources/plugin.rb +1 -1
- data/lib/artifactory/resources/repository.rb +5 -1
- data/lib/artifactory/resources/system.rb +1 -1
- data/lib/artifactory/resources/url_base.rb +2 -1
- data/lib/artifactory/resources/user.rb +2 -1
- data/lib/artifactory/util.rb +4 -3
- data/lib/artifactory/version.rb +2 -2
- metadata +11 -131
- data/.gitignore +0 -27
- data/.travis.yml +0 -28
- data/CHANGELOG.md +0 -141
- data/Gemfile +0 -14
- data/README.md +0 -288
- data/Rakefile +0 -28
- data/appveyor.yml +0 -30
- data/artifactory.gemspec +0 -25
- data/spec/integration/resources/artifact_spec.rb +0 -99
- data/spec/integration/resources/backup.rb +0 -22
- data/spec/integration/resources/build_component_spec.rb +0 -64
- data/spec/integration/resources/build_spec.rb +0 -38
- data/spec/integration/resources/group_spec.rb +0 -45
- data/spec/integration/resources/layout_spec.rb +0 -22
- data/spec/integration/resources/ldap_setting_spec.rb +0 -22
- data/spec/integration/resources/mail_server_spec.rb +0 -22
- data/spec/integration/resources/permission_target_spec.rb +0 -75
- data/spec/integration/resources/repository_spec.rb +0 -40
- data/spec/integration/resources/system_spec.rb +0 -58
- data/spec/integration/resources/url_base_spec.rb +0 -22
- data/spec/integration/resources/user_spec.rb +0 -45
- data/spec/spec_helper.rb +0 -52
- data/spec/support/api_server.rb +0 -49
- data/spec/support/api_server/artifact_endpoints.rb +0 -186
- data/spec/support/api_server/build_component_endpoints.rb +0 -44
- data/spec/support/api_server/build_endpoints.rb +0 -240
- data/spec/support/api_server/group_endpoints.rb +0 -53
- data/spec/support/api_server/permission_target_endpoints.rb +0 -53
- data/spec/support/api_server/repository_endpoints.rb +0 -114
- data/spec/support/api_server/status_endpoints.rb +0 -11
- data/spec/support/api_server/system_endpoints.rb +0 -104
- data/spec/support/api_server/user_endpoints.rb +0 -59
- data/spec/unit/artifactory_spec.rb +0 -73
- data/spec/unit/client_spec.rb +0 -132
- data/spec/unit/resources/artifact_spec.rb +0 -608
- data/spec/unit/resources/backup_spec.rb +0 -61
- data/spec/unit/resources/base_spec.rb +0 -180
- data/spec/unit/resources/build_component_spec.rb +0 -118
- data/spec/unit/resources/build_spec.rb +0 -347
- data/spec/unit/resources/defaults_spec.rb +0 -27
- data/spec/unit/resources/group_spec.rb +0 -108
- data/spec/unit/resources/layout_spec.rb +0 -61
- data/spec/unit/resources/ldap_setting_spec.rb +0 -65
- data/spec/unit/resources/mail_server_spec.rb +0 -57
- data/spec/unit/resources/permission_target_spec.rb +0 -189
- data/spec/unit/resources/plugin_spec.rb +0 -25
- data/spec/unit/resources/repository_spec.rb +0 -217
- data/spec/unit/resources/system_spec.rb +0 -90
- data/spec/unit/resources/url_base_spec.rb +0 -53
- data/spec/unit/resources/user_spec.rb +0 -115
data/.gitignore
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
*~
|
2
|
-
*#
|
3
|
-
.#*
|
4
|
-
\#*#
|
5
|
-
.*.sw[a-z]
|
6
|
-
*.un~
|
7
|
-
*.tmp
|
8
|
-
*.bk
|
9
|
-
*.bkup
|
10
|
-
.DS_Store
|
11
|
-
.kitchen.local.yml
|
12
|
-
.rspec
|
13
|
-
Berksfile.lock
|
14
|
-
Gemfile.lock
|
15
|
-
|
16
|
-
.bundle/
|
17
|
-
.cache/
|
18
|
-
.kitchen/
|
19
|
-
.vagrant/
|
20
|
-
.vagrant.d/
|
21
|
-
.yardoc/
|
22
|
-
bin/
|
23
|
-
coverage/
|
24
|
-
doc/
|
25
|
-
pkg/
|
26
|
-
tmp/
|
27
|
-
vendor/
|
data/.travis.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
rvm:
|
2
|
-
- 2.1
|
3
|
-
- 2.2
|
4
|
-
- 2.3
|
5
|
-
- 2.4
|
6
|
-
|
7
|
-
bundler_args: --jobs 7
|
8
|
-
|
9
|
-
branches:
|
10
|
-
only:
|
11
|
-
- master
|
12
|
-
|
13
|
-
before_install:
|
14
|
-
- gem install bundler
|
15
|
-
|
16
|
-
script: bundle exec rake travis:ci
|
17
|
-
|
18
|
-
notifications:
|
19
|
-
hipchat:
|
20
|
-
on_change: true
|
21
|
-
on_failure: true
|
22
|
-
on_success: false
|
23
|
-
on_pull_requests: false
|
24
|
-
rooms:
|
25
|
-
# Build Statuses
|
26
|
-
- secure: fQEeBZSIV9mKpM5XeKxmvcgUb19skv3+qW6TiyvuPReB4B/mc5vf3AABWhbdnnHzjsKnq2iQtcppXVG0eJwuRM5D1werMO91zwSRNBU/ClOLHaYBp5l4tVkuHzAd3eo/Z67vxE0BAV9lGWeWv7r3y/BLgJ265nQMyfgZSyz1i44=
|
27
|
-
# Release Engineering
|
28
|
-
- secure: eUtMt0CeB2bbIcTeQA3rUJsTtBkq/Ng5AnM59NOCzutcPTnNDeM4kNQEfgJ5QEZZkx08IXyiPJ14gEQUaV0bF0s0FLyzFxjlX9p2jem99FmEA404KJ7axoUiGGxgATbq9V7tUOrp1zG+a8xVQTahZASKadPlC9TSRgKqjUL+Dvg=
|
data/CHANGELOG.md
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
Artifactory Client CHANGELOG
|
2
|
-
============================
|
3
|
-
This file is used to document the changes between releases of the Artifactory
|
4
|
-
Ruby client.
|
5
|
-
|
6
|
-
v2.8.2 (06-14-2017)
|
7
|
-
-------------------
|
8
|
-
- Properly parse empty response bodies
|
9
|
-
|
10
|
-
v2.8.1 (03-21-2017)
|
11
|
-
-------------------
|
12
|
-
- Allow downloading of large files. Fixes #83.
|
13
|
-
|
14
|
-
v2.8.0 (03-17-2017)
|
15
|
-
-------------------
|
16
|
-
- Include statuses in Build resource
|
17
|
-
|
18
|
-
v2.7.0 (02-21-2017)
|
19
|
-
-------------------
|
20
|
-
- Include statuses in Build resource
|
21
|
-
|
22
|
-
v2.6.0 (02-02-2017)
|
23
|
-
-------------------
|
24
|
-
- Add API Key authentication
|
25
|
-
- Add new Ruby versions to test matrix
|
26
|
-
- Add ChefStyle for linting
|
27
|
-
|
28
|
-
v2.5.2 (01-27-2017)
|
29
|
-
-------------------
|
30
|
-
- Update tests to run properly on Windows
|
31
|
-
- Begin testing PRs with Appveyor
|
32
|
-
- Ensure URI from artifacts are escaped
|
33
|
-
|
34
|
-
v2.5.1 (11-10-2016)
|
35
|
-
-------------------
|
36
|
-
- Ensure `Artifact#Upload_from_archive` returns empty response
|
37
|
-
- Additional test coverage
|
38
|
-
|
39
|
-
v2.5.0 (09-15-2016)
|
40
|
-
-------------------
|
41
|
-
- Add support for extended YUM repo attributes
|
42
|
-
|
43
|
-
v2.4.0 (09-13-2016)
|
44
|
-
-------------------
|
45
|
-
- Coerce `ARTIFACTORY_READ_TIMEOUT` value to integer
|
46
|
-
- Add url attribute to support remote repositories
|
47
|
-
|
48
|
-
v2.3.3 (06-27-2016)
|
49
|
-
-------------------
|
50
|
-
- Artifactory 4 requires setting package type during repository creation
|
51
|
-
|
52
|
-
v2.3.2 (11-20-2015)
|
53
|
-
-------------------
|
54
|
-
- Fix embedded requests when endpoint has a non-empty path
|
55
|
-
|
56
|
-
v2.3.1 (11-13-2015)
|
57
|
-
-------------------
|
58
|
-
- Ensure embedded requests respect configured settings
|
59
|
-
|
60
|
-
v2.3.0 (08-04-2015)
|
61
|
-
-------------------
|
62
|
-
- Support for Build endpoints
|
63
|
-
|
64
|
-
v2.2.1 (12-16-2014)
|
65
|
-
-------------------
|
66
|
-
- provide data to post in `Artifact#copy_or_move`
|
67
|
-
- pass correct variable to redirect request in `Client#request`
|
68
|
-
- use CGI escape to encode data values
|
69
|
-
- when checksums are available, upload using the checksum headers.
|
70
|
-
|
71
|
-
v2.2.0 (11-20-2014)
|
72
|
-
-------------------
|
73
|
-
- Add artifact usage search
|
74
|
-
- Add artifact creation search
|
75
|
-
- Add support for configuring permission targets
|
76
|
-
|
77
|
-
v2.1.3 (08-29-2014)
|
78
|
-
-------------------
|
79
|
-
- CGI escape matrix properties
|
80
|
-
|
81
|
-
v2.1.2 (08-26-2014)
|
82
|
-
-------------------
|
83
|
-
- Use the proper REST verbs on various resources to prevent a bug
|
84
|
-
|
85
|
-
v2.1.1 (08-25-2014)
|
86
|
-
-------------------
|
87
|
-
- Use the proper name for POM consistency checks
|
88
|
-
- Use the proper name for checksum policies
|
89
|
-
- Use the proper name for max unique snapshots
|
90
|
-
|
91
|
-
**Other Changes**
|
92
|
-
- Improve integration test coverage
|
93
|
-
- Enable running integration tests in `Rakefile`
|
94
|
-
|
95
|
-
v2.1.0 (08-21-2014)
|
96
|
-
-------------------
|
97
|
-
- Add `Content-Size` header
|
98
|
-
- Expose `read_timeout` as a configurable (defaulting to 120 seconds)
|
99
|
-
|
100
|
-
v2.0.0 (07-15-2014)
|
101
|
-
-------------------
|
102
|
-
**Breaking Changes**
|
103
|
-
- Change the airity of uploading an Artifact
|
104
|
-
- Automatically upload checksum files during Artifact upload
|
105
|
-
|
106
|
-
**Other Changes**
|
107
|
-
- Bump to RSpec 3
|
108
|
-
- Add support for configuring the Backup resource
|
109
|
-
- Add support for configuring the LDAPSetting resource
|
110
|
-
- Add support for configuring the MailServer resource
|
111
|
-
- Add support for configuring the URLBase resource
|
112
|
-
- Set `Transfer-Encoding` to "chunked"
|
113
|
-
- Do not swallow returned errors from the server
|
114
|
-
|
115
|
-
v1.2.0 (2014-06-02)
|
116
|
-
-------------------
|
117
|
-
- Change the airty of Repository#find to align with other resources
|
118
|
-
- Add the ability to save/create repositories
|
119
|
-
- Remove i18n
|
120
|
-
- Make proxy configuration more verbose
|
121
|
-
- Remove HTTPClient in favor of raw Net::HTTP
|
122
|
-
- Add custom SSL configuration options
|
123
|
-
- Make Configurable#proxy_port a string because #ocd
|
124
|
-
- Allow file uploads
|
125
|
-
- Return an Artifact object after uploading
|
126
|
-
- Allow repositories to be deleted
|
127
|
-
- Add required attribute for repository layout
|
128
|
-
- Move upload method from Repository to Artifact
|
129
|
-
- Implement Repository.upload via Artifact.upload
|
130
|
-
- Move to_matrix_properties method to base class
|
131
|
-
- Add the ability to list/find repository layouts from xml configuration
|
132
|
-
- Specify content-type for updating config
|
133
|
-
|
134
|
-
v1.1.0 (2014-02-11)
|
135
|
-
-------------------
|
136
|
-
- Add support for group resources
|
137
|
-
- Add support for user resources
|
138
|
-
|
139
|
-
v1.0.0 (2014-02-10)
|
140
|
-
-------------------
|
141
|
-
- Initial release
|
data/Gemfile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
gemspec
|
3
|
-
|
4
|
-
group :test do
|
5
|
-
gem "chefstyle"
|
6
|
-
gem "sinatra", "~> 1.4"
|
7
|
-
gem "rspec", "~> 3.0"
|
8
|
-
gem "webmock", "~> 2.3"
|
9
|
-
gem "rainbow", "< 2.2.1"
|
10
|
-
# rspec-mocks 3.4.1 breaks tests with 'System level too deep' errors.
|
11
|
-
gem "rspec-mocks", "3.4.0"
|
12
|
-
gem "simplecov"
|
13
|
-
gem "simplecov-console"
|
14
|
-
end
|
data/README.md
DELETED
@@ -1,288 +0,0 @@
|
|
1
|
-
Artifactory Client
|
2
|
-
==================
|
3
|
-
[![Gem Version](http://img.shields.io/gem/v/artifactory.svg)][gem] [![Travis Build Status](http://img.shields.io/travis/chef/artifactory-client.svg?label=Travis%20CI)][travis] [![AppVeyor Build Status](http://img.shields.io/appveyor/ci/chef/artifactory-client.svg?label=AppVeyor)][appveyor]
|
4
|
-
|
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
|
-
|
7
|
-
The Artifactory gem offers a convienent interface for managing various parts of the Artifactory API. It is not a complete API implementation, and should still be considered a work in progress.
|
8
|
-
|
9
|
-
This project is managed by the CHEF Release Engineering team. For more information on the Release Engineering team's contribution, triage, and release process, please consult the [CHEF Release Engineering OSS Management Guide](https://docs.google.com/a/opscode.com/document/d/1oJB0vZb_3bl7_ZU2YMDBkMFdL-EWplW1BJv_FXTUOzg/edit).
|
10
|
-
|
11
|
-
|
12
|
-
Quick start
|
13
|
-
-----------
|
14
|
-
Install via Rubygems:
|
15
|
-
|
16
|
-
$ gem install artifactory
|
17
|
-
|
18
|
-
or add it to your Gemfile if you're using Bundler:
|
19
|
-
|
20
|
-
```ruby
|
21
|
-
gem 'artifactory', '~> 1.0'
|
22
|
-
```
|
23
|
-
|
24
|
-
In your library or project, you wil likely want to include the `Artifactory::Resource` namespace:
|
25
|
-
|
26
|
-
```ruby
|
27
|
-
include Artifactory::Resource
|
28
|
-
```
|
29
|
-
|
30
|
-
This will given you "Rails-like" access to the top-level Artifactory resources like:
|
31
|
-
|
32
|
-
```ruby
|
33
|
-
System.info
|
34
|
-
Repository.all
|
35
|
-
```
|
36
|
-
|
37
|
-
If you choose not to include the module (for namespacing reasons), you will need to specify the full module path to access resources:
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
Artifactory::Resource::System.info
|
41
|
-
Artifactory::Resource::Repository.all
|
42
|
-
```
|
43
|
-
|
44
|
-
### Create a connection
|
45
|
-
Before you can make a request, you must give Artifactory your connection information.
|
46
|
-
|
47
|
-
```ruby
|
48
|
-
Artifactory.configure do |config|
|
49
|
-
# The endpoint for the Artifactory server. If you are running the "default"
|
50
|
-
# Artifactory installation using tomcat, don't forget to include the
|
51
|
-
# +/artifactoy+ part of the URL.
|
52
|
-
config.endpoint = 'https://my.storage.server/artifactory'
|
53
|
-
|
54
|
-
# The basic authentication information. Since this uses HTTP Basic Auth, it
|
55
|
-
# is highly recommended that you run Artifactory over SSL.
|
56
|
-
config.username = 'admin'
|
57
|
-
config.password = 'password'
|
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
|
-
|
63
|
-
# Speaking of SSL, you can specify the path to a pem file with your custom
|
64
|
-
# certificates and the gem will wire it all up for you (NOTE: it must be a
|
65
|
-
# valid PEM file).
|
66
|
-
config.ssl_pem_file = '/path/to/my.pem'
|
67
|
-
|
68
|
-
# Or if you are feelying frisky, you can always disable SSL verification
|
69
|
-
config.ssl_verify = false
|
70
|
-
|
71
|
-
# You can specify any proxy information, including any authentication
|
72
|
-
# information in the URL.
|
73
|
-
config.proxy_username = 'user'
|
74
|
-
config.proxy_password = 'password'
|
75
|
-
config.proxy_address = 'my.proxy.server'
|
76
|
-
config.proxy_port = '8080'
|
77
|
-
end
|
78
|
-
```
|
79
|
-
|
80
|
-
All of these parameters are also configurable via the top-level `Artifactory` object. For example:
|
81
|
-
|
82
|
-
```ruby
|
83
|
-
Artifactory.endpoint = '...'
|
84
|
-
```
|
85
|
-
|
86
|
-
Or, if you want to be really Unixy, these parameters are all configurable via environment variables:
|
87
|
-
|
88
|
-
```bash
|
89
|
-
# Artifactory will use these values for the defaults
|
90
|
-
export ARTIFACTORY_ENDPOINT=http://my.storage.server/artifactory
|
91
|
-
export ARTIFACTORY_USERNAME=admin
|
92
|
-
export ARTIFACTORY_PASSWORD=password
|
93
|
-
export ARTIFACTORY_API_KEY=XXXXXXXXXXXXXXXXXX
|
94
|
-
export ARTIFACTORY_SSL_PEM_FILE=/path/to/my.pem
|
95
|
-
```
|
96
|
-
|
97
|
-
You can also create a full `Client` object with hash parameters:
|
98
|
-
|
99
|
-
```ruby
|
100
|
-
client = Artifactory::Client.new(endpoint: '...', username: '...')
|
101
|
-
```
|
102
|
-
|
103
|
-
### Making requests
|
104
|
-
The Artifactory gem attempts to make the Artifactory API as object-oriented and Ruby-like as possible. All of the methods and API calls are heavily documented with examples inline using YARD. In order to keep the examples versioned with the code, the README only lists a few examples for using the Artifactory gem. Please see the inline documentation for the full API documentation. The tests in the 'spec' directory are an additional source of examples.
|
105
|
-
|
106
|
-
#### Artifacts
|
107
|
-
```ruby
|
108
|
-
# Upload an artifact to a repository whose key is 'repo_key'
|
109
|
-
artifact.upload('/local/path/to/file', 'repo_key', param_1: 'foo')
|
110
|
-
|
111
|
-
# Search for an artifact by name
|
112
|
-
artifact = Artifact.search(name: 'package.deb').first
|
113
|
-
artifact #=> "#<Artifactory::Resource::Artifact md5: 'ABCD1234'>"
|
114
|
-
|
115
|
-
# Get the properties of an artifact
|
116
|
-
artifact.md5 #=> "ABCD1234"
|
117
|
-
artifact.properties #=> { ... }
|
118
|
-
# Set the properties of an artifact
|
119
|
-
artifact.properties({prop1: 'value1', 'prop2': 'value2'}) #=> { ... }
|
120
|
-
|
121
|
-
# Download the artifact to disk
|
122
|
-
artifact.download #=> /tmp/folders-a38b0decf038201/package.deb
|
123
|
-
artifact.download('~/Desktop', filename: 'software.deb') #=> /Users/you/Desktop/software.deb
|
124
|
-
|
125
|
-
# Delete the artifact from the Artifactory server
|
126
|
-
artifact.delete #=> true
|
127
|
-
```
|
128
|
-
|
129
|
-
#### Builds
|
130
|
-
```ruby
|
131
|
-
# Show all components
|
132
|
-
BuildComponent.all #=> [#<BuildComponent ...>]
|
133
|
-
|
134
|
-
# Show all builds for a components
|
135
|
-
Build.all('wicket') #=> [#<Build ...>]
|
136
|
-
|
137
|
-
# Find a build component by name
|
138
|
-
component = BuildComponent.find('wicket')
|
139
|
-
|
140
|
-
# Delete some builds for a component
|
141
|
-
component.delete(build_numbers: %w( 51 52)) #=> true
|
142
|
-
|
143
|
-
# Delete all builds for a component
|
144
|
-
component.delete(delete_all: true) #=> true
|
145
|
-
|
146
|
-
# Delete a component and all of its associated data (including artifacts)
|
147
|
-
component.delete(artifacts: true, delete_all: true) #=> true
|
148
|
-
|
149
|
-
# Get a list of all buld records for a component
|
150
|
-
component.builds #=> #=> [#<Artifactory::Resource::Build ...>, ...]
|
151
|
-
|
152
|
-
# Create a new build record
|
153
|
-
build = Build.new(name: 'fricket', number: '51', properties: {...}, modules: [...])
|
154
|
-
build.save
|
155
|
-
|
156
|
-
# Find a build
|
157
|
-
build = Build.find('wicket', '51')
|
158
|
-
|
159
|
-
# Promote a build
|
160
|
-
build.promote('libs-release-local', status: 'staged', comment: 'Tested on all target platforms.')
|
161
|
-
```
|
162
|
-
|
163
|
-
#### Plugins
|
164
|
-
```ruby
|
165
|
-
# Show all plugins
|
166
|
-
Plugin.all #=> [#<Plugin ...>]
|
167
|
-
```
|
168
|
-
|
169
|
-
#### Repository
|
170
|
-
```ruby
|
171
|
-
# Find a repository by name
|
172
|
-
repo = Repository.find(name: 'libs-release-local')
|
173
|
-
repo #=> #<Artifactory::Resource::Repository ...>
|
174
|
-
|
175
|
-
# Get information about the repository
|
176
|
-
repo.description => "The default storage mechanism for..."
|
177
|
-
|
178
|
-
# Change the repository
|
179
|
-
repo.description = "This is a new description"
|
180
|
-
repo.save
|
181
|
-
|
182
|
-
# Upload an artifact to the repo
|
183
|
-
repo.upload('/local/path/to/file', param_1: 'foo', param_2: 'bar')
|
184
|
-
|
185
|
-
# Get a list of artifacts in this repository
|
186
|
-
repo.artifacts #=> [#<Artifactory::Resource::Artifact ...>, ...]
|
187
|
-
```
|
188
|
-
|
189
|
-
#### System
|
190
|
-
```ruby
|
191
|
-
# Get the system information
|
192
|
-
System.info #=> "..."
|
193
|
-
|
194
|
-
# See if artifactory is running
|
195
|
-
System.ping #=> true
|
196
|
-
|
197
|
-
# Get the Artifactory server version and other information
|
198
|
-
System.version #=> { ... }
|
199
|
-
```
|
200
|
-
|
201
|
-
#### Raw requests
|
202
|
-
If there's a specific endpoint or path you need to hit that is not implemented by this gem, you can execute a "raw" request:
|
203
|
-
|
204
|
-
```ruby
|
205
|
-
# Using the top-level Artifactory module
|
206
|
-
Artifactory.get('/some/special/path', param_1: 'foo', param_2: 'bar')
|
207
|
-
|
208
|
-
# Using an Artifactory::Client object
|
209
|
-
client.get('/some/special/path', param_1: 'foo', param_2: 'bar')
|
210
|
-
```
|
211
|
-
|
212
|
-
For more information on the methods available, please see the [`Artifactory::Client` class](https://github.com/opscode/artifactory-client/blob/master/lib/artifactory/client.rb).
|
213
|
-
|
214
|
-
### Threadsafety
|
215
|
-
If you plan to use the Artifactory gem in a library, you should be aware that _certain_ pathways for accessing resources are **not** threadsafe. In order to deliver a "Rails-like" experience, accessing a resource without a client object uses a global shared state. Other threads may modify this state, and therefore we do **not** recommend using the Rails-like approach if you are concerned about threadsafety. The following code snippet may better explain the differences:
|
216
|
-
|
217
|
-
```ruby
|
218
|
-
# In our current thread...
|
219
|
-
Artifactory.endpoint = 'http://foo.com/artifactory'
|
220
|
-
|
221
|
-
# Meanwhile, in another thread...
|
222
|
-
Thread.new do
|
223
|
-
Artifactory.endpoint = 'http://bar.com/artifactory'
|
224
|
-
end
|
225
|
-
|
226
|
-
# You have a 50/50 chance of which endpoint is used, depending on the order in
|
227
|
-
# which the threads execute on the CPU.
|
228
|
-
Artifactory.endpoint #=> 'http://foo.com/artifactory'
|
229
|
-
Artifactory.endpoint #=> 'http://bar.com/artifactory'
|
230
|
-
```
|
231
|
-
|
232
|
-
To avoid this potential headache, the Artifactory gem offers a less Rails-like API in which the `Artifactory::Client` object becomes the pivot for all resources. First, you must create a client object (you cannot use the global namespace):
|
233
|
-
|
234
|
-
```ruby
|
235
|
-
client = Artifactory::Client.new(endpoint: 'http://foo.com/artifactory')
|
236
|
-
```
|
237
|
-
|
238
|
-
And then execute all requests using this client object, with the general pattern `resource_method`:
|
239
|
-
|
240
|
-
```ruby
|
241
|
-
# Search for artifacts
|
242
|
-
client.artifact_search(name: '...') #=> [...]
|
243
|
-
|
244
|
-
# Get all plugins
|
245
|
-
client.all_plugins #=> [...]
|
246
|
-
```
|
247
|
-
|
248
|
-
This pattern is slightly less eye-appealing, but it will ensure that your code is threadsafe.
|
249
|
-
|
250
|
-
|
251
|
-
Development
|
252
|
-
-----------
|
253
|
-
1. Clone the project on GitHub
|
254
|
-
2. Create a feature branch
|
255
|
-
3. Submit a Pull Request
|
256
|
-
|
257
|
-
Artifactory uses a built-in Sinatra server that "acts like" a real Artifactory Pro server. Since we cannot bundle a full Artifactory Pro server with the gem, we have re-implemented various pieces of their API. If you are writing a feature that accesses a new endpoint, you will likely need to add that endpoint to the vendored Sinatra app, using the [API documentation for Artifactory](http://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API).
|
258
|
-
|
259
|
-
Important Notes:
|
260
|
-
|
261
|
-
- **All new features must include test coverage.** At a bare minimum, Unit tests are required. It is preferred if you include acceptance tests as well.
|
262
|
-
- **The tests must be be idempotent.** The HTTP calls made during a test should be able to be run over and over.
|
263
|
-
- **Tests are order independent.** The default RSpec configuration randomizes the test order, so this should not be a problem.
|
264
|
-
|
265
|
-
|
266
|
-
License & Authors
|
267
|
-
-----------------
|
268
|
-
- Author: Seth Vargo <sethvargo@gmail.com>
|
269
|
-
|
270
|
-
```text
|
271
|
-
Copyright 2013-2014 Chef Software, Inc.
|
272
|
-
|
273
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
274
|
-
you may not use this file except in compliance with the License.
|
275
|
-
You may obtain a copy of the License at
|
276
|
-
|
277
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
278
|
-
|
279
|
-
Unless required by applicable law or agreed to in writing, software
|
280
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
281
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
282
|
-
See the License for the specific language governing permissions and
|
283
|
-
limitations under the License.
|
284
|
-
```
|
285
|
-
|
286
|
-
[appveyor]: https://ci.appveyor.com/project/chef/artifactory-client
|
287
|
-
[gem]: https://rubygems.org/gems/artifactory
|
288
|
-
[travis]: https://travis-ci.org/chef/artifactory-client
|