superbot-cloud 0.1.21 → 0.1.22

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: d3f5c46b12fa88cce4a1cb3add9b4837a5e2ae8d544f38e19bc5aa5ff7860341
4
- data.tar.gz: '00895f0c78c4646130c6f0bec226e478d1c50efeb521e2a0d8d2209b06652410'
3
+ metadata.gz: 236b54d121ca0847ea9e218994a43aaa73aeacfcd817a343b19f773b80e0eac3
4
+ data.tar.gz: 834355e7f75a9bf38539af8dcb99cd279523db4cba22ef67f5f64a0803f1f929
5
5
  SHA512:
6
- metadata.gz: 42fbbd8d20c97449ba3be6203a8ef7ec8702c857dd593545b5575230f07e18725e2aef7deaf9fcd45d0c70dc2a2053b75be2480c9235bbda6290273d21d6f219
7
- data.tar.gz: 2a6da5e6d20e892223642b48ff7e767511b2930eab88f94f997c66415bab0bdf521c4290e4635e7e6a3326790f1f599723dc7f3b8c9f44b27db001ba2b776fc6
6
+ metadata.gz: b85e340908cf50d182a9ce1a1cc50e1baa86871ff1580f955266b8cf8858a8b180029be179e068c5097569aee6d74bb39e6a83bb0ec8bccac7cb9595fa96c642
7
+ data.tar.gz: ee5d064d978b99c5ba2158e3c602b902ba801f9bdee0812050e5e3d23882664c8208ef44388f7de212baee4535f29ce209b57a654c1c9415623781620474a705
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superbot-cloud (0.1.21)
4
+ superbot-cloud (0.1.22)
5
5
  marcel (= 0.3.3)
6
6
  multipart-post (= 2.0.0)
7
7
 
@@ -12,6 +12,7 @@ module Superbot
12
12
  organization_list: { method: :get, endpoint: 'organizations' },
13
13
  test_list: { method: :get, endpoint: 'tests' },
14
14
  test_upload: { method: :post_multipart, endpoint: 'tests' },
15
+ test_download: { method: :get, endpoint: 'tests', required_param: :name },
15
16
  delete_test: { method: :delete, endpoint: 'tests', required_param: :name },
16
17
  webdriver_session_list: { method: :get, endpoint: 'webdriver_sessions' },
17
18
  delete_webdriver_session: { method: :delete, endpoint: 'webdriver_sessions', required_param: :session_id },
@@ -5,9 +5,12 @@ module Superbot
5
5
  module CLI
6
6
  module Member
7
7
  class AddCommand < BaseCommand
8
+ include Superbot::Cloud::Validations
9
+
8
10
  parameter "USERNAME", "Username of a user to add", required: true
9
11
 
10
12
  def execute
13
+ require_login
11
14
  add_member
12
15
  end
13
16
 
@@ -5,7 +5,10 @@ module Superbot
5
5
  module CLI
6
6
  module Member
7
7
  class ListCommand < BaseCommand
8
+ include Superbot::Cloud::Validations
9
+
8
10
  def execute
11
+ require_login
9
12
  list_members
10
13
  end
11
14
 
@@ -5,9 +5,12 @@ module Superbot
5
5
  module CLI
6
6
  module Member
7
7
  class RemoveCommand < BaseCommand
8
+ include Superbot::Cloud::Validations
9
+
8
10
  parameter "USERNAME", "Username of a user to remove"
9
11
 
10
12
  def execute
13
+ require_login
11
14
  remove_member
12
15
  end
13
16
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Superbot
4
+ module Cloud
5
+ module CLI
6
+ module Test
7
+ class BaseCommand < Clamp::Command
8
+ option ["--org"], "ORGANIZATION", "Organization to to take actions on", attribute_name: :organization
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -4,10 +4,9 @@ module Superbot
4
4
  module Cloud
5
5
  module CLI
6
6
  module Test
7
- class DeleteCommand < Clamp::Command
7
+ class DeleteCommand < BaseCommand
8
8
  include Superbot::Cloud::Validations
9
9
 
