artifactory 2.5.2 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -15,5 +15,5 @@
15
15
  #
16
16
 
17
17
  module Artifactory
18
- VERSION = '2.5.2'
18
+ VERSION = "2.6.0"
19
19
  end
@@ -1,8 +1,8 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::Artifact, :integration do
5
- shared_examples 'an artifact search endpoint' do |name, options = {}|
5
+ shared_examples "an artifact search endpoint" do |name, options = {}|
6
6
  it "finds artifacts by #{name}" do
7
7
  response = described_class.send(name, options)
8
8
  expect(response).to be_a(Array)
@@ -10,75 +10,75 @@ module Artifactory
10
10
 
11
11
  artifact_1 = response[0]
12
12
  expect(artifact_1).to be_a(described_class)
13
- expect(artifact_1.repo).to eq('libs-release-local')
13
+ expect(artifact_1.repo).to eq("libs-release-local")
14
14
 
15
15
  artifact_2 = response[1]
16
16
  expect(artifact_2).to be_a(described_class)
17
- expect(artifact_2.repo).to eq('ext-release-local')
17
+ expect(artifact_2.repo).to eq("ext-release-local")
18
18
 
19
19
  artifact_3 = response[2]
20
20
  expect(artifact_3).to be_a(described_class)
21
- expect(artifact_3.repo).to eq('bin-release-local')
21
+ expect(artifact_3.repo).to eq("bin-release-local")
22
22
  end
23
23
 
24
24
  it "finds artifacts by repo" do
25
- response = described_class.send(name, options.merge(repos: 'libs-release-local'))
25
+ response = described_class.send(name, options.merge(repos: "libs-release-local"))
26
26
  expect(response).to be_a(Array)
27
27
  expect(response.size).to eq(1)
28
28
 
29
29
  artifact = response.first
30
30
  expect(artifact).to be_a(described_class)
31
- expect(artifact.repo).to eq('libs-release-local')
31
+ expect(artifact.repo).to eq("libs-release-local")
32
32
  end
33
33
  end
34
34
 
35
- describe '.search' do
36
- it_behaves_like 'an artifact search endpoint', :search, name: 'artifact.deb'
35
+ describe ".search" do
36
+ it_behaves_like "an artifact search endpoint", :search, name: "artifact.deb"
37
37
  end
38
38
 
