jenkins_shell 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/jsh +6 -0
  3. data/lib/jenkins_shell.rb +12 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a3c4e6f5e959d87ca2844c64a33796acd3f451ab3a539f9753ddcc3c513d79f
4
- data.tar.gz: 18488798eeaf5089518edfd2d99318a388b28d7e1a555769fa140682e4f5fb91
3
+ metadata.gz: 312770d8559331c1c1c690d8d951379fba91f3a4e9485c6943924dcc4e1ae66d
4
+ data.tar.gz: ec496b9f0adae39a2f5957f6a4e22679fef0ae7ce0e8ae6bac57ea83dc6ae218
5
5
  SHA512:
6
- metadata.gz: bb5d6ca84706904c59e0626eaa60e91e3e536558dc3fa37103b301a65fe608af89f7fa5972a6e5c74bf0f548dabe3cf7e3e08cc80ca631de71629d017396a6f4
7
- data.tar.gz: 447d92effb45eb20436baa27f5da20811aa23a8d7ac18dbdb81c853a6fb73588385857043747c8fe9e5d09aee823cca9f37f409f87dd89ec7162724a4ed56ee5
6
+ metadata.gz: cde7c76edd18478d4d3160106d86a8daa15e5e492784e0ff1743fe82cee190086f2b13866fedcb9e5558f7a072bc5f9c681f8d030475be4220b5fc0612219343
7
+ data.tar.gz: 9ce975b9adc01fe55d8c2bc67d6cb69061404935cbd50868f6d911628137f74fdf1043115a4f01f2d2264b052565ec4a82ed5cdfe1fe98a434391ca0d5c503be
data/bin/jsh CHANGED
@@ -27,6 +27,7 @@ def parse(args)
27
27
  options = Hash.new
28
28
  options["password"] = nil
29
29
  options["port"] = "8080"
30
+ options["ssl"] = false
30
31
  options["username"] = nil
31
32
  options["verbose"] = false
32
33
 
@@ -69,6 +70,10 @@ def parse(args)
69
70
  options["port"] = port
70
71
  end
71
72
 
73
+ opts.on("-s", "--ssl", "Use TLS/SSL") do
74
+ options["ssl"] = true
75
+ end
76
+
72
77
  opts.on("-u", "--user=USER", "Use specified username") do |u|
73
78
  options["username"] = u
74
79
  end
@@ -123,6 +128,7 @@ begin
123
128
  jsh = JenkinsShell.new(
124
129
  options["host"],
125
130
  options["port"],
131
+ options["ssl"],
126
132
  options["username"],
127
133
  passwd
128
134
  )
@@ -51,6 +51,7 @@ class JenkinsShell
51
51
  begin
52
52
  # Establish connection
53
53
  http = Net::HTTP.new(@host, @port)
54
+ http.use_ssl = @ssl
54
55
 
55
56
  # Create request
56
57
  req = Net::HTTP::Get.new(path)
@@ -78,14 +79,23 @@ class JenkinsShell
78
79
  end
79
80
  private :get
80
81
 
81
- def initialize(host, port = 8080, username = nil, password = nil)
82
+ def initialize(
83
+ host,
84
+ port = 8080,
85
+ ssl = false,
86
+ username = nil,
87
+ password = nil
88
+ )
82
89
  @cookie = nil
83
90
  @crumb = nil
84
91
  @int_cwd = "."
85
92
  @host = host.gsub(/^https?:\/\/|(:[0-9]+)?\/.+/, "")
86
93
  @password = password
87
94
  @port = port
95
+ @ssl = ssl
88
96
  @username = username
97
+
98
+ # Initialize @cwd
89
99
  @cwd = pwd
90
100
  end
91
101
 
@@ -110,6 +120,7 @@ class JenkinsShell
110
120
  begin
111
121
  # Establish connection
112
122
  http = Net::HTTP.new(@host, @port)
123
+ http.use_ssl = @ssl
113
124
 
114
125
  # Create request
115
126
  req = Net::HTTP::Post.new(path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins_shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker