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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -2
  3. data/CHANGELOG.md +6 -0
  4. data/Gemfile +9 -13
  5. data/README.md +10 -1
  6. data/Rakefile +16 -7
  7. data/appveyor.yml +4 -2
  8. data/artifactory.gemspec +14 -14
  9. data/lib/artifactory.rb +26 -26
  10. data/lib/artifactory/client.rb +25 -23
  11. data/lib/artifactory/configurable.rb +1 -0
  12. data/lib/artifactory/defaults.rb +24 -15
  13. data/lib/artifactory/errors.rb +2 -2
  14. data/lib/artifactory/resources/artifact.rb +34 -33
  15. data/lib/artifactory/resources/backup.rb +5 -5
  16. data/lib/artifactory/resources/base.rb +7 -7
  17. data/lib/artifactory/resources/build.rb +15 -15
  18. data/lib/artifactory/resources/build_component.rb +4 -4
  19. data/lib/artifactory/resources/group.rb +4 -4
  20. data/lib/artifactory/resources/layout.rb +3 -3
  21. data/lib/artifactory/resources/ldap_setting.rb +7 -6
  22. data/lib/artifactory/resources/mail_server.rb +3 -3
  23. data/lib/artifactory/resources/permission_target.rb +20 -20
  24. data/lib/artifactory/resources/plugin.rb +1 -1
  25. data/lib/artifactory/resources/repository.rb +20 -20
  26. data/lib/artifactory/resources/system.rb +6 -6
  27. data/lib/artifactory/resources/url_base.rb +4 -3
  28. data/lib/artifactory/resources/user.rb +4 -4
  29. data/lib/artifactory/util.rb +10 -10
  30. data/lib/artifactory/version.rb +1 -1
  31. data/spec/integration/resources/artifact_spec.rb +31 -31
  32. data/spec/integration/resources/backup.rb +7 -7
  33. data/spec/integration/resources/build_component_spec.rb +18 -18
  34. data/spec/integration/resources/build_spec.rb +15 -15
  35. data/spec/integration/resources/group_spec.rb +16 -16
  36. data/spec/integration/resources/layout_spec.rb +7 -7
  37. data/spec/integration/resources/ldap_setting_spec.rb +7 -7
  38. data/spec/integration/resources/mail_server_spec.rb +7 -7
  39. data/spec/integration/resources/permission_target_spec.rb +35 -35
  40. data/spec/integration/resources/repository_spec.rb +14 -14
  41. data/spec/integration/resources/system_spec.rb +20 -21
  42. data/spec/integration/resources/url_base_spec.rb +7 -7
  43. data/spec/integration/resources/user_spec.rb +16 -16
  44. data/spec/spec_helper.rb +11 -11
  45. data/spec/support/api_server.rb +13 -13
  46. data/spec/support/api_server/artifact_endpoints.rb +94 -94
  47. data/spec/support/api_server/build_component_endpoints.rb +18 -18
  48. data/spec/support/api_server/build_endpoints.rb +76 -76
  49. data/spec/support/api_server/group_endpoints.rb +24 -24
  50. data/spec/support/api_server/permission_target_endpoints.rb +24 -24
  51. data/spec/support/api_server/repository_endpoints.rb +82 -82
  52. data/spec/support/api_server/status_endpoints.rb +5 -5
  53. data/spec/support/api_server/system_endpoints.rb +17 -18
  54. data/spec/support/api_server/user_endpoints.rb +30 -30
  55. data/spec/unit/artifactory_spec.rb +17 -17
  56. data/spec/unit/client_spec.rb +43 -43
  57. data/spec/unit/resources/artifact_spec.rb +256 -256
  58. data/spec/unit/resources/backup_spec.rb +8 -8
  59. data/spec/unit/resources/base_spec.rb +51 -51
  60. data/spec/unit/resources/build_component_spec.rb +45 -45
  61. data/spec/unit/resources/build_spec.rb +98 -98
  62. data/spec/unit/resources/defaults_spec.rb +4 -4
  63. data/spec/unit/resources/group_spec.rb +36 -36
  64. data/spec/unit/resources/layout_spec.rb +8 -8
  65. data/spec/unit/resources/ldap_setting_spec.rb +8 -8
  66. data/spec/unit/resources/mail_server_spec.rb +8 -8
  67. data/spec/unit/resources/permission_target_spec.rb +79 -79
  68. data/spec/unit/resources/plugin_spec.rb +7 -7
  69. data/spec/unit/resources/repository_spec.rb +98 -98
  70. data/spec/unit/resources/system_spec.rb +30 -30
  71. data/spec/unit/resources/url_base_spec.rb +8 -8
  72. data/spec/unit/resources/user_spec.rb +40 -40
  73. metadata +3 -3
