jenkins_shell 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/jsh +3 -0
- data/lib/jenkins_shell/error/connection_refused.rb +5 -0
- data/lib/jenkins_shell/error/invalid_html_received.rb +5 -0
- data/lib/jenkins_shell/error.rb +5 -0
- data/lib/jenkins_shell.rb +20 -8
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b75e3e5e33e080ce9171c0b0ee8db6516c0ac65caf40f6439f2ab29d46a8f48
|
4
|
+
data.tar.gz: 8d6e7aa40827b25a6c0ae21be8189aa91e2117100578a033dadfbb8d9adab657
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac037325b5a840fb70578e5dc11705b22d21653d0f26e8d8cae5afb550220d483076d4e992c137cbc7260fe5626a3a3d6eb0443fc8acf79caeae6bce598aa6fa
|
7
|
+
data.tar.gz: 317538957c5d1f4d0d4e16f170926d0e67cca4612652cf1acaeba0406030fac8cd3096e006274f72e359d16d4fc8ad08c8e5224ba2c919e0c85394ae81c9b4e6
|
data/bin/jsh
CHANGED
@@ -115,6 +115,9 @@ rescue Interrupt
|
|
115
115
|
rescue Errno::EPIPE
|
116
116
|
# Do nothing. This can happen if piping to another program such as
|
117
117
|
# less. Usually if less is closed before we're done with STDOUT.
|
118
|
+
rescue JenkinsShell::Error => e
|
119
|
+
puts e.message
|
120
|
+
exit JShExit::EXCEPTION
|
118
121
|
rescue Exception => e
|
119
122
|
$stderr.puts "Oops! Looks like an error has occured! If the " \
|
120
123
|
"error persists, file a bug at:".wrap
|
data/lib/jenkins_shell.rb
CHANGED
@@ -26,14 +26,24 @@ class JenkinsShell
|
|
26
26
|
gs = "println(\"cmd /c cd #{fix} && #{cmd}\".execute().text)"
|
27
27
|
enc = URI::encode(URI::encode(gs), "&()/").gsub("%20", "+")
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
begin
|
30
|
+
# Establish connection and send script
|
31
|
+
http = Net::HTTP.new(@host, @port)
|
32
|
+
xml = REXML::Document.new(
|
33
|
+
http.post("/script", "script=#{enc}").body
|
34
|
+
)
|
35
|
+
|
36
|
+
# Parse response and return script output
|
37
|
+
return xml.get_elements("html/body/div/div/pre")[1].text
|
38
|
+
rescue Errno::ECONNREFUSED
|
39
|
+
raise JenkinsShell::Error::ConnectionRefused.new(
|
40
|
+
@host,
|
41
|
+
@port
|
42
|
+
)
|
43
|
+
rescue REXML::ParseException
|
44
|
+
raise JenkinsShell::Error::InvalidHTMLReceived.new
|
45
|
+
end
|
46
|
+
return ""
|
37
47
|
end
|
38
48
|
|
39
49
|
def initialize(host, port = 8080)
|
@@ -50,3 +60,5 @@ class JenkinsShell
|
|
50
60
|
return ""
|
51
61
|
end
|
52
62
|
end
|
63
|
+
|
64
|
+
require "jenkins_shell/error"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkins_shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -80,6 +80,9 @@ extra_rdoc_files: []
|
|
80
80
|
files:
|
81
81
|
- bin/jsh
|
82
82
|
- lib/jenkins_shell.rb
|
83
|
+
- lib/jenkins_shell/error.rb
|
84
|
+
- lib/jenkins_shell/error/connection_refused.rb
|
85
|
+
- lib/jenkins_shell/error/invalid_html_received.rb
|
83
86
|
- lib/jenkins_shell/wish/cd_wish.rb
|
84
87
|
- lib/jenkins_shell/wish/cmd_wish.rb
|
85
88
|
- lib/jenkins_shell/wish/ls_wish.rb
|