be-let-it-be 0.0.2 → 0.0.3

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: 15176b1a907a256ee2b544ff198041fdce5d64599f70209d6ec498898b75ad9c
4
- data.tar.gz: 2cb16333cfb481c3392716be02a2900e837e6de27b45eff297789daf7b1f3d1c
3
+ metadata.gz: a7d99f9f4833b5a845a011636240c7021580144ae51712caa303fed93889a562
4
+ data.tar.gz: 4bb51c1083cb8a269e37d5da677efdd68bba8f8ba163c7619586b3f80ef65ea0
5
5
  SHA512:
6
- metadata.gz: 7a7407883bc8103b91493f2e8e97f725967419015d6e450583d8663ee1981e26100f22c614c8e5205cbb211f4626689c51d47b3fe384235410f13c8ca82cafd4
7
- data.tar.gz: 550a4e4d787185bc322814b18f13deed3c686bfa122e27bd3259936be08a24c37be97d2aaeab8196ad01926d428b9975ce9682f2c32c507c8e507bdbf8e7dbd0
6
+ metadata.gz: '09327031b5cb63a160b6f43eed9bc15fc7d8416d5aefdd9aa5e90849c7f7f277838e1d5147999e0fdeb541008337cd5edb9056a61949c50210128534c8ecf049'
7
+ data.tar.gz: 646cbf8d1740b56d924214b174831ccd872e2c74401b618367de4f85d22cf7050be0ecb117e20adb195ac3d45e76951e3b7e18a9636605dfac50ab33359e3f9e
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # be-let-it-be
2
2
 
3
- [![Ruby](https://github.com/moznion/be-let-it-be/actions/workflows/main.yml/badge.svg)](https://github.com/moznion/be-let-it-be/actions/workflows/main.yml)
3
+ [![Ruby](https://github.com/moznion/be-let-it-be/actions/workflows/main.yml/badge.svg)](https://github.com/moznion/be-let-it-be/actions/workflows/main.yml) [![Gem Version](https://badge.fury.io/rb/be-let-it-be.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/be-let-it-be)
4
4
 
5
5
  A command-line tool that automatically converts RSpec's `let` and `let!` declarations to `let_it_be` where it's safe to do so. The tool runs your tests after each conversion to ensure they still pass, making the optimization process safe and reliable.
6
6
 
@@ -9,6 +9,7 @@ module BeLetItBe
9
9
  option :dryrun, type: :boolean, default: false, desc: "Show what would be converted without modifying files"
10
10
  option :verbose, type: :boolean, default: false, desc: "Show the processing output verboselly"
11
11
  option :rspec_cmd, type: :string, default: "bundle exec rspec", desc: "RSpec command to check the behaviour"
12
+ option :dryrun_exit_code, type: :numeric, default: 1, desc: "Exit code to use in dryrun mode when any convertible declarations are present"
12
13
 
13
14
  def convert(file)
14
15
  @processed_let_lines = []
@@ -34,7 +35,7 @@ module BeLetItBe
34
35
  num_of_lets = lets.length
35
36
 
36
37
  if num_of_lets.zero?
37
- say "no let/let! in the given spec; do nothing"
38
+ say "no let/let! in the given spec; do nothing"
38
39
  exit 0
39
40
  end
40
41
 
@@ -49,11 +50,11 @@ module BeLetItBe
49
50
  say "[#{processed_num}/#{num_of_lets}] Testing conversion of #{let[:type]} :#{let[:name]} at #{file}:#{let[:line]}"
50
51
 
51
52
  if converter.try_conversion_single_let(let, temp_file, -> { run_rspec(temp_file) })
52
- say " Converted to let_it_be"
53
+ say " Converted to let_it_be"
53
54
  converter = Converter.new(temp_file) # pile the converted items
54
55
  converted_count += 1
55
56
  else
56
- say " Keeping original #{let[:type]} (test failed with let_it_be)"
57
+ say " Keeping original #{let[:type]} (test failed with let_it_be)"
57
58
  end
58
59
 
59
60
  @processed_let_lines << let[:line]
@@ -61,14 +62,16 @@ module BeLetItBe
61
62
  end
62
63
 
63
64
  if converted_count > 0
65
+ say "🚀 Successfully converted #{converted_count} out of #{lets.size} definitions to let_it_be"
66
+
64
67
  if options[:dryrun]
65
68
  puts File.read(temp_file)
69
+ exit options[:dryrun_exit_code]
66
70
  else
67
71
  File.write(file, File.read(temp_file))
68
72
  end
69
- say "✅ Successfully converted #{converted_count} out of #{lets.size} definitions to let_it_be"
70
73
  else
71
- say " No conversions were possible (all tests failed with let_it_be)"
74
+ say "❣️ No conversions were possible (all tests failed with let_it_be)"
72
75
  end
73
76
  ensure
74
77
  File.unlink(temp_file) if File.exist?(temp_file)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BeLetItBe
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: be-let-it-be
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - moznion
@@ -47,7 +47,6 @@ extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
49
  - ".standard.yml"
50
- - CHANGELOG.md
51
50
  - CODE_OF_CONDUCT.md
52
51
  - LICENSE.txt
53
52
  - README.md
@@ -68,7 +67,7 @@ licenses:
68
67
  metadata:
69
68
  homepage_uri: https://github.com/moznion/be-let-it-be
70
69
  source_code_uri: https://github.com/moznion/be-let-it-be
71
- changelog_uri: https://github.com/moznion/be-let-it-be/blob/main/CHANGELOG.md
70
+ changelog_uri: https://github.com/moznion/be-let-it-be/releases
72
71
  rdoc_options: []
73
72
  require_paths:
74
73
  - lib
data/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2025-06-08
4
-
5
- - Initial release