wsio 0.0.4 → 0.0.5
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.
- data.tar.gz.sig +0 -0
- data/LICENSE +22 -0
- data/Manifest +1 -0
- data/README +4 -2
- data/Rakefile +1 -1
- data/lib/wsio.rb +12 -10
- data/wsio.gemspec +4 -4
- metadata +5 -3
- metadata.gz.sig +1 -3
data.tar.gz.sig
CHANGED
Binary file
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2010 Jeff Lindsay
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest
CHANGED
data/README
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
wsio -- web stream input/output tool
|
2
2
|
|
3
|
-
|
3
|
+
Dependencies: Ruby (dev version to compile extensions) and Rubygems
|
4
|
+
|
5
|
+
Install: sudo gem install wsio
|
4
6
|
|
5
7
|
Usage: wsio [options] [user[:pass]@][hostname][path]
|
6
8
|
-l Listen to stream and print to STDOUT
|
@@ -23,7 +25,7 @@ Run this on your central aggregator:
|
|
23
25
|
|
24
26
|
wsio -l somehost/log > /var/log/aggregate
|
25
27
|
|
26
|
-
Run this on your *laptop behind
|
28
|
+
Run this on your *laptop behind NAT* to watch the logs:
|
27
29
|
|
28
30
|
wsio -l somehost/log
|
29
31
|
|
data/Rakefile
CHANGED
data/lib/wsio.rb
CHANGED
@@ -9,26 +9,26 @@ def start(args)
|
|
9
9
|
if host_and_path.include? '@'
|
10
10
|
auth, host_and_path = host_and_path.split('@')
|
11
11
|
user, pass = (auth.split(':')<<nil)[0,2]
|
12
|
-
#unless pass
|
13
|
-
# pass = ask("Password for #{user}: ") {|q| q.echo = false}
|
14
|
-
#end
|
12
|
+
# pass = ask("Password for #{user}: ") {|q| q.echo = false} unless pass
|
15
13
|
end
|
16
14
|
raise "No host specified" if host_and_path[0] == 45 or host_and_path.empty?
|
17
15
|
args = args.join.gsub('-', '')
|
18
16
|
scheme = (args.include? 's') ? 'https' : 'http'
|
19
17
|
url = "#{scheme}://#{host_and_path}"
|
20
18
|
client = HTTPClient.new
|
21
|
-
client.ssl_config.verify_mode =
|
19
|
+
client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE if args.include? 'k'
|
22
20
|
#client.set_auth(url, 'user', 'pass') if user ## This doesn't work?
|
23
21
|
headers = {}
|
24
22
|
headers['Authorization'] = "Basic #{Base64.encode64([user,pass].join(':')).gsub("\n",'')}" if user # Fix set_auth
|
25
23
|
if args.include? 'l'
|
26
24
|
client.get_content(url, nil, headers) do |chunk|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
unless chunk.strip.empty?
|
26
|
+
obj = JSON.parse(chunk)
|
27
|
+
if obj.is_a? Array
|
28
|
+
puts obj.first
|
29
|
+
else
|
30
|
+
puts chunk
|
31
|
+
end
|
32
32
|
end
|
33
33
|
end
|
34
34
|
else
|
@@ -47,7 +47,9 @@ def start(args)
|
|
47
47
|
end
|
48
48
|
rescue JSON::ParserError
|
49
49
|
body = line.strip
|
50
|
-
|
50
|
+
if body.split('&').collect{|m| /^[^&^=]+=[^&^=]+$/.match(m) }.all?
|
51
|
+
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
52
|
+
else
|
51
53
|
headers["Content-Type"] = "text/plain"
|
52
54
|
end
|
53
55
|
end
|
data/wsio.gemspec
CHANGED
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{wsio}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Jeff Lindsay"]
|
9
9
|
s.cert_chain = ["/Users/progrium/.gem/gem-public_cert.pem"]
|
10
|
-
s.date = %q{2010-
|
10
|
+
s.date = %q{2010-06-26}
|
11
11
|
s.default_executable = %q{wsio}
|
12
12
|
s.description = %q{Web stream input/output tool}
|
13
13
|
s.email = %q{jeff.lindsay@twilio.com}
|
14
14
|
s.executables = ["wsio"]
|
15
|
-
s.extra_rdoc_files = ["README", "bin/wsio", "lib/wsio.rb"]
|
16
|
-
s.files = ["README", "Rakefile", "bin/wsio", "lib/wsio.rb", "Manifest", "wsio.gemspec"]
|
15
|
+
s.extra_rdoc_files = ["LICENSE", "README", "bin/wsio", "lib/wsio.rb"]
|
16
|
+
s.files = ["LICENSE", "README", "Rakefile", "bin/wsio", "lib/wsio.rb", "Manifest", "wsio.gemspec"]
|
17
17
|
s.homepage = %q{http://github.com/progrium/wsio}
|
18
18
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Wsio", "--main", "README"]
|
19
19
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeff Lindsay
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
WZqts+sMhUpDxxL+p6p6bQ==
|
36
36
|
-----END CERTIFICATE-----
|
37
37
|
|
38
|
-
date: 2010-
|
38
|
+
date: 2010-06-26 00:00:00 -07:00
|
39
39
|
default_executable:
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -88,10 +88,12 @@ executables:
|
|
88
88
|
extensions: []
|
89
89
|
|
90
90
|
extra_rdoc_files:
|
91
|
+
- LICENSE
|
91
92
|
- README
|
92
93
|
- bin/wsio
|
93
94
|
- lib/wsio.rb
|
94
95
|
files:
|
96
|
+
- LICENSE
|
95
97
|
- README
|
96
98
|
- Rakefile
|
97
99
|
- bin/wsio
|
metadata.gz.sig
CHANGED