39
- describe '.gavc_search' do
40
- it_behaves_like 'an artifact search endpoint', :gavc_search, {
41
- group: 'org.acme',
42
- name: 'artifact.deb',
43
- version: '1.0',
44
- classifier: 'sources',
39
+ describe ".gavc_search" do
40
+ it_behaves_like "an artifact search endpoint", :gavc_search, {
41
+ group: "org.acme",
42
+ name: "artifact.deb",
43
+ version: "1.0",
44
+ classifier: "sources",
45
45
  }
46
46
  end
47
47
 
48
- describe '.property_search' do
49
- it_behaves_like 'an artifact search endpoint', :property_search, {
50
- branch: 'master',
51
- committer: 'Seth Vargo',
48
+ describe ".property_search" do
49
+ it_behaves_like "an artifact search endpoint", :property_search, {
50
+ branch: "master",
51
+ committer: "Seth Vargo",
52
52
  }
53
53
  end
54
54
 
55
- describe '.checksum_search' do
56
- it_behaves_like 'an artifact search endpoint', :checksum_search, md5: 'abcd1234'
55
+ describe ".checksum_search" do
56
+ it_behaves_like "an artifact search endpoint", :checksum_search, md5: "abcd1234"
57
57
  end
58
58
 
59
- describe '.usage_search' do
60
- it_behaves_like 'an artifact search endpoint', :usage_search, notUsedSince: '1414800000'
59
+ describe ".usage_search" do
60
+ it_behaves_like "an artifact search endpoint", :usage_search, notUsedSince: "1414800000"
61
61
  end
62
62
 
63
- describe '.creation_search' do
64
- it_behaves_like 'an artifact search endpoint', :creation_search, from: '1414800000'
63
+ describe ".creation_search" do
64
+ it_behaves_like "an artifact search endpoint", :creation_search, from: "1414800000"
65
65
  end
66
66
 
67
- describe '.versions' do
68
- it 'returns an array of versions' do
67
+ describe ".versions" do
68
+ it "returns an array of versions" do
69
69
  response = described_class.versions
70
70
  expect(response).to be_a(Array)
71
71
  expect(response.size).to eq(3)
72
72
 
73
- expect(response[0]['version']).to eq('1.2')
73
+ expect(response[0]["version"]).to eq("1.2")
74
74
  end
75
75
  end
76
76
 
77
- describe '.latest_version' do
78
- it 'finds the latest version of the artifact' do
77
+ describe ".latest_version" do
78
+ it "finds the latest version of the artifact" do
79
79
  response = described_class.latest_version
80
80
  expect(response).to be_a(String)
81
- expect(response).to eq('1.0-201203131455-2')
81
+ expect(response).to eq("1.0-201203131455-2")
82
82
  end
83
83
  end
84
84
  end
@@ -1,21 +1,21 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::Backup, :integration do
5
- describe '.all' do
6
- it 'returns an array of Backups' do
5
+ describe ".all" do
6
+ it "returns an array of Backups" 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 Backup by key' do
15
- backup = described_class.find('backup-daily')
13
+ describe ".find" do
14
+ it "finds a Backup by key" do
15
+ backup = described_class.find("backup-daily")
16
16
 
17
17
  expect(backup).to be_a(described_class)
18
- expect(backup.key).to eq('backup-daily')
18
+ expect(backup.key).to eq("backup-daily")
19
19
  end
20
20
  end
21
21
  end
@@ -1,30 +1,30 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::BuildComponent, :integration do
5
- let(:build_component) { described_class.find('wicket') }
5
+ let(:build_component) { described_class.find("wicket") }
6
6
 
7
- describe '.all' do
8
- it 'returns an array of build component objects' do
7
+ describe ".all" do
8
+ it "returns an array of build component objects" do
9
9
  results = described_class.all
10
10
  expect(results).to be_a(Array)
11
11
  expect(results.first).to be_a(described_class)
12
12
  end
13
13
  end
14
14
 
15
- describe '.find' do
16
- it 'finds a build component by name' do
15
+ describe ".find" do
16
+ it "finds a build component by name" do
17
17
  expect(build_component).to be_a(described_class)
18
- expect(build_component.name).to eq('wicket')
19
- expect(build_component.last_started).to eq(Time.parse('2015-06-19T20:13:20.222Z'))
18
+ expect(build_component.name).to eq("wicket")
19
+ expect(build_component.last_started).to eq(Time.parse("2015-06-19T20:13:20.222Z"))
20
20
  end
21
21
  end
22
22
 
23
- describe '#delete' do
24
- let(:build_numbers) { %w( 51 52 )}
23
+ describe "#delete" do
24
+ let(:build_numbers) { %w{ 51 52 } }
25
25
  let(:delete_all) { false }
26
26
 
27
- it 'deletes the specified builds from the component' do
27
+ it "deletes the specified builds from the component" do
28
28
 
29
29
  expect(build_component.delete(
30
30
  build_numbers: build_numbers,
@@ -32,20 +32,20 @@ module Artifactory
32
32
  )).to be_truthy
33
33
  end
34
34
 
35
- context 'no build numbers provided' do
35
+ context "no build numbers provided" do
36
36
  let(:build_numbers) { nil }
37
37
 
38
- it 'deletes no builds' do
38
+ it "deletes no builds" do
39
39
 
40
40
  expect(build_component.delete(
41
41
  delete_all: delete_all
42
42
  )).to be_falsey
43
43
  end
44
44
 
45
- context 'the delete_all flag is true' do
45
+ context "the delete_all flag is true" do
46
46
  let(:delete_all) { true }
47
47
 
48
- it 'deletes the component and all builds' do
48
+ it "deletes the component and all builds" do
49
49
  expect(build_component.delete(
50
50
  delete_all: delete_all
51
51
  )).to be_truthy
@@ -54,10 +54,10 @@ module Artifactory
54
54
  end
55
55
  end
56
56
 
57
- describe '#rename' do
58
- it 'renames the build component on the server' do
57
+ describe "#rename" do
58
+ it "renames the build component on the server" do
59
59
 
60
- expect(build_component.rename('fricket')).to be_truthy
60
+ expect(build_component.rename("fricket")).to be_truthy
61
61
  end
62
62
  end
63
63
  end
@@ -1,33 +1,33 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::Build, :integration do
5
- describe '.all' do
6
- it 'returns an array of build objects' do
7
- results = described_class.all('wicket')
5
+ describe ".all" do
6
+ it "returns an array of build objects" do
7
+ results = described_class.all("wicket")
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 build by component and number' do
15
- build = described_class.find('wicket', 51)
13
+ describe ".find" do
14
+ it "finds a build by component and number" do
15
+ build = described_class.find("wicket", 51)
16
16
 
17
17
  expect(build).to be_a(described_class)
18
- expect(build.name).to eq('wicket')
19
- expect(build.number).to eq('51')
20
- expect(build.started).to eq(Time.parse('2014-09-30T12:00:19.893+0300'))
18
+ expect(build.name).to eq("wicket")
19
+ expect(build.number).to eq("51")
20
+ expect(build.started).to eq(Time.parse("2014-09-30T12:00:19.893+0300"))
21
21
  end
22
22
  end
23
23
 
24
- describe '#save' do
25
- it 'saves the build data to the server' do
24
+ describe "#save" do
25
+ it "saves the build data to the server" do
26
26
  build = described_class.new(
27
- name: 'fricket',
28
- number: '1',
27
+ name: "fricket",
28
+ number: "1",
29
29
  properties: {
30
- 'buildInfo.env.JAVA_HOME' => '/usr/jdk/latest'
30
+ "buildInfo.env.JAVA_HOME" => "/usr/jdk/latest",
31
31
  })
32
32
 
33
33
  expect(build.save).to be_truthy
@@ -1,43 +1,43 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::Group, :integration do
5
- describe '.all' do
6
- it 'returns an array of group objects' do
5
+ describe ".all" do
6
+ it "returns an array of group 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
  readers = results[0]
15
15
  leads = results[1]
16
16
 
17
- expect(readers.name).to eq('readers')
18
- expect(leads.name).to eq('tech-leads')
17
+ expect(readers.name).to eq("readers")
18
+ expect(leads.name).to eq("tech-leads")
19
19
  end
20
20
  end
21
21
 
22
- describe '.find' do
23
- it 'finds a group by name' do
24
- readers = described_class.find('readers')
22
+ describe ".find" do
23
+ it "finds a group by name" do
24
+ readers = described_class.find("readers")
25
25
 
26
26
  expect(readers).to be_a(described_class)
27
- expect(readers.name).to eq('readers')
27
+ expect(readers.name).to eq("readers")
28
28
  end
29
29
  end
30
30
 
31
- describe '#delete' do
32
- it 'deletes the group from the server' do
33
- readers = described_class.find('readers')
31
+ describe "#delete" do
32
+ it "deletes the group from the server" do
33
+ readers = described_class.find("readers")
34
34
  expect(readers.delete).to be_truthy
35
35
  end
36
36
  end
37
37
 
38
- describe '#save' do
39
- it 'saves the group to the server' do
40
- group = described_class.new(name: 'testing')
38
+ describe "#save" do
39
+ it "saves the group to the server" do
40
+ group = described_class.new(name: "testing")
41
41
  expect(group.save).to be_truthy
42
42
  end
43
43
  end
@@ -1,21 +1,21 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::Layout, :integration do
5
- describe '.all' do
6
- it 'returns an array of Layouts' do
5
+ describe ".all" do
6
+ it "returns an array of Layouts" 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 layout by name' do
15
- mvn_layout = described_class.find('maven-2-default')
13
+ describe ".find" do
14
+ it "finds a layout by name" do
15
+ mvn_layout = described_class.find("maven-2-default")
16
16
 
17
17
  expect(mvn_layout).to be_a(described_class)
18
- expect(mvn_layout.name).to eq('maven-2-default')
18
+ expect(mvn_layout.name).to eq("maven-2-default")
19
19
  end
20
20
  end
21
21
  end
@@ -1,21 +1,21 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::LDAPSetting, :integration do
5
- describe '.all' do
6
- it 'returns an array of LdapSetting' do
5
+ describe ".all" do
6
+ it "returns an array of LdapSetting" 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 an LdapSetting by key' do
15
- ldap = described_class.find('example-ldap')
13
+ describe ".find" do
14
+ it "finds an LdapSetting by key" do
15
+ ldap = described_class.find("example-ldap")
16
16
 
17
17
  expect(ldap).to be_a(described_class)
18
- expect(ldap.key).to eq('example-ldap')
18
+ expect(ldap.key).to eq("example-ldap")
19
19
  end
20
20
  end
21
21
  end
@@ -1,21 +1,21 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::MailServer, :integration do
5
- describe '.all' do
6
- it 'returns an array of MailServer' do
5
+ describe ".all" do
6
+ it "returns an array of MailServer" 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 MailServer by host' do
15
- smtp = described_class.find('smtp.gmail.com')
13
+ describe ".find" do
14
+ it "finds a MailServer by host" do
15
+ smtp = described_class.find("smtp.gmail.com")
16
16
 
17
17
  expect(smtp).to be_a(described_class)
18
- expect(smtp.host).to eq('smtp.gmail.com')
18
+ expect(smtp.host).to eq("smtp.gmail.com")
19
19
  end
20
20
  end
21
21
  end
@@ -1,74 +1,74 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::PermissionTarget, :integration do
5
- describe '.all' do
6
- it 'returns an array of PermissionTarget objects' do
5
+ describe ".all" do
6
+ it "returns an array of PermissionTarget 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
  anything = results[0]
15
- any_remote = results[1]
15
+ any_remote = results[1]
16
16
 
17
- expect(anything.name).to eq('Anything')
18
- expect(any_remote.name).to eq('Any Remote')
17
+ expect(anything.name).to eq("Anything")
18
+ expect(any_remote.name).to eq("Any Remote")
19
19
  end
20
20
  end
21
21
 
22
- describe '.find' do
23
- it 'finds a permission target by name' do
24
- readers = described_class.find('Anything')
22
+ describe ".find" do
23
+ it "finds a permission target by name" do
24
+ readers = described_class.find("Anything")
25
25
 
26
26
  expect(readers).to be_a(described_class)
27
- expect(readers.name).to eq('Anything')
27
+ expect(readers.name).to eq("Anything")
28
28
  end
29
29
  end
30
30
 
31
- describe '#delete' do
32
- it 'deletes the permission target from the server' do
33
- readers = described_class.find('Anything')
31
+ describe "#delete" do
32
+ it "deletes the permission target from the server" do
33
+ readers = described_class.find("Anything")
34
34
  expect(readers.delete).to be_truthy
35
35
  end
36
36
  end
37
37
 
38
- describe '#save' do
39
- it 'saves the permission target to the server' do
40
- target = described_class.new(name: 'testing')
38
+ describe "#save" do
39
+ it "saves the permission target to the server" do
40
+ target = described_class.new(name: "testing")
41
41
  expect(target.save).to be_truthy
42
42
  end
43
43
  end
44
44
 
45
- describe '#users' do
46
- it 'displays the users hash with sorted verbose permissions' do
47
- target = described_class.find('Any Remote')
48
- expect(target.users).to eq( { 'anonymous' => ['deploy', 'read'] } )
45
+ describe "#users" do
46
+ it "displays the users hash with sorted verbose permissions" do
47
+ target = described_class.find("Any Remote")
48
+ expect(target.users).to eq( { "anonymous" => %w{deploy read} } )
49
49
  end
50
50
  end
51
51
 
52
- describe '#groups' do
53
- it 'displays the groups hash with sorted verbose permissions' do
54
- target = described_class.find('Anything')
55
- expect(target.groups).to eq( { 'readers' => ['admin', 'read'] } )
52
+ describe "#groups" do
53
+ it "displays the groups hash with sorted verbose permissions" do
54
+ target = described_class.find("Anything")
55
+ expect(target.groups).to eq( { "readers" => %w{admin read} } )
56
56
  end
57
57
  end
58
58
 
59
- describe '#users=' do
60
- it 'sets the users hash' do
61
- target = described_class.find('Any Remote')
62
- target.users = { 'admins' => ['admin'] }
63
- expect(target.users).to eq( { 'admins' => ['admin'] })
59
+ describe "#users=" do
60
+ it "sets the users hash" do
61
+ target = described_class.find("Any Remote")
62
+ target.users = { "admins" => ["admin"] }
63
+ expect(target.users).to eq( { "admins" => ["admin"] })
64
64
  end
65
65
  end
66
66
 
67
- describe '#groups=' do
68
- it 'sets the groups hash' do
69
- target = described_class.find('Anything')
70
- target.groups = { 'deployers' => ['deploy'] }
71
- expect(target.groups).to eq( { 'deployers' => ['deploy'] })
67
+ describe "#groups=" do
68
+ it "sets the groups hash" do
69
+ target = described_class.find("Anything")
70
+ target.groups = { "deployers" => ["deploy"] }
71
+ expect(target.groups).to eq( { "deployers" => ["deploy"] })
72
72
  end
73
73
  end
74
74
  end