playwright-cli 0.1.0 → 0.1.1
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/assets/templates/new_script.erb +6 -7
- data/lib/playwright/cli/command.rb +6 -0
- data/lib/playwright/cli/commands/destroy/command.rb +1 -1
- data/lib/playwright/cli/commands/destroy.rb +1 -1
- data/lib/playwright/cli/commands/generate/command.rb +1 -1
- data/lib/playwright/cli/commands/generate.rb +1 -1
- data/lib/playwright/cli/commands/version.rb +1 -1
- data/lib/playwright/cli/commands.rb +1 -1
- data/lib/playwright/cli/registry.rb +37 -0
- data/lib/playwright/cli/template.rb +1 -1
- data/lib/playwright/cli/utils/ask.rb +1 -1
- data/lib/playwright/cli/utils/display.rb +1 -1
- data/lib/playwright/cli/utils/script_files.rb +1 -1
- data/lib/playwright/cli/utils.rb +1 -1
- data/lib/playwright/cli/version.rb +2 -2
- data/lib/playwright/cli.rb +15 -2
- data/playwright-cli.gemspec +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daf6b0773f6e0c4cf167238c7be5822a05edc46a5a91b0695d4af614404e31fe
|
4
|
+
data.tar.gz: cfa4ecbf6a0008335b7eb50be5dee2072868c0ff90b04b2bf82635801727c457
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3316da2a6707077cd299168c5b32579dbba6e0f90c08a771caaf919545a1f356fab67c20e5f510d08ca3b14c9f5504dedddf2abefd212d67562fa18678e5af9b
|
7
|
+
data.tar.gz: fbd942ca4ef8b5e72d334c47420fb3a9900f87043e8b263de072a191a64ba8536c2e105f724d8c6b39e92acbd09150096260106d7812163d4e8b70fb0555514d
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,23 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'playwright/cli'
|
4
4
|
|
5
5
|
module <%= klass_name %>
|
6
6
|
module CLI
|
7
7
|
module Commands
|
8
|
-
extend
|
8
|
+
extend Playwright::CLI::Registry
|
9
9
|
|
10
|
-
class Greet <
|
10
|
+
class Greet < Playwright::CLI::Command
|
11
11
|
desc "Says a greeting to the name given. This is an example."
|
12
12
|
|
13
13
|
argument :name, required: true, desc: 'Whom shall I greet?'
|
14
14
|
|
15
15
|
example [
|
16
|
-
"
|
17
|
-
"#=> Why, hello Johnny Boy!"
|
16
|
+
"\"Johnny Boy\" #=> Why, hello Johnny Boy!"
|
18
17
|
]
|
19
18
|
|
20
19
|
def call(name:, **)
|
21
|
-
puts "Why, hello #{name}"
|
20
|
+
puts "Why, hello #{name}!"
|
22
21
|
end
|
23
22
|
|
24
23
|
end
|
@@ -29,4 +28,4 @@ module <%= klass_name %>
|
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
|
-
|
31
|
+
Playwright::CLI.new(<%= klass_name %>::CLI::Commands).call
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'hanami/cli'
|
2
|
+
|
3
|
+
module Playwright
|
4
|
+
class CLI < Hanami::CLI
|
5
|
+
module Registry
|
6
|
+
def self.extended base
|
7
|
+
base.class_eval do
|
8
|
+
extend Hanami::CLI::Registry
|
9
|
+
extend ClassMethods
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
def register_root(*args)
|
15
|
+
register(unique_root_string, *args)
|
16
|
+
@root_command = true
|
17
|
+
end
|
18
|
+
|
19
|
+
def has_root?
|
20
|
+
!!@root_command
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_root(arguments)
|
24
|
+
get([unique_root_string, *arguments])
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def unique_root_string
|
30
|
+
"05d93d18-a93a-4a80-9556-caf2c835112e"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/playwright/cli/utils.rb
CHANGED
data/lib/playwright/cli.rb
CHANGED
@@ -7,7 +7,7 @@ require 'erb'
|
|
7
7
|
require 'pry'
|
8
8
|
|
9
9
|
module Playwright
|
10
|
-
|
10
|
+
class CLI < Hanami::CLI
|
11
11
|
ROOT_PATH = File.expand_path('../..', File.dirname(__FILE__))
|
12
12
|
PLAYS_PATH = File.join(ROOT_PATH, 'plays')
|
13
13
|
PLAYS_BIN_PATH = File.join(PLAYS_PATH, 'bin')
|
@@ -15,11 +15,24 @@ module Playwright
|
|
15
15
|
|
16
16
|
require "playwright/cli/utils"
|
17
17
|
require "playwright/cli/commands"
|
18
|
+
require "playwright/cli/registry"
|
18
19
|
require "playwright/cli/template"
|
19
20
|
require "playwright/cli/version"
|
20
21
|
|
21
22
|
def self.call(*args)
|
22
|
-
|
23
|
+
new(Commands).call(*args)
|
24
|
+
end
|
25
|
+
|
26
|
+
def call(arguments: ARGV, out: $stdout)
|
27
|
+
result = commands.get(arguments)
|
28
|
+
|
29
|
+
if !result.found? && commands.has_root?
|
30
|
+
result = commands.get_root(arguments)
|
31
|
+
command, args = parse(result, out)
|
32
|
+
command.call(args)
|
33
|
+
else
|
34
|
+
super(*args)
|
35
|
+
end
|
23
36
|
end
|
24
37
|
|
25
38
|
end
|
data/playwright-cli.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playwright-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Gregory
|
@@ -129,12 +129,14 @@ files:
|
|
129
129
|
- exe/playwright
|
130
130
|
- lib/assets/templates/new_script.erb
|
131
131
|
- lib/playwright/cli.rb
|
132
|
+
- lib/playwright/cli/command.rb
|
132
133
|
- lib/playwright/cli/commands.rb
|
133
134
|
- lib/playwright/cli/commands/destroy.rb
|
134
135
|
- lib/playwright/cli/commands/destroy/command.rb
|
135
136
|
- lib/playwright/cli/commands/generate.rb
|
136
137
|
- lib/playwright/cli/commands/generate/command.rb
|
137
138
|
- lib/playwright/cli/commands/version.rb
|
139
|
+
- lib/playwright/cli/registry.rb
|
138
140
|
- lib/playwright/cli/template.rb
|
139
141
|
- lib/playwright/cli/utils.rb
|
140
142
|
- lib/playwright/cli/utils/ask.rb
|