improved_jenkins_client 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,65 @@
1
+ #
2
+ # Copyright (c) 2012-2013 Kannan Manickam <arangamani.kannan@gmail.com>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #
22
+
23
+ require 'thor'
24
+ require 'thor/group'
25
+
26
+ module JenkinsApi
27
+ module CLI
28
+ # This class provides various command line operations to System class.
29
+ class System < Thor
30
+ include Thor::Actions
31
+
32
+ desc "quietdown", "Puts the Jenkins server in Quiet down mode"
33
+ # CLI command that puts Jenkins in Quiet Down mode
34
+ def quietdown
35
+ @client = Helper.setup(parent_options)
36
+ @client.system.quiet_down
37
+ end
38
+
39
+ desc "cancel_quietdown", "Cancels the Quiet down mode of Jenkins server"
40
+ # CLI command that cancels Jenkins from Quiet Down mode
41
+ def cancel_quietdown
42
+ @client = Helper.setup(parent_options)
43
+ @client.system.cancel_quiet_down
44
+ end
45
+
46
+ desc "reload", "Reload Jenkins server"
47
+ # CLI command to reload Jenkins configuration from disk
48
+ def reload
49
+ @client = Helper.setup(parent_options)
50
+ @client.system.reload
51
+ end
52
+
53
+ desc "restart", "Restarts the Jenkins server"
54
+ method_option :force, :type => :boolean, :aliases => "-s",
55
+ :desc => "Force restart"
56
+ # CLI command to (force) restart Jenkins
57
+ def restart
58
+ @client = Helper.setup(parent_options)
59
+ force = options[:force] ? true : false
60
+ @client.system.restart(force)
61
+ end
62
+
63
+ end
64
+ end
65
+ end