superbot-teleport 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/superbot/teleport/cli/root_command.rb +12 -11
- data/lib/superbot/teleport/cli/validations.rb +21 -0
- data/lib/superbot/teleport/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 428aebb42ee7827783d9af49474d5e48f7303eaaff8a9612d9e37b033baf9de3
|
4
|
+
data.tar.gz: 6163a6bb059033dbedb3c82553fea9e4f67daea2ad18385b4ffa3e50211f3475
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f3f9cfe22bac517f19cb42b1d931325338c9f2f0a6b87c1a3b88dd5806d254a73fffc2c6b1509791323a618af34ce546b46f464cc8bd55b72560dfd19a0f445
|
7
|
+
data.tar.gz: cb266fdb6b96987283270b122da3187f9b3a7ea60afe72f1f47b95faf171247593edd4753b73e99af01cff7435c9574a32d1b2b71d280d45c217c0576a246803
|
data/Gemfile.lock
CHANGED
@@ -1,35 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'validations'
|
4
|
+
|
3
5
|
module Superbot
|
4
6
|
module Teleport
|
5
7
|
module CLI
|
6
8
|
class RootCommand < Clamp::Command
|
7
|
-
include Superbot::Validations
|
8
|
-
include Superbot::Cloud::Validations
|
9
|
+
include Superbot::Teleport::Validations
|
9
10
|
|
10
11
|
option ['-v', '--version'], :flag, "Show version information" do
|
11
12
|
puts Superbot::Teleport::VERSION
|
12
13
|
exit 0
|
13
14
|
end
|
14
15
|
|
15
|
-
option ['--browser'], 'BROWSER', "Browser type to use. Can be either local or cloud", default: 'cloud'
|
16
|
-
validates_browser_type browser
|
17
|
-
end
|
16
|
+
option ['--browser'], 'BROWSER', "Browser type to use. Can be either local or cloud", default: 'cloud'
|
18
17
|
option ['--region'], 'REGION', 'Region for remote webdriver'
|
19
18
|
option ['--org'], 'ORGANIZATION', 'Name of organization to take action', attribute_name: :organization
|
20
19
|
|
21
20
|
def execute
|
22
|
-
|
21
|
+
validate_teleport_options(browser, organization)
|
22
|
+
|
23
|
+
run_local_chromedriver if browser == 'local'
|
23
24
|
|
24
25
|
puts 'Opening teleport...', ''
|
25
26
|
puts 'Configure your remote webdriver to http://localhost:4567/wd/hub', ''
|
26
27
|
puts 'Press [control+c] to exit', ''
|
27
28
|
|
28
|
-
if browser == 'local'
|
29
|
-
chromedriver_path = Chromedriver::Helper.new.binary_path
|
30
|
-
@chromedriver = Kommando.run_async "#{chromedriver_path} --silent --port=9515 --url-base=wd/hub"
|
31
|
-
end
|
32
|
-
|
33
29
|
@web = Superbot::Web.run!(webdriver_type: browser, region: region, organization: organization)
|
34
30
|
ensure
|
35
31
|
close_teleport
|
@@ -39,6 +35,11 @@ module Superbot
|
|
39
35
|
@web&.quit!
|
40
36
|
@chromedriver&.kill
|
41
37
|
end
|
38
|
+
|
39
|
+
def run_local_chromedriver
|
40
|
+
chromedriver_path = Chromedriver::Helper.new.binary_path
|
41
|
+
@chromedriver = Kommando.run_async "#{chromedriver_path} --silent --port=9515 --url-base=wd/hub"
|
42
|
+
end
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Superbot
|
4
|
+
module Teleport
|
5
|
+
module Validations
|
6
|
+
include Superbot::Cloud::Validations
|
7
|
+
|
8
|
+
def validate_teleport_options(browser, organization)
|
9
|
+
return if browser == 'local'
|
10
|
+
|
11
|
+
unless %w[local cloud local_cloud].include?(browser)
|
12
|
+
signal_usage_error "The --browser=#{browser} browser option is not allowed. Should be either 'local' or 'cloud'."
|
13
|
+
end
|
14
|
+
|
15
|
+
signal_usage_error '--org option is required for cloud teleport' unless organization
|
16
|
+
|
17
|
+
require_login
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superbot-teleport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Superbot HQ
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- lib/superbot/teleport.rb
|
131
131
|
- lib/superbot/teleport/cli.rb
|
132
132
|
- lib/superbot/teleport/cli/root_command.rb
|
133
|
+
- lib/superbot/teleport/cli/validations.rb
|
133
134
|
- lib/superbot/teleport/version.rb
|
134
135
|
- lib/superbot/teleport/web.rb
|
135
136
|
- superbot-teleport.gemspec
|