bukin 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/.travis.yml +0 -1
  2. data/Gemfile +2 -0
  3. data/README.md +3 -3
  4. data/bukin.gemspec +2 -2
  5. data/docs/process.md +24 -0
  6. data/lib/bukin.rb +54 -2
  7. data/lib/bukin/bukfile.rb +46 -48
  8. data/lib/bukin/bukget.rb +63 -0
  9. data/lib/bukin/bukkit_dl.rb +45 -0
  10. data/lib/bukin/cli.rb +109 -83
  11. data/lib/bukin/download.rb +16 -0
  12. data/lib/bukin/file_match.rb +33 -0
  13. data/lib/bukin/installer.rb +65 -68
  14. data/lib/bukin/jenkins.rb +47 -0
  15. data/lib/bukin/lockfile.rb +23 -21
  16. data/lib/bukin/resource.rb +17 -0
  17. data/lib/bukin/version.rb +1 -1
  18. data/spec/bukfile_spec.rb +0 -16
  19. data/spec/bukget_spec.rb +56 -0
  20. data/spec/bukkit_dl_spec.rb +50 -0
  21. data/spec/cassettes/Bukin_Bukget/chooses_the_version_with_a_jar_file_when_there_are_multiple_versions.yml +61 -0
  22. data/spec/cassettes/Bukin_Bukget/installs_a_specific_version_of_a_resource.yml +61 -0
  23. data/spec/cassettes/Bukin_Bukget/installs_the_latest_version_of_a_resource.yml +49 -0
  24. data/spec/cassettes/Bukin_Bukget/returns_an_error_when_asked_for_a_file_that_does_not_exist.yml +61 -0
  25. data/spec/cassettes/Bukin_Bukget/returns_an_error_when_asked_for_a_resource_that_doese_not_exist.yml +43 -0
  26. data/spec/cassettes/Bukin_Bukget/returns_an_error_when_asked_for_a_version_that_doese_not_exist.yml +435 -0
  27. data/spec/cassettes/Bukin_BukkitDl/chooses_the_first_file_when_there_are_multiple_files.yml +59 -0
  28. data/spec/cassettes/Bukin_BukkitDl/installs_a_specific_version_of_a_resource.yml +59 -0
  29. data/spec/cassettes/Bukin_BukkitDl/installs_the_latest_version_of_a_resource.yml +59 -0
  30. data/spec/cassettes/Bukin_BukkitDl/returns_an_error_when_asked_for_a_file_that_does_not_exist.yml +59 -0
  31. data/spec/cassettes/Bukin_BukkitDl/returns_an_error_when_asked_for_a_resource_that_doese_not_exist.yml +128 -0
  32. data/spec/cassettes/Bukin_BukkitDl/returns_an_error_when_asked_for_a_version_that_doese_not_exist.yml +128 -0
  33. data/spec/cassettes/Bukin_Jenkins/chooses_the_first_file_when_there_are_multiple_files.yml +50 -0
  34. data/spec/cassettes/Bukin_Jenkins/installs_a_specific_version_of_a_resource.yml +50 -0
  35. data/spec/cassettes/Bukin_Jenkins/installs_the_latest_version_of_a_resource.yml +49 -0
  36. data/spec/cassettes/Bukin_Jenkins/returns_an_error_when_asked_for_a_file_that_does_not_exist.yml +50 -0
  37. data/spec/cassettes/Bukin_Jenkins/returns_an_error_when_asked_for_a_resource_that_doese_not_exist.yml +59 -0
  38. data/spec/cassettes/Bukin_Jenkins/returns_an_error_when_asked_for_a_version_that_does_not_exist.yml +59 -0
  39. data/spec/file_match_spec.rb +39 -0
  40. data/spec/installer_spec.rb +0 -1
  41. data/spec/jenkins_spec.rb +61 -0
  42. data/spec/lockfile_spec.rb +8 -8
  43. data/spec/spec_helper.rb +10 -0
  44. metadata +57 -26
  45. data/lib/bukin/exceptions.rb +0 -5
  46. data/lib/bukin/friendly_errors.rb +0 -22
  47. data/lib/bukin/providers/bukget.rb +0 -54
  48. data/lib/bukin/providers/bukkit_dl.rb +0 -29
  49. data/lib/bukin/providers/jenkins.rb +0 -40
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ci.md-5.net/job/spigot/1000/api/json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - cloudflare-nginx
21
+ Date:
22
+ - Wed, 13 Nov 2013 13:34:29 GMT
23
+ Content-Type:
24
+ - application/json;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=d023c4ab18d7b18e89b84e2e16e359ec01384349669268; expires=Mon, 23-Dec-2019
31
+ 23:50:00 GMT; path=/; domain=.md-5.net; HttpOnly
32
+ X-Jenkins:
33
+ - '1.533'
34
+ X-Jenkins-Session:
35
+ - e5616afa
36
+ X-Powered-By:
37
+ - Servlet/2.5 (Winstone/0.9.10)
38
+ Cf-Ray:
39
+ - ccbd6f8ef580502
40
+ body:
41
+ encoding: US-ASCII
42
+ string: ! '{"actions":[{"causes":[{"shortDescription":"Started by GitHub push
43
+ by md-5"}]},{},{"buildsByBranchName":{"origin/master":{"buildNumber":1000,"buildResult":null,"revision":{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","branch":[{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","name":"origin/master"}]}}},"lastBuiltRevision":{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","branch":[{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","name":"origin/master"}]},"remoteUrls":["https://github.com/EcoCityCraft/Spigot.git"],"scmName":""},{},{},{"failCount":0,"skipCount":0,"totalCount":5152,"urlName":"testReport"},{},{"level":null,"levelValue":0}],"artifacts":[{"displayPath":"spigot-1.6.1-R0.1-SNAPSHOT.jar","fileName":"spigot-1.6.1-R0.1-SNAPSHOT.jar","relativePath":"Spigot-Server/target/spigot-1.6.1-R0.1-SNAPSHOT.jar"},{"displayPath":"spigot.jar","fileName":"spigot.jar","relativePath":"Spigot-Server/target/spigot.jar"}],"building":false,"description":null,"duration":59650,"estimatedDuration":72188,"executor":null,"fullDisplayName":"Spigot
44
+ #1000","id":"2013-07-04_20-43-08","keepLog":false,"number":1000,"result":"SUCCESS","timestamp":1372984988000,"url":"http://ci.md-5.net/job/spigot/1000/","builtOn":"","changeSet":{"items":[{"affectedPaths":["CraftBukkit-Patches/0058-Entity-Mount-and-Dismount-Events.patch"],"commitId":"b9b585c433429807ff4a60b6bf6e1411088a1a21","timestamp":1372985078000,"author":{"absoluteUrl":"http://ci.md-5.net/user/md_5","fullName":"md_5"},"comment":"Prevent
45
+ crash on dismount, thanks Soledge for the report!\n","date":"2013-07-04 20:44:38
46
+ +1000","id":"b9b585c433429807ff4a60b6bf6e1411088a1a21","msg":"Prevent crash
47
+ on dismount, thanks Soledge for the report!","paths":[{"editType":"edit","file":"CraftBukkit-Patches/0058-Entity-Mount-and-Dismount-Events.patch"}]}],"kind":"git"},"culprits":[{"absoluteUrl":"http://ci.md-5.net/user/md_5","fullName":"md_5"}],"mavenArtifacts":null,"mavenVersionUsed":"3.0.4"}'
48
+ http_version:
49
+ recorded_at: Wed, 13 Nov 2013 13:34:29 GMT
50
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ci.md-5.net/job/spigot/1000/api/json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - cloudflare-nginx
21
+ Date:
22
+ - Wed, 13 Nov 2013 13:34:29 GMT
23
+ Content-Type:
24
+ - application/json;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=de193df05cbfcf505dcb10d372df6bc0a1384349668965; expires=Mon, 23-Dec-2019
31
+ 23:50:00 GMT; path=/; domain=.md-5.net; HttpOnly
32
+ X-Jenkins:
33
+ - '1.533'
34
+ X-Jenkins-Session:
35
+ - e5616afa
36
+ X-Powered-By:
37
+ - Servlet/2.5 (Winstone/0.9.10)
38
+ Cf-Ray:
39
+ - ccbd6f702ff0508
40
+ body:
41
+ encoding: US-ASCII
42
+ string: ! '{"actions":[{"causes":[{"shortDescription":"Started by GitHub push
43
+ by md-5"}]},{},{"buildsByBranchName":{"origin/master":{"buildNumber":1000,"buildResult":null,"revision":{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","branch":[{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","name":"origin/master"}]}}},"lastBuiltRevision":{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","branch":[{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","name":"origin/master"}]},"remoteUrls":["https://github.com/EcoCityCraft/Spigot.git"],"scmName":""},{},{},{"failCount":0,"skipCount":0,"totalCount":5152,"urlName":"testReport"},{},{"level":null,"levelValue":0}],"artifacts":[{"displayPath":"spigot-1.6.1-R0.1-SNAPSHOT.jar","fileName":"spigot-1.6.1-R0.1-SNAPSHOT.jar","relativePath":"Spigot-Server/target/spigot-1.6.1-R0.1-SNAPSHOT.jar"},{"displayPath":"spigot.jar","fileName":"spigot.jar","relativePath":"Spigot-Server/target/spigot.jar"}],"building":false,"description":null,"duration":59650,"estimatedDuration":72188,"executor":null,"fullDisplayName":"Spigot
44
+ #1000","id":"2013-07-04_20-43-08","keepLog":false,"number":1000,"result":"SUCCESS","timestamp":1372984988000,"url":"http://ci.md-5.net/job/spigot/1000/","builtOn":"","changeSet":{"items":[{"affectedPaths":["CraftBukkit-Patches/0058-Entity-Mount-and-Dismount-Events.patch"],"commitId":"b9b585c433429807ff4a60b6bf6e1411088a1a21","timestamp":1372985078000,"author":{"absoluteUrl":"http://ci.md-5.net/user/md_5","fullName":"md_5"},"comment":"Prevent
45
+ crash on dismount, thanks Soledge for the report!\n","date":"2013-07-04 20:44:38
46
+ +1000","id":"b9b585c433429807ff4a60b6bf6e1411088a1a21","msg":"Prevent crash
47
+ on dismount, thanks Soledge for the report!","paths":[{"editType":"edit","file":"CraftBukkit-Patches/0058-Entity-Mount-and-Dismount-Events.patch"}]}],"kind":"git"},"culprits":[{"absoluteUrl":"http://ci.md-5.net/user/md_5","fullName":"md_5"}],"mavenArtifacts":null,"mavenVersionUsed":"3.0.4"}'
48
+ http_version:
49
+ recorded_at: Wed, 13 Nov 2013 13:34:29 GMT
50
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ci.md-5.net/job/spigot/lastSuccessfulBuild/api/json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - cloudflare-nginx
21
+ Date:
22
+ - Wed, 13 Nov 2013 13:34:28 GMT
23
+ Content-Type:
24
+ - application/json;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=ddb8735198bef7856bc72cac724508e711384349668679; expires=Mon, 23-Dec-2019
31
+ 23:50:00 GMT; path=/; domain=.md-5.net; HttpOnly
32
+ X-Jenkins:
33
+ - '1.533'
34
+ X-Jenkins-Session:
35
+ - e5616afa
36
+ X-Powered-By:
37
+ - Servlet/2.5 (Winstone/0.9.10)
38
+ Cf-Ray:
39
+ - ccbd6f536ba0502
40
+ body:
41
+ encoding: US-ASCII
42
+ string: ! '{"actions":[{"causes":[{"shortDescription":"Started by GitHub push
43
+ by md-5"}]},{},{"buildsByBranchName":{"origin/master":{"buildNumber":1136,"buildResult":null,"revision":{"SHA1":"cdbe22b7c79b516e2741d2aead1555891bb1603c","branch":[{"SHA1":"cdbe22b7c79b516e2741d2aead1555891bb1603c","name":"origin/master"}]}}},"lastBuiltRevision":{"SHA1":"cdbe22b7c79b516e2741d2aead1555891bb1603c","branch":[{"SHA1":"cdbe22b7c79b516e2741d2aead1555891bb1603c","name":"origin/master"}]},"remoteUrls":["https://github.com/SpigotMC/Spigot.git"],"scmName":""},{},{},{"failCount":0,"skipCount":3,"totalCount":5159,"urlName":"testReport"},{},{"level":null,"levelValue":0}],"artifacts":[{"displayPath":"spigot-1.6.4-R2.1-SNAPSHOT.jar","fileName":"spigot-1.6.4-R2.1-SNAPSHOT.jar","relativePath":"Spigot-Server/target/spigot-1.6.4-R2.1-SNAPSHOT.jar"},{"displayPath":"spigot.jar","fileName":"spigot.jar","relativePath":"Spigot-Server/target/spigot.jar"}],"building":false,"description":null,"duration":75160,"estimatedDuration":72188,"executor":null,"fullDisplayName":"Spigot
44
+ #1136","id":"2013-11-04_18-24-23","keepLog":false,"number":1136,"result":"SUCCESS","timestamp":1383607463000,"url":"http://ci.md-5.net/job/spigot/1136/","builtOn":"","changeSet":{"items":[{"affectedPaths":["Bukkit","Bukkit-Patches/0001-POM-Changes.patch","CraftBukkit-Patches/0001-POM-Changes.patch","CraftBukkit","CraftBukkit-Patches/0043-Do-Not-Search-for-Offline-Players.patch","CraftBukkit-Patches/0033-Close-Unloaded-Save-Files.patch","CraftBukkit-Patches/0047-Allow-Disabling-of-Command-TabComplete.patch"],"commitId":"cdbe22b7c79b516e2741d2aead1555891bb1603c","timestamp":1383608794000,"author":{"absoluteUrl":"http://ci.md-5.net/user/md_5","fullName":"md_5"},"comment":"Update
45
+ master to R2 as well.\n","date":"2013-11-04 18:46:34 +1100","id":"cdbe22b7c79b516e2741d2aead1555891bb1603c","msg":"Update
46
+ master to R2 as well.","paths":[{"editType":"edit","file":"CraftBukkit-Patches/0001-POM-Changes.patch"},{"editType":"edit","file":"Bukkit-Patches/0001-POM-Changes.patch"},{"editType":"edit","file":"CraftBukkit-Patches/0033-Close-Unloaded-Save-Files.patch"},{"editType":"edit","file":"Bukkit"},{"editType":"edit","file":"CraftBukkit-Patches/0043-Do-Not-Search-for-Offline-Players.patch"},{"editType":"edit","file":"CraftBukkit-Patches/0047-Allow-Disabling-of-Command-TabComplete.patch"},{"editType":"edit","file":"CraftBukkit"}]}],"kind":"git"},"culprits":[{"absoluteUrl":"http://ci.md-5.net/user/md_5","fullName":"md_5"}],"mavenArtifacts":null,"mavenVersionUsed":"3.0.4"}'
47
+ http_version:
48
+ recorded_at: Wed, 13 Nov 2013 13:34:28 GMT
49
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ci.md-5.net/job/spigot/1000/api/json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - cloudflare-nginx
21
+ Date:
22
+ - Wed, 13 Nov 2013 13:34:27 GMT
23
+ Content-Type:
24
+ - application/json;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=da9b24c4e8ad9023960f4b0802d4a778b1384349667748; expires=Mon, 23-Dec-2019
31
+ 23:50:00 GMT; path=/; domain=.md-5.net; HttpOnly
32
+ X-Jenkins:
33
+ - '1.533'
34
+ X-Jenkins-Session:
35
+ - e5616afa
36
+ X-Powered-By:
37
+ - Servlet/2.5 (Winstone/0.9.10)
38
+ Cf-Ray:
39
+ - ccbd6ef6a400502
40
+ body:
41
+ encoding: US-ASCII
42
+ string: ! '{"actions":[{"causes":[{"shortDescription":"Started by GitHub push
43
+ by md-5"}]},{},{"buildsByBranchName":{"origin/master":{"buildNumber":1000,"buildResult":null,"revision":{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","branch":[{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","name":"origin/master"}]}}},"lastBuiltRevision":{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","branch":[{"SHA1":"b9b585c433429807ff4a60b6bf6e1411088a1a21","name":"origin/master"}]},"remoteUrls":["https://github.com/EcoCityCraft/Spigot.git"],"scmName":""},{},{},{"failCount":0,"skipCount":0,"totalCount":5152,"urlName":"testReport"},{},{"level":null,"levelValue":0}],"artifacts":[{"displayPath":"spigot-1.6.1-R0.1-SNAPSHOT.jar","fileName":"spigot-1.6.1-R0.1-SNAPSHOT.jar","relativePath":"Spigot-Server/target/spigot-1.6.1-R0.1-SNAPSHOT.jar"},{"displayPath":"spigot.jar","fileName":"spigot.jar","relativePath":"Spigot-Server/target/spigot.jar"}],"building":false,"description":null,"duration":59650,"estimatedDuration":72188,"executor":null,"fullDisplayName":"Spigot
44
+ #1000","id":"2013-07-04_20-43-08","keepLog":false,"number":1000,"result":"SUCCESS","timestamp":1372984988000,"url":"http://ci.md-5.net/job/spigot/1000/","builtOn":"","changeSet":{"items":[{"affectedPaths":["CraftBukkit-Patches/0058-Entity-Mount-and-Dismount-Events.patch"],"commitId":"b9b585c433429807ff4a60b6bf6e1411088a1a21","timestamp":1372985078000,"author":{"absoluteUrl":"http://ci.md-5.net/user/md_5","fullName":"md_5"},"comment":"Prevent
45
+ crash on dismount, thanks Soledge for the report!\n","date":"2013-07-04 20:44:38
46
+ +1000","id":"b9b585c433429807ff4a60b6bf6e1411088a1a21","msg":"Prevent crash
47
+ on dismount, thanks Soledge for the report!","paths":[{"editType":"edit","file":"CraftBukkit-Patches/0058-Entity-Mount-and-Dismount-Events.patch"}]}],"kind":"git"},"culprits":[{"absoluteUrl":"http://ci.md-5.net/user/md_5","fullName":"md_5"}],"mavenArtifacts":null,"mavenVersionUsed":"3.0.4"}'
48
+ http_version:
49
+ recorded_at: Wed, 13 Nov 2013 13:34:27 GMT
50
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ci.md-5.net/job/missing-name/lastSuccessfulBuild/api/json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 404
17
+ message: Not Found
18
+ headers:
19
+ Server:
20
+ - cloudflare-nginx
21
+ Date:
22
+ - Wed, 13 Nov 2013 13:34:28 GMT
23
+ Content-Type:
24
+ - text/html;charset=ISO-8859-1
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=d4294a426679092bed169dc605b3a08f91384349668389; expires=Mon, 23-Dec-2019
31
+ 23:50:00 GMT; path=/; domain=.md-5.net; HttpOnly
32
+ X-Powered-By:
33
+ - Servlet/2.5 (Winstone/0.9.10)
34
+ Cf-Ray:
35
+ - ccbd6f36f420502
36
+ body:
37
+ encoding: US-ASCII
38
+ string: ! '<html><head><title>Error 404</title></head><body bgcolor="#ffffff"><script
39
+ type="text/javascript">
40
+
41
+ //<![CDATA[
42
+
43
+ new Image().src = "/cdn-cgi/ping?cf%5blocation%5d=404&cf%5bjs%5d=1";
44
+
45
+ //]]>
46
+
47
+ </script>
48
+
49
+ <noscript>
50
+
51
+ <img src="/cdn-cgi/ping?cf%5blocation%5d=404&amp;cf%5bjs%5d=0" alt=""/>
52
+
53
+ </noscript><h1>Status Code: 404</h1>Exception: <br>Stacktrace: <pre>(none)
54
+
55
+ </pre><br><hr size="1" width="90%"><i>Generated by Winstone Servlet Engine
56
+ v0.9.10 at Wed Nov 13 08:11:34 EST 2013</i></body></html>'
57
+ http_version:
58
+ recorded_at: Wed, 13 Nov 2013 13:34:28 GMT
59
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ci.md-5.net/job/spigot/99999999/api/json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 404
17
+ message: Not Found
18
+ headers:
19
+ Server:
20
+ - cloudflare-nginx
21
+ Date:
22
+ - Wed, 13 Nov 2013 13:34:28 GMT
23
+ Content-Type:
24
+ - text/html;charset=ISO-8859-1
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=d7038afcc263318f0c283816b9d78396a1384349668073; expires=Mon, 23-Dec-2019
31
+ 23:50:00 GMT; path=/; domain=.md-5.net; HttpOnly
32
+ X-Powered-By:
33
+ - Servlet/2.5 (Winstone/0.9.10)
34
+ Cf-Ray:
35
+ - ccbd6f178eb0502
36
+ body:
37
+ encoding: US-ASCII
38
+ string: ! '<html><head><title>Error 404</title></head><body bgcolor="#ffffff"><script
39
+ type="text/javascript">
40
+
41
+ //<![CDATA[
42
+
43
+ new Image().src = "/cdn-cgi/ping?cf%5blocation%5d=404&cf%5bjs%5d=1";
44
+
45
+ //]]>
46
+
47
+ </script>
48
+
49
+ <noscript>
50
+
51
+ <img src="/cdn-cgi/ping?cf%5blocation%5d=404&amp;cf%5bjs%5d=0" alt=""/>
52
+
53
+ </noscript><h1>Status Code: 404</h1>Exception: <br>Stacktrace: <pre>(none)
54
+
55
+ </pre><br><hr size="1" width="90%"><i>Generated by Winstone Servlet Engine
56
+ v0.9.10 at Wed Nov 13 08:11:34 EST 2013</i></body></html>'
57
+ http_version:
58
+ recorded_at: Wed, 13 Nov 2013 13:34:28 GMT
59
+ recorded_with: VCR 2.7.0
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+ require 'bukin'
3
+
4
+ describe Bukin::FileMatch do
5
+ it 'matches anything passed to it' do
6
+ match = Bukin::FileMatch.any
7
+ match.should =~ 'filename.jar'
8
+ match.should =~ 'another-file-name.jar'
9
+ match.should =~ 'yet_another.zip'
10
+ end
11
+
12
+ it 'matches a string' do
13
+ match = Bukin::FileMatch.new('filename.jar')
14
+ match.should =~ 'filename.jar'
15
+ match.should_not =~ 'another-file-name.jar'
16
+ match.should_not =~ 'yet_another.zip'
17
+ end
18
+
19
+ it 'matches a regex' do
20
+ match = Bukin::FileMatch.new(/^.*\.jar$/)
21
+ match.should =~ 'filename.jar'
22
+ match.should =~ 'another-file-name.jar'
23
+ match.should_not =~ 'yet_another.zip'
24
+ end
25
+
26
+ it 'matches an array of matches' do
27
+ match = Bukin::FileMatch.new(['filename.jar', 'another-file-name.jar'])
28
+ match.should =~ 'filename.jar'
29
+ match.should =~ 'another-file-name.jar'
30
+ match.should_not =~ 'yet_another.zip'
31
+ end
32
+
33
+ it 'matches none for other types' do
34
+ match = Bukin::FileMatch.new(:filename)
35
+ match.should_not =~ 'filename.jar'
36
+ match.should_not =~ 'another-file-name.jar'
37
+ match.should_not =~ 'yet_another.zip'
38
+ end
39
+ end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'bukin'
3
3
  require 'bukin/installer'
4
- require 'bukin/exceptions'
5
4
 
6
5
  describe Bukin::Installer do
7
6
  describe :get_match do
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+ require 'bukin'
3
+ require 'bukin/file_match'
4
+
5
+ describe Bukin::Jenkins, :vcr do
6
+ before do
7
+ # Sorry md_5, but I'm using you for my integration tests
8
+ @url = 'http://ci.md-5.net'
9
+ @name = 'spigot'
10
+ @version = 'build-1000'
11
+ @download = 'http://ci.md-5.net/job/spigot/1000/artifact/Spigot-Server/'\
12
+ 'target/spigot-1.6.1-R0.1-SNAPSHOT.jar'
13
+ @missing_name = 'missing-name'
14
+ @missing_version = 'build-99999999'
15
+ @missing_file = 'missing-file.jar'
16
+ @latest_version = 'build-1136'
17
+ end
18
+
19
+ it 'installs the latest version of a resource' do
20
+ provider = Bukin::Jenkins.new(@url)
21
+ version, download = provider.find(name: @name)
22
+
23
+ version.should == @latest_version
24
+ end
25
+
26
+ it 'installs a specific version of a resource' do
27
+ provider = Bukin::Jenkins.new(@url)
28
+ version, download = provider.find(name: @name, version: @version)
29
+
30
+ version.should == @version
31
+ download.should == @download
32
+ end
33
+
34
+ it 'returns an error when asked for a resource that doese not exist' do
35
+ provider = Bukin::Jenkins.new(@url)
36
+ expect do
37
+ provider.find(name: @missing_name)
38
+ end.to raise_error(Bukin::NoDownloadError)
39
+ end
40
+
41
+ it 'returns an error when asked for a version that does not exist' do
42
+ provider = Bukin::Jenkins.new(@url)
43
+ expect do
44
+ provider.find(name: @name, version: @missing_version)
45
+ end.to raise_error(Bukin::NoDownloadError)
46
+ end
47
+
48
+ it 'returns an error when asked for a file that does not exist' do
49
+ provider = Bukin::Jenkins.new(@url)
50
+ expect do
51
+ provider.find(name: @name, version: @version, file: @missing_file)
52
+ end.to raise_error(Bukin::NoDownloadError)
53
+ end
54
+
55
+ it 'chooses the first file when there are multiple files' do
56
+ provider = Bukin::Jenkins.new(@url)
57
+ version, download = provider.find(name: @name, version: @version)
58
+
59
+ download.should == @download
60
+ end
61
+ end
@@ -4,17 +4,17 @@ require 'fakefs/safe'
4
4
  require 'yaml'
5
5
 
6
6
  describe Bukin::Lockfile do
7
-
8
- before(:each) {File.delete(PATH) if File.exist?(PATH)}
9
- after(:all) {FakeFS.deactivate!}
10
7
  before(:all) do
11
8
  FakeFS.activate!
12
- PATH = File.join(Dir.pwd, Bukin::Lockfile::FILE_NAME)
9
+ @path = File.join(Dir.pwd, Bukin::Lockfile::FILE_NAME)
13
10
  end
14
11
 
12
+ before(:each) {File.delete(@path) if File.exist?(@path)}
13
+ after(:all) {FakeFS.deactivate!}
14
+
15
15
  it 'assignes a default path if none is provided' do
16
16
  lockfile = Bukin::Lockfile.new
17
- lockfile.path.should == PATH
17
+ lockfile.path.should == @path
18
18
  end
19
19
 
20
20
  it 'assignes the path provided in the constructor' do
@@ -30,7 +30,7 @@ describe Bukin::Lockfile do
30
30
  it 'loads resources from an already existing lockfile' do
31
31
  resources = { 'resources' => 'value' }
32
32
 
33
- File.open(PATH, 'w') {|file| file.write resources.to_yaml}
33
+ File.open(@path, 'w') {|file| file.write resources.to_yaml}
34
34
 
35
35
  lockfile = Bukin::Lockfile.new
36
36
  lockfile.resources.should == 'value'
@@ -46,7 +46,7 @@ describe Bukin::Lockfile do
46
46
  lockfile.save
47
47
 
48
48
  path = File.join
49
- data = YAML::load_file(PATH)
49
+ data = YAML::load_file(@path)
50
50
  data.should == {
51
51
  'resources' => {
52
52
  'resource_name' => {
@@ -56,7 +56,7 @@ describe Bukin::Lockfile do
56
56
  }
57
57
  }
58
58
 
59
- File.delete(PATH)
59
+ File.delete(@path)
60
60
  lockfile = Bukin::Lockfile.new
61
61
  lockfile.resources.should == {}
62
62
  end