playwright-cli 0.1.1 → 0.1.3

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: daf6b0773f6e0c4cf167238c7be5822a05edc46a5a91b0695d4af614404e31fe
4
- data.tar.gz: cfa4ecbf6a0008335b7eb50be5dee2072868c0ff90b04b2bf82635801727c457
3
+ metadata.gz: c70812c6e97a5e0351036b1f32cc533e7833d59ad46c32efb16b6cdc8e167023
4
+ data.tar.gz: c39ef6a202fed3feeb7015d1f0adbfdfe29fd42f41a4493555e4e67b28f2d5d0
5
5
  SHA512:
6
- metadata.gz: 3316da2a6707077cd299168c5b32579dbba6e0f90c08a771caaf919545a1f356fab67c20e5f510d08ca3b14c9f5504dedddf2abefd212d67562fa18678e5af9b
7
- data.tar.gz: fbd942ca4ef8b5e72d334c47420fb3a9900f87043e8b263de072a191a64ba8536c2e105f724d8c6b39e92acbd09150096260106d7812163d4e8b70fb0555514d
6
+ metadata.gz: bbffdc6bdb10897709564e578ea6b9312dd2a2c0f8a468a5c80b9a7d0e98624c5a5fcc72bfef381ca55492d3bbcfa4b54a24bce7e6e8d50d0bb606ba3c22ac36
7
+ data.tar.gz: 2c93bab7b6fc00a73d48fc5f3eae2f332ae8ec1cd9468bc8aa9998269381d6a343fbe7d6287156e982d2e4671c6e57e956acbb9a6b4cbf38fa7db3aee787d4e9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- playwright-cli (0.1.1)
4
+ playwright-cli (0.1.3)
5
5
  colorize (~> 0.1)
6
6
  hanami-cli (~> 0.1)
7
7
 
@@ -18,6 +18,7 @@ GEM
18
18
  hanami-utils (1.1.2)
19
19
  concurrent-ruby (~> 1.0)
20
20
  transproc (~> 1.0)
21
+ memfs (1.0.0)
21
22
  method_source (0.9.0)
22
23
  pry (0.9.12.6)
23
24
  coderay (~> 1.0)
@@ -47,6 +48,7 @@ PLATFORMS
47
48
 
48
49
  DEPENDENCIES
49
50
  bundler (~> 1.16)
51
+ memfs (~> 1.0)
50
52
  playwright-cli!
51
53
  pry (~> 0.9.0)
52
54
  pry-nav (~> 0.2.4)
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'playwright/cli'
4
+ require_relative 'lib/version'
5
+
6
+ module <%= klass_name %>
7
+ module CLI
8
+ module Commands
9
+ extend Playwright::CLI::Registry
10
+
11
+ class Greet < Playwright::CLI::Command
12
+ desc "Says a greeting to the name given. This is an example."
13
+
14
+ argument :name, required: true, desc: 'Whom shall I greet?'
15
+
16
+ example [
17
+ "\"Johnny Boy\" #=> Why, hello Johnny Boy!"
18
+ ]
19
+
20
+ def call(name:, **)
21
+ puts "Why, hello #{name}!"
22
+ end
23
+
24
+ end
25
+
26
+ register 'greet', Greet
27
+ register 'version', Version, aliases: ['v', '-v', '--version']
28
+
29
+ end
30
+ end
31
+ end
32
+
33
+ Playwright::CLI.new(<%= klass_name %>::CLI::Commands).call
@@ -7,7 +7,7 @@ module <%= klass_name %>
7
7
  module Commands
8
8
  extend Playwright::CLI::Registry
9
9
 
10
- class Greet < Playwright::CLI::Command
10
+ class Root < 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?'
@@ -22,7 +22,7 @@ module <%= klass_name %>
22
22
 
23
23
  end
24
24
 
25
- register 'greet', Greet
25
+ register_root Root
26
26
 
27
27
  end
28
28
  end
@@ -0,0 +1,22 @@
1
+ module <%= klass_name %>
2
+ module CLI
3
+
4
+ VERSION = "0.0.1"
5
+
6
+ module Commands
7
+ extend Playwright::CLI::Registry
8
+
9
+ class Version < Playwright::CLI::Command
10
+ desc "Responds with the version number."
11
+
12
+ example ["#=> #{VERSION}"]
13
+
14
+ def call(**)
15
+ puts VERSION
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -13,19 +13,28 @@ module Playwright
13
13
  PLAYS_BIN_PATH = File.join(PLAYS_PATH, 'bin')
14
14
  TEMPLATES_PATH = File.join(ROOT_PATH, 'lib', 'assets', 'templates')
15
15
 
16
+ require "playwright/cli/configuration"
16
17
  require "playwright/cli/utils"
17
18
  require "playwright/cli/commands"
18
19
  require "playwright/cli/registry"
19
20
  require "playwright/cli/template"
20
21
  require "playwright/cli/version"
21
22
 
23
+ def self.configuration
24
+ @configuration ||= Configuration.new
25
+ end
26
+
27
+ def self.configure
28
+ yield(configuration)
29
+ end
30
+
22
31
  def self.call(*args)
23
32
  new(Commands).call(*args)
24
33
  end
25
-
34
+
26
35
  def call(arguments: ARGV, out: $stdout)
27
36
  result = commands.get(arguments)
28
-
37
+
29
38
  if !result.found? && commands.has_root?
30
39
  result = commands.get_root(arguments)
31
40
  command, args = parse(result, out)
@@ -2,13 +2,15 @@ module Playwright
2
2
  class CLI < Hanami::CLI
3
3
  module Commands
4
4
  extend Hanami::CLI::Registry
5
- require 'playwright/cli/commands/version'
6
- require 'playwright/cli/commands/generate'
7
5
  require 'playwright/cli/commands/destroy'
6
+ require 'playwright/cli/commands/edit'
7
+ require 'playwright/cli/commands/generate'
8
+ require 'playwright/cli/commands/version'
8
9
 
9
- register "version", Version, aliases: ['v', '-v', '--version']
10
- register "generate", Generate, aliases: ['g', 'new']
11
10
  register "destroy", Destroy, aliases: ['delete', 'd']
11
+ register "edit", Edit, aliases: ['e']
12
+ register "generate", Generate, aliases: ['g', 'new']
13
+ register "version", Version, aliases: ['v', '-v', '--version']
12
14
  end
13
15
  end
14
16
  end
@@ -6,7 +6,7 @@ module Playwright
6
6
  class Destroy < Hanami::CLI::Command
7
7
  class Command
8
8
  include Utils::Display
9
- include Utils::ScriptFiles
9
+ include Utils::FileManager
10
10
 
11
11
  TEMPLATE_FILE = 'new_script.erb'.freeze
12
12
  PATH_BIN_DIR = File.join('/', 'usr', 'local', 'bin').freeze
@@ -21,19 +21,7 @@ module Playwright
21
21
  end
22
22
 
23
23
  def run
24
- validate!
25
- destroy_script
26
- end
27
-
28
- private
29
-
30
- def validate!
31
- script_path_and_file?
32
- end
33
-
34
- def destroy_script
35
- delete_playwright_script
36
- display.color_print "Playwright script \"#{@name}\" destroyed!"
24
+ file_manager.uninstall_script @name
37
25
  end
38
26
 
39
27
  end
@@ -0,0 +1,24 @@
1
+ require 'playwright/cli/commands/edit/command'
2
+
3
+ module Playwright
4
+ class CLI < Hanami::CLI
5
+ module Commands
6
+ extend Hanami::CLI::Registry
7
+
8
+ class Edit < Hanami::CLI::Command
9
+ desc "Opens your editor to playwright command."
10
+
11
+ argument :name, required: true, desc: 'Script name'
12
+
13
+ example [
14
+ "my-script # opens your editor to my-script"
15
+ ]
16
+
17
+ def call(name: nil, **)
18
+ Command.run(name)
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,27 @@
1
+ module Playwright
2
+ class CLI < Hanami::CLI
3
+ module Commands
4
+ extend Hanami::CLI::Registry
5
+
6
+ class Edit < Hanami::CLI::Command
7
+ class Command
8
+ include Utils::Display
9
+ include Utils::FileManager
10
+
11
+ def self.run(name)
12
+ new(name).run
13
+ end
14
+
15
+ def initialize(name)
16
+ @name = name
17
+ end
18
+
19
+ def run
20
+ file_manager.open_editor script_name: @name
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -9,13 +9,14 @@ module Playwright
9
9
  desc "Builds a template for a new playwright command."
