pipe2me-client 0.2.1 → 0.2.2
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 +4 -4
- data/README.mdown +1 -1
- data/bin/pipe2me +8 -3
- data/bin/pipe2med +3 -0
- data/lib/pipe2me/cli-foreman.rb +7 -0
- data/lib/pipe2me/cli.rb +6 -1
- data/lib/pipe2me/ext/http.rb +6 -5
- data/lib/pipe2me/tunnel/commands.rb +2 -4
- data/lib/pipe2me/tunnel.rb +6 -1
- data/lib/pipe2me/version.rb +1 -1
- data/test/env-test.sh +1 -1
- data/test/setup-test.sh +1 -1
- data/test/verify-test.sh +19 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42624605ab61b1e56bf53471eebe5d321699f5bb
|
4
|
+
data.tar.gz: 7624869dc720e1ecc272f86c67d1be7d66ec06a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 156fa716529c419b83c0fe2859758ef291991b37966dfe1c0455a3b2b9d5d7aad8fd8dcbe55224c1f18235d65d788e4600f02ee4f2765118810463497ca92fea
|
7
|
+
data.tar.gz: 2d053da9bc4a94e57b2fcfa4f1eb35fc43b33eb329ce0b7f9a170ed86eb6e8ce7df7dd881508817678d54c5a0b35a3d6f2fd9b9c584a027c30d8237c2a4dac5b
|
data/README.mdown
CHANGED
data/bin/pipe2me
CHANGED
@@ -6,16 +6,21 @@ require "pipe2me/cli"
|
|
6
6
|
require "pipe2me/cli-foreman"
|
7
7
|
require "pipe2me/cli-monit"
|
8
8
|
|
9
|
+
if ENV["BACKTRACE"].to_i == 1
|
10
|
+
Pipe2me::CLI.start ARGV
|
11
|
+
exit 0
|
12
|
+
end
|
13
|
+
|
9
14
|
begin
|
10
15
|
Pipe2me::CLI.start ARGV
|
11
16
|
rescue
|
12
17
|
if UI.verbosity >= 2
|
13
|
-
UI.error
|
18
|
+
UI.error $!.message
|
14
19
|
raise
|
15
20
|
elsif UI.verbosity >= 0
|
16
|
-
UI.error
|
21
|
+
UI.error $!.message
|
17
22
|
else
|
18
|
-
STDERR.puts
|
23
|
+
STDERR.puts $!.message
|
19
24
|
end
|
20
25
|
exit 1
|
21
26
|
end
|
data/bin/pipe2med
ADDED
data/lib/pipe2me/cli-foreman.rb
CHANGED
@@ -16,6 +16,13 @@ class Pipe2me::CLI < Thor
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
config = Pipe2me::Tunnel.send(:config)
|
20
|
+
fqdn = config[:fqdn]
|
21
|
+
|
22
|
+
Pipe2me::Tunnel.tunnels.each do |protocol, remote_port, local_port|
|
23
|
+
UI.success "Tunneling #{protocol}://localhost:#{local_port} <=> #{protocol}://#{fqdn}:#{remote_port}"
|
24
|
+
end
|
25
|
+
|
19
26
|
Kernel.exec "foreman start -f #{procfile}"
|
20
27
|
end
|
21
28
|
end
|
data/lib/pipe2me/cli.rb
CHANGED
@@ -12,7 +12,7 @@ class Pipe2me::CLI < Thor
|
|
12
12
|
option :server, :default => "http://test.pipe2.me:8080"
|
13
13
|
option :auth, :required => true # "auth token"
|
14
14
|
option :protocols, :default => "https" # "protocol names, e.g. 'http,https,imap'"
|
15
|
-
option :ports
|
15
|
+
option :ports, :type => :string # "local ports, one per protocol"
|
16
16
|
def setup
|
17
17
|
Pipe2me::Config.server = options[:server]
|
18
18
|
server_info = Pipe2me::Tunnel.setup options
|
@@ -27,6 +27,11 @@ class Pipe2me::CLI < Thor
|
|
27
27
|
puts File.read("pipe2me.info.inc")
|
28
28
|
end
|
29
29
|
|
30
|
+
desc "verify", "Verify the tunnel"
|
31
|
+
def verify
|
32
|
+
Pipe2me::Tunnel.verify
|
33
|
+
end
|
34
|
+
|
30
35
|
desc "update", "Updates configuration"
|
31
36
|
def update
|
32
37
|
Pipe2me::Tunnel.update
|
data/lib/pipe2me/ext/http.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "net/http"
|
2
2
|
require "ostruct"
|
3
|
+
require "forwardable"
|
3
4
|
|
4
5
|
# The HTTP module implements a simple wrapper around Net::HTTP, intended to
|
5
6
|
# ease the pain of dealing with HTTP requests.
|
@@ -19,12 +20,11 @@ module Pipe2me::HTTP
|
|
19
20
|
@response = response
|
20
21
|
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
23
|
+
extend Forwardable
|
24
|
+
delegate [ :code, :url ] => :@response
|
25
25
|
|
26
26
|
def message #:nodoc:
|
27
|
-
"#{
|
27
|
+
"#{url}: #{code} #{@response[0..120]} (#{@response.response.class})"
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -82,7 +82,8 @@ module Pipe2me::HTTP
|
|
82
82
|
(200..299).include? status
|
83
83
|
end
|
84
84
|
|
85
|
-
# returns the response object itself, if it is valid (i.e. has a ),
|
85
|
+
# returns the response object itself, if it is valid (i.e. has a 2XX status),
|
86
|
+
# or raise an Error.
|
86
87
|
def validate!
|
87
88
|
return self if valid?
|
88
89
|
|
@@ -3,12 +3,10 @@ module Pipe2me::Tunnel::Commands
|
|
3
3
|
|
4
4
|
T = Pipe2me::Tunnel
|
5
5
|
|
6
|
-
private
|
7
|
-
|
8
6
|
# returns an array of [ protocol, remote_port, local_port ] entries
|
9
7
|
def tunnels
|
10
8
|
@tunnels ||= begin
|
11
|
-
urls, ports = config.urls, config.ports
|
9
|
+
urls, ports = config.urls, config.ports.to_s.split(",")
|
12
10
|
|
13
11
|
urls.zip(ports).map do |url, local_port|
|
14
12
|
uri = URI.parse(url)
|
@@ -32,7 +30,7 @@ module Pipe2me::Tunnel::Commands
|
|
32
30
|
def echo_commands
|
33
31
|
tunnels.map do |protocol, remote_port, local_port|
|
34
32
|
next unless cmd = echo_server_command(protocol, local_port)
|
35
|
-
[ "echo_#{
|
33
|
+
[ "echo_#{local_port}", cmd ]
|
36
34
|
end.compact
|
37
35
|
end
|
38
36
|
|
data/lib/pipe2me/tunnel.rb
CHANGED
@@ -50,7 +50,7 @@ module Pipe2me::Tunnel
|
|
50
50
|
|
51
51
|
# The base URL for this tunnels' configuration
|
52
52
|
def url
|
53
|
-
"#{config.server}/tunnels/#{config.
|
53
|
+
"#{config.server}/tunnels/#{config.id}"
|
54
54
|
end
|
55
55
|
|
56
56
|
def config
|
@@ -64,6 +64,11 @@ module Pipe2me::Tunnel
|
|
64
64
|
|
65
65
|
public
|
66
66
|
|
67
|
+
def verify
|
68
|
+
HTTP.get! "#{url}/verify"
|
69
|
+
puts config.fqdn
|
70
|
+
end
|
71
|
+
|
67
72
|
def update
|
68
73
|
unless File.exists?(SSH_PRIVKEY)
|
69
74
|
ssh_keygen
|
data/lib/pipe2me/version.rb
CHANGED
data/test/env-test.sh
CHANGED
data/test/setup-test.sh
CHANGED
@@ -5,7 +5,7 @@ describe "tunnel setup"
|
|
5
5
|
|
6
6
|
# setup a tunnel
|
7
7
|
it_sets_up_tunnels() {
|
8
|
-
fqdn=$($pipe2me setup --server $pipe2me_server --auth $pipe2me_token)
|
8
|
+
fqdn=$($pipe2me setup --server $pipe2me_server --auth $pipe2me_token --ports 8100,8101 --protocols http,https)
|
9
9
|
|
10
10
|
# pipe2me setup --server $pipe2me_server returns the fqdn of the subdomain and nothing else
|
11
11
|
test 1 -eq $(echo $fqdn | wc -l)
|
data/test/verify-test.sh
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env roundup
|
2
|
+
describe "verify subcommand"
|
3
|
+
|
4
|
+
. $(dirname $1)/testhelper.inc
|
5
|
+
|
6
|
+
# setup a tunnel
|
7
|
+
it_sets_up_tunnels_and_verifies() {
|
8
|
+
fqdn=$($pipe2me setup --server $pipe2me_server --auth short@test.kinko.me)
|
9
|
+
|
10
|
+
# pipe2me setup --server $pipe2me_server returns the fqdn of the subdomain and nothing else
|
11
|
+
test 1 -eq $(echo $fqdn | wc -l)
|
12
|
+
|
13
|
+
verified=$($pipe2me verify)
|
14
|
+
test "$fqdn" == "$verified"
|
15
|
+
|
16
|
+
# sleep 4 seconds. The tunnel lives for 3 seconds
|
17
|
+
sleep 4
|
18
|
+
! $pipe2me verify
|
19
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipe2me-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- radiospiel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: pipe2.me command line client V0.2.
|
69
|
+
description: pipe2.me command line client V0.2.2; (c) The kink team, 2013, 2014.
|
70
70
|
email: contact@kinko.me
|
71
71
|
executables:
|
72
72
|
- pipe2me
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- README.mdown
|
77
77
|
- bin/pipe2me
|
78
|
+
- bin/pipe2med
|
78
79
|
- lib/pipe2me.rb
|
79
80
|
- lib/pipe2me/cli-foreman.rb
|
80
81
|
- lib/pipe2me/cli-monit.rb
|
@@ -106,6 +107,7 @@ files:
|
|
106
107
|
- test/testhelper.debug
|
107
108
|
- test/testhelper.inc
|
108
109
|
- test/testhelper.release
|
110
|
+
- test/verify-test.sh
|
109
111
|
- test/version-test.sh
|
110
112
|
homepage: https://github.com/kinko/pipe2me-client
|
111
113
|
licenses: []
|
@@ -129,5 +131,5 @@ rubyforge_project:
|
|
129
131
|
rubygems_version: 2.2.1
|
130
132
|
signing_key:
|
131
133
|
specification_version: 4
|
132
|
-
summary: pipe2.me command line client V0.2.
|
134
|
+
summary: pipe2.me command line client V0.2.2; (c) The kink team, 2013, 2014.
|
133
135
|
test_files: []
|