diff --git a/brakeman.gemspec b/brakeman.gemspec index 10ec080c2..1a4fe04cc 100644 --- a/brakeman.gemspec +++ b/brakeman.gemspec @@ -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 diff --git a/build.rb b/build.rb index be7d3a354..189e5cf6c 100755 --- a/build.rb +++ b/build.rb @@ -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' @@ -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