r2m 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +5 -0
- data/README.md +1 -1
- data/docs/.keep +0 -0
- data/docs/_config.yml +1 -0
- data/exe/r2m +2 -2
- data/lib/r2m/command.rb +24 -10
- data/lib/r2m/processor.rb +2 -2
- data/lib/r2m/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 503c7c4d167a93d9ab4e6cdc6ca79954e6069e0fd19057d299f8ea7246af1f4d
|
4
|
+
data.tar.gz: c902939ee55bc510b05dd89f4518654b38299dce0a26c0f8e565a3faab69acb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '048f7dbdf9e279ab9bba516b66a57b5fce3faf108d9e4b0eef140c6a7131a2ba961fae58181c693055ec4cffd09acb3751da4c2dffe9527e66748572c67cf2aa'
|
7
|
+
data.tar.gz: 4ed428ef6032d856d2f0db3b95673d67b5473c08a8ffed490922f703854f21a86bc10d254f1bdc4930c81a2f93a653787d1d26c35e870339f6144fd205b58ba2
|
data/.github/FUNDING.yml
ADDED
data/README.md
CHANGED
data/docs/.keep
ADDED
File without changes
|
data/docs/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
theme: jekyll-theme-architect
|
data/exe/r2m
CHANGED
data/lib/r2m/command.rb
CHANGED
@@ -1,21 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require 'thor'
|
4
|
+
require_relative './processor'
|
3
5
|
|
4
6
|
module R2M
|
7
|
+
# Adds CLI commands convert and migrate
|
8
|
+
# bin/r2m convert
|
5
9
|
class Command < Thor
|
6
10
|
include Thor::Actions
|
7
11
|
|
8
12
|
default_command :convert
|
9
|
-
argument :path, default: 'spec'
|
10
13
|
|
11
14
|
def self.exit_on_failure?
|
12
15
|
true
|
13
16
|
end
|
14
17
|
|
15
|
-
desc 'convert', 'Convert Rspec to
|
18
|
+
desc 'convert [path...]', 'Convert Rspec to minitest'
|
19
|
+
def convert(pathes)
|
20
|
+
files(pathes).each { |file| process file }
|
21
|
+
end
|
16
22
|
|
17
|
-
|
18
|
-
|
23
|
+
desc 'migrate [path...]', 'Move found specs to test folder and convert them'
|
24
|
+
method_option :replace_suffix,
|
25
|
+
desc: 'Renames *_spec.rb to *_test.rb',
|
26
|
+
default: true,
|
27
|
+
aliases: ['s'],
|
28
|
+
type: :boolean
|
29
|
+
def migrate(pathes)
|
30
|
+
pp files(pathes)
|
19
31
|
end
|
20
32
|
|
21
33
|
private
|
@@ -24,12 +36,14 @@ module R2M
|
|
24
36
|
Processor.new(self).process(file)
|
25
37
|
end
|
26
38
|
|
27
|
-
def files
|
28
|
-
|
29
|
-
Dir.
|
30
|
-
|
31
|
-
|
32
|
-
|
39
|
+
def files(pathes)
|
40
|
+
Array(pathes).map do |path|
|
41
|
+
if Dir.exist?(path)
|
42
|
+
Dir.glob(File.join(path, '**', '*_spec.rb'))
|
43
|
+
else
|
44
|
+
Dir.glob(path)
|
45
|
+
end
|
46
|
+
end.flatten
|
33
47
|
end
|
34
48
|
end
|
35
49
|
end
|
data/lib/r2m/processor.rb
CHANGED
@@ -20,10 +20,10 @@ module R2M
|
|
20
20
|
# # => def test_converts_it_s_to_test_method_with_support
|
21
21
|
def convert_it_to_methods(file)
|
22
22
|
@command.gsub_file(file, /(?<=\bit ').*?(?=' do\b)/) do |match|
|
23
|
-
match.gsub(
|
23
|
+
match.gsub(/\W+/, '_').downcase
|
24
24
|
end
|
25
25
|
|
26
|
-
@command.gsub_file(file, /it '(.*)' do/, 'def test_\1')
|
26
|
+
@command.gsub_file(file, /it '_?(.*)' do/, 'def test_\1')
|
27
27
|
end
|
28
28
|
|
29
29
|
# Finds +be_empty+ RSpec matchers and converts to minitest matchers
|
data/lib/r2m/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r2m
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Keen
|
@@ -33,6 +33,7 @@ executables:
|
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files: []
|
35
35
|
files:
|
36
|
+
- ".github/FUNDING.yml"
|
36
37
|
- ".gitignore"
|
37
38
|
- ".travis.yml"
|
38
39
|
- CODE_OF_CONDUCT.md
|
@@ -43,6 +44,8 @@ files:
|
|
43
44
|
- Rakefile
|
44
45
|
- bin/console
|
45
46
|
- bin/setup
|
47
|
+
- docs/.keep
|
48
|
+
- docs/_config.yml
|
46
49
|
- exe/r2m
|
47
50
|
- exe/rspec2minitest
|
48
51
|
- lib/r2m.rb
|