@@ -1,38 +1,38 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::Repository, :integration do
5
- describe '.all' do
6
- it 'returns an array of repository objects' do
5
+ describe ".all" do
6
+ it "returns an array of repository objects" do
7
7
  results = described_class.all
8
8
  expect(results).to be_a(Array)
9
9
  expect(results.first).to be_a(described_class)
10
10
  end
11
11
  end
12
12
 
13
- describe '.find' do
14
- it 'finds a repository by key' do
15
- repository = described_class.find('libs-snapshots-local')
13
+ describe ".find" do
14
+ it "finds a repository by key" do
15
+ repository = described_class.find("libs-snapshots-local")
16
16
 
17
17
  expect(repository).to be_a(described_class)
18
- expect(repository.key).to eq('libs-snapshots-local')
18
+ expect(repository.key).to eq("libs-snapshots-local")
19
19
  expect(repository.max_unique_snapshots).to eq(10)
20
- expect(repository.package_type).to eql('generic')
20
+ expect(repository.package_type).to eql("generic")
21
21
  end
22
22
 
23
- it 'finds debian repositories' do
24
- repo = 'libs-debian-local'
23
+ it "finds debian repositories" do
24
+ repo = "libs-debian-local"
25
25
 
26
26
  repository = described_class.find(repo)
27
27
 
28
- expect(repository.package_type).to eql('debian')
28
+ expect(repository.package_type).to eql("debian")
29
29
  expect(repository.key).to eql(repo)
30
30
  end
31
31
  end
32
32
 
33
- describe '#save' do
34
- it 'saves the repository to the server' do
35
- repository = described_class.new(key: 'libs-testing-local')
33
+ describe "#save" do
34
+ it "saves the repository to the server" do
35
+ repository = described_class.new(key: "libs-testing-local")
36
36
  expect(repository.save).to be_truthy
37
37
  end
38
38
  end
@@ -1,29 +1,29 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::System, :integration do
5
- describe '.info' do
6
- it 'gets the system information' do
7
- expect(described_class.info).to eq('This is some serious system info right here')
5
+ describe ".info" do
6
+ it "gets the system information" do
7
+ expect(described_class.info).to eq("This is some serious system info right here")
8
8
  end
9
9
  end
10
10
 
11
- describe '.ping' do
12
- it 'returns ok' do
11
+ describe ".ping" do
12
+ it "returns ok" do
13
13
  expect(described_class.ping).to be_truthy
14
14
  end
15
15
  end
16
16
 
17
- describe '.configuration' do
18
- it 'returns the system configuration' do
17
+ describe ".configuration" do
18
+ it "returns the system configuration" do
19
19
  expect(described_class.configuration).to be_a(REXML::Document)
20
20
  end
21
21
  end
22
22
 
23
- describe '.update_configuration' do
24
- let(:tempfile) { Tempfile.new(['config', 'xml']) }
23
+ describe ".update_configuration" do
24
+ let(:tempfile) { Tempfile.new(%w{config xml}) }
25
25
  let(:content) do
26
- <<-EOH.strip.gsub(/^ {10}/, '')
26
+ <<-EOH.strip.gsub(/^ {10}/, "")
27
27
  <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
28
28
  <newConfig>true</newConfig>
29
29
  EOH
@@ -34,7 +34,7 @@ module Artifactory
34
34
  tempfile.unlink
35
35
  end
36
36
 
37
- it 'posts the new configuration to the server' do
37
+ it "posts the new configuration to the server" do
38
38
  tempfile.write(content)
39
39
  tempfile.rewind
40
40
 
@@ -42,16 +42,15 @@ module Artifactory
42
42
  end
43
43
  end