10
10
 
11
11
  argument :name, required: true, desc: 'Script name'
12
+ option :type, default: 'simple', values: %w[ expanded simple ]
12
13
 
13
14
  example [
14
15
  "my-new-script\n# script will be called with my-new-script\n# class will be called MyNewScript"
15
16
  ]
16
17
 
17
- def call(name: nil, **)
18
- Command.run(name)
18
+ def call(name:, type:, **)
19
+ Command.run(name, type.to_sym)
19
20
  end
20
21
  end
21
22
 
@@ -1,3 +1,5 @@
1
+ require 'playwright/cli/template'
2
+
1
3
  module Playwright
2
4
  class CLI < Hanami::CLI
3
5
  module Commands
@@ -7,77 +9,22 @@ module Playwright
7
9
  class Command
8
10
  include Utils::Display
9
11
  include Utils::Ask
10
- include Utils::ScriptFiles
12
+ include Utils::FileManager
11
13
 
12
14
  TEMPLATE_FILE = 'new_script.erb'.freeze
13
15
  PATH_BIN_DIR = File.join('/', 'usr', 'local', 'bin').freeze
14
16
 
15
- def self.run(name)
16
- new(name).run
17
+ def self.run(name, type)
18
+ new(name, type).run
17
19
  end
18
20
 
19
- def initialize(name)
20
- @template = Playwright::CLI::Template.new(file: TEMPLATE_FILE, script_name: name)
21
+ def initialize(name, type)
21
22
  @name = name
23
+ @type = type
22
24
  end
23
25
 
24
26
  def run
25
- valid? do
26
- create_script
27
- set_permissions
28
- symlink_into_path
29
- open_editor
30
- end
31
- end
32
-
33
- private
34
-
35
- def valid?
36
- validate!
37
- yield
38
- end
39
-
40
- def validate!
41
- if symlink_path_and_file? && !script_path_and_file?
42
- display.error "There is already a script in your #{PATH_BIN_DIR} with that name!"
43
- elsif script_path_and_file?
44
- if ask.boolean_question "This playwright script already exists! Overwrite it?"
45
- delete_playwright_script
46
- else
47
- display.abort "Aborting Operation."
48
- end
49
- end
50
- true
51
- end
52
-
53
- def create_script
54
- if script_path_and_file?
55
- display.error "This script already exists!"
56
- end
57
- FileUtils.mkdir_p(Playwright::CLI::PLAYS_BIN_PATH)
58
- FileUtils.touch(script_path_and_file)
59
- File.write(script_path_and_file, @template.render)
60
- display.color_print "New File Created: #{script_path_and_file}"
61
- end
62
-
63
- def set_permissions
64
- FileUtils.chmod "u+x", script_path_and_file
65
- display.color_print "Executable Permissions Set!"
66
- end
67
-
68
- def symlink_into_path
69
- delete_symlink_path_file
70
- FileUtils.symlink(script_path_and_file, symlink_path_and_file)
71
- display.color_print "Symlink Created!"
72
- end
73
-
74
- def open_editor
75
- `$EDITOR #{script_path_and_file}`
76
- if $?.success?
77
- display.color_print "Opening script in your editor..."
78
- else
79
- display.error "Could not open Editor!"
80
- end
27
+ file_manager.install_script script_name: @name, type: @type
81
28
  end
82
29
 
83
30
  end
@@ -0,0 +1,17 @@
1
+ module Playwright
2
+ class CLI
3
+ class Configuration
4
+ attr_accessor :home_dir,
5
+ :executable_path_dir
6
+
7
+ DEFAULT_HOME = ENV['HOME']
8
+ DEFAULT_EXECUTABLE_PATH_DIR = File.join('/', 'usr', 'local', 'bin')
9
+
10
+ def initialize
11
+ @home_dir = DEFAULT_HOME
12
+ @executable_path_dir = DEFAULT_EXECUTABLE_PATH_DIR
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -1,24 +1,39 @@
1
+ require 'playwright/cli/utils/file_manager'
2
+
1
3
  module Playwright
2
4
  class CLI < Hanami::CLI
3
5
  class Template
4
6
 
