spoom 1.1.13 → 1.1.15
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 +4 -4
- data/lib/spoom/cli/bump.rb +10 -0
- data/lib/spoom/cli/run.rb +7 -0
- data/lib/spoom/context.rb +12 -0
- data/lib/spoom/git.rb +3 -3
- data/lib/spoom/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a61ae83fa56b7a78027c8954c5680d4784c5a3f8b2d717ed3ba49b36409ede2
|
4
|
+
data.tar.gz: b339a398e57f92f71b797dd8d427e18749d1afd6246be42fe549baf96563706e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 981c7b625e31b732ce731c600fd1291afb9635818918d77424750ba152633f06e8f4515037c5044badcc951ded1dd9fd768ae135ff2305359005a2cb7ad47a38
|
7
|
+
data.tar.gz: 123baadb32b3341271b323eab29a1ddb4561c74b9afbe6cfa71af61ff1547783a24a1d439406f482b3c40920b960e4b04fc19ca7c0423c18407af00bc35fa692
|
data/lib/spoom/cli/bump.rb
CHANGED
@@ -28,6 +28,7 @@ module Spoom
|
|
28
28
|
desc: "Command to suggest if files can be bumped"
|
29
29
|
option :count_errors, type: :boolean, default: false,
|
30
30
|
desc: "Count the number of errors if all files were bumped"
|
31
|
+
option :sorbet_options, type: :string, default: "", desc: "Pass options to Sorbet"
|
31
32
|
sig { params(directory: String).void }
|
32
33
|
def bump(directory = ".")
|
33
34
|
in_sorbet_project!
|
@@ -85,6 +86,7 @@ module Spoom
|
|
85
86
|
|
86
87
|
error_url_base = Spoom::Sorbet::Errors::DEFAULT_ERROR_URL_BASE
|
87
88
|
result = Sorbet.srb_tc(
|
89
|
+
*options[:sorbet_options].split(" "),
|
88
90
|
"--error-url-base=#{error_url_base}",
|
89
91
|
path: exec_path,
|
90
92
|
capture_err: true,
|
@@ -105,6 +107,14 @@ module Spoom
|
|
105
107
|
exit(files_to_bump.empty?)
|
106
108
|
end
|
107
109
|
|
110
|
+
unless result.exit_code == 100
|
111
|
+
# Sorbet will return exit code 100 if there are type checking errors.
|
112
|
+
# If Sorbet returned something else, it means it didn't terminate normally.
|
113
|
+
say_error(result.err, status: nil, nl: false)
|
114
|
+
undo_changes(files_to_bump, from)
|
115
|
+
exit(1)
|
116
|
+
end
|
117
|
+
|
108
118
|
errors = Sorbet::Errors::Parser.parse_string(result.err, error_url_base: error_url_base)
|
109
119
|
|
110
120
|
all_files = errors.flat_map do |err|
|
data/lib/spoom/cli/run.rb
CHANGED
@@ -64,6 +64,13 @@ module Spoom
|
|
64
64
|
exit(0)
|
65
65
|
end
|
66
66
|
|
67
|
+
unless result.exit_code == 100
|
68
|
+
# Sorbet will return exit code 100 if there are type checking errors.
|
69
|
+
# If Sorbet returned something else, it means it didn't terminate normally.
|
70
|
+
say_error(result.err, status: nil, nl: false)
|
71
|
+
exit(1)
|
72
|
+
end
|
73
|
+
|
67
74
|
errors = Spoom::Sorbet::Errors::Parser.parse_string(result.err, error_url_base: error_url_base)
|
68
75
|
errors_count = errors.size
|
69
76
|
|
data/lib/spoom/context.rb
CHANGED
@@ -46,6 +46,12 @@ module Spoom
|
|
46
46
|
|
47
47
|
# File System
|
48
48
|
|
49
|
+
# Does the context directory at `absolute_path` exist and is a directory?
|
50
|
+
sig { returns(T::Boolean) }
|
51
|
+
def exist?
|
52
|
+
File.directory?(@absolute_path)
|
53
|
+
end
|
54
|
+
|
49
55
|
# Create the context directory at `absolute_path`
|
50
56
|
sig { void }
|
51
57
|
def mkdir!
|
@@ -190,6 +196,12 @@ module Spoom
|
|
190
196
|
Spoom::Git.current_branch(path: @absolute_path)
|
191
197
|
end
|
192
198
|
|
199
|
+
# Get the last commit in the currently checked out branch
|
200
|
+
sig { params(short_sha: T::Boolean).returns(T.nilable(Git::Commit)) }
|
201
|
+
def git_last_commit(short_sha: true)
|
202
|
+
Spoom::Git.last_commit(path: @absolute_path, short_sha: short_sha)
|
203
|
+
end
|
204
|
+
|
193
205
|
# Sorbet
|
194
206
|
|
195
207
|
# Run `bundle exec srb` in this context directory
|
data/lib/spoom/git.rb
CHANGED
@@ -75,9 +75,9 @@ module Spoom
|
|
75
75
|
# Utils
|
76
76
|
|
77
77
|
# Get the last commit in the currently checked out branch
|
78
|
-
sig { params(path: String).returns(T.nilable(Commit)) }
|
79
|
-
def last_commit(path: ".")
|
80
|
-
result = log("HEAD --format='
|
78
|
+
sig { params(path: String, short_sha: T::Boolean).returns(T.nilable(Commit)) }
|
79
|
+
def last_commit(path: ".", short_sha: true)
|
80
|
+
result = log("HEAD --format='%#{short_sha ? "h" : "H"} %at' -1", path: path)
|
81
81
|
return nil unless result.status
|
82
82
|
|
83
83
|
out = result.out.strip
|
data/lib/spoom/version.rb
CHANGED
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.1.
|
4
|
+
version: 1.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Terrasa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.5.
|
75
|
+
version: 0.5.10187
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.5.
|
82
|
+
version: 0.5.10187
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: sorbet-runtime
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|