spoom 1.7.9 → 1.7.10
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/bundler_helper.rb +33 -0
- data/lib/spoom/cli/srb/sigs.rb +7 -3
- data/lib/spoom/context/bundle.rb +1 -1
- data/lib/spoom/poset.rb +1 -1
- data/lib/spoom/version.rb +1 -1
- data/rbi/spoom.rbi +7 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82dc04cf069a738410f097150bff4d94af38dc6f7eefca31c368596eaf138da0
|
|
4
|
+
data.tar.gz: ea4046ff175a5c05eb85dc8cc22b6cb88f294d63b378b88a790f6bd4d92bfaff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6c72f54e3398d0d599b92d5c266bdea3db2ee78b10151bf9a5644f2679d0778ecef4cfce105bb8dd284947e6c737ff194599c2e72ab7894dd0122466034c553
|
|
7
|
+
data.tar.gz: ed0df1194a93939bbb4117efbc3218d9f18d079cd2dd6b704579ba8e4c78f6f5f8a58b02072dc99bd19870eeaed0bc449ee70ea5c965e152685239b801d97c99
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Spoom
|
|
5
|
+
module BundlerHelper
|
|
6
|
+
extend T::Sig
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
# Generate a gem requirement for the given gem name, using that gem's version in the "real" current bundle.
|
|
10
|
+
#
|
|
11
|
+
# This ensures that any child Spoom::Contexts use predictable gem versions,
|
|
12
|
+
# without having to manually specify them and bump them to stay in sync with Spoom's real Gemfile.
|
|
13
|
+
#
|
|
14
|
+
# Given `"foo"`, returns a string like 'gem "foo", "= 1.2.3"', suitable for inserting into a Gemfile.
|
|
15
|
+
#: (String) -> String
|
|
16
|
+
def gem_requirement_from_real_bundle(gem_name)
|
|
17
|
+
specs = Bundler.load.gems[gem_name]
|
|
18
|
+
|
|
19
|
+
if specs.nil? || specs.empty?
|
|
20
|
+
raise "Did not find gem #{gem_name.inspect} in the current bundle"
|
|
21
|
+
elsif specs.count > 1
|
|
22
|
+
raise <<~MSG
|
|
23
|
+
Found multiple versions of #{gem_name.inspect} in the current bundle:
|
|
24
|
+
#{specs.sort_by(&:version).map { |spec| " - #{spec.name} #{spec.version}" }.join("\n")}
|
|
25
|
+
MSG
|
|
26
|
+
else
|
|
27
|
+
spec = specs.first
|
|
28
|
+
%(gem "#{spec.name}", "= #{spec.version}")
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/lib/spoom/cli/srb/sigs.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: true
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require "spoom/bundler_helper"
|
|
5
|
+
|
|
4
6
|
module Spoom
|
|
5
7
|
module Cli
|
|
6
8
|
module Srb
|
|
@@ -142,12 +144,14 @@ module Spoom
|
|
|
142
144
|
# Now we create a new context to import our modified gem and run tapioca
|
|
143
145
|
say("Running Tapioca...")
|
|
144
146
|
tapioca_context = Spoom::Context.mktmp!
|
|
145
|
-
tapioca_context.
|
|
147
|
+
tapioca_context.write_gemfile!(<<~GEMFILE)
|
|
146
148
|
source "https://rubygems.org"
|
|
147
149
|
|
|
148
|
-
|
|
150
|
+
#{Spoom::BundlerHelper.gem_requirement_from_real_bundle("rbs")}
|
|
151
|
+
#{Spoom::BundlerHelper.gem_requirement_from_real_bundle("tapioca")}
|
|
152
|
+
|
|
149
153
|
gem "#{spec.name}", path: "#{copy_context.absolute_path}"
|
|
150
|
-
|
|
154
|
+
GEMFILE
|
|
151
155
|
exec(tapioca_context, "bundle install")
|
|
152
156
|
exec(tapioca_context, "bundle exec tapioca gem #{spec.name} --no-doc --no-loc --no-file-header")
|
|
153
157
|
|
data/lib/spoom/context/bundle.rb
CHANGED
|
@@ -48,7 +48,7 @@ module Spoom
|
|
|
48
48
|
return {} unless file?("Gemfile.lock")
|
|
49
49
|
|
|
50
50
|
parser = Bundler::LockfileParser.new(read_gemfile_lock)
|
|
51
|
-
parser.specs.
|
|
51
|
+
parser.specs.to_h { |spec| [spec.name, spec] }
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# Get `gem` version from the `Gemfile.lock` content
|
data/lib/spoom/poset.rb
CHANGED
data/lib/spoom/version.rb
CHANGED
data/rbi/spoom.rbi
CHANGED
|
@@ -11,6 +11,13 @@ module Spoom
|
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
module Spoom::BundlerHelper
|
|
15
|
+
class << self
|
|
16
|
+
sig { params(gem_name: ::String).returns(::String) }
|
|
17
|
+
def gem_requirement_from_real_bundle(gem_name); end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
14
21
|
module Spoom::Cli; end
|
|
15
22
|
|
|
16
23
|
class Spoom::Cli::Deadcode < ::Thor
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spoom
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexandre Terrasa
|
|
@@ -162,6 +162,7 @@ files:
|
|
|
162
162
|
- exe/spoom
|
|
163
163
|
- lib/spoom.rb
|
|
164
164
|
- lib/spoom/backtrace_filter/minitest.rb
|
|
165
|
+
- lib/spoom/bundler_helper.rb
|
|
165
166
|
- lib/spoom/cli.rb
|
|
166
167
|
- lib/spoom/cli/config.rb
|
|
167
168
|
- lib/spoom/cli/deadcode.rb
|