5
- attr_reader :script_name
7
+ attr_reader :script_name, :out_file, :type
6
8
 
7
- def initialize(file:, script_name:)
8
- @script_name = script_name
9
- @file = File.join(Playwright::CLI::TEMPLATES_PATH, file)
10
- end
9
+ SIMPLE_TYPE = :simple
10
+ SIMPLE_TEMPLATE = 'simple_script_template.erb'
11
+ EXPANDED_TYPE = :expanded
12
+ EXPANDED_TEMPLATE = 'expanded_script_template.erb'
13
+ SUBCOMMAND_TYPE = :subcommand
14
+ SUBCOMMAND_TEMPLATE = 'version_subcommand_template.erb'
11
15
 
12
- def klass_name
13
- @script_name.split(/[A-Z\-\_\/]/).map(&:capitalize).join
16
+ TEMPLATE_MAP = {
17
+ SIMPLE_TYPE => SIMPLE_TEMPLATE,
18
+ EXPANDED_TYPE => EXPANDED_TEMPLATE,
19
+ SUBCOMMAND_TYPE => SUBCOMMAND_TEMPLATE
20
+ }
21
+
22
+ def initialize(name:, out_file:, type: SIMPLE_TYPE, klass_name: nil)
23
+ @script_name = name
24
+ @out_file = out_file
25
+ @template_file = File.join(Playwright::CLI::TEMPLATES_PATH, TEMPLATE_MAP[type])
26
+ @klass_name = klass_name
14
27
  end
15
28
 
16
- def contents
17
- File.read @file
29
+ def klass_name
30
+ @klass_name || @script_name.gsub('.rb', '').split(/[A-Z\-\_\/]/).map(&:capitalize).join
18
31
  end
19
32
 
20
33
  def render
21
- ERB.new(contents).result(binding)
34
+ contents = File.read(@template_file)
35
+ text = ERB.new(contents).result(binding)
36
+ File.write(out_file, text)
22
37
  end
23
38
 
24
39
  end
@@ -1,6 +1,6 @@
1
1
  require 'playwright/cli/utils/ask'
2
2
  require 'playwright/cli/utils/display'
3
- require 'playwright/cli/utils/script_files'
3
+ require 'playwright/cli/utils/file_manager'
4
4
 
5
5
  module Playwright
6
6
  class CLI < Hanami::CLI
@@ -18,7 +18,8 @@ module Playwright
18
18
 
19
19
  def boolean_question question
20
20
  display.color_print "#{question} [yn]", color: DEFAULT_COLOR
21
- response = STDIN.gets.chomp.strip.downcase.to_sym
21
+ response = $stdin.gets
22
+ sanitized_response = response.chomp.strip.downcase.to_sym if response && response.length > 0
22
23
  boolean_response_map[response]
23
24
  end
24
25
 