44
44
 
45
- describe '.version' do
46
- it 'gets the version information' do
45
+ describe ".version" do
46
+ it "gets the version information" do
47
47
  expect(described_class.version).to eq({
48
- 'version' => '3.1.0',
49
- 'revision' => '30062',
50
- 'addons' => [
51
- 'ldap',
52
- 'license',
53
- 'yum'
54
- ]
48
+ "version" => "3.1.0",
49
+ "revision" => "30062",
50
+ "addons" => %w{
51
+ ldap
52
+ license
53
+ yum},
55
54
  })
56
55
  end
57
56
  end
@@ -1,21 +1,21 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::URLBase, :integration do
5
- describe '.all' do
6
- it 'returns an array of UrlBases' do
5
+ describe ".all" do
6
+ it "returns an array of UrlBases" do
7
7
  results = described_class.all
8
8
  expect(results).to be_a(Array)
9
9
  expect(results.first).to be_a(described_class)
10
10
  end
11
11
  end
12
12
 
13
- describe '.find' do
14
- it 'finds a urlBase by url' do
15
- base = described_class.find('http://33.33.33.20/artifactory')
13
+ describe ".find" do
14
+ it "finds a urlBase by url" do
15
+ base = described_class.find("http://33.33.33.20/artifactory")
16
16
 
17
17
  expect(base).to be_a(described_class)
18
- expect(base.url_base).to eq('http://33.33.33.20/artifactory')
18
+ expect(base.url_base).to eq("http://33.33.33.20/artifactory")
19
19
  end
20
20
  end
21
21
  end
@@ -1,43 +1,43 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::User, :integration do
5
- describe '.all' do
6
- it 'returns an array of user objects' do
5
+ describe ".all" do
6
+ it "returns an array of user objects" do
7
7
  results = described_class.all
8
8
  expect(results).to be_a(Array)
9
9
  expect(results.first).to be_a(described_class)
10
10
  end
11
11
 
12
- it 'includes the information from the server' do
12
+ it "includes the information from the server" do
13
13
  results = described_class.all
14
14
  seth = results[0]
15
15
  yvonne = results[1]
16
16
 
17
- expect(seth.name).to eq('sethvargo')
18
- expect(yvonne.name).to eq('yzl')
17
+ expect(seth.name).to eq("sethvargo")
18
+ expect(yvonne.name).to eq("yzl")
19
19
  end
20
20
  end
21
21
 
22
- describe '.find' do
23
- it 'finds a user by name' do
24
- seth = described_class.find('sethvargo')
22
+ describe ".find" do
23
+ it "finds a user by name" do
24
+ seth = described_class.find("sethvargo")
25
25
 
26
26
  expect(seth).to be_a(described_class)
27
- expect(seth.name).to eq('sethvargo')
27
+ expect(seth.name).to eq("sethvargo")
28
28
  end
29
29
  end
30
30
 
31
- describe '#delete' do
32
- it 'deletes the user from the server' do
33
- sethvargo = described_class.find('sethvargo')
31
+ describe "#delete" do
32
+ it "deletes the user from the server" do
33
+ sethvargo = described_class.find("sethvargo")
34
34
  expect(sethvargo.delete).to be_truthy
35
35
  end
36
36
  end
37
37
 
38
- describe '#save' do
39
- it 'saves the user to the server' do
40
- user = described_class.new(name: 'schisamo')
38
+ describe "#save" do
39
+ it "saves the user to the server" do
40
+ user = described_class.new(name: "schisamo")
41
41
  expect(user.save).to be_truthy
42
42
  end
43
43
  end
@@ -1,12 +1,12 @@
1
- require 'bundler/setup'
2
- require 'rspec'
3
- require 'webmock/rspec'
1
+ require "bundler/setup"
2
+ require "rspec"
3
+ require "webmock/rspec"
4
4
 
5
- if ENV['COVERAGE']
6
- require 'simplecov'
7
- require 'simplecov-console'
5
+ if ENV["COVERAGE"]
6
+ require "simplecov"
7
+ require "simplecov-console"
8
8
  SimpleCov.start do
