diff --git a/redis-with-ruby/Gemfile b/redis-with-ruby/Gemfile index 4d64c99..568a50b 100644 --- a/redis-with-ruby/Gemfile +++ b/redis-with-ruby/Gemfile @@ -2,5 +2,6 @@ source :rubygems gem 'fastercsv' gem 'hiredis' +gem 'rake' gem 'redis' gem 'slop' diff --git a/redis-with-ruby/Gemfile.lock b/redis-with-ruby/Gemfile.lock index b7847a9..985ef31 100644 --- a/redis-with-ruby/Gemfile.lock +++ b/redis-with-ruby/Gemfile.lock @@ -3,6 +3,7 @@ GEM specs: fastercsv (1.5.4) hiredis (0.4.4) + rake (0.9.2.2) redis (2.2.2) slop (3.0.4) @@ -12,5 +13,6 @@ PLATFORMS DEPENDENCIES fastercsv hiredis + rake redis slop diff --git a/redis-with-ruby/Rakefile b/redis-with-ruby/Rakefile new file mode 100644 index 0000000..b114140 --- /dev/null +++ b/redis-with-ruby/Rakefile @@ -0,0 +1,21 @@ +desc 'drop all of the earthquake data' +task :drop do + get_earthquakes.drop_all +end + + +desc 'load all of the earthquake data' +task :load do + get_earthquakes.load_data +end + + +desc 'drop, then load all of the earthquake data' +task :reload => [:drop, :load] +task :default => :load + + +def get_earthquakes + require File.expand_path('../earthquakes', __FILE__) + Earthquakes.new +end