superbot-teleport 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3fd672f58dfea7f59eb5447390216d3df293dce7433fb1b172b2da0fc98509b6
4
- data.tar.gz: 3f64c2112cc4b132f8279281f8a859789a5c2de4801d56ad130c4774cb959208
3
+ metadata.gz: d14ae01b4e635a6c850972fb6ea0c5fe7c63ebcf06a7ef4dc9bbee3cfc8299f6
4
+ data.tar.gz: 4445395a416f399b44c8fa327d20e3cfc8548a26319cfb560b071f403240e10a
5
5
  SHA512:
6
- metadata.gz: 5efc9d5a4bb41ce8443e41a37e8339d8c91183c2bd376c008df4baf2b72aeebdf6d0b77679f7aab15822cb1c45cf70bbe29c5f9f9126685945783d3d638d77a4
7
- data.tar.gz: a9c3b1afeedd66eb83653eb3118f200bafc8d167c148f741a9a030052c181d294fafa3e20b3d4cc65f72e73c8563a5c0ba2addafe8cbcb9a415d0b46b04d6fca
6
+ metadata.gz: d49717df1b5499094b7058a0a52adcbd106475a9ff80d9efa58e5c6552575343ee76782747ff9a2426ef703b251e2f7beb83b785df179ee891b58f703aa80b20
7
+ data.tar.gz: 1e4e6756ba65807a615f680bca92bd5cc43e29d14d443f390e2b773a1930768b970690c5f1bb254b14561a5247f0e897c7487da421cac14176c78eae8105d0a2
@@ -1,13 +1,67 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superbot-teleport (0.0.1)
4
+ superbot-teleport (0.1.0)
5
+ excon
6
+ sinatra
5
7
 
6
8
  GEM
7
9
  remote: https://rubygems.org/
8
10
  specs:
11
+ archive-zip (0.11.0)
12
+ io-like (~> 0.3.0)
13
+ childprocess (0.9.0)
14
+ ffi (~> 1.0, >= 1.0.11)
15
+ chromedriver-helper (2.1.0)
16
+ archive-zip (~> 0.10)
17
+ nokogiri (~> 1.8)
18
+ coderay (1.1.2)
9
19
  diff-lcs (1.3)
20
+ excon (0.62.0)
21
+ ffi (1.9.25)
22
+ formatador (0.2.5)
23
+ guard (2.15.0)
24
+ formatador (>= 0.2.4)
25
+ listen (>= 2.7, < 4.0)
26
+ lumberjack (>= 1.0.12, < 2.0)
27
+ nenv (~> 0.1)
28
+ notiffany (~> 0.0)
29
+ pry (>= 0.9.12)
30
+ shellany (~> 0.0)
31
+ thor (>= 0.18.1)
32
+ guard-bundler (2.1.0)
33
+ bundler (~> 1.0)
34
+ guard (~> 2.2)
35
+ guard-compat (~> 1.1)
36
+ guard-compat (1.2.1)
37
+ guard-process (1.2.1)
38
+ guard-compat (~> 1.2, >= 1.2.1)
39
+ spoon (~> 0.0.1)
40
+ io-like (0.3.0)
41
+ listen (3.1.5)
42
+ rb-fsevent (~> 0.9, >= 0.9.4)
43
+ rb-inotify (~> 0.9, >= 0.9.7)
44
+ ruby_dep (~> 1.2)
45
+ lumberjack (1.0.13)
46
+ method_source (0.9.2)
47
+ mini_portile2 (2.3.0)
48
+ mustermann (1.0.3)
49
+ nenv (0.3.0)
50
+ nokogiri (1.8.5)
51
+ mini_portile2 (~> 2.3.0)
52
+ notiffany (0.1.1)
53
+ nenv (~> 0.1)
54
+ shellany (~> 0.0)
55
+ pry (0.12.2)
56
+ coderay (~> 1.1.0)
57
+ method_source (~> 0.9.0)
58
+ rack (2.0.6)
59
+ rack-protection (2.0.4)
60
+ rack
10
61
  rake (11.3.0)
62
+ rb-fsevent (0.10.3)
63
+ rb-inotify (0.9.10)
64
+ ffi (>= 0.5.0, < 2)
11
65
  rspec (3.8.0)
12
66
  rspec-core (~> 3.8.0)
13
67
  rspec-expectations (~> 3.8.0)
@@ -21,14 +75,37 @@ GEM
21
75
  diff-lcs (>= 1.2.0, < 2.0)
22
76
  rspec-support (~> 3.8.0)
23
77
  rspec-support (3.8.0)
78
+ ruby_dep (1.5.0)
79
+ rubyzip (1.2.2)
80
+ selenium-webdriver (3.141.0)
81
+ childprocess (~> 0.5)
82
+ rubyzip (~> 1.2, >= 1.2.2)
83
+ shellany (0.0.1)
84
+ sinatra (2.0.4)
85
+ mustermann (~> 1.0)
86
+ rack (~> 2.0)
87
+ rack-protection (= 2.0.4)
88
+ tilt (~> 2.0)
89
+ spoon (0.0.6)
90
+ ffi
91
+ superbot-selenium-webdriver (1.0.0)
92
+ chromedriver-helper (= 2.1.0)
93
+ selenium-webdriver (= 3.141.0)
94
+ thor (0.20.3)
95
+ tilt (2.0.9)
24
96
 
