artifactory 2.8.2 → 3.0.0

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