Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Commit

Permalink
Updated the gemspec to prevent version.rb from being loaded twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Jun 27, 2011
1 parent 9851a71 commit ce04dba
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ronin-metasploit.gemspec
Expand Up @@ -3,6 +3,8 @@
require 'yaml'

Gem::Specification.new do |gemspec|
root = File.dirname(__FILE__)
lib_dir = File.join(root,'lib')
files = if File.directory?('.git')
`git ls-files`.split($/)
elsif File.directory?('.hg')
Expand All @@ -23,12 +25,12 @@ Gem::Specification.new do |gemspec|
}

version = {
:file => 'lib/ronin/metasploit/version.rb',
:file => 'ronin/metasploit/version',
:constant => 'Ronin::Metasploit::VERSION'
}

defaults = {
'name' => File.basename(File.dirname(__FILE__)),
'name' => File.basename(root),
'files' => files,
'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
Expand All @@ -40,8 +42,10 @@ Gem::Specification.new do |gemspec|
gemspec.name = metadata.fetch('name',defaults[:name])
gemspec.version = if metadata['version']
metadata['version']
elsif File.file?(version[:file])
require File.join('.',version[:file])
else
$LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)

require version[:file]
eval(version[:constant])
end

Expand Down

0 comments on commit ce04dba

Please sign in to comment.