25
97
  PLATFORMS
26
98
  ruby
27
99
 
28
100
  DEPENDENCIES
29
101
  bundler (~> 1.17)
102
+ guard
103
+ guard-bundler
104
+ guard-process
105
+ pry
30
106
  rake (~> 11.2)
31
107
  rspec (~> 3.8)
108
+ superbot-selenium-webdriver
32
109
  superbot-teleport!
33
110
 
34
111
  BUNDLED WITH
@@ -0,0 +1,35 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+ guard 'process', name: 'sb-teleport', command: 'exe/sb-teleport' do
18
+ watch(%r{^lib/(.+)\.rb})
19
+ end
20
+
21
+ guard 'process', name: 'chromedriver', command: 'chromedriver-helper' do
22
+ end
23
+
24
+
25
+ guard :bundler do
26
+ require 'guard/bundler'
27
+ require 'guard/bundler/verify'
28
+ helper = Guard::Bundler::Verify.new
29
+
30
+ files = ['Gemfile']
31
+ files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
32
+
33
+ # Assume files are symlinked from somewhere
34
+ files.each { |file| watch(helper.real_path(file)) }
35
+ end
@@ -4,6 +4,5 @@ require_relative "teleport/cli"
4
4
  module Superbot
5
5
  module Teleport
6
6
  class Error < StandardError; end
7
- # Your code goes here...
8
7
  end
9
8
  end
@@ -1,8 +1,62 @@
1
+ require 'sinatra'
2
+ require 'excon'
3
+ require 'pry'
4
+
1
5
  module Superbot
2
6
  module Teleport
3
7
  class CLI
4
8
  def start!
5
- puts "starbot!"
9
+ s = Sinatra.new
10
+ s.set :raise_errors, false
11
+ s.set :show_exceptions, false
12
+
13
+ s.before do
14
+ $__request = request
15
+ end
16
+
17
+ s.error Excon::Error::Socket do
18
+ puts "="*30
19
+ puts $__request.path_info
20
+
21
+ if $!.message.end_with? "(Errno::ECONNREFUSED)"
22
+ status 500
23
+ "upstream failed"
24
+ else
25
+ raise "unknown"
26
+ end
27
+ end
28
+
29
+ s.set :connection, (
30
+ Excon.new ENV.fetch("SUPERBOT_TELEPORT_UPSTREAM_URL"), {
31
+ persistent: true,
32
+ connect_timeout: 5,
33
+ read_timeout: 5,
34
+ write_timeout: 5,
35
+ debug_request: (ENV["EXCON_DEBUG"] == "true"),
36
+ debug_response: (ENV["EXCON_DEBUG"] == "true")
37
+ }
38
+ )
39
+
40
+ [:get, :post, :delete].each do |method|
41
+ s.send method, "/wd/hub/*" do
42
+ path = params[:splat].join("/")
43
+
44
+ unless ENV.fetch("SUPERBOT_TELEPORT_UPSTREAM_URL").include? "localhost"
45
+ path = "wd/hub/#{path}"
46
+ headers["Content-Type"] = "application/json"
47
+ end
48
+
49
+ upstream = settings.connection.request({
50
+ method: method, path: path, body: request.body, headers: headers
51
+ })
52
+
53
+ headers = upstream.headers
54
+ status upstream.status
55
+ upstream.body
56
+ end
57
+ end
58
+
59
+ s.run!
6
60
  end
7
61
  end
8
62
  end
@@ -1,5 +1,5 @@
1
1
  module Superbot
2
2
  module Teleport
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -21,7 +21,16 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
+ spec.add_runtime_dependency "sinatra"
25
+ spec.add_runtime_dependency "excon"
26
+
24
27
  spec.add_development_dependency "bundler", "~> 1.17"
25
28
  spec.add_development_dependency "rake", "~> 11.2"
26
29
  spec.add_development_dependency "rspec", "~> 3.8"
30
+ spec.add_development_dependency "guard"
31
+ spec.add_development_dependency "guard-process"
32
+ spec.add_development_dependency "guard-bundler"
33
+ spec.add_development_dependency "pry"
34
+
35
+ spec.add_development_dependency "superbot-selenium-webdriver"
27
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superbot-teleport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Superbot HQ
@@ -10,6 +10,34 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2018-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sinatra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: excon
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +80,76 @@ dependencies:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
82
  version: '3.8'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-process
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-bundler
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: superbot-selenium-webdriver
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
55
153
  description:
56
154
  email:
57
155
  executables:
@@ -66,6 +164,7 @@ files:
66
164
  - ".travis.yml"
67
165
  - Gemfile
68
166
  - Gemfile.lock
167
+ - Guardfile
69
168
  - LICENSE.txt
70
169
  - README.md
71
170
  - Rakefile