r2m 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53939bc36ae3235482a35f14f0b36c57fdb17d8ffb6a67b9ebc9234539a42238
4
- data.tar.gz: 3a7715ced211cd31c3792e0d571953f6a83175dcfc51d605f435feb4ba51ff10
3
+ metadata.gz: 503c7c4d167a93d9ab4e6cdc6ca79954e6069e0fd19057d299f8ea7246af1f4d
4
+ data.tar.gz: c902939ee55bc510b05dd89f4518654b38299dce0a26c0f8e565a3faab69acb9
5
5
  SHA512:
6
- metadata.gz: c37f2ad45f5906bfe4ffa97e8e0d83349f15b34d9cc8e1910a18b4197f9ac820dd5b828cf3b82e86647988dcbdcbc1519f0065764f3080bf7efb18eb8bd14799
7
- data.tar.gz: c1b7292e75f40c8a103e56ac4f9ea36301384a32e8cef8a8871533d16502c11526e4859fb2f094320f3708682bd1307530c5bec3571d5ce5051b591f4fbf8487
6
+ metadata.gz: '048f7dbdf9e279ab9bba516b66a57b5fce3faf108d9e4b0eef140c6a7131a2ba961fae58181c693055ec4cffd09acb3751da4c2dffe9527e66748572c67cf2aa'
7
+ data.tar.gz: 4ed428ef6032d856d2f0db3b95673d67b5473c08a8ffed490922f703854f21a86bc10d254f1bdc4930c81a2f93a653787d1d26c35e870339f6144fd205b58ba2
@@ -0,0 +1,5 @@
1
+ # These are supported funding model platforms
2
+
3
+ # github: [pftg]
4
+ patreon: pftg
5
+ custom: ['https://www.jetthoughts.com', 'https://jtway.co']
data/README.md CHANGED
@@ -22,7 +22,7 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ $ r2m convert test/system/**/*_spec.rb
26
26
 
27
27
  ## Development
28
28
 
data/docs/.keep ADDED
File without changes
data/docs/_config.yml ADDED
@@ -0,0 +1 @@
1
+ theme: jekyll-theme-architect
data/exe/r2m CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  require 'rubygems'
5
5
 
6
- require 'r2m/command'
6
+ require_relative '../lib/r2m/command'
7
7
 
8
- R2M::Command.start
8
+ R2M::Command.start(ARGV)
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 MiniTest'
18
+ desc 'convert [path...]', 'Convert Rspec to minitest'
19
+ def convert(pathes)
20
+ files(pathes).each { |file| process file }
21
+ end
16
22
 
17
- def convert
18
- files.each { |file| process file }
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
- if Dir.exist?(path)
29
- Dir.glob(File.join(path, '**', '*_test.rb'))
30
- else
31
- Dir.glob(path)
32
- end
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(/[^\w]+/, '_').downcase
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
@@ -1,3 +1,3 @@
1
1
  module R2M
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
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.1
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