jenkins2-api 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb7adfa9fee666dfd820c9335817339c5811050a
4
- data.tar.gz: 935de4c49948e3366d473d3d9939b8b3f5d8ba1f
3
+ metadata.gz: 7818ba111c5d81543addda66980d367fc24c70a5
4
+ data.tar.gz: 3837cccb393319e4fd1229edd6858fb448b4da7f
5
5
  SHA512:
6
- metadata.gz: 039408941cef2b5ea1cb82305cd2fd966fa2e7b8c1a8593ce9590f120935890cfae8b08bbb3ccc84681fe9f8b7c24a49e14bcef42e3c2ecac4a240cace5236a5
7
- data.tar.gz: 7c2d3d47d2f2edb6694643075a4bfbcd5a1c1e37510ac960d32781e2c273d8ebe7e52d50cdb964d13ae918e681f3e2ff24d42236f5f6995439b18790daa30108
6
+ metadata.gz: 9955b2662594d644f7044f23a7458d4d0d12b70f880c1a914a4b0c21b7d03e1d79585d619247b634aab688a4af12df9158b2c83fbcf1d9b51688b5f4f7ea11f0
7
+ data.tar.gz: 1b028e3a5ddd4f9dd7c229a68c3e772c353d17a6647b2ab05f1a69eb4397123194ad62ebda9475799eb4fb7eff471f387be711bdd2e1f1d8c046b55a599ff50d
data/README.md CHANGED
@@ -138,6 +138,14 @@ client.configuration.plugin_install(
138
138
  client.configuration.safe_restart
139
139
  ```
140
140
 
141
+ From CLI:
142
+
143
+ ```
144
+ jenkins2api plugin list
145
+ jenkins2api plugin install 'Pipeline: Stage View Plugin' 'pipeline-stage-view'
146
+ jenkins2api system safe-restart
147
+ ```
148
+
141
149
  #### Trigger a build
142
150
 
143
151
  ```
data/bin/jenkins2api CHANGED
@@ -34,6 +34,18 @@ module Jenkins2API
34
34
  'node <command>',
35
35
  'Node related commands'
36
36
  )
37
+ register(
38
+ Jenkins2API::Command::Plugin,
39
+ 'plugin',
40
+ 'plugin <command>',
41
+ 'Plugins related commands'
42
+ )
43
+ register(
44
+ Jenkins2API::Command::System,
45
+ 'system',
46
+ 'system <command>',
47
+ 'System related commands'
48
+ )
37
49
  end
38
50
  end
39
51
  end
@@ -18,6 +18,12 @@ module Jenkins2API
18
18
 
19
19
  puts slave_name
20
20
  end
21
+
22
+ desc 'logs JOB_NAME BUILD_ID', 'Get the logs for a specific build'
23
+ # Retrieve logs for a specific job and join them by newline
24
+ def logs(name, build_id)
25
+ puts client.build.logtext_lines(name, build_id).join("\n")
26
+ end
21
27
  end
22
28
  end
23
29
  end
@@ -0,0 +1,32 @@
1
+ require 'thor'
2
+
3
+ module Jenkins2API
4
+ # Command module wraps all the cli commands
5
+ module Command
6
+ # Contains all the commands under +plugin+ namespace
7
+ class Plugin < Jenkins2API::ThorCommand
8
+ desc 'list', 'List plugins'
9
+ # List installed plugins
10
+ def list
11
+ puts "Legend:\n I Inactive\n U Update is available\n"
12
+
13
+ client.configuration.plugin_list.each do |plugin|
14
+ flag = ' '
15
+ flag = 'I' unless plugin['active']
16
+ flag = 'U' if plugin['hasUpdate']
17
+
18
+ printf(
19
+ " [%s] %s (%s@%s)\n", flag, plugin['longName'],
20
+ plugin['shortName'], plugin['version']
21
+ )
22
+ end
23
+ end
24
+
25
+ desc 'install PLUGIN_NAME PLUGIN_ID', 'Install a specific plugin'
26
+ # Install a plugin
27
+ def install(name, id)
28
+ client.configuration.plugin_install(name, id)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,15 @@
1
+ require 'thor'
2
+
3
+ module Jenkins2API
4
+ # Command module wraps all the cli commands
5
+ module Command
6
+ # Contains all the commands under +system+ namespace
7
+ class System < Jenkins2API::ThorCommand
8
+ desc 'safe-restart', 'Restart jenkins in safe mode'
9
+ # Install a plugin
10
+ def safe_restart
11
+ client.configuration.safe_restart
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Jenkins2API
2
2
  # Current version to publish
3
3
  # Gemspec also uses this constant
4
- VERSION = '1.0.14'.freeze
4
+ VERSION = '1.0.15'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins2-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.14
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Balazs Nadasdi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-03 00:00:00.000000000 Z
11
+ date: 2017-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -122,6 +122,8 @@ files:
122
122
  - lib/commands/build.rb
123
123
  - lib/commands/job.rb
124
124
  - lib/commands/node.rb
125
+ - lib/commands/plugin.rb
126
+ - lib/commands/system.rb
125
127
  - lib/endpoints/artifact.rb
126
128
  - lib/endpoints/base_endpoint.rb
127
129
  - lib/endpoints/build.rb