Skip to content

Commit

Permalink
Add compatibility for Redmine v4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jr180180 committed Feb 1, 2020
1 parent 6c7e39d commit 700381c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ Installation

$ rake emoji

4. Run the plugin rake task to provide the assets (from the Redmine root directory):
4. If your Redmine version 4.1, run the following rake install. Otherwise, skip to step 5.

$ rake emojibutton:install

5. Run the plugin rake task to provide the assets (from the Redmine root directory):

$ rake redmine:plugins:migrate RAILS_ENV=production

5. Restart redmine
6. Restart redmine


Usage
Expand Down
5 changes: 5 additions & 0 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
require 'emojibutton_formatter_textile_patch'
require 'emojibutton_formatter_markdown_patch'
require 'emojibutton_helper_patch'
require 'sprockets/railtie' unless defined?(Sprockets)

unless File.exist?(Rails.root.join('app', 'assets', 'config', 'manifest.js'))
`mkdir -p app/assets/config && echo '{}' > app/assets/config/manifest.js`
end

Redmine::Plugin.register :redmine_emojibutton do
name 'Redmine Emoji Button'
Expand Down
15 changes: 15 additions & 0 deletions lib/tasks/install.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
desc 'Add requirements for Redmine v4.1+'
namespace :emojibutton do
task :install do

# Uncomment the sprockets railtie requirement
path = "#{Rake.original_dir}/config/application.rb"
IO.write(path, File.open(path) { |f| f.read.gsub(/^# require 'sprockets\/railtie'$/, "require 'sprockets/railtie'") })

# Add a blank manifest file for sprockets
unless File.exist?(Rails.root.join('app', 'assets', 'config', 'manifest.js'))
`mkdir -p app/assets/config && echo '{}' > app/assets/config/manifest.js`
end

end
end

0 comments on commit 700381c

Please sign in to comment.