FIX: Loading of Emoji files depended on working directory

The importer scripts could not be used unless the working directory was
the Discourse root directory.
This commit is contained in:
Gerhard Schlager 2015-01-24 00:07:39 +01:00
parent 256519dddf
commit 361b3fb07a
2 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ class Emoji
end
def self.db_file
"lib/emoji/db.json"
"#{Rails.root}/lib/emoji/db.json"
end
def self.load_standard

View File

@ -75,14 +75,14 @@ module PrettyText
"app/assets/javascripts/discourse/lib/markdown.js"
)
Dir["#{Rails.root}/app/assets/javascripts/discourse/dialects/**.js"].sort.each do |dialect|
Dir["#{app_root}/app/assets/javascripts/discourse/dialects/**.js"].sort.each do |dialect|
unless dialect =~ /\/dialect\.js$/
ctx.load(dialect)
end
end
# custom emojis
emoji = ERB.new(File.read("app/assets/javascripts/discourse/lib/emoji/emoji.js.erb"))
emoji = ERB.new(File.read("#{app_root}/app/assets/javascripts/discourse/lib/emoji/emoji.js.erb"))
ctx.eval(emoji.result)
Emoji.custom.each do |emoji|