Skip to content

Commit

Permalink
remove dud configuration options before packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
george-carlin committed Jun 23, 2015
1 parent caf4ed3 commit e4a8f60
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packaging/rake_rules.rb
@@ -1,8 +1,9 @@
# For Bundler.with_clean_env
require 'bundler/setup'

require 'core/version'

require "sqlite3"

PACKAGE_NAME = "dradis"
VERSION = Core::VERSION::STRING
TRAVELING_RUBY_VERSION = "20150517-2.1.6"
Expand Down Expand Up @@ -194,6 +195,16 @@ def create_package(target)
sh "RAILS_ENV=production thor dradis:setup:seed"
sh "cp db/production.sqlite3 #{package_dir}/lib/app/db/"

db = SQLite3::Database.new "#{package_dir}/lib/app/db/production.sqlite3"
table = "dradis_configurations"
# These configuration options contain hardcoded file paths that will almost
# definitely not be the same on the user's machine... so delete them and
# make the user generate their own.
db.execute "DELETE FROM #{table} WHERE name='admin:paths:templates:reports';"
db.execute "DELETE FROM #{table} WHERE name='admin:paths:templates:plugins';"
# Reset the password:
db.execute "UPDATE #{table} SET value='improvable_dradis' WHERE name='password';"

puts "\nCopying ruby..."
sh "mkdir #{package_dir}/lib/ruby"
sh "tar -xzf packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}.tar.gz -C #{package_dir}/lib/ruby"
Expand Down

0 comments on commit e4a8f60

Please sign in to comment.