Fix Heroku deployment
This commit is contained in:
parent
be287cf67e
commit
f08d131842
2 changed files with 5 additions and 4 deletions
|
@ -1,5 +1,3 @@
|
|||
require 'filemagic'
|
||||
|
||||
class Invoice < ActiveRecord::Base
|
||||
|
||||
belongs_to :supplier
|
||||
|
@ -20,7 +18,8 @@ class Invoice < ActiveRecord::Base
|
|||
|
||||
def attachment=(incoming_file)
|
||||
self.attachment_data = incoming_file.read
|
||||
self.attachment_mime = FileMagic.new(FileMagic::MAGIC_MIME).buffer(self.attachment_data)
|
||||
# allow to soft-fail when FileMagic isn't present and removed from Gemfile (e.g. Heroku)
|
||||
self.attachment_mime = defined?(FileMagic) ? FileMagic.new(FileMagic::MAGIC_MIME).buffer(self.attachment_data) : 'application/octet-stream'
|
||||
end
|
||||
|
||||
def delete_attachment=(value)
|
||||
|
|
|
@ -51,9 +51,11 @@ if ! git checkout -b "$BRANCH"; then
|
|||
echo "Could not create to temporary branch '$BRANCH', aborting." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# remove sqlite3 dependency as it doesn't install on heroku
|
||||
# remove sqlite3 + filemagic dependency as they don't install on heroku
|
||||
sed -i "s|^\\(\\s*gem\\s\\+'sqlite3'\\)|#\1|" Gemfile
|
||||
sed -i "s|^\\(\\s*sqlite3\\b\)|#\1|" Gemfile.lock
|
||||
sed -i "s|^\\(\\s*gem\\s\\+'ruby-filemagic'\\)|#\1|" Gemfile
|
||||
sed -i "s|^\\(\\s*ruby-filemagic\\b\)|#\1|" Gemfile.lock
|
||||
# make sure postgresql db is present, as it is the default heroku db
|
||||
echo "
|
||||
gem 'rails_12factor'
|
||||
|
|
Loading…
Reference in a new issue