10
- option ["-o", "--org"], "ORGANIZATION", "Organization to search test for deletion", attribute_name: :organization
11
10
  parameter "NAME", "the name of the test to delete", required: true
12
11
 
13
12
  def execute
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'pathname'
5
+
6
+ module Superbot
7
+ module Cloud
8
+ module CLI
9
+ module Test
10
+ class DownloadCommand < BaseCommand
11
+ include Superbot::Cloud::Validations
12
+
13
+ parameter "NAME", "the name of test to download"
14
+
15
+ def execute
16
+ require_login
17
+ download_test
18
+ end
19
+
20
+ def download_test
21
+ puts "Downloading #{name}..."
22
+ test = Superbot::Cloud::Api.request(
23
+ :test_download,
24
+ params: {
25
+ name: name,
26
+ organization_name: organization
27
+ }
28
+ )
29
+
30
+ if Dir.exist?(test[:name])
31
+ puts "Directory #{test[:name]} already exists"
32
+ print "Override files? [Y/n] "
33
+ answer = $stdin.gets.rstrip
34
+ abort "Aborted." unless answer.downcase.start_with?('y') || answer.empty?
35
+ end
36
+
37
+ FileUtils.mkdir_p test[:name]
38
+ test[:files].each do |file|
39
+ File.write(File.join(test[:name], file[:filename]), file[:content])
40
+ print file[:filename], ' - ', 'Success'
41
+ puts
42
+ end
43
+ puts "Test files successfully downloaded to #{File.join(Dir.pwd, test[:name])}"
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -4,11 +4,9 @@ module Superbot
4
4
  module Cloud
5
5
  module CLI
6
6
  module Test
7
- class ListCommand < Clamp::Command
7
+ class ListCommand < BaseCommand
8
8
  include Superbot::Cloud::Validations
9
9
 
10
- option ["-o", "--org"], "ORGANIZATION", "Organization to list tests for", attribute_name: :organization
11
-
12
10
  def execute
13
11
  require_login
14
12
  list_tests
@@ -9,13 +9,11 @@ module Superbot
9
9
  module Cloud
10
10
  module CLI
11
11
  module Test
12
- class UploadCommand < Clamp::Command
12
+ class UploadCommand < BaseCommand
13
13
  include Superbot::Cloud::Validations
14
14
 
15
15
  parameter "PATH", "the path to folder containing tests to upload"
16
16
 
17
- option ["-o", "--org"], "ORGANIZATION", "Organization to upload tests for", attribute_name: :organization
18
-
19
17
  def execute
20
18
  require_login
21
19
  upload_tests
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'test/base_command'
3
4
  require_relative 'test/list_command'
4
5
  require_relative 'test/upload_command'
6
+ require_relative 'test/download_command'
5
7
  require_relative 'test/delete_command'
6
8
 
7
9
  module Superbot
@@ -10,6 +12,7 @@ module Superbot
10
12
  class TestCommand < Clamp::Command
11
13
  subcommand ['list'], "List user tests from the cloud", Test::ListCommand
12
14
  subcommand ['upload'], "Upload test to the cloud", Test::UploadCommand
15
+ subcommand ['download'], "Download test from the cloud", Test::DownloadCommand
13
16
  subcommand ['delete'], "Delete test from the cloud", Test::DeleteCommand
14
17
 
15
18
  def self.run
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Superbot
4
4
  module Cloud
5
- VERSION = "0.1.21"
5
+ VERSION = "0.1.22"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superbot-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Superbots
@@ -143,7 +143,9 @@ files:
143
143
  - lib/superbot/cloud/cli/organization/list_command.rb
144
144
  - lib/superbot/cloud/cli/organization_command.rb
145
145
  - lib/superbot/cloud/cli/root_command.rb
146
+ - lib/superbot/cloud/cli/test/base_command.rb
146
147
  - lib/superbot/cloud/cli/test/delete_command.rb
148
+ - lib/superbot/cloud/cli/test/download_command.rb
147
149
  - lib/superbot/cloud/cli/test/list_command.rb
148
150
  - lib/superbot/cloud/cli/test/upload_command.rb
149
151
  - lib/superbot/cloud/cli/test_command.rb