krl 0.1.65 → 0.1.66

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.
Files changed (3) hide show
  1. data/lib/check.rb +2 -1
  2. data/lib/common.rb +13 -0
  3. metadata +3 -3
data/lib/check.rb CHANGED
@@ -12,7 +12,7 @@ module KRL_CMD
12
12
  apiurl = args.to_s
13
13
  end
14
14
  apiargs = { "krl" => File.open(krl_file, 'r') { |f| f.read } }
15
- validateresponse = Net::HTTP.post_form(URI.parse(apiurl), apiargs).body.to_s
15
+ validateresponse = KRL_COMMON::long_post_form(URI.parse(apiurl), apiargs).body.to_s
16
16
  jdata = JSON.parse(validateresponse, { :max_nesting => false })
17
17
  if jdata["error"]
18
18
  puts "Errors:"
@@ -21,5 +21,6 @@ module KRL_CMD
21
21
  puts "OK"
22
22
  end
23
23
  end
24
+
24
25
  end
25
26
  end
data/lib/common.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'terminal-table/import'
2
+ require 'net/http'
3
+
2
4
  module KRL_COMMON
3
5
  def self.pretty_table(collection, fields, limit=0)
4
6
  ptable = table do |t|
@@ -35,5 +37,16 @@ module KRL_COMMON
35
37
  end
36
38
 
37
39
  end
40
+
41
+ def self.long_post_form(url, params)
42
+ req = Net::HTTP::Post.new(url.path)
43
+ req.form_data = params
44
+ req.basic_auth url.user, url.password if url.user
45
+ Net::HTTP.new(url.host, url.port).start {|http|
46
+ http.read_timeout = 120
47
+ http.request(req)
48
+ }
49
+ end
50
+
38
51
 
39
52
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 65
9
- version: 0.1.65
8
+ - 66
9
+ version: 0.1.66
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Farmer, Cid Dennis
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-02 00:00:00 -06:00
17
+ date: 2010-09-10 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency