Created
May 29, 2014 18:44
-
-
Save taylor-smith/94e5660151a642e3427f to your computer and use it in GitHub Desktop.
(Poor) Examples of sample db:load, db:create, db:drop rake tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :type_of_task do | |
task :name_of_task => [:task_dependency] do | |
puts "I Work!" | |
end | |
task :task_dependency do | |
puts "I am working as well!" | |
end | |
end | |
namespace :app do | |
task :load_app do | |
puts "I work!" | |
end | |
end | |
namespace :db do | |
task :load => ["app:load_app"] do | |
# db = SQLite3::Database.new("test.db") | |
def something | |
db ||= SQLite3::Database.new("test.db") | |
puts 'I work!' | |
end | |
something | |
end | |
task :create => [:load] do | |
db ||= SQLite3::Database.new "test.db" | |
puts "I Work" | |
end | |
task :drop => [:load] do | |
File.delete("test.db") | |
puts "I work" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment