28 lines
1.1 KiB
Ruby
28 lines
1.1 KiB
Ruby
|
namespace :db do
|
||
|
desc "Bootstrap your database for Spree."
|
||
|
task :bootstrap => :environment do
|
||
|
# load initial database fixtures (in db/sample/*.yml) into the current environment's database
|
||
|
ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
|
||
|
Dir.glob(File.join(PaypalExpressExtension.root, "db", 'sample', '*.{yml,csv}')).each do |fixture_file|
|
||
|
Fixtures.create_fixtures("#{PaypalExpressExtension.root}/db/sample", File.basename(fixture_file, '.*'))
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
namespace :spree do
|
||
|
namespace :extensions do
|
||
|
namespace :paypal_express do
|
||
|
desc "Copies public assets of the Paypal Express to the instance public/ directory."
|
||
|
task :update => :environment do
|
||
|
is_svn_git_or_dir = proc {|path| path =~ /\.svn/ || path =~ /\.git/ || File.directory?(path) }
|
||
|
Dir[PaypalExpressExtension.root + "/public/**/*"].reject(&is_svn_git_or_dir).each do |file|
|
||
|
path = file.sub(PaypalExpressExtension.root, '')
|
||
|
directory = File.dirname(path)
|
||
|
puts "Copying #{path}..."
|
||
|
mkdir_p RAILS_ROOT + directory
|
||
|
cp file, RAILS_ROOT + path
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|