-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
74 lines (65 loc) · 2.77 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# frozen_string_literal: true
Bundler.require
require 'sinatra/activerecord/rake'
require './app'
task default: :help
Dir['tasks/*.rake'].each { |task| load task }
task :console do
puts 'Loading development console...'
system('irb -r ./app.rb')
end
task :server do
puts 'Loading development console...'
system('bundle exec shotgun -p 3003')
end
task :routes do
Cessation::App.routes.each do |route|
puts route.to_s.colorize(:green)
end
end
desc 'Run specs'
task :spec do
system('bundle exec rspec')
end
task :rcov do
ENV['COVERAGE'] = 'true'
Rake::Task['spec'].execute
end
task :help do
db_tasks = <<DBTASKS
##########################################
UTILITY TASKS
##########################################
rake console # Run a IRB console with all enviroment loaded
rake spec # Run specs
rake rcov # Run specs and calculate coverage
rake server # Run shotgun server in 3010 port
##########################################
DATABASE RELATED TASKS
##########################################
rake db:create # Creates the database from DATABASE_URL
# or config/database.yml for the current ENV
rake db:create_migration # Create a migration (parameters: NAME, VERSION)
rake db:drop # Drops the database from DATABASE_URL
# or config/database.yml for the current ENV
rake db:fixtures:load # Load fixtures into the current environment's database
rake db:migrate # Migrate the database
# (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rake db:migrate:status # Display status of migrations
rake db:rollback # Rolls the schema back to the
# previous version (specify steps w/ STEP=n)
rake db:schema:cache:clear # Clear a db/schema_cache.dump file
rake db:schema:cache:dump # Create a db/schema_cache.dump file
rake db:schema:dump # Create a db/schema.rb file that is portable
# against any DB supported by AR
rake db:schema:load # Load a schema.rb file into the database
rake db:seed # Load the seed data from db/seeds.rb
rake db:setup # Create the database, load the schema, and
# initialize with the seed data (use db:reset to
# also drop the database first)
rake db:structure:dump # Dump the database structure to db/structure.sql
rake db:structure:load # Recreate the databases from the structure.sql file
rake db:version # Retrieves the current schema version number
DBTASKS
puts db_tasks.colorize(:green)
end