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
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::URLBase do
@@ -9,7 +9,7 @@ module Artifactory
9
9
  allow(client).to receive(:get).and_return(response) if defined?(response)
10
10
  end
11
11
 
12
- describe '.all' do
12
+ describe ".all" do
13
13
  doc = <<-XML
14
14
  <config>
15
15
  <urlBase>http://33.33.33.20/artifactory</urlBase>
@@ -23,14 +23,14 @@ module Artifactory
23
23
  allow(Resource::System).to receive(:configuration).and_return(xml)
24
24
  end
25
25
 
26
- it 'returns the url bases' do
26
+ it "returns the url bases" do
27
27
  expect(described_class.all).to be_a(Array)
28
28
  expect(described_class.all.first).to be_a(described_class)
29
- expect(described_class.all.first.url_base).to eq('http://33.33.33.20/artifactory')
29
+ expect(described_class.all.first.url_base).to eq("http://33.33.33.20/artifactory")
30
30
  end
31
31
  end
32
32
 
33
- describe '.find' do
33
+ describe ".find" do
34
34
  doc = <<-XML
35
35
  <config>
36
36
  <urlBase>http://proxyserver/artifactory</urlBase>
@@ -44,9 +44,9 @@ module Artifactory
44
44
  allow(Resource::System).to receive(:configuration).and_return(xml)
45
45
  end
46
46
 
47
- it 'returns the found urlBase' do
48
- expect(described_class.find('http://proxyserver/artifactory')).to be_a(described_class)
49
- expect(described_class.find('http://proxyserver/artifactory').url_base).to eq('http://proxyserver/artifactory')
47
+ it "returns the found urlBase" do
48
+ expect(described_class.find("http://proxyserver/artifactory")).to be_a(described_class)
49
+ expect(described_class.find("http://proxyserver/artifactory").url_base).to eq("http://proxyserver/artifactory")
50
50
  end
51
51
  end
52
52
  end
@@ -1,9 +1,9 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Resource::User do
5
5
  let(:client) { double(:client) }
6
- let(:endpoint_host) { 'http://33.33.33.11' }
6
+ let(:endpoint_host) { "http://33.33.33.11" }
7
7
  let(:endpoint) { "#{endpoint_host}/" }
8
8
 
9
9
  before(:each) do
@@ -11,101 +11,101 @@ module Artifactory
11
11
  allow(client).to receive(:get).and_return(response) if defined?(response)
12
12
  end
13
13
 
14
- describe '.all' do
14
+ describe ".all" do
15
15
  let(:response) do
16
16
  [
17
- { 'uri' => 'a' },
18
- { 'uri' => 'b' },
19
- { 'uri' => 'c' },
17
+ { "uri" => "a" },
18
+ { "uri" => "b" },
19
+ { "uri" => "c" },
20
20
  ]
21
21
  end
22
22
  before do
23
- allow(described_class).to receive(:from_url).with('a', client: client).and_return('a')
24
- allow(described_class).to receive(:from_url).with('b', client: client).and_return('b')
25
- allow(described_class).to receive(:from_url).with('c', client: client).and_return('c')
23
+ allow(described_class).to receive(:from_url).with("a", client: client).and_return("a")
24
+ allow(described_class).to receive(:from_url).with("b", client: client).and_return("b")
25
+ allow(described_class).to receive(:from_url).with("c", client: client).and_return("c")
26
26
  end
27
27
 
28
- it 'gets /api/security/users' do
29
- expect(client).to receive(:get).with('/api/security/users').once
28
+ it "gets /api/security/users" do
29
+ expect(client).to receive(:get).with("/api/security/users").once
30
30
  described_class.all
31
31
  end
32
32
 
33
- it 'returns the users' do
34
- expect(described_class.all).to eq(['a', 'b', 'c'])
33
+ it "returns the users" do
34
+ expect(described_class.all).to eq(%w{a b c})
35
35
  end
36
36
  end
37
37
 
38
- describe '.find' do
38
+ describe ".find" do
39
39
  let(:response) { {} }
40
40
 
41
41
  it 'gets /api/repositories/#{name}' do
