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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 806ad5eff604cf39f4c5566ba019761a12df693d15d27cdfc578dd9351920eb8
4
- data.tar.gz: 3c43f28c41a540151a2626662256fa0165acd2376209058df0edfa8e839df982
3
+ metadata.gz: daf6b0773f6e0c4cf167238c7be5822a05edc46a5a91b0695d4af614404e31fe
4
+ data.tar.gz: cfa4ecbf6a0008335b7eb50be5dee2072868c0ff90b04b2bf82635801727c457
5
5
  SHA512:
6
- metadata.gz: aa56f0328a6efcfaf7bf3ed10e68038d0f8d3ddf582c4aea99a95fa00bed7b948c8dfa362c51e9b7ac97b837a32ed5d9a325c081b053384d4dcfcb9b1538658e
7
- data.tar.gz: 04fb36eed9299571cce88ae1bdd996013dba46f19a231d87486e02f6bebda8b09eb617e9b1686755a63294225887eb7aff51177a5e181c9a70b3e68f7538e8fb
6
+ metadata.gz: 3316da2a6707077cd299168c5b32579dbba6e0f90c08a771caaf919545a1f356fab67c20e5f510d08ca3b14c9f5504dedddf2abefd212d67562fa18678e5af9b
7
+ data.tar.gz: fbd942ca4ef8b5e72d334c47420fb3a9900f87043e8b263de072a191a64ba8536c2e105f724d8c6b39e92acbd09150096260106d7812163d4e8b70fb0555514d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- playwright-cli (0.0.7)
4
+ playwright-cli (0.1.1)
5
5
  colorize (~> 0.1)
6
6
  hanami-cli (~> 0.1)
7
7
 
@@ -1,24 +1,23 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'hanami/cli'
3
+ require 'playwright/cli'
4
4
 
5
5
  module <%= klass_name %>
6
6
  module CLI
7
7
  module Commands
8
- extend Hanami::CLI::Registry
8
+ extend Playwright::CLI::Registry
9
9
 
10
- class Greet < Hanami::CLI::Command
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
- "$ <%= script_name %> greet \"Johnny Boy\"",
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
- Hanami::CLI.new(<%= klass_name %>::CLI::Commands).call
31
+ Playwright::CLI.new(<%= klass_name %>::CLI::Commands).call
@@ -0,0 +1,6 @@
1
+ module Playwright
2
+ class CLI < Hanami::CLI
3
+ class Command < Hanamic::CLI::Command
4
+ end
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
- module CLI
2
+ class CLI < Hanami::CLI
3
3
  module Commands
4
4
  extend Hanami::CLI::Registry
5
5
 
@@ -1,7 +1,7 @@
1
1
  require 'playwright/cli/commands/destroy/command'
2
2
 
3
3
  module Playwright
4
- module CLI
4
+ class CLI < Hanami::CLI
5
5
  module Commands
6
6
  extend Hanami::CLI::Registry
7
7
 
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
- module CLI
2
+ class CLI < Hanami::CLI
3
3
  module Commands
4
4
  extend Hanami::CLI::Registry
5
5
 
@@ -1,7 +1,7 @@
1
1
  require 'playwright/cli/commands/generate/command'
2
2
 
3
3
  module Playwright
4
- module CLI
4
+ class CLI < Hanami::CLI
5
5
  module Commands
6
6
  extend Hanami::CLI::Registry
7
7
 
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
- module CLI
2
+ class CLI < Hanami::CLI
3
3
  module Commands
4
4
  extend Hanami::CLI::Registry
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
- module CLI
2
+ class CLI < Hanami::CLI
3
3
  module Commands
4
4
  extend Hanami::CLI::Registry
5
5
  require 'playwright/cli/commands/version'
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
- module CLI
2
+ class CLI < Hanami::CLI
3
3
  class Template
4
4
 
5
5
  attr_reader :script_name
@@ -1,7 +1,7 @@
1
1
  require 'playwright/cli/utils/display'
2
2
 
3
3
  module Playwright
4
- module CLI
4
+ class CLI < Hanami::CLI
5
5
  module Utils
6
6
  module Ask
7
7
 
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
- module CLI
2
+ class CLI < Hanami::CLI
3
3
  module Utils
4
4
  module Display
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
- module CLI
2
+ class CLI < Hanami::CLI
3
3
  module Utils
4
4
  module ScriptFiles
5
5
 
@@ -3,7 +3,7 @@ require 'playwright/cli/utils/display'
3
3
  require 'playwright/cli/utils/script_files'
4
4
 
5
5
  module Playwright
6
- module CLI
6
+ class CLI < Hanami::CLI
7
7
  module Utils
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
- module CLI
3
- VERSION = "0.1.0"
2
+ class CLI < Hanami::CLI
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@ require 'erb'
7
7
  require 'pry'
8
8
 
9
9
  module Playwright
10
- module CLI
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
- Hanami::CLI.new(Commands).call(*args)
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
@@ -1,6 +1,7 @@
1
1
 
2
2
  lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hanami/cli'
4
5
  require "playwright/cli/version"
5
6
 
6
7
  Gem::Specification.new do |spec|
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.0
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