superbot-cloud 0.1.18 → 0.1.19

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: 4fb1c9b07574d814298c45682877013348a7915d974478df1e720d2bbe25bcac
4
- data.tar.gz: 35258cf7c427a781d5925c68af3f80c4730f03ef3a8a522196fcf7dc3ca1d949
3
+ metadata.gz: 5a9d3104480558f1d2611d811fe52920244cf502ab70d1a0ffc7d6d4f9e28a9c
4
+ data.tar.gz: ef334a9ad002c647fb9029b7704a02d78ca53266415e3ca6b6f3c7419ed74b3f
5
5
  SHA512:
6
- metadata.gz: f4c9f068fd91b3b917a27c7299c86084362c4152057a32510d4c2e10621811f670ebae048a1b2349181e00ebc191edf11cff269f62af487920b6aff41f5a107d
7
- data.tar.gz: 1835a015a48dc819e8d57af3b32786a9d2bd9d818b27009672b4c5d478ba384e44e4e56d29aa120cebfa5d1a1c82104ded7802d53fe1c702202e9fdb1fdb2bcd
6
+ metadata.gz: d133a15f010b11308d09a31d0f24ecabb956ae1e9e944758f3c8d8b59f51f3fe0d01f099b70442ad67404a35e0f5236b8c8347101657b52b9bab975bf6564a83
7
+ data.tar.gz: 58ef5bfebf9d0eea808ad5bced543e56af3162542aa195343ce9fc373ab2c5b44076dcaebbf46f4f5fb351017551965bdd24820150519ed52c852225b53097ed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superbot-cloud (0.1.18)
4
+ superbot-cloud (0.1.19)
5
5
  marcel (= 0.3.3)
6
6
  multipart-post (= 2.0.0)
7
7
 
@@ -15,6 +15,7 @@ GEM
15
15
  ffi (~> 1.0, >= 1.0.11)
16
16
  clamp (1.2.1)
17
17
  diff-lcs (1.3)
18
+ excon (0.62.0)
18
19
  ffi (1.9.25)
19
20
  jaro_winkler (1.5.1)
20
21
  kommando (0.1.2)
@@ -31,7 +32,7 @@ GEM
31
32
  powerpack (0.1.2)
32
33
  public_suffix (3.0.3)
33
34
  rack (2.0.6)
34
- rack-protection (2.0.3)
35
+ rack-protection (2.0.4)
35
36
  rack
36
37
  rainbow (3.0.0)
37
38
  rake (10.5.0)
@@ -61,21 +62,26 @@ GEM
61
62
  selenium-webdriver (3.141.0)
62
63
  childprocess (~> 0.5)
63
64
  rubyzip (~> 1.2, >= 1.2.2)
64
- sinatra (2.0.3)
65
+ sinatra (2.0.4)
65
66
  mustermann (~> 1.0)
66
67
  rack (~> 2.0)
67
- rack-protection (= 2.0.3)
68
+ rack-protection (= 2.0.4)
68
69
  tilt (~> 2.0)
69
70
  sinatra-silent (0.0.1)
70
- superbot (0.1.23)
71
+ superbot (0.1.28)
71
72
  clamp (= 1.2.1)
72
73
  kommando (~> 0.1)
73
74
  launchy (= 2.4.3)
74
75
  selenium-webdriver (~> 3.14, >= 3.14.0)
75
- sinatra (= 2.0.3)
76
+ sinatra (= 2.0.4)
76
77
  sinatra-silent (= 0.0.1)
77
- superbot-cloud (~> 0.1.17)
78
+ superbot-cloud (~> 0.1.18)
79
+ superbot-teleport (~> 0.2.1)
78
80
  zaru (= 0.2.0)
81
+ superbot-teleport (0.2.1)
82
+ clamp (= 1.2.1)
83
+ excon
84
+ kommando (~> 0.1)
79
85
  tilt (2.0.9)
80
86
  unicode-display_width (1.4.0)
81
87
  zaru (0.2.0)
@@ -88,8 +94,8 @@ DEPENDENCIES
88
94
  rake (~> 10.0)
89
95
  rspec (~> 3.0)
90
96
  rubocop (~> 0.53)
91
- superbot (~> 0.1.23)
97
+ superbot (~> 0.1.28)
92
98
  superbot-cloud!
93
99
 
94
100
  BUNDLED WITH
95
- 1.16.6
101
+ 1.17.1
data/exe/superbot-cloud CHANGED
@@ -17,4 +17,4 @@ end
17
17
 
18
18
  require 'superbot/cloud'
19
19
 
20
- Superbot::CLI::CloudCommand.run
20
+ Superbot::Cloud::CLI::RootCommand.run
@@ -2,7 +2,8 @@
2
2
 
3
3
  module Superbot
4
4
  module Cloud
