jenkins_api_client 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/.gitignore +3 -0
  2. data/.jenkins.yml +9 -0
  3. data/.travis.yml +11 -15
  4. data/CHANGELOG.md +15 -0
  5. data/Gemfile +2 -2
  6. data/README.md +7 -9
  7. data/Rakefile +27 -14
  8. data/lib/jenkins_api_client.rb +36 -6
  9. data/lib/jenkins_api_client/build_queue.rb +213 -0
  10. data/lib/jenkins_api_client/cli/base.rb +10 -6
  11. data/lib/jenkins_api_client/cli/helper.rb +13 -4
  12. data/lib/jenkins_api_client/cli/job.rb +6 -9
  13. data/lib/jenkins_api_client/cli/node.rb +6 -4
  14. data/lib/jenkins_api_client/cli/system.rb +2 -1
  15. data/lib/jenkins_api_client/client.rb +31 -25
  16. data/lib/jenkins_api_client/job.rb +248 -95
  17. data/lib/jenkins_api_client/node.rb +128 -10
  18. data/lib/jenkins_api_client/system.rb +4 -2
  19. data/lib/jenkins_api_client/version.rb +2 -2
  20. data/lib/jenkins_api_client/view.rb +17 -4
  21. data/scripts/login_with_irb.rb +4 -3
  22. data/spec/func_tests/client_spec.rb +90 -0
  23. data/spec/func_tests/job_spec.rb +348 -0
  24. data/spec/func_tests/node_spec.rb +174 -0
  25. data/spec/{spec_helper.rb → func_tests/spec_helper.rb} +2 -2
  26. data/spec/func_tests/system_spec.rb +55 -0
  27. data/spec/func_tests/view_spec.rb +53 -0
  28. data/spec/unit_tests/client_spec.rb +211 -0
  29. data/spec/unit_tests/fixtures/files/computer_sample.xml +17 -0
  30. data/spec/unit_tests/fixtures/files/job_sample.xml +16 -0
  31. data/spec/unit_tests/job_spec.rb +355 -0
  32. data/spec/unit_tests/node_spec.rb +192 -0
  33. data/spec/unit_tests/spec_helper.rb +8 -0
  34. data/spec/unit_tests/system_spec.rb +54 -0
  35. data/spec/unit_tests/view_spec.rb +127 -0
  36. metadata +34 -23
  37. data/spec/client_spec.rb +0 -52
  38. data/spec/job_spec.rb +0 -158
  39. data/spec/node_spec.rb +0 -48
  40. data/spec/system_spec.rb +0 -46
data/spec/node_spec.rb DELETED
@@ -1,48 +0,0 @@
1
- #
2
- # Specifying JenkinsApi::Client::Node class capabilities
3
- # Author Kannan Manickam <arangamani.kannan@gmail.com>
4
- #
5
-
6
- require File.expand_path('../spec_helper', __FILE__)
7
- require 'yaml'
8
-
9
- describe JenkinsApi::Client::Node do
10
- context "With properly initialized client" do
11
- before(:all) do
12
- @creds_file = '~/.jenkins_api_client/login.yml'
13
- @node_name = 'master'
14
- begin
15
- @client = JenkinsApi::Client.new(YAML.load_file(File.expand_path(@creds_file, __FILE__)))
16
- rescue Exception => e
17
- puts "WARNING: Credentials are not set properly."
18
- puts e.message
19
- end
20
- end
21
-
22
- it "Should be able to list all nodes" do
23
- @client.node.list.class.should == Array
24
- end
25
-
26
- it "Should be able to list all general attributes" do
27
- node_attributes = JenkinsApi::Client::Node::GENERAL_ATTRIBUTES
28
- node_attributes.each do |attr|
29
- @client.node.method("get_#{attr}").call
30
- end
31
- end
32
-
33
- it "Should be able to list all node properties" do
34
- node_properties = JenkinsApi::Client::Node::NODE_PROPERTIES
35
- node_properties.each do |property|
36
- @client.node.method("is_#{property}?").call(@node_name)
37
- end
38
- end
39
-
40
- it "Should be able to list all node attributes" do
41
- node_attributes = JenkinsApi::Client::Node::NODE_ATTRIBUTES
42
- node_attributes.each do |attr|
43
- @client.node.method("get_node_#{attr}").call(@node_name)
44
- end
45
- end
46
-
47
- end
48
- end
data/spec/system_spec.rb DELETED
@@ -1,46 +0,0 @@
1
- #
2
- # Specifying JenkinsApi::Client::System class capabilities
3
- # Author: Kannan Manickam <arangamani.kannan@gmail.com>
4
- #
5
-
6
- require File.expand_path('../spec_helper', __FILE__)
7
- require 'yaml'
8
-
9
- describe JenkinsApi::Client::System do
10
- context "With properly initialized client" do
11
- before(:all) do
12
- @creds_file = '~/.jenkins_api_client/login.yml'
13
- begin
14
- @client = JenkinsApi::Client.new(YAML.load_file(File.expand_path(@creds_file, __FILE__)))
15
- rescue Exception => e
16
- puts "WARNING: Credentials are not set properly."
17
- puts e.message
18
- end
19
- end
20
-
21
- it "Should be able to quiet down a Jenkins server" do
22
- @client.system.quiet_down.to_i.should == 302
23
- end
24
-
25
- it "Should be able to cancel the quiet down a Jenkins server" do
26
- @client.system.cancel_quiet_down.to_i.should == 302
27
- end
28
-
29
- it "Should be able to restart a Jenkins server safely" do
30
- @client.system.restart.to_i.should == 302
31
- end
32
-
33
- it "Should be able to wait after a safe restart" do
34
- @client.system.wait_for_ready.should == true
35
- end
36
-
37
- it "Should be able to force restart a Jenkins server" do
38
- @client.system.restart(true).to_i.should == 302
39
- end
40
-
41
- it "Should be able to wait after a force restart" do
42
- @client.system.wait_for_ready.should == true
43
- end
44
-
45
- end
46
- end