Skip to content

Instantly share code, notes, and snippets.

@mathildathompson
Last active August 29, 2015 14:00
Show Gist options
  • Save mathildathompson/7f023ea32f7a873c4c77 to your computer and use it in GitHub Desktop.
Save mathildathompson/7f023ea32f7a873c4c77 to your computer and use it in GitHub Desktop.
rake -T
#You can create your own tasks that will make your life easier;
#Source code files get compiled into object files and these get compiled into machine language;
#Describe in MAKE how to make the files, pays attention to what time the files were updates;
#Sinatra is a DSL lets you use a version of Ruby;
#Rake; #B
#Rake looks in the current directory for a rake file and looks what tasks are available;
#Sort the capitals before the lowercase files, this means it will be sorted first;
#Automated tasks with ruby is done with Rake;
#The same thing that is done in Javascript is Grunt;
rake -T #Finds the rake file;
rake hello.tmp #calles the tmp/hello.temp function;
#It depeneds on the rake file so you have to be in the correct directory;
date
#You have have a task that depends on other tasks;
#Go into pry and type in ENV to show all the environment variables;
export CUPS=7
unset CUPS
ENV['CUPS'] #Inside pry
#Bash is the born again Shell, there is ZShell;
#Name spacing is a prefix infront of tasks which allows us not to have conflicts;
rake morning:drink_coffee
rake #The default task in rake is to run all of the unit tests;
#If you want to add your own tasks add them to the lib tasks folder;
#You have access to User.all inside of the Rake tasks that you created in rails
Rake::Task['morning:make_coffee'].invoke
Add your owns tasks b going to tree lib/tasks
lib/tasks/db.rake
task :artist_count => :environemnt do #We need to environemnt here so we can for example get all the Artists from the database;
puts Artist.count
end
namespace :db do
desc "Drop, recreate and migrate the database"
task :reset do
Rake::Task['db:drop'].invoke
Rake::Task['db:create'].invoke
end
end
#Heroku also supports this;
#Create different types of files, for example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment