Skip to content

Instantly share code, notes, and snippets.

@taylor-smith
Created May 29, 2014 18:44
Show Gist options
  • Save taylor-smith/94e5660151a642e3427f to your computer and use it in GitHub Desktop.
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
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