artifactory 2.8.2 → 3.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +5 -5
  2. data/lib/artifactory.rb +3 -2
  3. data/lib/artifactory/client.rb +16 -7
  4. data/lib/artifactory/collections/artifact.rb +1 -1
  5. data/lib/artifactory/collections/base.rb +1 -1
  6. data/lib/artifactory/collections/build.rb +1 -1
  7. data/lib/artifactory/configurable.rb +15 -15
  8. data/lib/artifactory/defaults.rb +2 -2
  9. data/lib/artifactory/errors.rb +6 -6
  10. data/lib/artifactory/resources/artifact.rb +17 -19
  11. data/lib/artifactory/resources/backup.rb +3 -1
  12. data/lib/artifactory/resources/base.rb +17 -7
  13. data/lib/artifactory/resources/build.rb +6 -6
  14. data/lib/artifactory/resources/build_component.rb +1 -0
  15. data/lib/artifactory/resources/certificate.rb +90 -0
  16. data/lib/artifactory/resources/group.rb +2 -1
  17. data/lib/artifactory/resources/layout.rb +2 -1
  18. data/lib/artifactory/resources/ldap_setting.rb +3 -1
  19. data/lib/artifactory/resources/mail_server.rb +2 -1
  20. data/lib/artifactory/resources/permission_target.rb +18 -2
  21. data/lib/artifactory/resources/plugin.rb +1 -1
  22. data/lib/artifactory/resources/repository.rb +5 -1
  23. data/lib/artifactory/resources/system.rb +1 -1
  24. data/lib/artifactory/resources/url_base.rb +2 -1
  25. data/lib/artifactory/resources/user.rb +2 -1
  26. data/lib/artifactory/util.rb +4 -3
  27. data/lib/artifactory/version.rb +2 -2
  28. metadata +11 -131
  29. data/.gitignore +0 -27
  30. data/.travis.yml +0 -28
  31. data/CHANGELOG.md +0 -141
  32. data/Gemfile +0 -14
  33. data/README.md +0 -288
  34. data/Rakefile +0 -28
  35. data/appveyor.yml +0 -30
  36. data/artifactory.gemspec +0 -25
  37. data/spec/integration/resources/artifact_spec.rb +0 -99
  38. data/spec/integration/resources/backup.rb +0 -22
  39. data/spec/integration/resources/build_component_spec.rb +0 -64
  40. data/spec/integration/resources/build_spec.rb +0 -38
  41. data/spec/integration/resources/group_spec.rb +0 -45
  42. data/spec/integration/resources/layout_spec.rb +0 -22
  43. data/spec/integration/resources/ldap_setting_spec.rb +0 -22
  44. data/spec/integration/resources/mail_server_spec.rb +0 -22
  45. data/spec/integration/resources/permission_target_spec.rb +0 -75
  46. data/spec/integration/resources/repository_spec.rb +0 -40
  47. data/spec/integration/resources/system_spec.rb +0 -58
  48. data/spec/integration/resources/url_base_spec.rb +0 -22
  49. data/spec/integration/resources/user_spec.rb +0 -45
  50. data/spec/spec_helper.rb +0 -52
  51. data/spec/support/api_server.rb +0 -49
  52. data/spec/support/api_server/artifact_endpoints.rb +0 -186
  53. data/spec/support/api_server/build_component_endpoints.rb +0 -44
  54. data/spec/support/api_server/build_endpoints.rb +0 -240
  55. data/spec/support/api_server/group_endpoints.rb +0 -53
  56. data/spec/support/api_server/permission_target_endpoints.rb +0 -53
  57. data/spec/support/api_server/repository_endpoints.rb +0 -114
  58. data/spec/support/api_server/status_endpoints.rb +0 -11
  59. data/spec/support/api_server/system_endpoints.rb +0 -104
  60. data/spec/support/api_server/user_endpoints.rb +0 -59
  61. data/spec/unit/artifactory_spec.rb +0 -73
  62. data/spec/unit/client_spec.rb +0 -132
  63. data/spec/unit/resources/artifact_spec.rb +0 -608
  64. data/spec/unit/resources/backup_spec.rb +0 -61
  65. data/spec/unit/resources/base_spec.rb +0 -180
  66. data/spec/unit/resources/build_component_spec.rb +0 -118
  67. data/spec/unit/resources/build_spec.rb +0 -347
  68. data/spec/unit/resources/defaults_spec.rb +0 -27
  69. data/spec/unit/resources/group_spec.rb +0 -108
  70. data/spec/unit/resources/layout_spec.rb +0 -61
  71. data/spec/unit/resources/ldap_setting_spec.rb +0 -65
  72. data/spec/unit/resources/mail_server_spec.rb +0 -57
  73. data/spec/unit/resources/permission_target_spec.rb +0 -189
  74. data/spec/unit/resources/plugin_spec.rb +0 -25
  75. data/spec/unit/resources/repository_spec.rb +0 -217
  76. data/spec/unit/resources/system_spec.rb +0 -90
  77. data/spec/unit/resources/url_base_spec.rb +0 -53
  78. data/spec/unit/resources/user_spec.rb +0 -115
