upgrade(rails 5): no longer use rake to invoke rake tasks, use rails

though I left the case alone where the command would previously been
just `bundle exec rake`, as doing the same doesn't work for rails.
This commit is contained in:
Joseph Mastey
2017-01-19 13:59:40 -06:00
parent c310273606
commit 54b8c291ea
11 changed files with 22 additions and 23 deletions
+3 -3
View File
@@ -11,8 +11,8 @@ before_install:
- "if [ $(phantomjs --version) != '2.1.1' ]; then tar -xvf ${PWD}/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C ${PWD}/travis_phantomjs; fi"
- "phantomjs --version"
before_script: rake db:setup
before_script: bundle exec rake db:setup
before_script: rails db:setup
before_script: bundle exec rails db:setup
cache: bundler
sudo: false
env: RAILSGOAT_MAINTAINER=true
env: RAILSGOAT_MAINTAINER=true
+9 -8
View File
@@ -42,7 +42,7 @@ $ gem install bundler
Initialize the database:
```bash
$ rake db:setup
$ rails db:setup
```
Start the Thin web server:
@@ -78,7 +78,7 @@ To run Railsgoat with Docker you must first have [Docker](https://docs.docker.co
```
#~/code/railsgoat
$ docker-compose build
$ docker-compose run web rake db:setup
$ docker-compose run web rails db:setup
$ docker-compose up
...
Creating railsgoat_web_1
@@ -103,16 +103,16 @@ In this case, remove that server.pid file and try again. Note also that this fil
## Capybara Tests
RailsGoat now includes a set of failing Capybara RSpecs, each one indicating that a separate vulnerability exists in the application. To run them, you first need to install [PhantomJS](https://github.com/jonleighton/poltergeist#installing-phantomjs) (version 2.1.1 has been tested in Dev and on Travis CI), which is required by the Poltergeist Capybara driver. Upon installation, simply run the following rake task:
RailsGoat now includes a set of failing Capybara RSpecs, each one indicating that a separate vulnerability exists in the application. To run them, you first need to install [PhantomJS](https://github.com/jonleighton/poltergeist#installing-phantomjs) (version 2.1.1 has been tested in Dev and on Travis CI), which is required by the Poltergeist Capybara driver. Upon installation, simply run the following task:
```
$ rake training
$ rails training
```
To run just one spec:
```
$ rake training SPEC=spec/vulnerabilities/sql_injection_spec.rb
$ rails training SPEC=spec/vulnerabilities/sql_injection_spec.rb
```
NOTE: As vulnerabilities are fixed in the application, these specs will not change to `passing`, but to `pending`.
@@ -124,10 +124,10 @@ By default in development mode Railsgoat runs with a SQLite database. There is a
```
#Create the MySQL database
RAILS_ENV=mysql rake db:create
RAILS_ENV=mysql rails db:create
#Run the migrations against the database
RAILS_ENV=mysql rake db:migrate
RAILS_ENV=mysql rails db:migrate
#Boot Rails using MySQl
RAILS_ENV=mysql rails s
@@ -137,9 +137,10 @@ RAILS_ENV=mysql rails s
In order for RailsGoat to effectively process email, you will first need to run MailCatcher, an SMTP server that will intercept email messages and display them in a web interface.
To start an instance of MailCatcher, simply run:
Mailcatcher is not installed by default. To install MailCatcher and start an instance of it, simply run:
```
$ gem install mailcatcher
$ mailcatcher
```
+2 -3
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require_relative 'config/application'
Railsgoat::Application.load_tasks
Rails.application.load_tasks
+1 -1
View File
@@ -23,7 +23,7 @@ module Railsgoat
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# Run "rails -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+1 -1
View File
@@ -19,7 +19,7 @@ mysql:
password:
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# re-generated from your development database when you run "rails".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
+1 -1
View File
@@ -15,7 +15,7 @@ Railsgoat::Application.configure do
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_files = false
config.public_file_server.enabled = false
# Compress JavaScripts and CSS
config.assets.compress = true
+2 -2
View File
@@ -8,8 +8,8 @@ Railsgoat::Application.configure do
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_files = true
config.static_cache_control = "public, max-age=3600"
config.public_file_server.enabled = true
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
# Show full error reports and disable caching.
config.consider_all_requests_local = true
-1
View File
@@ -1,4 +1,3 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
+1 -1
View File
@@ -1,5 +1,5 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
# The data can then be loaded with the rails db:seed (or created alongside the db with db:setup).
#
users = [
+1 -1
View File
@@ -1,2 +1,2 @@
Use this README file to introduce your application and point to useful places in the API for learning more.
Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
Run "rails doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
+1 -1
View File
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
rake db:setup
rails db:setup
rails server