artrest 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +31 -0
- data/artrest.gemspec +30 -0
- data/bin/artrest +194 -0
- data/lib/artrest.rb +81 -0
- data/lib/artrest/build.rb +31 -0
- data/lib/artrest/buildnumber.rb +26 -0
- data/lib/artrest/builds.rb +46 -0
- data/lib/artrest/dir_entry.rb +115 -0
- data/lib/artrest/repositories.rb +61 -0
- data/lib/artrest/repository.rb +42 -0
- data/lib/artrest/resource.rb +366 -0
- data/lib/artrest/resources.rb +54 -0
- data/lib/artrest/system.rb +74 -0
- data/lib/artrest/system_general_configuration.rb +45 -0
- data/lib/artrest/version.rb +3 -0
- data/spec/artrest/build_spec.rb +62 -0
- data/spec/artrest/buildnumber_spec.rb +45 -0
- data/spec/artrest/builds_spec.rb +69 -0
- data/spec/artrest/folder_spec.rb +88 -0
- data/spec/artrest/repositories_spec.rb +47 -0
- data/spec/artrest/repository_spec.rb +63 -0
- data/spec/artrest/resource_spec.rb +385 -0
- data/spec/artrest/resources_spec.rb +66 -0
- data/spec/artrest/system_general_configuration_spec.rb +72 -0
- data/spec/artrest/system_spec.rb +50 -0
- data/spec/artrest_spec.rb +30 -0
- data/spec/fixtures/build/build_response_correct.txt +7 -0
- data/spec/fixtures/buildnumber/buildnumber_25_response.txt +7 -0
- data/spec/fixtures/builds/build_api_response_correct.txt +7 -0
- data/spec/fixtures/folder/pom_file_response_1.txt +7 -0
- data/spec/fixtures/folder/sub_folder_response.txt +7 -0
- data/spec/fixtures/folder/top_folder_response.txt +7 -0
- data/spec/fixtures/repositories/libs_snapshot_local_folder_response.txt +7 -0
- data/spec/fixtures/repositories/repositories_response.txt +7 -0
- data/spec/fixtures/repository/libs_snapshot_local_response.txt +7 -0
- data/spec/fixtures/resource/artifact_response.txt +7 -0
- data/spec/fixtures/resource/build_response.txt +7 -0
- data/spec/fixtures/resource/buildnumber_response.txt +7 -0
- data/spec/fixtures/resource/builds_response.txt +7 -0
- data/spec/fixtures/resource/folder_response.txt +7 -0
- data/spec/fixtures/resource/json_response.txt +7 -0
- data/spec/fixtures/resource/repositories_response.txt +7 -0
- data/spec/fixtures/resource/repository_not_found_response.txt +7 -0
- data/spec/fixtures/resource/repository_response.txt +7 -0
- data/spec/fixtures/resource/repository_unauthorized_response.txt +8 -0
- data/spec/fixtures/resource/string_response.txt +188 -0
- data/spec/fixtures/resource/sub_response.txt +188 -0
- data/spec/fixtures/resource/system_general_configuration_response.txt +654 -0
- data/spec/fixtures/resource/system_response.txt +188 -0
- data/spec/fixtures/resources/resources_response.txt +7 -0
- data/spec/fixtures/system/200_OK_ping_response.txt +7 -0
- data/spec/fixtures/system/general_configuration_response.txt +654 -0
- data/spec/fixtures/system/system_response.txt +188 -0
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +38 -0
- metadata +269 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MzNlODRhZDFkMWVkMjJmZjNhN2E2YmQ5Mzg1OWE0YTFhMWE5OTQzYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MzM0ZDBhOWMxOTkwZDQwYjQwM2I5MDRjMTUzZWE4NzdjMTA4Njk5MA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjE4MjM0YTQ0MjczYmJiZGE2NzYyNDE1MzgwNDlmMDZhYTZlMDBlYjJkYmY3
|
10
|
+
MzUxYmYzZmYxY2ZlNWIzZGE3YzhlMmJlY2Y4MDA2ODk0MGNmN2M5ZDM1NDky
|
11
|
+
YzhjNTE4NGI5MTlmZjcyNjA4MGJlZGFkMDYxNWNhYjQxZWJmOTQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmYxZmMyZWYyOTUwY2ExYzUzMDA4NWQ2NjY3Y2Q2MmVhOGVmYzRmNWVhZGRl
|
14
|
+
MzhkMWQyZDkwZDJiODYzOGMxMTE0NGFiMjQ5N2U0ODZhYzYwZDg2ZjhkNWE3
|
15
|
+
NmMzOTE1ODgwNDZlOWE3NmIzMjYzNDgyNTE0YzE3ODc5MTM0MzU=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Olaf Bergner
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Artrest
|
2
|
+
|
3
|
+
ArtRest, a ruby client for the Artifactory REST API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'artrest'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install artrest
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
if RUBY_VERSION <= '1.9.0'
|
5
|
+
require "rake/rdoctask"
|
6
|
+
else
|
7
|
+
require 'rdoc/task'
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Run all specs"
|
11
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
12
|
+
spec.rspec_opts = ["--color", "--format", "nested"]
|
13
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Print specdocs"
|
17
|
+
RSpec::Core::RakeTask.new(:doc) do |spec|
|
18
|
+
spec.rspec_opts = ["--format", "specdoc"]
|
19
|
+
spec.pattern = 'spec/*_spec.rb'
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Generate the rdoc"
|
23
|
+
Rake::RDocTask.new do |rdoc|
|
24
|
+
files = ["README.md", "LICENSE.txt", "lib/**/*.rb"]
|
25
|
+
rdoc.rdoc_files.add(files)
|
26
|
+
rdoc.main = "README.md"
|
27
|
+
rdoc.title = "ArtRest: Ruby Artifactory client"
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Run the rspec"
|
31
|
+
task :default => :spec
|
data/artrest.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'artrest/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "artrest"
|
8
|
+
gem.version = ArtRest::VERSION
|
9
|
+
gem.authors = ["Olaf Bergner"]
|
10
|
+
gem.email = ["olaf.bergner@gmx.de"]
|
11
|
+
gem.description = %q{ArtRest: A Ruby REST client for Artifactory}
|
12
|
+
gem.summary = %q{ArtRest is a commandline client for the Artifactory REST API}
|
13
|
+
gem.homepage = "http://github.com/obergner/artrest"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_runtime_dependency 'rest-client', '>= 1.6.7'
|
21
|
+
gem.add_runtime_dependency 'json', '>= 1.7.5'
|
22
|
+
gem.add_runtime_dependency 'activesupport', '>= 3.0.0'
|
23
|
+
gem.add_runtime_dependency 'gli', '>= 2.4.1'
|
24
|
+
gem.add_runtime_dependency 'mime-types', '>= 1.19'
|
25
|
+
gem.add_runtime_dependency 'addressable', '>= 2.3.2'
|
26
|
+
|
27
|
+
gem.add_development_dependency 'rake', '>= 0.9.2.2'
|
28
|
+
gem.add_development_dependency 'rspec', '>= 2.11.0'
|
29
|
+
gem.add_development_dependency 'webmock', '>= 1.9.0'
|
30
|
+
end
|
data/bin/artrest
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'yaml'
|
4
|
+
require 'active_support/core_ext/hash/keys'
|
5
|
+
require 'artrest'
|
6
|
+
|
7
|
+
include GLI::App
|
8
|
+
|
9
|
+
#
|
10
|
+
# Global options
|
11
|
+
#
|
12
|
+
program_desc 'A command-line interface for Artifactory\'s REST API'
|
13
|
+
|
14
|
+
version ArtRest::VERSION
|
15
|
+
|
16
|
+
desc 'Artifactory\'s base URL'
|
17
|
+
default_value 'http://localhost:8081/artifactory'
|
18
|
+
arg_name 'Artifactory URL'
|
19
|
+
flag [:h,:host]
|
20
|
+
|
21
|
+
desc 'Username used to access Artifactory'
|
22
|
+
default_value 'admin'
|
23
|
+
arg_name 'Artifactory user'
|
24
|
+
flag [:u,:user]
|
25
|
+
|
26
|
+
desc 'Password used to access Artifactory'
|
27
|
+
default_value 'password'
|
28
|
+
arg_name 'Artifactory password'
|
29
|
+
flag [:p,:password]
|
30
|
+
|
31
|
+
desc 'Configuration file containing default values for all options'
|
32
|
+
long_desc 'Path to a configuration file containing default values for all global options that may be passed on the command line.
|
33
|
+
|
34
|
+
It is intended that global options passed on the command line overwrite corresponding options defined in this configuration file.
|
35
|
+
This feature is NOT YET IMPLEMENTED!'
|
36
|
+
default_value File.join(ENV['HOME'], '.artrest.yml')
|
37
|
+
arg_name 'Configuration file'
|
38
|
+
flag [:c, :config]
|
39
|
+
|
40
|
+
#
|
41
|
+
# Preprocess commands
|
42
|
+
#
|
43
|
+
pre do |global,command,options,args|
|
44
|
+
# Pre logic here
|
45
|
+
# Return true to proceed; false to abourt and not call the
|
46
|
+
# chosen command
|
47
|
+
# Use skips_pre before a command to skip this block
|
48
|
+
# on that command only
|
49
|
+
config = load_config_file(global[:config])
|
50
|
+
global.merge!(config)
|
51
|
+
ArtRest.connect(global[:host], global[:user], global[:password])
|
52
|
+
end
|
53
|
+
|
54
|
+
def load_config_file(filename)
|
55
|
+
return {} unless File.exist?(filename)
|
56
|
+
YAML.load_file(filename).symbolize_keys
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# Artifactory's system API
|
61
|
+
#
|
62
|
+
desc 'Entry point into Artifactory\' system API: info, ping, global configuration'
|
63
|
+
command :system do |c|
|
64
|
+
|
65
|
+
c.desc 'Print system info to stdout'
|
66
|
+
c.long_desc 'Print Artifactory\'s system configuration to stdout. Mainly
|
67
|
+
* JVM version
|
68
|
+
* JVM command line parameters
|
69
|
+
* JVM memory consumption
|
70
|
+
'
|
71
|
+
|
72
|
+
c.command :info do |info|
|
73
|
+
info.action do |global_options,options,args|
|
74
|
+
puts ArtRest.system.unparsed_content.to_s
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
c.desc 'Ping Artifactory and print response to stdout'
|
79
|
+
c.long_desc 'Issue a ping request to Artifactory and print its response to stdout'
|
80
|
+
|
81
|
+
c.command :ping do |ping|
|
82
|
+
ping.action do |global_options,options,args|
|
83
|
+
puts ArtRest.system.ping
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
c.desc 'Optional file to store configuration in. If not given, configuration will be printed to stdout.'
|
88
|
+
c.arg_name 'file'
|
89
|
+
|
90
|
+
c.desc 'Retrieve Artifactory\'s global configuration'
|
91
|
+
c.long_desc 'Retrieve Artifactory\'s global configuration and either print it to stdout or store it in a file'
|
92
|
+
|
93
|
+
c.command :config do |config|
|
94
|
+
config.action do |global_options,options,args|
|
95
|
+
filename = args[0]
|
96
|
+
cfg = ArtRest.system.configuration.unparsed_content.to_s
|
97
|
+
if filename
|
98
|
+
File.open(filename, 'w') { |f| f.write(cfg) }
|
99
|
+
else
|
100
|
+
puts cfg
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
c.default_command :info
|
106
|
+
end
|
107
|
+
|
108
|
+
#
|
109
|
+
# Artifactory's builds API
|
110
|
+
#
|
111
|
+
desc 'Print information about builds to stdout'
|
112
|
+
command :builds do |c|
|
113
|
+
|
114
|
+
c.desc 'Pretty print output in a format fit to be parsed by mere humans'
|
115
|
+
c.switch [:p, :pretty]
|
116
|
+
|
117
|
+
c.desc 'Print a list of all builds to stdout'
|
118
|
+
|
119
|
+
c.command :all do |all|
|
120
|
+
|
121
|
+
all.action do |global_options,options,args|
|
122
|
+
puts ArtRest.builds.unparsed_content(options[:pretty] ? :pretty : :plain).to_s
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
c.desc 'Name of build to retrieve'
|
127
|
+
c.arg_name 'build'
|
128
|
+
|
129
|
+
c.desc 'Print information on named build to stdout'
|
130
|
+
|
131
|
+
c.command :get do |get|
|
132
|
+
|
133
|
+
get.action do |global_options,options,args|
|
134
|
+
help_now!('name of build to retrieve is required') if args.empty?
|
135
|
+
puts ArtRest.builds[args[0]].unparsed_content(options[:pretty] ? :pretty : :plain).to_s
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
c.default_command :all
|
140
|
+
end
|
141
|
+
|
142
|
+
#
|
143
|
+
# Artifactory's buildnumber API
|
144
|
+
#
|
145
|
+
desc 'Print information about buildnumbers to stdout'
|
146
|
+
command :buildnumber do |c|
|
147
|
+
|
148
|
+
c.desc 'Pretty print output in a format fit to be parsed by mere humans'
|
149
|
+
c.switch [:p, :pretty]
|
150
|
+
|
151
|
+
c.desc 'Name of build to retrieve'
|
152
|
+
c.arg_name 'build'
|
153
|
+
|
154
|
+
c.desc 'Number of build to retrieve'
|
155
|
+
c.arg_name 'buildnumber'
|
156
|
+
|
157
|
+
c.desc 'Print information on named build/buildnumber to stdout'
|
158
|
+
|
159
|
+
c.action do |global_options,options,args|
|
160
|
+
help_now!('name of buildnumber to retrieve is required') if args[0].nil?
|
161
|
+
help_now!('number of buildnumber to retrieve is required') if args[1].nil?
|
162
|
+
puts ArtRest.builds[args[0]][args[1]].unparsed_content(options[:pretty] ? :pretty : :plain).to_s
|
163
|
+
end
|
164
|
+
end
|
165
|
+
#
|
166
|
+
# Artifactory's repositories API
|
167
|
+
#
|
168
|
+
desc 'Print information about repositories to stdout'
|
169
|
+
command :repositories do |c|
|
170
|
+
|
171
|
+
c.action do |global_options,options,args|
|
172
|
+
puts "repositories command ran"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
#
|
177
|
+
# Postprocess commands + error handling
|
178
|
+
#
|
179
|
+
post do |global,command,options,args|
|
180
|
+
# Post logic here
|
181
|
+
# Use skips_post before a command to skip this
|
182
|
+
# block on that command only
|
183
|
+
end
|
184
|
+
|
185
|
+
on_error do |exception|
|
186
|
+
# Error logic here
|
187
|
+
# return false to skip default error handling
|
188
|
+
true
|
189
|
+
end
|
190
|
+
|
191
|
+
#
|
192
|
+
# Main
|
193
|
+
#
|
194
|
+
exit run(ARGV)
|
data/lib/artrest.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'addressable/uri'
|
2
|
+
require 'rest-client'
|
3
|
+
require 'json'
|
4
|
+
require 'mime/types'
|
5
|
+
require 'active_support/core_ext/string/inflections'
|
6
|
+
require 'active_support/core_ext/kernel/singleton_class'
|
7
|
+
|
8
|
+
require 'artrest/version'
|
9
|
+
require 'artrest/resource'
|
10
|
+
require 'artrest/resources'
|
11
|
+
require 'artrest/system'
|
12
|
+
require 'artrest/system_general_configuration'
|
13
|
+
require 'artrest/repositories'
|
14
|
+
require 'artrest/repository'
|
15
|
+
require 'artrest/dir_entry'
|
16
|
+
require 'artrest/builds'
|
17
|
+
require 'artrest/build'
|
18
|
+
require 'artrest/buildnumber'
|
19
|
+
|
20
|
+
module ArtRest
|
21
|
+
|
22
|
+
class << self
|
23
|
+
attr_accessor :options
|
24
|
+
end
|
25
|
+
|
26
|
+
# Cache supplied +base_url+, +username+ and +password+ prior to using this
|
27
|
+
# API.
|
28
|
+
#
|
29
|
+
# * *Args* :
|
30
|
+
# - +base_url+ -> Our Artifactory server's URL, typically
|
31
|
+
# http://localhost:8081/artifactory
|
32
|
+
# - +username+ -> Username used when connecting to Artifactory
|
33
|
+
# - +password+ -> Password used when connecting to Artifactory
|
34
|
+
# - +options+ -> Additional connections parameters, currently unused
|
35
|
+
# * *Raises* :
|
36
|
+
# - +ArgumentError+ -> If one of the parameters is +nil+
|
37
|
+
#
|
38
|
+
def self.connect(base_url, user, password, options = {})
|
39
|
+
raise ArgumentError.new "Must pass base_url" unless base_url
|
40
|
+
raise ArgumentError.new "Must pass user" unless user
|
41
|
+
raise ArgumentError.new "Must pass password" unless password
|
42
|
+
self.options = {
|
43
|
+
:base_url => base_url,
|
44
|
+
:user => user,
|
45
|
+
:password => password
|
46
|
+
}
|
47
|
+
self.options.merge!(options)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Return *the* ArtRest::System resource.
|
51
|
+
#
|
52
|
+
# * *Returns* :
|
53
|
+
# - *The* ArtRest::System resource
|
54
|
+
# * *Raises* :
|
55
|
+
# - +RuntimeException+ -> If you didn't call ::connect prior to calling
|
56
|
+
# this method
|
57
|
+
#
|
58
|
+
def self.system
|
59
|
+
self.check_connected
|
60
|
+
System.get(self.options[:base_url], self.options)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Return *the* ArtRest::Builds resource.
|
64
|
+
#
|
65
|
+
# * *Returns* :
|
66
|
+
# - *The* ArtRest::Builds resource
|
67
|
+
# * *Raises* :
|
68
|
+
# - +RuntimeException+ -> If you didn't call ::connect prior to calling
|
69
|
+
# this method
|
70
|
+
#
|
71
|
+
def self.builds
|
72
|
+
self.check_connected
|
73
|
+
Builds.get(self.options[:base_url], self.options)
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def self.check_connected
|
79
|
+
raise RuntimeError, "You need to call ArtRest::connect prior to using this API" unless self.options
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
module ArtRest
|
3
|
+
|
4
|
+
# Represents an {Artifactory}[http://www.jfrog.com/home/v_artifactory_opensource_overview]
|
5
|
+
# {Build Runs}[http://wiki.jfrog.org/confluence/display/RTF/Artifactory's+REST+API#Artifactory'sRESTAPI-BuildRuns]
|
6
|
+
# resource.
|
7
|
+
#
|
8
|
+
# === Example
|
9
|
+
#
|
10
|
+
# build = ArtRest::Build.new('http://localhost:8081/artifactory/api/build/wicket', { ... })
|
11
|
+
#
|
12
|
+
class Build < ArtRest::Resources
|
13
|
+
|
14
|
+
class << self
|
15
|
+
|
16
|
+
def matches_path(path, options) # :nodoc:
|
17
|
+
path =~ %r|^/api/build/[a-zA-Z+-._]+/?$|
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
self.mime_type = MIME::Types['application/json']
|
22
|
+
|
23
|
+
self.resources_creator = Proc.new do |content, options|
|
24
|
+
self_url = content['uri']
|
25
|
+
(content['buildsNumbers'] || []).map { |buildnr| ArtRest::Buildnumber.new("#{self_url}#{buildnr['uri']}", options) }
|
26
|
+
end
|
27
|
+
|
28
|
+
self.resource_attributes :uri,
|
29
|
+
:buildsNumbers
|
30
|
+
end
|
31
|
+
end
|