Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaquim-oliveira-neto/d31895bc402bf1a631eecfed17f35b31 to your computer and use it in GitHub Desktop.
Save joaquim-oliveira-neto/d31895bc402bf1a631eecfed17f35b31 to your computer and use it in GitHub Desktop.
Problem with running rake on production
#-----lib/tasks/import.rake------#
# require File.expand_path(File.dirname(__FILE__) + '../../../app/models/application_record.rb')
# require File.expand_path(File.dirname(__FILE__) + '../../../app/models/invoice.rb')
# require File.expand_path(File.dirname(__FILE__) + '../../../app/models/installment.rb')
# require File.expand_path(File.dirname(__FILE__) + '../../../app/models/seller.rb')
# require File.expand_path(File.dirname(__FILE__) + '../../../app/models/payer.rb')
# require File.expand_path(File.dirname(__FILE__) + '../../../app/models/operation.rb')
# require File.expand_path(File.dirname(__FILE__) + '../../../app/services/legacy_importation.rb')
namespace :import do
desc "Given the path of a excel spreadsheet exported from Smart it will import paid invoices "
task :paid_invoices, [:path] do |t, args|
# Rails.application.eager_load!
path = args.path
LegacyImportation.new.paid_invoices_importation(path)
end
desc "Given the path of a excel spreadsheet exported from Smart it will import opened invoices "
task :opened_invoices, [:path] do |t, args|
# Rails.application.eager_load!
path = args.path
LegacyImportation.new.opened_invoices_importation(path)
end
end
#--------on terminal--------#
# works fine
rake import:opened_invoices\[lib/xlsx_reader/titulos_abertos_biort.xlsx\]
# throw us an error: "uninitialized constant"
heroku run rake import:opened_invoices\[lib/xlsx_reader/titulos_abertos_biort.xlsx\]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment