Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use of rake db tasks #1592

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -6,6 +6,8 @@
.yardoc .yardoc
# Mac OS X files # Mac OS X files
.DS_Store .DS_Store
# database config for testing
config/database.yml
# simplecov coverage data # simplecov coverage data
coverage coverage
data/meterpreter/ext_server_pivot.dll data/meterpreter/ext_server_pivot.dll
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -2,6 +2,10 @@ language: ruby
before_install: before_install:
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -qq libpcap-dev - sudo apt-get install -qq libpcap-dev
before_script:
- cp config/database.yml.travis config/database.yml
- rake db:create
- rake db:migrate


rvm: rvm:
#- '1.8.7' #- '1.8.7'
Expand Down
14 changes: 13 additions & 1 deletion Rakefile
Expand Up @@ -2,6 +2,18 @@ require 'bundler/setup'


require 'metasploit_data_models' require 'metasploit_data_models'


#
# load rake files like a rails engine
#

pathname = Pathname.new(__FILE__)
root = pathname.parent
rakefile_glob = root.join('lib', 'tasks', '**', '*.rake').to_path

Dir.glob(rakefile_glob) do |rakefile|
load rakefile
end

print_without = false print_without = false


begin begin
Expand All @@ -12,7 +24,7 @@ rescue LoadError


print_without = true print_without = true
else else
RSpec::Core::RakeTask.new(:spec) RSpec::Core::RakeTask.new(:spec => 'db:test:prepare')


task :default => :spec task :default => :spec
end end
Expand Down
21 changes: 21 additions & 0 deletions config/database.yml.example
@@ -0,0 +1,21 @@
# Please only use postgresql bound to a TCP port.
development: &pgsql
adapter: postgresql
database: metasploit_framework_development
username: metasploit_framework_development
password: __________________________________
host: localhost
port: 5432
pool: 5
timeout: 5

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
#
# Note also, sqlite3 is totally unsupported by Metasploit now.
test:
<<: *pgsql
database: metasploit_framework_test
username: metasploit_framework_test
password: ___________________________
27 changes: 27 additions & 0 deletions config/database.yml.travis
@@ -0,0 +1,27 @@
# @note This file is only for use in travis-ci. If you need to make a
# config/database.yml for running rake, rake spec, or rspec locally, please
# customize `conifg/database.yml.example`
#
# @example Customizing config/database.yml.example
# cp config/database.yml.example config/database.yml
# # update password fields for each environment's user

# Using the postgres user locally without a host and port is the supported
# configuration from Travis-CI
#
# @see http://about.travis-ci.org/docs/user/database-setup/#PostgreSQL
development: &pgsql
adapter: postgresql
database: metasploit_framework_development
username: postgres
pool: 5
timeout: 5

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
#
# Note also, sqlite3 is totally unsupported by Metasploit now.
test:
<<: *pgsql
database: metasploit_framework_test