9
- add_filter 'spec/'
9
+ add_filter "spec/"
10
10
  formatter SimpleCov::Formatter::MultiFormatter.new [
11
11
  SimpleCov::Formatter::HTMLFormatter,
12
12
  SimpleCov::Formatter::Console,
@@ -15,10 +15,10 @@ if ENV['COVERAGE']
15
15
  end
16
16
 
17
17
  # Require our main library
18
- require 'artifactory'
18
+ require "artifactory"
19
19
 
20
20
  # Require helpers
21
- require_relative 'support/api_server'
21
+ require_relative "support/api_server"
22
22
 
23
23
  RSpec.configure do |config|
24
24
  # Custom helper modules and extensions
@@ -38,7 +38,7 @@ RSpec.configure do |config|
38
38
  config.after(:each) { Artifactory.reset! }
39
39
 
40
40
  config.before(:each, :integration) do
41
- Artifactory.endpoint = 'http://localhost:8889'
41
+ Artifactory.endpoint = "http://localhost:8889"
42
42
  Artifactory.username = nil
43
43
  Artifactory.password = nil
44
44
  stub_request(:any, /#{Artifactory.endpoint}/).to_rack(Artifactory::APIServer)
@@ -48,5 +48,5 @@ RSpec.configure do |config|
48
48
  # order dependency and want to debug it, you can fix the order by providing
49
49
  # the seed, which is printed after each run.
50
50
  # --seed 1234
51
- config.order = 'random'
51
+ config.order = "random"
52
52
  end
@@ -1,4 +1,4 @@
1
- require 'sinatra/base'
1
+ require "sinatra/base"
2
2
 
3
3
  module Artifactory
4
4
  #
@@ -6,15 +6,15 @@ module Artifactory
6
6
  # fake, but it is based off of real responses from the Artifactory server.
7
7
  #
8
8
  class APIServer < Sinatra::Base
9
- require_relative 'api_server/artifact_endpoints'
10
- require_relative 'api_server/build_component_endpoints'
11
- require_relative 'api_server/build_endpoints'
12
- require_relative 'api_server/group_endpoints'
13
- require_relative 'api_server/repository_endpoints'
14
- require_relative 'api_server/permission_target_endpoints'
15
- require_relative 'api_server/status_endpoints'
16
- require_relative 'api_server/system_endpoints'
17
- require_relative 'api_server/user_endpoints'
9
+ require_relative "api_server/artifact_endpoints"
10
+ require_relative "api_server/build_component_endpoints"
11
+ require_relative "api_server/build_endpoints"
12
+ require_relative "api_server/group_endpoints"
13
+ require_relative "api_server/repository_endpoints"
14
+ require_relative "api_server/permission_target_endpoints"
15
+ require_relative "api_server/status_endpoints"
16
+ require_relative "api_server/system_endpoints"
17
+ require_relative "api_server/user_endpoints"
18
18
 
19
19
  register APIServer::ArtifactEndpoints
20
20
  register APIServer::BuildComponentEndpoints
@@ -38,9 +38,9 @@ module Artifactory
38
38
  #
39
39
  def server_url
40
40
  @server_url ||= begin
41
- scheme = request.env['rack.url_scheme']
42
- address = request.env['SERVER_NAME']
43
- port = request.env['SERVER_PORT']
41
+ scheme = request.env["rack.url_scheme"]
42
+ address = request.env["SERVER_NAME"]
43
+ port = request.env["SERVER_PORT"]
44
44
 
45
45
  Pathname.new("#{scheme}://#{address}:#{port}")
46
46
  end
@@ -1,156 +1,156 @@
1
1
  module Artifactory
2
2
  module APIServer::ArtifactEndpoints
3
3
  def self.registered(app)
4
- app.get('/api/search/artifact') do
5
- content_type 'application/vnd.org.jfrog.artifactory.search.ArtifactSearchResult+json'
4
+ app.get("/api/search/artifact") do
5
+ content_type "application/vnd.org.jfrog.artifactory.search.ArtifactSearchResult+json"
6
6
  artifacts_for_conditions do
7
- params['name'] == 'artifact.deb'
7
+ params["name"] == "artifact.deb"
8
8
  end
9
9
  end
10
10
 
11
- app.get('/api/search/gavc') do
12
- content_type 'application/vnd.org.jfrog.artifactory.search.GavcSearchResult+json'
11
+ app.get("/api/search/gavc") do
12
+ content_type "application/vnd.org.jfrog.artifactory.search.GavcSearchResult+json"
13
13
  artifacts_for_conditions do
14
- params['g'] == 'org.acme' &&
15
- params['a'] == 'artifact.deb' &&
16
- params['v'] == '1.0' &&
17
- params['c'] == 'sources'
14
+ params["g"] == "org.acme" &&
15
+ params["a"] == "artifact.deb" &&
16
+ params["v"] == "1.0" &&
17
+ params["c"] == "sources"
18
18
  end
19
19
  end
20
20
 
21
- app.get('/api/search/prop') do
22
- content_type 'application/vnd.org.jfrog.artifactory.search.MetadataSearchResult+json'
21
+ app.get("/api/search/prop") do
22
+ content_type "application/vnd.org.jfrog.artifactory.search.MetadataSearchResult+json"
23
23
  artifacts_for_conditions do
24
- params['branch'] == 'master' && params['committer'] == 'Seth Vargo'
24
+ params["branch"] == "master" && params["committer"] == "Seth Vargo"
25
25
  end
26
26
  end
27
27
 
28
- app.get('/api/search/checksum') do
29
- content_type 'application/vnd.org.jfrog.artifactory.search.ChecksumSearchResult+json'
28
+ app.get("/api/search/checksum") do
29
+ content_type "application/vnd.org.jfrog.artifactory.search.ChecksumSearchResult+json"
30
30
  artifacts_for_conditions do
31
- params['md5'] == 'abcd1234'
31
+ params["md5"] == "abcd1234"
32
32
  end
33
33
  end
34
34
 
35
- app.get('/api/search/usage') do
36
- content_type 'application/vnd.org.jfrog.artifactory.search.ArtifactUsageResult+json'
35
+ app.get("/api/search/usage") do
36
+ content_type "application/vnd.org.jfrog.artifactory.search.ArtifactUsageResult+json"
37
37
  artifacts_for_conditions do
38
- params['notUsedSince'] == '1414800000'
38
+ params["notUsedSince"] == "1414800000"
39
39
  end
40
40
  end
41
41
 
42
- app.get('/api/search/creation') do
43
- content_type 'application/vnd.org.jfrog.artifactory.search.ArtifactCreationResult+json'
42
+ app.get("/api/search/creation") do
43
+ content_type "application/vnd.org.jfrog.artifactory.search.ArtifactCreationResult+json"
44
44
  artifacts_for_conditions do
45
- params['from'] == '1414800000'
45
+ params["from"] == "1414800000"
46
46
  end
47
47
  end
48
48
 
49
- app.get('/api/search/versions') do
50
- content_type 'application/vnd.org.jfrog.artifactory.search.ArtifactVersionsResult+json'
49
+ app.get("/api/search/versions") do
50
+ content_type "application/vnd.org.jfrog.artifactory.search.ArtifactVersionsResult+json"
51
51
  JSON.fast_generate(
52
- 'results' => [
53
- { 'version' => '1.2', 'integration' => false },
54
- { 'version' => '1.0-SNAPSHOT', 'integration' => true },
55
- { 'version' => '1.0', 'integration' => false },
52
+ "results" => [
53
+ { "version" => "1.2", "integration" => false },
54
+ { "version" => "1.0-SNAPSHOT", "integration" => true },
55
+ { "version" => "1.0", "integration" => false },
56
56
  ]
57
57
  )
58
58
  end
59
59
 
60
- app.get('/api/search/latestVersion') do
61
- '1.0-201203131455-2'
60
+ app.get("/api/search/latestVersion") do
61
+ "1.0-201203131455-2"
62
62
  end
63
63
 
64
- app.get('/api/storage/libs-release-local/org/acme/artifact.deb') do
65
- content_type 'application/vnd.org.jfrog.artifactory.storage.FileInfo+json'
64
+ app.get("/api/storage/libs-release-local/org/acme/artifact.deb") do
65
+ content_type "application/vnd.org.jfrog.artifactory.storage.FileInfo+json"
66
66
  JSON.fast_generate(
67
- 'uri' => server_url.join('/api/storage/libs-release-local/org/acme/artifact.deb'),
68
- 'downloadUri' => server_url.join('/artifactory/libs-release-local/org/acme/artifact.deb'),
69
- 'repo' => 'libs-release-local',
70
- 'path' => '/org/acme/artifact.deb',
71
- 'created' => Time.parse('1991-07-23 12:07am'),
72
- 'createdBy' => 'schisamo',
73
- 'lastModified' => Time.parse('2013-12-24 11:50pm'),
74
- 'modifiedBy' => 'sethvargo',
75
- 'lastUpdated' => Time.parse('2014-01-01 1:00pm'),
76
- 'size' => '1024',
77
- 'mimeType' => 'application/tgz',
78
- 'checksums' => {
79
- 'md5' => 'MD5123',
80
- 'sha' => 'SHA456'
67
+ "uri" => server_url.join("/api/storage/libs-release-local/org/acme/artifact.deb"),
68
+ "downloadUri" => server_url.join("/artifactory/libs-release-local/org/acme/artifact.deb"),
69
+ "repo" => "libs-release-local",
70
+ "path" => "/org/acme/artifact.deb",
71
+ "created" => Time.parse("1991-07-23 12:07am"),
72
+ "createdBy" => "schisamo",
73
+ "lastModified" => Time.parse("2013-12-24 11:50pm"),
74
+ "modifiedBy" => "sethvargo",
75
+ "lastUpdated" => Time.parse("2014-01-01 1:00pm"),
76
+ "size" => "1024",
77
+ "mimeType" => "application/tgz",
78
+ "checksums" => {
79
+ "md5" => "MD5123",
80
+ "sha" => "SHA456",
81
81
  },
82
- 'originalChecksums' => {
83
- 'md5' => 'MD5123',
84
- 'sha' => 'SHA456'
82
+ "originalChecksums" => {
83
+ "md5" => "MD5123",
84
+ "sha" => "SHA456",
85
85
  }
86
86
  )
87
87
  end
88
88
 
89
- app.get('/api/storage/ext-release-local/org/acme/artifact.deb') do
90
- content_type 'application/vnd.org.jfrog.artifactory.storage.FileInfo+json'
89
+ app.get("/api/storage/ext-release-local/org/acme/artifact.deb") do
90
+ content_type "application/vnd.org.jfrog.artifactory.storage.FileInfo+json"
91
91
  JSON.fast_generate(
92
- 'uri' => server_url.join('/api/storage/ext-release-local/org/acme/artifact.deb'),
93
- 'downloadUri' => server_url.join('/artifactory/ext-release-local/org/acme/artifact.deb'),
94
- 'repo' => 'ext-release-local',
95
- 'path' => '/org/acme/artifact.deb',
96
- 'created' => Time.parse('1995-04-11 11:05am'),
97
- 'createdBy' => 'yzl',
98
- 'lastModified' => Time.parse('2013-11-10 10:10pm'),
99
- 'modifiedBy' => 'schisamo',
100
- 'lastUpdated' => Time.parse('2014-02-02 2:00pm'),
101
- 'size' => '1024',
102
- 'mimeType' => 'application/tgz',
103
- 'checksums' => {
104
- 'md5' => 'MD5789',
105
- 'sha' => 'SHA101'
92
+ "uri" => server_url.join("/api/storage/ext-release-local/org/acme/artifact.deb"),
93
+ "downloadUri" => server_url.join("/artifactory/ext-release-local/org/acme/artifact.deb"),
94
+ "repo" => "ext-release-local",
95
+ "path" => "/org/acme/artifact.deb",
96
+ "created" => Time.parse("1995-04-11 11:05am"),
97
+ "createdBy" => "yzl",
98
+ "lastModified" => Time.parse("2013-11-10 10:10pm"),
99
+ "modifiedBy" => "schisamo",
100
+ "lastUpdated" => Time.parse("2014-02-02 2:00pm"),
101
+ "size" => "1024",
102
+ "mimeType" => "application/tgz",
103
+ "checksums" => {
104
+ "md5" => "MD5789",
105
+ "sha" => "SHA101",
106
106
  },
107
- 'originalChecksums' => {
108
- 'md5' => 'MD5789',
109
- 'sha' => 'SHA101'
107
+ "originalChecksums" => {
108
+ "md5" => "MD5789",
109
+ "sha" => "SHA101",
110
110
  }
111
111
  )
112
112
  end
113
113
 
114
- app.get('/api/storage/bin-release-local/org/acme/artifact 1.0.0.msi') do
115
- content_type 'application/vnd.org.jfrog.artifactory.storage.FileInfo+json'
114
+ app.get("/api/storage/bin-release-local/org/acme/artifact 1.0.0.msi") do
115
+ content_type "application/vnd.org.jfrog.artifactory.storage.FileInfo+json"
116
116
  JSON.fast_generate(
117
- 'uri' => server_url.join('/api/storage/bin-release-local/org/acme/artifact 1.0.0.msi'),
118
- 'downloadUri' => server_url.join('/artifactory/bin-release-local/org/acme/artifact 1.0.0.msi'),
119
- 'repo' => 'bin-release-local',
120
- 'path' => '/org/acme/artifact 1.0.0.msi',
121
- 'created' => Time.parse('1995-04-11 11:05am'),
122
- 'createdBy' => 'yzl',
123
- 'lastModified' => Time.parse('2013-11-10 10:10pm'),
124
- 'modifiedBy' => 'schisamo',
125
- 'lastUpdated' => Time.parse('2014-02-02 2:00pm'),
126
- 'size' => '1024',
127
- 'mimeType' => 'application/octet-stream',
128
- 'checksums' => {
129
- 'md5' => 'MD5789',
130
- 'sha' => 'SHA101'
117
+ "uri" => server_url.join("/api/storage/bin-release-local/org/acme/artifact 1.0.0.msi"),
118
+ "downloadUri" => server_url.join("/artifactory/bin-release-local/org/acme/artifact 1.0.0.msi"),
119
+ "repo" => "bin-release-local",
120
+ "path" => "/org/acme/artifact 1.0.0.msi",
121
+ "created" => Time.parse("1995-04-11 11:05am"),
122
+ "createdBy" => "yzl",
123
+ "lastModified" => Time.parse("2013-11-10 10:10pm"),
124
+ "modifiedBy" => "schisamo",
125
+ "lastUpdated" => Time.parse("2014-02-02 2:00pm"),
126
+ "size" => "1024",
127
+ "mimeType" => "application/octet-stream",
128
+ "checksums" => {
129
+ "md5" => "MD5789",
130
+ "sha" => "SHA101",
131
131
  },
132
- 'originalChecksums' => {
133
- 'md5' => 'MD5789',
134
- 'sha' => 'SHA101'
132
+ "originalChecksums" => {
133
+ "md5" => "MD5789",
134
+ "sha" => "SHA101",
135
135
  }
136
136
  )
137
137
  end
138
138
 
139
139
  app.class_eval do
140
140
  def artifacts_for_conditions(&block)
141
- if block.call
142
- if params['repos'] == 'libs-release-local'
141
+ if yield
142
+ if params["repos"] == "libs-release-local"
143
143
  JSON.fast_generate(
144
- 'results' => [
145
- { 'uri' => server_url.join('/api/storage/libs-release-local/org/acme/artifact.deb') },
144
+ "results" => [
145
+ { "uri" => server_url.join("/api/storage/libs-release-local/org/acme/artifact.deb") },
146
146
  ]
147
147
  )
148
148
  else
149
149
  JSON.fast_generate(
150
- 'results' => [
151
- { 'uri' => server_url.join('/api/storage/libs-release-local/org/acme/artifact.deb') },
152
- { 'uri' => server_url.join('/api/storage/ext-release-local/org/acme/artifact.deb') },
153
- { 'uri' => server_url.join('/api/storage/bin-release-local/org/acme/artifact 1.0.0.msi') },
150
+ "results" => [
151
+ { "uri" => server_url.join("/api/storage/libs-release-local/org/acme/artifact.deb") },
152
+ { "uri" => server_url.join("/api/storage/ext-release-local/org/acme/artifact.deb") },
153
+ { "uri" => server_url.join("/api/storage/bin-release-local/org/acme/artifact 1.0.0.msi") },
154
154
  ]
155
155
  )
156
156
  end