5
- LOGIN_URI = "http://#{Superbot::DOMAIN}/login/cloud"
5
+ BASE_URI = "#{Superbot::URI_SCHEME}://#{Superbot::DOMAIN}"
6
+ LOGIN_URI = "#{BASE_URI}/login/cloud"
6
7
  CREDENTIALS_PATH = File.join(Dir.home, '.superbot')
7
8
  private_constant :CREDENTIALS_PATH
8
9
  CREDENTIALS_FILE_PATH = File.join(CREDENTIALS_PATH, 'cloud_credentials.json')
@@ -32,5 +33,5 @@ end
32
33
 
33
34
  require_relative "cloud/version"
34
35
  require_relative "cloud/api"
36
+ require_relative "cloud/web"
35
37
  require_relative "cloud/cli"
36
- require_relative "cloud/web_login"
@@ -5,7 +5,7 @@ require 'net/http/post/multipart'
5
5
  module Superbot
6
6
  module Cloud
7
7
  module Api
8
- BASE_URI = "#{Superbot::URI_SCHEME}://#{Superbot::DOMAIN}/api/v1"
8
+ BASE_URI = "#{Superbot::Cloud::BASE_URI}/api/v1"
9
9
  ENDPOINT_MAP = {
10
10
  login: { method: :post, endpoint: 'sessions' },
11
11
  token: { method: :post, endpoint: 'token' },
@@ -4,8 +4,8 @@ require 'net/http'
4
4
  require 'launchy'
5
5
 
6
6
  module Superbot
7
- module CLI
8
- module Cloud
7
+ module Cloud
8
+ module CLI
9
9
  class LoginCommand < Clamp::Command
10
10
  option ['-i', '--interactive'], :flag, 'interactive login from command line'
11
11
  option ['-f', '--force'], :flag, 'force override current credentials'
@@ -35,11 +35,8 @@ module Superbot
35
35
  end
36
36
 
37
37
  def web_login
38
- web = Superbot::Cloud::WebLogin.new
39
- web.run_async_after_running!
40
38
  open_cloud_login_uri
41
- handle_keyboard_interrupt
42
- wait_for_login(web)
39
+ Superbot::Web.run!
43
40
  end
44
41
 
45
42
  def open_cloud_login_uri
@@ -51,22 +48,6 @@ module Superbot
51
48
  puts "Your browser has been opened to visit:", cloud_login_uri
52
49
  puts
53
50
  end
54
-
55
- def handle_keyboard_interrupt
56
- trap "SIGINT" do
57
- puts
58
- puts "Command killed by keyboard interrupt"
59
- exit 130
60
- end
61
- end
62
-
63
- def wait_for_login(web)
64
- loop do
65
- break unless web.running?
66
-
67
- sleep 0.1
68
- end
69
- end
70
51
  end
71
52
  end
72
53
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Superbot
4
- module CLI
5
- module Cloud
4
+ module Cloud
5
+ module CLI
6
6
  module Organization
7
7
  class ListCommand < Clamp::Command
8
8
  include Superbot::Cloud::Validations
@@ -3,10 +3,10 @@
3
3
  require_relative 'organization/list_command'
4
4
 
5
5
  module Superbot
6
- module CLI
7
- module Cloud
6
+ module Cloud
7
+ module CLI
8
8
  class OrganizationCommand < Clamp::Command
9
- subcommand ['list'], "List user organizations from the cloud", Cloud::Organization::ListCommand
9
+ subcommand ['list'], "List user organizations from the cloud", Organization::ListCommand
10
10
 
11
11
  def self.run
12
12
  super
@@ -1,11 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'cloud_command'
3
+ require_relative 'validations'
4
+ require_relative 'login_command'
5
+ require_relative 'version_command'
6
+ require_relative 'organization_command'
7
+ require_relative 'test_command'
8
+ require_relative 'webdriver_command'
4
9
 
5
10
  module Superbot
6
- module CLI
7
- class RootCommand < Clamp::Command
8
- subcommand ['cloud'], "Show cloud commands", CloudCommand
11
+ module Cloud
12
+ module CLI
13
+ class RootCommand < Clamp::Command
14
+ subcommand ['version'], 'Superbot cloud version', VersionCommand
15
+ subcommand ['login'], 'Login to superbot cloud', LoginCommand
16
+ subcommand(['org'], 'Manage your organizations', OrganizationCommand)
17
+ subcommand ['test'], "Manage your tests", TestCommand
18
+ subcommand ['webdriver'], "Manage your webdriver sessions", WebdriverCommand
19
+
20
+ option ['-v', '--version'], :flag, "Show version information" do
21
+ puts Superbot::Cloud::VERSION
22
+ exit 0
23
+ end
24
+
25
+ def self.run
26
+ super
27
+ rescue StandardError => exc
28
+ warn exc.message
29
+ warn exc.backtrace.join("\n")
30
+ end
31
+ end
9
32
  end
10
33
  end
11
34
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Superbot
4
- module CLI
5
- module Cloud
4
+ module Cloud
5
+ module CLI
6
6
  module Test
7
7
  class DeleteCommand < Clamp::Command
8
8
  include Superbot::Cloud::Validations
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Superbot
4
- module CLI
5
- module Cloud
4
+ module Cloud
5
+ module CLI
6
6
  module Test
7
7
  class ListCommand < Clamp::Command
8
8
  include Superbot::Cloud::Validations
@@ -6,8 +6,8 @@ require 'marcel'
6
6
  require 'pathname'
7
7
 
8
8
  module Superbot
9
- module CLI
10
- module Cloud
9
+ module Cloud
10
+ module CLI
11
11
  module Test
12
12
  class UploadCommand < Clamp::Command
13
13
  include Superbot::Cloud::Validations
@@ -5,12 +5,12 @@ require_relative 'test/upload_command'
5
5
  require_relative 'test/delete_command'
6
6
 
7
7
  module Superbot
8
- module CLI
9
- module Cloud
8
+ module Cloud
9
+ module CLI
10
10
  class TestCommand < Clamp::Command
11
- subcommand ['list'], "List user tests from the cloud", Cloud::Test::ListCommand
12
- subcommand ['upload'], "Upload test to the cloud", Cloud::Test::UploadCommand
13
- subcommand ['delete'], "Delete test from the cloud", Cloud::Test::DeleteCommand
11
+ subcommand ['list'], "List user tests from the cloud", Test::ListCommand
12
+ subcommand ['upload'], "Upload test to the cloud", Test::UploadCommand
13
+ subcommand ['delete'], "Delete test from the cloud", Test::DeleteCommand
14
14
 
15
15
  def self.run
16
16
  super
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Superbot
4
- module CLI
5
- module Cloud
4
+ module Cloud
5
+ module CLI
6
6
  class VersionCommand < Clamp::Command
7
7
  def execute
8
8
  puts Superbot::Cloud::VERSION
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Superbot
4
- module CLI
5
- module Cloud
4
+ module Cloud
5
+ module CLI
6
6
  module Webdriver
7
7
  class DeleteCommand < Clamp::Command
8
8
  include Superbot::Cloud::Validations
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Superbot
4
- module CLI
5
- module Cloud
4
+ module Cloud
5
+ module CLI
6
6
  module Webdriver
7
7
  class ListCommand < Clamp::Command
8
8
  include Superbot::Cloud::Validations
@@ -4,11 +4,11 @@ require_relative 'webdriver/list_command'
4
4
  require_relative 'webdriver/delete_command'
5
5
 
6
6
  module Superbot
7
- module CLI
8
- module Cloud
7
+ module Cloud
8
+ module CLI
9
9
  class WebdriverCommand < Clamp::Command
10
- subcommand ['list'], "List all webdriver sessions", Cloud::Webdriver::ListCommand
11
- subcommand ['delete'], "Terminate and finish specific session", Cloud::Webdriver::DeleteCommand
10
+ subcommand ['list'], "List all webdriver sessions", Webdriver::ListCommand
11
+ subcommand ['delete'], "Terminate and finish specific session", Webdriver::DeleteCommand
12
12
 
13
13
  def self.run
14
14
  super
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Superbot
4
4
  module Cloud
5
- VERSION = "0.1.18"
5
+ VERSION = "0.1.19"
6
6
  end
7
7
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Superbot
4
+ module Cloud
5
+ module Web
6
+ def self.register(sinatra)
7
+ sinatra.get "/login" do
8
+ credentials = request.params.slice('username', 'email', 'token')
9
+ Superbot::Cloud.save_credentials(credentials)
10
+ sinatra.quit!
11
+ redirect "#{Superbot::Cloud::LOGIN_URI}/success?username=#{Superbot::Cloud.credentials[:username]}"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_runtime_dependency "multipart-post", "2.0.0"
37
37
  spec.add_runtime_dependency "marcel", "0.3.3"
38
38
 
39
- spec.add_development_dependency "superbot", "~> 0.1.23"
39
+ spec.add_development_dependency "superbot", "~> 0.1.28"
40
40
  spec.add_development_dependency "bundler", "~> 1.16"
41
41
  spec.add_development_dependency "rake", "~> 10.0"
42
42
  spec.add_development_dependency "rspec", "~> 3.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superbot-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Superbots
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-29 00:00:00.000000000 Z
11
+ date: 2018-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.23
47
+ version: 0.1.28
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.23
54
+ version: 0.1.28
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -134,22 +134,21 @@ files:
134
134
  - lib/superbot/cloud.rb
135
135
  - lib/superbot/cloud/api.rb
136
136
  - lib/superbot/cloud/cli.rb
137
- - lib/superbot/cloud/cli/cloud/login_command.rb
138
- - lib/superbot/cloud/cli/cloud/organization/list_command.rb
139
- - lib/superbot/cloud/cli/cloud/organization_command.rb
140
- - lib/superbot/cloud/cli/cloud/test/delete_command.rb
141
- - lib/superbot/cloud/cli/cloud/test/list_command.rb
142
- - lib/superbot/cloud/cli/cloud/test/upload_command.rb
143
- - lib/superbot/cloud/cli/cloud/test_command.rb
144
- - lib/superbot/cloud/cli/cloud/validations.rb
145
- - lib/superbot/cloud/cli/cloud/version_command.rb
146
- - lib/superbot/cloud/cli/cloud/webdriver/delete_command.rb
147
- - lib/superbot/cloud/cli/cloud/webdriver/list_command.rb
148
- - lib/superbot/cloud/cli/cloud/webdriver_command.rb
149
- - lib/superbot/cloud/cli/cloud_command.rb
137
+ - lib/superbot/cloud/cli/login_command.rb
138
+ - lib/superbot/cloud/cli/organization/list_command.rb
139
+ - lib/superbot/cloud/cli/organization_command.rb
150
140
  - lib/superbot/cloud/cli/root_command.rb
141
+ - lib/superbot/cloud/cli/test/delete_command.rb
142
+ - lib/superbot/cloud/cli/test/list_command.rb
143
+ - lib/superbot/cloud/cli/test/upload_command.rb
144
+ - lib/superbot/cloud/cli/test_command.rb
145
+ - lib/superbot/cloud/cli/validations.rb
146
+ - lib/superbot/cloud/cli/version_command.rb
147
+ - lib/superbot/cloud/cli/webdriver/delete_command.rb
148
+ - lib/superbot/cloud/cli/webdriver/list_command.rb
149
+ - lib/superbot/cloud/cli/webdriver_command.rb
151
150
  - lib/superbot/cloud/version.rb
152
- - lib/superbot/cloud/web_login.rb
151
+ - lib/superbot/cloud/web.rb
153
152
  - superbot-cloud.gemspec
154
153
  homepage: https://github.com/superbothq/superbot-cloud
155
154
  licenses:
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "cloud/validations"
4
- require_relative 'cloud/login_command'
5
- require_relative 'cloud/version_command'
6
- require_relative 'cloud/organization_command'
7
- require_relative 'cloud/test_command'
8
- require_relative 'cloud/webdriver_command'
9
-
10
- module Superbot
11
- module CLI
12
- class CloudCommand < Clamp::Command
13
- subcommand ['version'], 'Superbot cloud version', Cloud::VersionCommand
14
- subcommand ['login'], 'Login to superbot cloud', Cloud::LoginCommand
15
- subcommand(['org'], 'Manage your organizations', Cloud::OrganizationCommand)
16
- subcommand ['test'], "Manage your tests", Cloud::TestCommand
17
- subcommand ['webdriver'], "Manage your webdriver sessions", Cloud::WebdriverCommand
18
-
19
- option ['-v', '--version'], :flag, "Show version information" do
20
- puts Superbot::Cloud::VERSION
21
- exit 0
22
- end
23
-
24
- def self.run
25
- super
26
- rescue StandardError => exc
27
- warn exc.message
28
- warn exc.backtrace.join("\n")
29
- end
30
- end
31
- end
32
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'sinatra'
4
- require "sinatra/silent"
5
- require 'fileutils'
6
-
7
- module Superbot
8
- module Cloud
9
- class WebLogin
10
- def initialize
11
- @sinatra = Sinatra.new do
12
- set :bind, "127.0.0.1"
13
- set :silent_sinatra, true
14
- set :silent_webrick, true
15
- set :silent_access_log, false
16
- server_settings[:Silent] = true
17
- instance = self
18
-
19
- get "/login" do
20
- credentials = request.params.slice('username', 'email', 'token')
21
- Superbot::Cloud.save_credentials(credentials)
22
- instance.quit!
23
- redirect "#{Superbot::Cloud::LOGIN_URI}/success?username=#{Superbot::Cloud.credentials[:username]}"
24
- end
25
- end
26
- end
27
-
28
- def self.run!
29
- new.run!
30
- end
31
-
32
- def run!
33
- @sinatra.run_async!
34
- end
35
-
36
- def running?
37
- @sinatra.running?
38
- end
39
-
40
- def run_async_after_running!
41
- Thread.new do
42
- @sinatra.run!
43
- end
44
-
45
- loop do
46
- break if running?
47
-
48
- sleep 0.001
49
- end
50
- end
51
- end
52
- end
53
- end