redmine_plugin_asset_pipeline 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/Gemfile +2 -0
- data/README.md +1 -1
- data/lib/generators/redmine_plugin_asset_pipeline/initializers/initializers_generator.rb +16 -0
- data/lib/generators/redmine_plugin_asset_pipeline/initializers/templates/09-save_original_path_to_asset.rb +11 -0
- data/lib/generators/redmine_plugin_asset_pipeline/initializers/templates/15-restore_original_path_to_asset.rb +11 -0
- data/lib/generators/redmine_plugin_asset_pipeline/initializers/templates/28-patch_redmine_plugin_for_sprockets.rb +5 -0
- data/lib/redmine_plugin_asset_pipeline.rb +3 -16
- data/lib/redmine_plugin_asset_pipeline/infectors.rb +9 -4
- data/lib/redmine_plugin_asset_pipeline/infectors/application_helper.rb +92 -83
- data/lib/redmine_plugin_asset_pipeline/infectors/redmine.rb +11 -5
- data/lib/redmine_plugin_asset_pipeline/infectors/redmine/plugin.rb +63 -56
- data/lib/redmine_plugin_asset_pipeline/plugin.rb +45 -41
- data/lib/redmine_plugin_asset_pipeline/sprockets_processor.rb +15 -6
- data/lib/redmine_plugin_asset_pipeline/version.rb +3 -1
- data/redmine_plugin_asset_pipeline.gemspec +9 -9
- metadata +20 -39
- data/Rakefile +0 -1
- data/init.rb +0 -7
- data/lib/generators/redmine_pipeline/private_assets_initializer/private_assets_initializer_generator.rb +0 -11
- data/lib/generators/redmine_pipeline/private_assets_initializer/templates/09-unpatch_10_patches.rb +0 -7
- data/lib/generators/redmine_pipeline/private_assets_initializer/templates/25-patch_assets_mirror.rb +0 -20
- data/lib/redmine_plugin_asset_pipeline/configuration.rb +0 -11
- data/lib/redmine_plugin_asset_pipeline/infectors/redmine/themes.rb +0 -4
- data/lib/redmine_plugin_asset_pipeline/infectors/redmine/themes/theme.rb +0 -7
- data/test/test_helper.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7d1a03fb7135a16db604b8360a66eba81f3c977df4045cc3b6d4f517f9ac86f
|
4
|
+
data.tar.gz: 9fddbed14c4cd27b1c048cbda5095b38d3566a66f7335aed3ac2e6e781f4ef54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3691542db719c734b09bf8c5648fc2c1cff2f313acdd6b382a08c5747c8cfc931225f9c615087973eea28090a44204b9e9ec7ce6fa648d976d4154c35818f496
|
7
|
+
data.tar.gz: e14659ccd62485ca8a841be9491fcc2a7181c177f2bcba47a205c32e43a3d49a1af0b4b17e7c70e909d06b0164b45b95cde8a02e139f4e164546037dbd2c3da2
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -67,7 +67,7 @@ Our recommendations:
|
|
67
67
|
|
68
68
|
* Move redmine assets to directory `private/assets` (simple create it in root of Redmine)
|
69
69
|
* Run `rails generate redmine_pipeline:private_assets_initializer` (that create initializers
|
70
|
-
`09-
|
70
|
+
`09-save_original_path_to_asset`, `15-restore_original_path_to_asset` and `28-patch_redmine_plugin_for_sprockets`, that patch Plugin class of Redmine for copy plugin assets to
|
71
71
|
private directory and cancel redmine patch that broke sprockets)
|
72
72
|
* Fix standard Redmine \*.css files (some paths in css hardcoded to the public root)
|
73
73
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RedminePluginAssetPipeline
|
4
|
+
# :nodoc:
|
5
|
+
class InitializersGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path('templates', __dir__)
|
7
|
+
|
8
|
+
def copy_initializer_file
|
9
|
+
save = '09-save_original_path_to_asset'
|
10
|
+
copy_file "#{save}.rb", "config/initializers/#{save}.rb"
|
11
|
+
|
12
|
+
restore = '25-restore_original_path_to_asset'
|
13
|
+
copy_file "#{restore}.rb", "config/initializers/#{restore}.rb"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,24 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'redmine_plugin_asset_pipeline/version'
|
2
4
|
require 'redmine_plugin_asset_pipeline/plugin'
|
3
5
|
|
6
|
+
# Library for activate asset pipeline in redmine
|
4
7
|
module RedminePluginAssetPipeline
|
5
8
|
extend ActiveSupport::Autoload
|
6
9
|
autoload :Configuration
|
7
10
|
autoload :Infectors
|
8
|
-
autoload :Rails
|
9
|
-
|
10
|
-
def self.configure
|
11
|
-
self.config ||= Configuration.new
|
12
|
-
yield(self.config)
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.config
|
16
|
-
@config
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def self.config=(value)
|
22
|
-
@config = value
|
23
|
-
end
|
24
11
|
end
|
@@ -1,5 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RedminePluginAssetPipeline
|
4
|
+
# collection of monkey patches
|
5
|
+
module Infectors
|
6
|
+
extend ActiveSupport::Autoload
|
7
|
+
autoload :Redmine
|
8
|
+
autoload :ApplicationHelper
|
9
|
+
end
|
5
10
|
end
|
@@ -1,102 +1,111 @@
|
|
1
|
-
|
2
|
-
extend ActiveSupport::Concern
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
3
|
+
module RedminePluginAssetPipeline
|
4
|
+
module Infectors
|
5
|
+
# Collection of monkey patches for ApplicationHelper of redmine
|
6
|
+
# several fixes for using sprockets context
|
7
|
+
module ApplicationHelper
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
def stylesheet_link_tag(*sources)
|
12
|
+
options = sources.last.is_a?(Hash) ? sources.pop : {}
|
13
|
+
plugin = options.delete(:plugin)
|
14
|
+
sources = sources.map do |source|
|
15
|
+
if plugin
|
16
|
+
"#{plugin}/stylesheets/#{source}"
|
17
|
+
elsif current_theme && current_theme.stylesheets.include?(source)
|
18
|
+
current_theme.stylesheet_path(source)
|
19
|
+
else
|
20
|
+
# @note: assets from gems
|
21
|
+
[source, "stylesheets/#{source}"].find do |s|
|
22
|
+
asset_digest_path("#{s}#{compute_asset_extname(s, type: :stylesheet)}").present?
|
23
|
+
end || source
|
24
|
+
end
|
25
|
+
end
|
26
|
+
sprockets_helper_context.stylesheet_link_tag(*sources, options)
|
18
27
|
end
|
19
|
-
end
|
20
|
-
sprockets_helper_context.stylesheet_link_tag(*sources, options)
|
21
|
-
end
|
22
28
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
def javascript_include_tag(*sources)
|
30
|
+
options = sources.last.is_a?(Hash) ? sources.pop : {}
|
31
|
+
plugin = options.delete(:plugin)
|
32
|
+
sources = sources.map do |source|
|
33
|
+
if plugin
|
34
|
+
"#{plugin}/javascripts/#{source}"
|
35
|
+
else
|
36
|
+
# @note: assets from gems
|
37
|
+
[source, "javascripts/#{source}"].find do |s|
|
38
|
+
asset_digest_path("#{s}#{compute_asset_extname(s, type: :javascript)}").present?
|
39
|
+
end || source
|
40
|
+
end
|
41
|
+
end
|
42
|
+
sprockets_helper_context.javascript_include_tag(*sources, options)
|
34
43
|
end
|
35
|
-
end
|
36
|
-
sprockets_helper_context.javascript_include_tag(*sources, options)
|
37
|
-
end
|
38
44
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
def image_tag(source, options={})
|
46
|
+
plugin = options.delete(:plugin)
|
47
|
+
if plugin
|
48
|
+
source = "#{plugin}/images/#{source}"
|
49
|
+
elsif current_theme && current_theme.images.include?(source)
|
50
|
+
source = current_theme.image_path(source)
|
51
|
+
else
|
52
|
+
source = [source, "images/#{source}"].find{ |s| asset_digest_path(s).present? } || source
|
53
|
+
end
|
54
|
+
sprockets_helper_context.image_tag(source, options)
|
55
|
+
end
|
50
56
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
57
|
+
# Only one fix - remove leading slash in path_to_image
|
58
|
+
def include_calendar_headers_tags
|
59
|
+
unless @calendar_headers_tags_included
|
60
|
+
tags = ''.html_safe
|
61
|
+
@calendar_headers_tags_included = true
|
62
|
+
content_for :header_tags do
|
63
|
+
start_of_week = Setting.start_of_week
|
64
|
+
start_of_week = l(:general_first_day_of_week, :default => '1') if start_of_week.blank?
|
65
|
+
# Redmine uses 1..7 (monday..sunday) in settings and locales
|
66
|
+
# JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0
|
67
|
+
start_of_week = start_of_week.to_i % 7
|
68
|
+
tags << javascript_tag(
|
69
|
+
"var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: #{start_of_week}, " +
|
64
70
|
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
|
65
71
|
path_to_image('images/calendar.png') +
|
66
72
|
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, " +
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
73
|
+
'selectOtherMonths: true, changeMonth: true, changeYear: true, ' +
|
74
|
+
'beforeShow: beforeShowDatePicker};')
|
75
|
+
jquery_locale = l('jquery.locale', :default => current_language.to_s)
|
76
|
+
unless jquery_locale == 'en'
|
77
|
+
tags << javascript_include_tag("i18n/datepicker-#{jquery_locale}.js")
|
78
|
+
end
|
79
|
+
tags
|
80
|
+
end
|
72
81
|
end
|
73
|
-
tags
|
74
82
|
end
|
75
|
-
end
|
76
|
-
end
|
77
83
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
+
def sprockets_helper_context
|
85
|
+
@context ||= Class.new do
|
86
|
+
include Sprockets::Rails::Helper
|
87
|
+
# Copy relevant config to AV context
|
88
|
+
app = Rails.application
|
89
|
+
config = app.config
|
84
90
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
91
|
+
self.debug_assets = config.assets.debug
|
92
|
+
self.digest_assets = config.assets.digest
|
93
|
+
self.assets_prefix = config.assets.prefix
|
94
|
+
self.assets_precompile = config.assets.precompile
|
89
95
|
|
90
|
-
|
91
|
-
|
96
|
+
self.assets_environment = app.assets
|
97
|
+
self.assets_manifest = app.assets_manifest
|
92
98
|
|
93
|
-
|
99
|
+
self.resolve_assets_with = config.assets.resolve_with
|
94
100
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
101
|
+
self.check_precompiled_asset = config.assets.check_precompiled_asset
|
102
|
+
self.unknown_asset_fallback = config.assets.unknown_asset_fallback
|
103
|
+
# Expose the app precompiled asset check to the view
|
104
|
+
self.precompiled_asset_checker = -> logical_path { app.asset_precompiled? logical_path }
|
105
|
+
end.new
|
106
|
+
end
|
107
|
+
end
|
100
108
|
end
|
101
109
|
end
|
102
110
|
end
|
111
|
+
|
@@ -1,5 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RedminePluginAssetPipeline
|
4
|
+
module Infectors
|
5
|
+
# Collection of patches
|
6
|
+
module Redmine
|
7
|
+
extend ActiveSupport::Autoload
|
8
|
+
autoload :Plugin
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,69 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Patch for copy plugin assets sources to private directory
|
2
|
-
module RedminePluginAssetPipeline
|
3
|
-
|
4
|
+
module RedminePluginAssetPipeline
|
5
|
+
module Infectors
|
6
|
+
module Redmine
|
7
|
+
# Monkey Patch for Redmine::Plugin
|
8
|
+
# move assets from all plugins to separate directory
|
9
|
+
module Plugin
|
10
|
+
extend ActiveSupport::Concern
|
4
11
|
|
5
|
-
|
6
|
-
|
7
|
-
alias_method :mirror_assets, :mirror_assets_to_private
|
12
|
+
included do
|
13
|
+
alias_method :mirror_assets, :mirror_assets_to_private
|
8
14
|
|
9
|
-
|
10
|
-
|
11
|
-
self.private_directory_base = File.join(Rails.root, 'private', 'plugin_assets')
|
12
|
-
end
|
13
|
-
end
|
15
|
+
class << self
|
16
|
+
cattr_accessor :private_directory_base
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
self.private_directory_base =
|
19
|
+
File.join(Rails.root, 'private', 'plugin_assets')
|
20
|
+
end
|
21
|
+
end
|
18
22
|
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
def private_directory
|
24
|
+
File.join(self.class.private_directory_base, id.to_s)
|
25
|
+
end
|
22
26
|
|
23
|
-
|
24
|
-
|
25
|
-
|
27
|
+
def mirror_assets_to_private
|
28
|
+
source = assets_directory
|
29
|
+
destination = private_directory
|
26
30
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
return unless File.directory?(source)
|
31
|
+
unless File.exist?(self.class.private_directory_base)
|
32
|
+
FileUtils.mkdir_p(self.class.private_directory_base)
|
33
|
+
end
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
35
|
+
FileUtils.rm_rf(destination) if File.exist?(destination)
|
36
|
+
return unless File.directory?(source)
|
37
|
+
|
38
|
+
if RedmineApp::Application.config.assets.compile
|
39
|
+
FileUtils.ln_s(source, destination) if File.exist?(source)
|
40
|
+
else
|
41
|
+
source_files = Dir[source + '/**/*']
|
42
|
+
source_dirs = source_files.select { |d| File.directory?(d) }
|
43
|
+
source_files -= source_dirs
|
44
|
+
unless source_files.empty?
|
45
|
+
base_target_dir = File.join(destination, File.dirname(source_files.first).gsub(source, ''))
|
46
|
+
begin
|
47
|
+
FileUtils.mkdir_p(base_target_dir)
|
48
|
+
rescue StandardError => e
|
49
|
+
raise "Could not create directory #{base_target_dir}: " + e.message
|
50
|
+
end
|
51
|
+
end
|
52
|
+
source_dirs.each do |dir|
|
53
|
+
# strip down these paths so we have simple, relative paths we can
|
54
|
+
# add to the destination
|
55
|
+
target_dir = File.join(destination, dir.gsub(source, ''))
|
56
|
+
begin
|
57
|
+
FileUtils.mkdir_p(target_dir)
|
58
|
+
rescue StandardError => e
|
59
|
+
raise "Could not create directory #{target_dir}: " + e.message
|
60
|
+
end
|
61
|
+
end
|
58
62
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
63
|
+
source_files.each do |file|
|
64
|
+
begin
|
65
|
+
target = File.join(destination, file.gsub(source, ''))
|
66
|
+
unless File.exist?(target) && FileUtils.identical?(file, target)
|
67
|
+
FileUtils.cp(file, target)
|
68
|
+
end
|
69
|
+
rescue StandardError => e
|
70
|
+
raise "Could not copy #{file} to #{target}: " + e.message
|
71
|
+
end
|
72
|
+
end
|
64
73
|
end
|
65
|
-
rescue Exception => e
|
66
|
-
raise "Could not copy #{file} to #{target}: " + e.message
|
67
74
|
end
|
68
75
|
end
|
69
76
|
end
|
@@ -1,49 +1,53 @@
|
|
1
|
-
|
2
|
-
config.after_initialize do
|
3
|
-
require File.expand_path('../../../init', __FILE__)
|
4
|
-
end
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
|
-
|
7
|
-
#enable asset pipeline before sprockets boots
|
8
|
-
initializer 'redmine.asset_pipeline', before: 'sprockets.environment' do
|
9
|
-
RedmineApp::Application.configure do
|
10
|
-
config.assets.paths << "#{config.root}/private/plugin_assets"
|
11
|
-
config.assets.precompile += %w(*/stylesheets/*.css */javascripts/*.js */images/* */fonts/*)
|
12
|
-
# Custom settings. Edit configs of your application
|
13
|
-
# See: http://guides.rubyonrails.org/asset_pipeline.html
|
14
|
-
#
|
15
|
-
# Redmine save all assets in root of public =(
|
16
|
-
# If you need to change that value
|
17
|
-
# manually move assets in public directory and edit it
|
18
|
-
# config.assets.prefix = ''
|
19
|
-
end
|
20
|
-
end
|
3
|
+
require 'redmine_plugin_asset_pipeline/sprockets_processor'
|
21
4
|
|
22
|
-
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
5
|
+
module RedminePluginAssetPipeline
|
6
|
+
# Initialize Sprockets
|
7
|
+
# Register `require_redmine_plugins` directives
|
8
|
+
# MonkeyPatching of `ApplicationHelper`
|
9
|
+
class Plugin < ::Rails::Engine
|
10
|
+
# asset pipeline configuration
|
11
|
+
# enable asset pipeline before sprockets boots
|
12
|
+
initializer 'redmine.asset_pipeline', before: 'sprockets.environment' do
|
13
|
+
RedmineApp::Application.configure do
|
14
|
+
config.assets.paths << "#{config.root}/private/plugin_assets"
|
15
|
+
config.assets.precompile +=
|
16
|
+
%w[*/stylesheets/*.css */javascripts/*.js */images/* */fonts/*]
|
17
|
+
end
|
18
|
+
end
|
31
19
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
20
|
+
# Register our processor
|
21
|
+
# (subclass of the standard one which adds a directive for redmine plugins)
|
22
|
+
initializer 'redmine.sprockets_processor', after: 'sprockets.environment' do
|
23
|
+
RedmineApp::Application.config.assets.configure do |env|
|
24
|
+
env.unregister_preprocessor(
|
25
|
+
'text/css',
|
26
|
+
Sprockets::DirectiveProcessor
|
27
|
+
)
|
28
|
+
env.register_preprocessor(
|
29
|
+
'text/css',
|
30
|
+
RedminePluginAssetPipeline::SprocketsProcessor
|
31
|
+
)
|
32
|
+
env.unregister_preprocessor(
|
33
|
+
'application/javascript',
|
34
|
+
Sprockets::DirectiveProcessor
|
35
|
+
)
|
36
|
+
env.register_preprocessor(
|
37
|
+
'application/javascript',
|
38
|
+
RedminePluginAssetPipeline::SprocketsProcessor
|
39
|
+
)
|
40
|
+
end
|
40
41
|
end
|
41
|
-
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
config.to_prepare do
|
44
|
+
require_dependency 'application_helper'
|
45
|
+
|
46
|
+
helper_patch = RedminePluginAssetPipeline::Infectors::ApplicationHelper
|
47
|
+
|
48
|
+
unless ApplicationHelper.included_modules.include?(helper_patch)
|
49
|
+
ApplicationHelper.include(helper_patch)
|
50
|
+
end
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RedminePluginAssetPipeline
|
2
4
|
# This processor subclasses the standard Sprockets::DirectiveProcessor
|
3
5
|
# as advised in Sprockets, to add a new directive called
|
4
6
|
# "require_redmine_plugins". This directive is relative to the
|
@@ -16,11 +18,18 @@ class RedminePluginAssetPipeline::SprocketsProcessor < Sprockets::DirectiveProce
|
|
16
18
|
# require(filename)
|
17
19
|
# end
|
18
20
|
# end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
class SprocketsProcessor < Sprockets::DirectiveProcessor
|
22
|
+
def process_require_redmine_plugins_directive(type, prefix = '')
|
23
|
+
assets_root = Rails.root.join(Redmine::Plugin.private_directory_base)
|
24
|
+
mask = assets_root.join("*/#{type}/#{prefix}_common_part*").expand_path
|
25
|
+
Dir.glob(mask).sort.each do |entry|
|
26
|
+
@required <<
|
27
|
+
resolve(
|
28
|
+
Pathname.new(entry).relative_path_from(assets_root).to_s,
|
29
|
+
accept: @content_type,
|
30
|
+
pipeline: :self
|
31
|
+
)
|
32
|
+
end
|
24
33
|
end
|
25
34
|
end
|
26
35
|
end
|
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'redmine_plugin_asset_pipeline/version'
|
5
6
|
|
@@ -8,18 +9,17 @@ Gem::Specification.new do |spec|
|
|
8
9
|
spec.version = RedminePluginAssetPipeline::VERSION
|
9
10
|
spec.authors = ['Tab10id']
|
10
11
|
spec.email = ['tabloidmeister@gmail.com']
|
11
|
-
spec.description =
|
12
|
-
spec.summary =
|
12
|
+
spec.description = 'Asset pipeline for Redmine'
|
13
|
+
spec.summary = 'Asset pipeline for Redmine'
|
13
14
|
spec.homepage = 'https://github.com/Tab10id/redmine_plugin_asset_pipeline'
|
14
15
|
spec.license = 'MIT'
|
15
16
|
|
16
|
-
spec.files = `git ls-files`.split(
|
17
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
spec.require_paths = ['lib']
|
20
21
|
|
21
|
-
spec.add_dependency '
|
22
|
-
spec.add_dependency 'sprockets',
|
23
|
-
spec.add_development_dependency 'bundler', '~>
|
24
|
-
spec.add_development_dependency 'rake'
|
22
|
+
spec.add_dependency 'rails', '~> 5.2'
|
23
|
+
spec.add_dependency 'sprockets-rails', '~> 3.2'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
25
25
|
end
|
metadata
CHANGED
@@ -1,71 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine_plugin_asset_pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tab10id
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: sprockets
|
28
|
+
name: sprockets-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2
|
33
|
+
version: '3.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2
|
40
|
+
version: '3.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
54
|
+
version: '2.0'
|
69
55
|
description: Asset pipeline for Redmine
|
70
56
|
email:
|
71
57
|
- tabloidmeister@gmail.com
|
@@ -74,27 +60,23 @@ extensions: []
|
|
74
60
|
extra_rdoc_files: []
|
75
61
|
files:
|
76
62
|
- ".gitignore"
|
63
|
+
- ".rubocop.yml"
|
77
64
|
- Gemfile
|
78
65
|
- LICENSE.txt
|
79
66
|
- README.md
|
80
|
-
-
|
81
|
-
-
|
82
|
-
- lib/generators/
|
83
|
-
- lib/generators/
|
84
|
-
- lib/generators/redmine_pipeline/private_assets_initializer/templates/25-patch_assets_mirror.rb
|
67
|
+
- lib/generators/redmine_plugin_asset_pipeline/initializers/initializers_generator.rb
|
68
|
+
- lib/generators/redmine_plugin_asset_pipeline/initializers/templates/09-save_original_path_to_asset.rb
|
69
|
+
- lib/generators/redmine_plugin_asset_pipeline/initializers/templates/15-restore_original_path_to_asset.rb
|
70
|
+
- lib/generators/redmine_plugin_asset_pipeline/initializers/templates/28-patch_redmine_plugin_for_sprockets.rb
|
85
71
|
- lib/redmine_plugin_asset_pipeline.rb
|
86
|
-
- lib/redmine_plugin_asset_pipeline/configuration.rb
|
87
72
|
- lib/redmine_plugin_asset_pipeline/infectors.rb
|
88
73
|
- lib/redmine_plugin_asset_pipeline/infectors/application_helper.rb
|
89
74
|
- lib/redmine_plugin_asset_pipeline/infectors/redmine.rb
|
90
75
|
- lib/redmine_plugin_asset_pipeline/infectors/redmine/plugin.rb
|
91
|
-
- lib/redmine_plugin_asset_pipeline/infectors/redmine/themes.rb
|
92
|
-
- lib/redmine_plugin_asset_pipeline/infectors/redmine/themes/theme.rb
|
93
76
|
- lib/redmine_plugin_asset_pipeline/plugin.rb
|
94
77
|
- lib/redmine_plugin_asset_pipeline/sprockets_processor.rb
|
95
78
|
- lib/redmine_plugin_asset_pipeline/version.rb
|
96
79
|
- redmine_plugin_asset_pipeline.gemspec
|
97
|
-
- test/test_helper.rb
|
98
80
|
homepage: https://github.com/Tab10id/redmine_plugin_asset_pipeline
|
99
81
|
licenses:
|
100
82
|
- MIT
|
@@ -118,5 +100,4 @@ rubygems_version: 3.0.3
|
|
118
100
|
signing_key:
|
119
101
|
specification_version: 4
|
120
102
|
summary: Asset pipeline for Redmine
|
121
|
-
test_files:
|
122
|
-
- test/test_helper.rb
|
103
|
+
test_files: []
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
data/init.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
Redmine::Plugin.register :redmine_plugin_asset_pipeline do
|
2
|
-
name 'Redmine Plugin Asset Pipeline plugin'
|
3
|
-
description 'This plugin adds asset pipeline support for redmine plugins'
|
4
|
-
url 'https://github.com/Tab10id/redmine_plugin_asset_pipeline'
|
5
|
-
version RedminePluginAssetPipeline::VERSION
|
6
|
-
requires_redmine version_or_higher: '3.0.0'
|
7
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module RedminePipeline
|
2
|
-
class PrivateAssetsInitializerGenerator < Rails::Generators::Base
|
3
|
-
source_root File.expand_path("../templates", __FILE__)
|
4
|
-
def copy_initializer_file
|
5
|
-
unpatch = '09-unpatch_10_patches'
|
6
|
-
copy_file "#{unpatch}.rb", "config/initializers/#{unpatch}.rb"
|
7
|
-
patch = '25-patch_assets_mirror'
|
8
|
-
copy_file "#{patch}.rb", "config/initializers/#{patch}.rb"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/lib/generators/redmine_pipeline/private_assets_initializer/templates/25-patch_assets_mirror.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Rails.configuration.before_configuration do
|
2
|
-
require_dependency 'redmine_plugin_asset_pipeline/plugin_patch'
|
3
|
-
unless Redmine::Plugin.included_modules.include? RedminePluginAssetPipeline::PluginPatch
|
4
|
-
Redmine::Plugin.send(:include, RedminePluginAssetPipeline::PluginPatch)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
RedminePluginAssetPipeline.configure do |config|
|
9
|
-
if Rails.env.development?
|
10
|
-
config.use_ln = true
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
module ActionView
|
15
|
-
module Helpers
|
16
|
-
module AssetUrlHelper
|
17
|
-
alias path_to_asset original_path_to_asset
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/test/test_helper.rb
DELETED