diff --git a/lib/copycopter_client.rb b/lib/copycopter_client.rb index 6735431..ed1dee6 100644 --- a/lib/copycopter_client.rb +++ b/lib/copycopter_client.rb @@ -72,5 +72,7 @@ def self.configure(apply = true) if defined? Rails require 'copycopter_client/rails' +elsif defined?(Padrino) && defined?(Rake) + load 'tasks/copycopter_client_tasks.rake' end diff --git a/lib/tasks/copycopter_client_tasks.rake b/lib/tasks/copycopter_client_tasks.rake index 33dc5ef..7be80bf 100644 --- a/lib/tasks/copycopter_client_tasks.rake +++ b/lib/tasks/copycopter_client_tasks.rake @@ -5,13 +5,13 @@ namespace :copycopter do puts "Successfully marked all blurbs as published." end - desc "Export Copycopter blurbs to yaml." + desc "Export Copycopter blurbs to yaml. Optionally set CC_EXPORT_PATH to the output path" task :export => :environment do CopycopterClient.cache.sync if yml = CopycopterClient.export - PATH = "config/locales/copycopter.yml" - File.new("#{Rails.root}/#{PATH}", 'w').write(yml) + PATH = ENV['CC_EXPORT_PATH'] ? ENV['CC_EXPORT_PATH'] : "config/locales/copycopter.yml" + File.new("#{Bundler.root}/#{PATH}", 'w').write(yml) puts "Successfully exported blurbs to #{PATH}." else puts "No blurbs have been cached."