Permalink
Browse files

Added a development:api_key task, and fixed rake environment

  • Loading branch information...
1 parent 0c1e7a0 commit bdae83161ca5a5fea0bf4a9264102cbc4dd3346e @konklone konklone committed Jul 5, 2011
Showing with 18 additions and 0 deletions.
  1. +18 −0 Rakefile
View
@@ -25,6 +25,22 @@ namespace :update do
end
end
+namespace :development do
+ desc "Load a fake 'development' api key into the db"
+ task :api_key => :environment do
+
+ key = ENV['key'] || "development"
+ email = ENV['email'] || "#{key}@example.com"
+
+ if ApiKey.where(:key => key).first.nil?
+ ApiKey.create! :status => "A", :email => email, :key => key
+ puts "Created '#{key}' API key under email #{email}"
+ else
+ puts "'#{key}' API key already exists"
+ end
+ end
+end
+
namespace :report do
desc "See reports for a given day (default to last night)"
@@ -113,5 +129,7 @@ namespace :api do
end
task :environment do
+ require 'rubygems'
+ require 'bundler/setup'
require 'config/environment'
end

0 comments on commit bdae831

Please sign in to comment.