rspec-interactive 0.7.2 → 0.8.0
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/rspec-interactive.rb +9 -0
- data/lib/rspec-interactive/input_completer.rb +9 -5
- data/lib/rspec-interactive/rubo_cop_command.rb +24 -0
- data/lib/rspec-interactive/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44b14e54786342da3629408fcbaa937173a3965eb3913da0c852a1e7300ac710
|
4
|
+
data.tar.gz: 729af533ef4f4aa26201704430c7dd99c1902d3cd6ab7e924a258340f77a7664
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d83fa6a30f885189a65de0a24cb639ff0e62e6e089378403f5698e75dea8761ab8e74dfd1fd05fe533f37070dd89f683ea9e95eac9ca4b9b0daa33e7b8d4cdf1
|
7
|
+
data.tar.gz: e2cd51ef90235dacf57a47feb4f8b4cdca4e8191c437c57acc73fe0990d055f98d4db6e0e38a84aae4e07fd342a60d34c75a3035ff2a4b86d0f88187cdb45d90
|
data/Gemfile.lock
CHANGED
data/lib/rspec-interactive.rb
CHANGED
@@ -11,6 +11,7 @@ require 'rspec-interactive/rspec_config_cache'
|
|
11
11
|
require 'rspec-interactive/input_completer'
|
12
12
|
require 'rspec-interactive/refresh_command'
|
13
13
|
require 'rspec-interactive/rspec_command'
|
14
|
+
require 'rspec-interactive/rubo_cop_command'
|
14
15
|
|
15
16
|
module RSpec
|
16
17
|
module Interactive
|
@@ -171,5 +172,13 @@ module RSpec
|
|
171
172
|
ensure
|
172
173
|
@runner = nil
|
173
174
|
end
|
175
|
+
|
176
|
+
def self.rubo_cop(args)
|
177
|
+
if defined?(RuboCop)
|
178
|
+
RuboCop::CLI.new.run args
|
179
|
+
else
|
180
|
+
@error_stream.puts "fatal: RuboCop not found. Is the gem installed in this project?"
|
181
|
+
end
|
182
|
+
end
|
174
183
|
end
|
175
184
|
end
|
@@ -1,23 +1,27 @@
|
|
1
1
|
module RSpec::Interactive
|
2
2
|
class InputCompleter < Pry::InputCompleter
|
3
3
|
|
4
|
-
def
|
4
|
+
def cli_completions(command, string)
|
5
5
|
line = Readline.line_buffer
|
6
6
|
before_current = Readline.point == string.length ? '' : line[0..(Readline.point - string.length)]
|
7
7
|
before_cursor = line[0..(Readline.point - 1)]
|
8
8
|
|
9
|
-
if line.match(/^
|
9
|
+
if line.match(/^ *#{command} +/)
|
10
10
|
Dir[string + '*'].map { |filename| File.directory?(filename) ? "#{filename}/" : filename }
|
11
|
-
elsif before_current.strip.empty? &&
|
12
|
-
["
|
11
|
+
elsif before_current.strip.empty? && command.match(/^#{Regexp.escape(string)}/)
|
12
|
+
["#{command} "]
|
13
13
|
else
|
14
14
|
nil
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
def call(str, options = {})
|
19
|
-
rspec_completions =
|
19
|
+
rspec_completions = cli_completions('rspec', str)
|
20
20
|
return rspec_completions if rspec_completions
|
21
|
+
|
22
|
+
rubocop_completions = cli_completions('rubocop', str)
|
23
|
+
return rubocop_completions if rubocop_completions
|
24
|
+
|
21
25
|
super
|
22
26
|
end
|
23
27
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RSpec::Interactive
|
4
|
+
class RuboCopCommand < Pry::ClassCommand
|
5
|
+
match 'rubocop'
|
6
|
+
description "Invoke RuboCop."
|
7
|
+
|
8
|
+
banner <<-BANNER
|
9
|
+
Usage: rubocop [arguments]
|
10
|
+
|
11
|
+
See https://docs.rubocop.org/rubocop/usage/basic_usage.html
|
12
|
+
BANNER
|
13
|
+
|
14
|
+
command_options(
|
15
|
+
:keep_retval => false
|
16
|
+
)
|
17
|
+
|
18
|
+
def process
|
19
|
+
RSpec::Interactive.rubo_cop(args)
|
20
|
+
end
|
21
|
+
|
22
|
+
Pry::Commands.add_command(::RSpec::Interactive::RuboCopCommand)
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-interactive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Dower
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- lib/rspec-interactive/refresh_command.rb
|
82
82
|
- lib/rspec-interactive/rspec_command.rb
|
83
83
|
- lib/rspec-interactive/rspec_config_cache.rb
|
84
|
+
- lib/rspec-interactive/rubo_cop_command.rb
|
84
85
|
- lib/rspec-interactive/runner.rb
|
85
86
|
- lib/rspec-interactive/version.rb
|
86
87
|
- rspec-interactive.gemspec
|