@@ -0,0 +1,212 @@
1
+ require 'playwright/cli/utils/ask'
2
+ require 'playwright/cli/utils/display'
3
+ require 'playwright/cli/configuration'
4
+ require 'playwright/cli/template'
5
+
6
+ module Playwright
7
+ class CLI < Hanami::CLI
8
+ module Utils
9
+ module FileManager
10
+
11
+ def file_manager
12
+ @file_manager ||= FileManager.new
13
+ end
14
+
15
+ class FileManager
16
+ include Display
17
+ include Ask
18
+
19
+ attr_reader :script_name, :type
20
+
21
+ def initialize script_name: nil, type: nil
22
+ @script_name = script_name
23
+ @type = type
24
+ end
25
+
26
+ def install_script script_name:, type:
27
+ @script_name = script_name
28
+ @type = type
29
+ create_script_files
30
+ set_permissions
31
+ write_template
32
+ create_symlink
33
+ open_editor
34
+ end
35
+
36
+ def uninstall_script script_name
37
+ @script_name = script_name
38
+ delete_script_files
39
+ end
40
+
41
+ def open_editor script_name: nil
42
+ @script_name ||= script_name
43
+ %x[$EDITOR #{root_dir}]
44
+ if $?.success?
45
+ display.color_print "Opening `#{@script_name}` in your editor..."
46
+ else
47
+ display.error "Could not open Editor!"
48
+ end
49
+ end
50
+
51
+ def script_name_rb
52
+ "#{script_name}.rb"
53
+ end
54
+
55
+ private
56
+
57
+ def self.playwright_parent_dir
58
+ Playwright::CLI.configuration.home_dir
59
+ end
60
+
61
+ def self.executable_path_dir
62
+ Playwright::CLI.configuration.executable_path_dir
63
+ end
64
+
65
+ def self.dot_playwright_dir
66
+ File.join playwright_parent_dir, '.playwright'
67
+ end
68
+
69
+ def self.plays_dir
70
+ File.join dot_playwright_dir, 'plays'
71
+ end
72
+
73
+ def self.config_file
74
+ File.join dot_playwright_dir, 'config.rb'
75
+ end
76
+
77
+ def self.create_file_structure
78
+ FileUtils.mkdir_p(plays_dir)
79
+ FileUtils.touch(config_file)
80
+ end
81
+
82
+ def self.path
83
+ ENV['PATH'].split(':')
84
+ end
85
+
86
+ def self.all_commands_in_path
87
+ @all_commands_in_path ||= path.map do |path_dir|
88
+ Dir["#{path_dir}/*"].map { |executable| executable.split('/').last }
89
+ end.flatten
90
+ end
91
+ # ==============================================================================
92
+ # LAZY ATTRIBUTES
93
+ # ==============================================================================
94
+
95
+ def template
96
+ @template ||= Template.new(name: script_name_rb, out_file: executable_file, type: type)
97
+ end
98
+
99
+ # ==============================================================================
100
+ # PATHS & PATH PREDICATES
101
+ # ==============================================================================
102
+
103
+ def root_dir
104
+ File.join self.class.plays_dir, script_name
105
+ end
106
+
107
+ def root_dir_exists?
108
+ File.exists? root_dir
109
+ end
110
+
111
+ def executable_file
112
+ File.join root_dir, script_name_rb
113
+ end
114
+
115
+ def executable_file_exists?
116
+ File.exists? executable_file
117
+ end
118
+
119
+ def symlink_file
120
+ File.join self.class.executable_path_dir, script_name
121
+ end
122
+
123
+ def symlink_file_exists?
124
+ File.symlink? symlink_file
125
+ end
126
+
127
+ def script_lib_dir
128
+ File.join root_dir, 'lib'
129
+ end
130
+
131
+ def version_subcommand_file
132
+ File.join script_lib_dir, 'version.rb'
133
+ end
134
+
135
+ # ==============================================================================
136
+ # CREATE METHODS
137
+ # ==============================================================================
138
+
139
+ def create_script_files
140
+ validate_before_create_script_files!
141
+ self.class.create_file_structure
142
+ FileUtils.mkdir_p root_dir
143
+ display.color_print "New Directory Created: #{root_dir}"
144
+ FileUtils.touch executable_file
145
+ display.color_print "New File Created: #{executable_file}"
146
+ create_expanded_files if type == :expanded
147
+ end
148
+
149
+ def create_expanded_files
150
+ FileUtils.mkdir_p script_lib_dir
151
+ FileUtils.touch version_subcommand_file
152
+ end
153
+
154
+ def set_permissions
155
+ FileUtils.chmod "u+x", executable_file
156
+ display.color_print "Executable Permissions Set: #{executable_file}"
157
+ end
158
+
159
+ def write_template
160
+ template.render
161
+ if type == Template::EXPANDED_TYPE
162
+ new_template = Template.new(
163
+ name: 'version.rb',
164
+ out_file: version_subcommand_file,
165
+ type: Template::SUBCOMMAND_TYPE,
166
+ klass_name: template.klass_name
167
+ )
168
+ new_template.render
169
+ end
170
+ end
171
+
172
+ def create_symlink
173
+ FileUtils.symlink(executable_file, symlink_file)
174
+ display.color_print "New Symlink Created: #{symlink_file} from #{executable_file}"
175
+ end
176
+
177
+ def validate_before_create_script_files!
178
+ if self.class.all_commands_in_path.include?(script_name)
179
+ display.error "There is already a script in your $PATH with that name!"
180
+ elsif executable_file_exists?
181
+ if ask.boolean_question "This playwright script already exists! Overwrite it?"
182
+ delete_playwright_script
183
+ else
184
+ display.abort "Aborting Operation."
185
+ end
186
+ end
187
+ end
188
+
189
+ # ==============================================================================
190
+ # DELETE METHODS
191
+ # ==============================================================================
192
+
193
+ def delete_script_files
194
+ validate_before_delete_script_files!
195
+ FileUtils.rm_rf root_dir
196
+ FileUtils.rm symlink_file
197
+ display.color_print "Playwright script '#{script_name}' destroyed!"
198
+ end
199
+
200
+ def validate_before_delete_script_files!
201
+ if symlink_file_exists? && !root_dir_exists?
202
+ display.error "The script named '#{script_name}' is not a playright script!"
203
+ elsif !root_dir_exists?
204
+ display.error "No play with that name exists!"
205
+ end
206
+ end
207
+
208
+ end
209
+ end
210
+ end
211
+ end
212
+ end
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
2
  class CLI < Hanami::CLI
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -36,6 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "rspec", "~> 3.0"
37
37
  spec.add_development_dependency "pry", "~> 0.9.0"
38
38
  spec.add_development_dependency "pry-nav", "~> 0.2.4"
39
+ spec.add_development_dependency "memfs", "~> 1.0"
39
40
 
40
41
  spec.add_runtime_dependency "hanami-cli", "~>0.1"
41
42
  spec.add_runtime_dependency "colorize", "~>0.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playwright-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Gregory
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-23 00:00:00.000000000 Z
11
+ date: 2018-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.2.4
83
+ - !ruby/object:Gem::Dependency
84
+ name: memfs
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: hanami-cli
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -127,21 +141,26 @@ files:
127
141
  - bin/console
128
142
  - bin/setup
129
143
  - exe/playwright
130
- - lib/assets/templates/new_script.erb
144
+ - lib/assets/templates/expanded_script_template.erb
145
+ - lib/assets/templates/simple_script_template.erb
146
+ - lib/assets/templates/version_subcommand_template.erb
131
147
  - lib/playwright/cli.rb
132
148
  - lib/playwright/cli/command.rb
133
149
  - lib/playwright/cli/commands.rb
134
150
  - lib/playwright/cli/commands/destroy.rb
135
151
  - lib/playwright/cli/commands/destroy/command.rb
152
+ - lib/playwright/cli/commands/edit.rb
153
+ - lib/playwright/cli/commands/edit/command.rb
136
154
  - lib/playwright/cli/commands/generate.rb
137
155
  - lib/playwright/cli/commands/generate/command.rb
138
156
  - lib/playwright/cli/commands/version.rb
157
+ - lib/playwright/cli/configuration.rb
139
158
  - lib/playwright/cli/registry.rb
140
159
  - lib/playwright/cli/template.rb
141
160
  - lib/playwright/cli/utils.rb
142
161
  - lib/playwright/cli/utils/ask.rb
143
162
  - lib/playwright/cli/utils/display.rb
144
- - lib/playwright/cli/utils/script_files.rb
163
+ - lib/playwright/cli/utils/file_manager.rb
145
164
  - lib/playwright/cli/version.rb
146
165
  - playwright-cli.gemspec
147
166
  homepage: https://github.com/mgreg90/playwright-cli
@@ -1,40 +0,0 @@
1
- module Playwright
2
- class CLI < Hanami::CLI
3
- module Utils
4
- module ScriptFiles
5
-
6
- PATH_BIN_DIR = File.join('/', 'usr', 'local', 'bin').freeze
7
-
8
- def script_path_and_file
9
- File.join Playwright::CLI::PLAYS_BIN_PATH, @name
10
- end
11
-
12
- def script_path_and_file?
13
- File.exists? script_path_and_file
14
- end
15
-
16
- def symlink_path_and_file
17
- File.join PATH_BIN_DIR, @name
18
- end
19
-
20
- def symlink_path_and_file?
21
- File.exists? symlink_path_and_file
22
- end
23
-
24
- def delete_playwright_script
25
- delete_script_file
26
- delete_symlink_path_file
27
- end
28
-
29
- def delete_script_file
30
- FileUtils.rm script_path_and_file if script_path_and_file?
31
- end
32
-
33
- def delete_symlink_path_file
34
- FileUtils.rm symlink_path_and_file if symlink_path_and_file?
35
- end
36
-
37
- end
38
- end
39
- end
40
- end