From fa310a9b736d858a929715802d98b1a3f0887569 Mon Sep 17 00:00:00 2001 From: Justin Collins Date: Thu, 2 Jun 2016 17:04:32 -0700 Subject: [PATCH] Re-organize gemspecs and add brakeman-lib --- brakeman-lib.gemspec | 22 ++++++++++++++++++++++ brakeman-min.gemspec | 8 ++++---- brakeman.gemspec | 14 ++++---------- gem_common.rb | 22 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 brakeman-lib.gemspec create mode 100644 gem_common.rb diff --git a/brakeman-lib.gemspec b/brakeman-lib.gemspec new file mode 100644 index 0000000000..7ea74130c1 --- /dev/null +++ b/brakeman-lib.gemspec @@ -0,0 +1,22 @@ +require './lib/brakeman/version' +require './gem_common' +gem_priv_key = File.expand_path("~/.ssh/gem-private_key.pem") + +Gem::Specification.new do |s| + s.name = %q{brakeman-lib} + s.version = Brakeman::Version + s.authors = ["Justin Collins"] + s.email = "gem@brakeman.org" + s.summary = "Security vulnerability scanner for Ruby on Rails." + s.description = "Brakeman detects security vulnerabilities in Ruby on Rails applications via static analysis. This package declares gem dependencies instead of bundling them." + s.homepage = "http://brakemanscanner.org" + s.files = ["bin/brakeman", "CHANGES", "WARNING_TYPES", "FEATURES", "README.md"] + Dir["lib/**/*"] + s.executables = ["brakeman"] + s.license = "MIT" + s.cert_chain = ['brakeman-public_cert.pem'] + s.signing_key = gem_priv_key if File.exist? gem_priv_key and $0 =~ /gem\z/ + + Brakeman::GemDependencies.dev_dependencies(s) + Brakeman::GemDependencies.base_dependencies(s) + Brakeman::GemDependencies.extended_dependencies(s) +end diff --git a/brakeman-min.gemspec b/brakeman-min.gemspec index 631978b1d0..80395157f7 100644 --- a/brakeman-min.gemspec +++ b/brakeman-min.gemspec @@ -1,4 +1,5 @@ require './lib/brakeman/version' +require './gem_common' gem_priv_key = File.expand_path("~/.ssh/gem-private_key.pem") Gem::Specification.new do |s| @@ -14,8 +15,7 @@ Gem::Specification.new do |s| s.license = "MIT" s.cert_chain = ['brakeman-public_cert.pem'] s.signing_key = gem_priv_key if File.exist? gem_priv_key and $0 =~ /gem\z/ - s.add_development_dependency "test-unit" - s.add_dependency "ruby_parser", "~>3.8.1" - s.add_dependency "ruby2ruby", "~>2.3.0" - s.add_dependency "safe_yaml", ">= 1.0" + + Brakeman::GemDependencies.dev_dependencies(s) + Brakeman::GemDependencies.base_dependencies(s) end diff --git a/brakeman.gemspec b/brakeman.gemspec index ee20a22b5e..03bc1a44e7 100644 --- a/brakeman.gemspec +++ b/brakeman.gemspec @@ -1,4 +1,5 @@ require './lib/brakeman/version' +require './gem_common' gem_priv_key = File.expand_path("~/.ssh/gem-private_key.pem") Gem::Specification.new do |s| @@ -18,15 +19,8 @@ Gem::Specification.new do |s| if File.exist? 'bundle/load.rb' s.files += Dir['bundle/ruby/*/gems/**/*'] + ['bundle/load.rb'] else - s.add_development_dependency "test-unit" unless ENV['BM_PACKAGE'] - s.add_dependency "ruby_parser", "~>3.8.1" - s.add_dependency "ruby2ruby", "~>2.3.0" - s.add_dependency "terminal-table", "~>1.4" - s.add_dependency "highline", ">=1.6.20", "<2.0" - s.add_dependency "erubis", "~>2.6" - s.add_dependency "haml", ">=3.0", "<5.0" - s.add_dependency "sass", "~>3.0" - s.add_dependency "slim", ">=1.3.6", "<4.0" - s.add_dependency "safe_yaml", ">= 1.0" + Brakeman::GemDependencies.dev_dependencies(s) unless ENV['BM_PACKAGE'] + Brakeman::GemDependencies.base_dependencies(s) + Brakeman::GemDependencies.extended_dependencies(s) end end diff --git a/gem_common.rb b/gem_common.rb new file mode 100644 index 0000000000..d5c4be2311 --- /dev/null +++ b/gem_common.rb @@ -0,0 +1,22 @@ +module Brakeman + module GemDependencies + def self.dev_dependencies spec + spec.add_development_dependency "test-unit" + end + + def self.base_dependencies spec + spec.add_dependency "ruby_parser", "~>3.8.1" + spec.add_dependency "ruby2ruby", "~>2.3.0" + spec.add_dependency "safe_yaml", ">= 1.0" + end + + def self.extended_dependencies spec + spec.add_dependency "terminal-table", "~>1.4" + spec.add_dependency "highline", ">=1.6.20", "<2.0" + spec.add_dependency "erubis", "~>2.6" + spec.add_dependency "haml", ">=3.0", "<5.0" + spec.add_dependency "sass", "~>3.0" + spec.add_dependency "slim", ">=1.3.6", "<4.0" + end + end +end