42
- expect(client).to receive(:get).with('/api/security/users/readers').once
43
- described_class.find('readers')
42
+ expect(client).to receive(:get).with("/api/security/users/readers").once
43
+ described_class.find("readers")
44
44
  end
45
45
  end
46
46
 
47
- describe '.from_url' do
47
+ describe ".from_url" do
48
48
  let(:response) { {} }
49
49
 
50
- it 'constructs a new instance from the result' do
50
+ it "constructs a new instance from the result" do
51
51
  expect(client).to receive(:endpoint).and_return(endpoint)
52
52
  expect(described_class).to receive(:from_hash).once
53
- described_class.from_url('/api/security/users/readers')
53
+ described_class.from_url("/api/security/users/readers")
54
54
  end
55
55
  end
56
56
 
57
- describe '.from_hash' do
57
+ describe ".from_hash" do
58
58
  let(:hash) do
59
59
  {
60
- 'admin' => false,
61
- 'email' => 'admin@example.com',
62
- 'groups' => ['admin'],
63
- 'internalPasswordDisabled' => true,
64
- 'lastLoggedIn' => nil,
65
- 'name' => 'admin',
66
- 'profileUpdatable' => true,
67
- 'realm' => 'artifactory',
60
+ "admin" => false,
61
+ "email" => "admin@example.com",
62
+ "groups" => ["admin"],
63
+ "internalPasswordDisabled" => true,
64
+ "lastLoggedIn" => nil,
65
+ "name" => "admin",
66
+ "profileUpdatable" => true,
67
+ "realm" => "artifactory",
68
68
  }
69
69
  end
70
70
 
71
- it 'creates a new instance' do
71
+ it "creates a new instance" do
72
72
  instance = described_class.from_hash(hash)
73
73
  expect(instance.admin).to be_falsey
74
- expect(instance.email).to eq('admin@example.com')
75
- expect(instance.groups).to eq(['admin'])
74
+ expect(instance.email).to eq("admin@example.com")
75
+ expect(instance.groups).to eq(["admin"])
76
76
  expect(instance.internal_password_disabled).to be_truthy
77
77
  expect(instance.last_logged_in).to be_nil
78
- expect(instance.name).to eq('admin')
78
+ expect(instance.name).to eq("admin")
79
79
  expect(instance.password).to be_nil
80
80
  expect(instance.profile_updatable).to be_truthy
81
- expect(instance.realm).to eq('artifactory')
81
+ expect(instance.realm).to eq("artifactory")
82
82
  end
83
83
  end
84
84
 
85
- describe '#save' do
85
+ describe "#save" do
86
86
  let(:client) { double }
87
87
  before do
88
88
  subject.client = client
89
- subject.name = 'schisamo'
89
+ subject.name = "schisamo"
90
90
  end
91
91
 
92
- context 'when the user is new' do
92
+ context "when the user is new" do
93
93
  before do
94
94
  allow(described_class).to receive(:find).with(subject.name, client: client).and_return(nil)
95
95
  end
96
96
 
97
- it 'PUTS the user to the server' do
97
+ it "PUTS the user to the server" do
98
98
  expect(client).to receive(:put).with("/api/security/users/#{subject.name}", kind_of(String), kind_of(Hash))
99
99
  subject.save
100
100
  end
101
101
  end
102
102
 
103
- context 'when the user exists' do
103
+ context "when the user exists" do
104
104
  before do
105
- allow(described_class).to receive(:find).with(subject.name, client: client).and_return({name: subject.name})
105
+ allow(described_class).to receive(:find).with(subject.name, client: client).and_return({ name: subject.name })
106
106
  end
107
107
 
108
- it 'POSTS the user to the server' do
108
+ it "POSTS the user to the server" do
109
109
  expect(client).to receive(:post).with("/api/security/users/#{subject.name}", kind_of(String), kind_of(Hash))
110
110
  subject.save
111
111
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artifactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-27 00:00:00.000000000 Z
11
+ date: 2017-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  requirements: []
142
142
  rubyforge_project:
143
- rubygems_version: 2.4.5.1
143
+ rubygems_version: 2.6.10
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Artifactory is a simple, lightweight Ruby client for interacting with the