Skip to content

Commit

Permalink
Merge pull request #1872 from presidentbeef/more_native_gems_to_ignore
Browse files Browse the repository at this point in the history
Ignore more native gems when building gem
  • Loading branch information
presidentbeef authored Oct 17, 2024
2 parents 2ece3b4 + 72df013 commit 43612a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions brakeman.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Gem::Specification.new do |s|

s.files += Dir['bundle/ruby/*/gems/**/*'].reject do |path|
# Skip unnecessary files in dependencies
path =~ /^bundle\/ruby\/\d\.\d\.\d\/gems\/[^\/]+\/(Rakefile|benchmark|bin|doc|example|man|site|spec|test)/ or
path.include? '/gems/racc'
path =~ %r{^bundle/ruby/\d\.\d\.\d/gems/[^\/]+/(Rakefile|benchmark|bin|doc|example|man|site|spec|test)} or
path =~ %r{/gems/(io-console|racc|strscan)/}
end

# racc is not only a built-in gem, but also has native code which we cannot
Expand Down
9 changes: 7 additions & 2 deletions build.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/env ruby
require 'fileutils'
bundle_exclude = %w[io-console racc strscan]

puts 'Packaging Brakeman gem...'

system 'rm -rf bundle Gemfile.lock brakeman-*.gem' and
system 'BM_PACKAGE=true bundle install --standalone'
system 'BM_PACKAGE=true bundle install --standalone'

abort "No bundle installed" unless Dir.exist? 'bundle'

Expand All @@ -13,7 +16,9 @@
f.puts "path = File.expand_path('../..', __FILE__)"

Dir["bundle/ruby/**/lib"].each do |dir|
f.puts %Q[$:.unshift "\#{path}/#{dir}"] unless dir.include? 'racc' or dir.include? 'strscan'
unless bundle_exclude.any? { |gem_name| dir.include? gem_name }
f.puts %Q[$:.unshift "\#{path}/#{dir}"]
end
end
end

Expand Down

0 comments on commit 43612a6

Please sign in to comment.