superbot-teleport 0.2.6 → 0.2.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d3d69e985d80169a431cac30c6d40680dcc21bc0bfa92ef5635815bdf4da3d8
4
- data.tar.gz: 40a98b33d15c4b260c19822a9a9bd1dd8141f5f48efb867861ae43cbd408f7ae
3
+ metadata.gz: 428aebb42ee7827783d9af49474d5e48f7303eaaff8a9612d9e37b033baf9de3
4
+ data.tar.gz: 6163a6bb059033dbedb3c82553fea9e4f67daea2ad18385b4ffa3e50211f3475
5
5
  SHA512:
6
- metadata.gz: 5d49b0f49c18286dc8a24ca0c37b55040c371188fe05a0d94815e5c8dac33d6baa6524328595fc3715428f4a207f7668d715e9fa05af0112de9ef02230dce51b
7
- data.tar.gz: cb9d3d36960fcd1a5cbcde1e16182052cf04515e220c40104d9250c73863a12423d745ba7d642105d759abc17194b10e5bf0214de9ba2073c6532eeec8cb6c20
6
+ metadata.gz: 4f3f9cfe22bac517f19cb42b1d931325338c9f2f0a6b87c1a3b88dd5806d254a73fffc2c6b1509791323a618af34ce546b46f464cc8bd55b72560dfd19a0f445
7
+ data.tar.gz: cb266fdb6b96987283270b122da3187f9b3a7ea60afe72f1f47b95faf171247593edd4753b73e99af01cff7435c9574a32d1b2b71d280d45c217c0576a246803
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superbot-teleport (0.2.6)
4
+ superbot-teleport (0.2.7)
5
5
  excon
6
6
 
7
7
  GEM
@@ -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' do |browser|
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
- require_login unless browser == 'local'
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
@@ -1,5 +1,5 @@
1
1
  module Superbot
2
2
  module Teleport
3
- VERSION = "0.2.6"
3
+ VERSION = "0.2.7"
4
4
  end
5
5
  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.6
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-08 00:00:00.000000000 Z
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