data/Rakefile DELETED
@@ -1,28 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- require "rspec/core/rake_task"
4
- RSpec::Core::RakeTask.new(:integration) do |t|
5
- t.rspec_opts = "--tag integration"
6
- end
7
- RSpec::Core::RakeTask.new(:unit) do |t|
8
- t.rspec_opts = "--tag ~integration"
9
- end
10
-
11
- require "chefstyle"
12
- require "rubocop/rake_task"
13
- desc "Run ChefStyle"
14
- RuboCop::RakeTask.new(:chefstyle) do |task|
15
- task.options << "--display-cop-names"
16
- end
17
-
18
- desc "Generate coverage report"
19
- RSpec::Core::RakeTask.new(:coverage) do |t|
20
- ENV["COVERAGE"] = "true"
21
- end
22
-
23
- namespace :travis do
24
- desc "Run tests on Travis"
25
- task ci: %w{chefstyle unit integration}
26
- end
27
-
28
- task default: %w{travis:ci}
@@ -1,30 +0,0 @@
1
- version: '{build}'
2
-
3
- skip_tags: true
4
-
5
- environment:
6
- matrix:
7
- - RUBY_VERSION: 21
8
- - RUBY_VERSION: 21-x64
9
- - RUBY_VERSION: 22
10
- - RUBY_VERSION: 22-x64
11
- - RUBY_VERSION: 23
12
- - RUBY_VERSION: 23-x64
13
-
14
- install:
15
- - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
16
- - gem install bundler
17
- - bundle install --path=vendor/bundle --retry=3 --jobs=7
18
-
19
- cache:
20
- - vendor/bundle
21
-
22
- build: off
23
-
24
- before_test:
25
- - ruby -v
26
- - gem -v
27
- - bundle -v
28
-
29
- test_script:
30
- - bundle exec rake travis:ci
@@ -1,25 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "artifactory/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "artifactory"
8
- spec.version = Artifactory::VERSION
9
- spec.author = "Seth Vargo"
10
- spec.email = "sethvargo@gmail.com"
11
- spec.description = "A Ruby client for Artifactory"
12
- spec.summary = "Artifactory is a simple, lightweight Ruby client for " \
13
- "interacting with the Artifactory and Artifactory Pro " \
14
- "APIs."
15
- spec.homepage = "https://github.com/opscode/artifactory-client"
16
- spec.license = "Apache 2.0"
17
-
18
- spec.files = `git ls-files`.split($/)
19
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
- spec.require_paths = ["lib"]
22
-
23
- spec.add_development_dependency "bundler"
24
- spec.add_development_dependency "rake"
25
- end
@@ -1,99 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Artifactory
4
- describe Resource::Artifact, :integration do
5
- shared_examples "an artifact search endpoint" do |name, options = {}|
6
- it "finds artifacts by #{name}" do
7
- response = described_class.send(name, options)
8
- expect(response).to be_a(Array)
9
- expect(response.size).to eq(3)
10
-
11
- artifact_1 = response[0]
12
- expect(artifact_1).to be_a(described_class)
13
- expect(artifact_1.repo).to eq("libs-release-local")
14
-
15
- artifact_2 = response[1]
16
- expect(artifact_2).to be_a(described_class)
17
- expect(artifact_2.repo).to eq("ext-release-local")
18
-
19
- artifact_3 = response[2]
20
- expect(artifact_3).to be_a(described_class)
21
- expect(artifact_3.repo).to eq("bin-release-local")
22
- end
23
-
24
- it "finds artifacts by repo" do
25
- response = described_class.send(name, options.merge(repos: "libs-release-local"))
26
- expect(response).to be_a(Array)
27
- expect(response.size).to eq(1)
28
-
29
- artifact = response.first
30
- expect(artifact).to be_a(described_class)
31
- expect(artifact.repo).to eq("libs-release-local")
32
- end
33
- end
34
-
35
- describe ".properties" do
36
- let(:artifact) do
37
- artifact = described_class.send(:search, repos: "libs-properties-local", name: "artifact.deb").first
38
- end
39
-
40
- it "returns artifact properties when reading" do
41
- expect(artifact.properties).to include({ "licenses" => [ "Apache 2" ] })
42
- end
43
-
44
- it "writes artifact properties" do
45
- expect(artifact.properties({ author: "Jörg", "status" => "public" })).to eq({ "licenses" => [ "Apache 2" ], "author" => "Jörg", "status" => "public" })
46
- end
47
- end
48
-
49
- describe ".search" do
50
- it_behaves_like "an artifact search endpoint", :search, name: "artifact.deb"
51
- end
52
-
53
- describe ".gavc_search" do
54
- it_behaves_like "an artifact search endpoint", :gavc_search, {
55
- group: "org.acme",
56
- name: "artifact.deb",
57
- version: "1.0",
58
- classifier: "sources",
59
- }
60
- end
61
-
62
- describe ".property_search" do
63
- it_behaves_like "an artifact search endpoint", :property_search, {
64
- branch: "master",
65
- committer: "Seth Vargo",
66
- }
67
- end
68
-
69
- describe ".checksum_search" do
70
- it_behaves_like "an artifact search endpoint", :checksum_search, md5: "abcd1234"
71
- end
72
-
73
- describe ".usage_search" do
74
- it_behaves_like "an artifact search endpoint", :usage_search, notUsedSince: "1414800000"
75
- end
76
-
77
- describe ".creation_search" do
78
- it_behaves_like "an artifact search endpoint", :creation_search, from: "1414800000"
79
- end
80
-
81
- describe ".versions" do
82
- it "returns an array of versions" do
83
- response = described_class.versions
84
- expect(response).to be_a(Array)
85
- expect(response.size).to eq(3)
86
-
87
- expect(response[0]["version"]).to eq("1.2")
88
- end
89
- end
90
-
91
- describe ".latest_version" do
92
- it "finds the latest version of the artifact" do
93
- response = described_class.latest_version
94
- expect(response).to be_a(String)
95
- expect(response).to eq("1.0-201203131455-2")
96
- end
97
- end
98
- end
99
- end
@@ -1,22 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Artifactory
4
- describe Resource::Backup, :integration do
5
- describe ".all" do
6
- it "returns an array of Backups" do
7
- results = described_class.all
8
- expect(results).to be_a(Array)
9
- expect(results.first).to be_a(described_class)
10
- end
11
- end
12
-
13
- describe ".find" do
14
- it "finds a Backup by key" do
15
- backup = described_class.find("backup-daily")
16
-
17
- expect(backup).to be_a(described_class)
18
- expect(backup.key).to eq("backup-daily")
19
- end
20
- end
21
- end
22
- end
@@ -1,64 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Artifactory
4
- describe Resource::BuildComponent, :integration do
5
- let(:build_component) { described_class.find("wicket") }
6
-
7
- describe ".all" do
8
- it "returns an array of build component objects" do
9
- results = described_class.all
10
- expect(results).to be_a(Array)
11
- expect(results.first).to be_a(described_class)
12
- end
13
- end
14
-
15
- describe ".find" do
16
- it "finds a build component by name" do
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"))
20
- end
21
- end
22
-
23
- describe "#delete" do
24
- let(:build_numbers) { %w{ 51 52 } }
25
- let(:delete_all) { false }
26
-
27
- it "deletes the specified builds from the component" do
28
-
29
- expect(build_component.delete(
30
- build_numbers: build_numbers,
31
- delete_all: delete_all
32
- )).to be_truthy
33
- end
34
-
35
- context "no build numbers provided" do
36
- let(:build_numbers) { nil }
37
-
38
- it "deletes no builds" do
39
-
40
- expect(build_component.delete(
41
- delete_all: delete_all
42
- )).to be_falsey
43
- end
44
-
45
- context "the delete_all flag is true" do
46
- let(:delete_all) { true }
47
-
48
- it "deletes the component and all builds" do
49
- expect(build_component.delete(
50
- delete_all: delete_all
51
- )).to be_truthy
52
- end
53
- end
54
- end
55
- end
56
-
57
- describe "#rename" do
58
- it "renames the build component on the server" do
59
-
60
- expect(build_component.rename("fricket")).to be_truthy
61
- end
62
- end
63
- end
64
- end
@@ -1,38 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Artifactory
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")
8
- expect(results).to be_a(Array)
9
- expect(results.first).to be_a(described_class)
10
- end
11
- end
12
-
13
- describe ".find" do
14
- it "finds a build by component and number" do
15
- build = described_class.find("wicket", 51)
16
-
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"))
21
- expect(build.statuses.first).to include("status" => "promoted")
22
- end
23
- end
24
-
25
- describe "#save" do
26
- it "saves the build data to the server" do
27
- build = described_class.new(
28
- name: "fricket",
29
- number: "1",
30
- properties: {
31
- "buildInfo.env.JAVA_HOME" => "/usr/jdk/latest",
32
- })
33
-
34
- expect(build.save).to be_truthy
35
- end
36
- end
37
- end
38
- end
@@ -1,45 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Artifactory
4
- describe Resource::Group, :integration do
5
- describe ".all" do
6
- it "returns an array of group objects" do
7
- results = described_class.all
8
- expect(results).to be_a(Array)
9
- expect(results.first).to be_a(described_class)
10
- end
11
-
12
- it "includes the information from the server" do
13
- results = described_class.all
14
- readers = results[0]
15
- leads = results[1]
16
-
17
- expect(readers.name).to eq("readers")
18
- expect(leads.name).to eq("tech-leads")
19
- end
20
- end
21
-
22
- describe ".find" do
23
- it "finds a group by name" do
24
- readers = described_class.find("readers")
25
-
26
- expect(readers).to be_a(described_class)
27
- expect(readers.name).to eq("readers")
28
- end
29
- end
30
-
31
- describe "#delete" do
32
- it "deletes the group from the server" do
33
- readers = described_class.find("readers")
34
- expect(readers.delete).to be_truthy
35
- end
36
- end
37
-
38
- describe "#save" do
39
- it "saves the group to the server" do
40
- group = described_class.new(name: "testing")
41
- expect(group.save).to be_truthy
42
- end
43
- end
44
- end
45
- end
@@ -1,22 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Artifactory
4
- describe Resource::Layout, :integration do
5
- describe ".all" do
6
- it "returns an array of Layouts" do
7
- results = described_class.all
8
- expect(results).to be_a(Array)
9
- expect(results.first).to be_a(described_class)
10
- end
11
- end
12
-
13
- describe ".find" do
14
- it "finds a layout by name" do
15
- mvn_layout = described_class.find("maven-2-default")
16
-
17
- expect(mvn_layout).to be_a(described_class)
18
- expect(mvn_layout.name).to eq("maven-2-default")
19
- end
20
- end
21
- end
22
- end
@@ -1,22 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Artifactory
4
- describe Resource::LDAPSetting, :integration do
5
- describe ".all" do
6
- it "returns an array of LdapSetting" do
7
- results = described_class.all
8
- expect(results).to be_a(Array)
9
- expect(results.first).to be_a(described_class)
10
- end
11
- end
12
-
13
- describe ".find" do
14
- it "finds an LdapSetting by key" do
15
- ldap = described_class.find("example-ldap")
16
-
17
- expect(ldap).to be_a(described_class)
18
- expect(ldap.key).to eq("example-ldap")
19
- end
20
- end
21
- end
22
- end
@@ -1,22 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Artifactory
4
- describe Resource::MailServer, :integration do
5
- describe ".all" do
6
- it "returns an array of MailServer" do
7
- results = described_class.all
8
- expect(results).to be_a(Array)
9
- expect(results.first).to be_a(described_class)
10
- end
11
- end
12
-
13
- describe ".find" do
14
- it "finds a MailServer by host" do
15
- smtp = described_class.find("smtp.gmail.com")
16
-
17
- expect(smtp).to be_a(described_class)
18
- expect(smtp.host).to eq("smtp.gmail.com")
19
- end
20
- end
21
- end
22
- end
@@ -1,75 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Artifactory
4
- describe Resource::PermissionTarget, :integration do
5
- describe ".all" do
6
- it "returns an array of PermissionTarget objects" do
7
- results = described_class.all
8
- expect(results).to be_a(Array)
9
- expect(results.first).to be_a(described_class)
10
- end
11
-
12
- it "includes the information from the server" do
13
- results = described_class.all
14
- anything = results[0]
15
- any_remote = results[1]
16
-
17
- expect(anything.name).to eq("Anything")
18
- expect(any_remote.name).to eq("Any Remote")
19
- end
20
- end
21
-
22
- describe ".find" do
23
- it "finds a permission target by name" do
24
- readers = described_class.find("Anything")
25
-
26
- expect(readers).to be_a(described_class)
27
- expect(readers.name).to eq("Anything")
28
- end
29
- end
30
-
31
- describe "#delete" do
32
- it "deletes the permission target from the server" do
33
- readers = described_class.find("Anything")
34
- expect(readers.delete).to be_truthy
35
- end
36
- end
37
-
38
- describe "#save" do
39
- it "saves the permission target to the server" do
40
- target = described_class.new(name: "testing")
41
- expect(target.save).to be_truthy
42
- end
43
- end
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" => %w{deploy read} } )
49
- end
50
- end
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" => %w{admin read} } )
56
- end
57
- end
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"] })
64
- end
65
- end
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"] })
72
- end
73
- end
74
- end
75
- end