spoom 1.0.6 → 1.0.7

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: 8b9a6d7f3818e0af29439ba291b6c05fa29a821de374ee5c8181c64a05f3f7a3
4
- data.tar.gz: 6d60e6fc252e6aebcfff2860778b1e2ac596740823a279aec1788ccaefa2fc4b
3
+ metadata.gz: f16907e7c4ce2a3d368bcac828ae7cfb43f0dde8f857bbfa364c4a3a16e0e433
4
+ data.tar.gz: b6d2a532d34b0cd5e8e4964d2edc5e279e5481de511a4e61ea764e120e4bae33
5
5
  SHA512:
6
- metadata.gz: d156b4d9c8f2edb2f68e1b5fc21b659d8bec0bc60fd9110f565889a620febce064cc3ee176228cd659f1b21ca0ab000a9790407537eb9bd18edbc41d601b963b
7
- data.tar.gz: a7e1bf03e8bd942bc0f2ac6379739bfd795d1642025e00ef33e198b6422c61598b23c753248a698568b7c1edde23d232604b76ccdfd9d1b7ef98139c74cc583a
6
+ metadata.gz: ad2f822b0c34fdb51ae8002bdc2c3f35202e219e334723716b141afe9ab00b18c65f74c3129cff6e4a9cb992d3c673ccb8afa522114cf2759af5cdd888df5100
7
+ data.tar.gz: f077abc8f9be4b2768776214601dd1c8d8c5709649536202a0ab9765058de9dc8590712b9a6fb96c30a0ac5ed46e7c21d84ab9bff190e48d99d5e0bddab1d44e
@@ -18,6 +18,8 @@ module Spoom
18
18
  option :force, desc: "change strictness without type checking", type: :boolean, default: false, aliases: :f
19
19
  sig { params(directory: String).void }
20
20
  def bump(directory = ".")
21
+ in_sorbet_project!
22
+
21
23
  from = options[:from]
22
24
  to = options[:to]
23
25
  force = options[:force]
@@ -32,28 +34,27 @@ module Spoom
32
34
  exit(1)
33
35
  end
34
36
 
37
+ directory = File.expand_path(directory)
35
38
  files_to_bump = Sorbet::Sigils.files_with_sigil_strictness(directory, from)
36
-
37
39
  Sorbet::Sigils.change_sigil_in_files(files_to_bump, to)
38
40
 
39
- return [] if force
41
+ return if force
40
42
 
41
- output, no_errors = Sorbet.srb_tc(path: File.expand_path(directory), capture_err: true)
43
+ output, no_errors = Sorbet.srb_tc(path: exec_path, capture_err: true)
42
44
 
43
- return [] if no_errors
45
+ return if no_errors
44
46
 
45
47
  errors = Sorbet::Errors::Parser.parse_string(output)
46
48
 
47
49
  files_with_errors = errors.map do |err|
48
- path = err.file
49
- File.join(directory, path) if path && File.file?(path)
50
+ path = File.expand_path(err.file)
51
+ next unless path.start_with?(directory)
52
+ next unless File.file?(path)
53
+ path
50
54
  end.compact.uniq
51
55
 
52
56
  Sorbet::Sigils.change_sigil_in_files(files_with_errors, from)
53
57
  end
54
-
55
- no_commands do
56
- end
57
58
  end
58
59
  end
59
60
  end
@@ -37,7 +37,11 @@ module Spoom
37
37
  sig { void }
38
38
  def in_sorbet_project!
39
39
  unless in_sorbet_project?
40
- say_error("not in a Sorbet project (no sorbet/config)")
40
+ say_error(
41
+ "not in a Sorbet project (#{colorize(sorbet_config, :yellow)} not found)\n\n" \
42
+ "When running spoom from another path than the project's root, " \
43
+ "use #{colorize('--path PATH', :blue)} to specify the path to the root."
44
+ )
41
45
  Kernel.exit(1)
42
46
  end
43
47
  end
@@ -1,6 +1,8 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'pathname'
5
+
4
6
  module Spoom
5
7
  module Config
6
8
  SORBET_CONFIG = "sorbet/config"
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Spoom
5
- VERSION = "1.0.6"
5
+ VERSION = "1.0.7"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spoom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Terrasa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-19 00:00:00.000000000 Z
11
+ date: 2020-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler