redmine_plugins_helper 0.16.3 → 0.17.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/config/initializers/assets.rb +0 -1
- data/lib/redmine_plugins_helper/available.rb +1 -1
- data/lib/redmine_plugins_helper/fix_migrations.rb +8 -4
- data/lib/redmine_plugins_helper/hooks/add_assets.rb +10 -3
- data/lib/redmine_plugins_helper/hooks/after_plugins_loaded.rb +3 -0
- data/lib/redmine_plugins_helper/migration/database.rb +3 -2
- data/lib/redmine_plugins_helper/migration.rb +4 -3
- data/lib/redmine_plugins_helper/patches/redmine/plugin/assets.rb +1 -1
- data/lib/redmine_plugins_helper/plugins_autoload_assets.rb +69 -0
- data/lib/redmine_plugins_helper/version.rb +1 -1
- data/lib/redmine_plugins_helper.rb +0 -2
- metadata +38 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2ce1440132f8632242716bef848524eb942c2df044f287f950e579cf7860a43a
|
|
4
|
+
data.tar.gz: 3d2379aba784a8a6e9ea1af1ff036978943bb02ca6669019ef1b74f77023025c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff7b6c0d75dc262837f31b900b9458677c1f6c89c03f6d4c9c79cd1c9390220c90e9faa5e25eef52fed8e8f808766b20744ca552225310c31c28de1dcb75a4eb
|
|
7
|
+
data.tar.gz: f5250d48bd2eb870a057b1504f413340a4dcfe8902f8c3b2340186b743b5ce5e7366788b023ad7fb93b8e058b701dd295123b3418d3eb8d8c6b5a59c05384c3c
|
|
@@ -29,18 +29,22 @@ module RedminePluginsHelper
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def database_version?(version)
|
|
32
|
-
|
|
32
|
+
schema_migration.versions.include?(version)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def remove_plugin_version(source_version)
|
|
36
36
|
Rails.logger.info("Removing #{source_version}")
|
|
37
|
-
|
|
37
|
+
schema_migration.delete_version(source_version)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def move_plugin_version(source_version, target_version)
|
|
41
41
|
Rails.logger.info("Moving #{source_version} to plugin \"#{target_version}\"")
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
schema_migration.delete_version(source_version)
|
|
43
|
+
schema_migration.create_version(target_version)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def schema_migration
|
|
47
|
+
@schema_migration ||= ::ActiveRecord::Base.connection_pool.schema_migration
|
|
44
48
|
end
|
|
45
49
|
|
|
46
50
|
def local_version(timestamp)
|
|
@@ -10,12 +10,19 @@ module RedminePluginsHelper
|
|
|
10
10
|
private
|
|
11
11
|
|
|
12
12
|
def plugins_autoload_stylesheet_tag
|
|
13
|
-
tag.link(
|
|
14
|
-
|
|
13
|
+
tag.link(
|
|
14
|
+
media: 'all',
|
|
15
|
+
rel: 'stylesheet',
|
|
16
|
+
href: asset_path(::RedminePluginsHelper::PluginsAutoloadAssets::CSS_OUTPUT_SUBPATH)
|
|
17
|
+
)
|
|
15
18
|
end
|
|
16
19
|
|
|
17
20
|
def plugins_autoload_script_tag
|
|
18
|
-
content_tag(
|
|
21
|
+
content_tag(
|
|
22
|
+
'script',
|
|
23
|
+
"\n",
|
|
24
|
+
src: asset_path(::RedminePluginsHelper::PluginsAutoloadAssets::JS_OUTPUT_SUBPATH)
|
|
25
|
+
)
|
|
19
26
|
end
|
|
20
27
|
end
|
|
21
28
|
end
|
|
@@ -7,6 +7,9 @@ module RedminePluginsHelper
|
|
|
7
7
|
require 'redmine_plugins_helper/patches'
|
|
8
8
|
Redmine::Plugin.all.sort.each(&:add_assets_paths)
|
|
9
9
|
Redmine::Plugin.all.sort.each(&:load_initializers)
|
|
10
|
+
Rails.application.config.after_initialize do
|
|
11
|
+
RedminePluginsHelper::PluginsAutoloadAssets.instance.generate
|
|
12
|
+
end
|
|
10
13
|
end
|
|
11
14
|
end
|
|
12
15
|
end
|
|
@@ -13,8 +13,9 @@ module RedminePluginsHelper
|
|
|
13
13
|
module ClassMethods
|
|
14
14
|
# @return [Enumerable<RedminePluginsHelper::Migration>]
|
|
15
15
|
def from_database
|
|
16
|
-
::ActiveRecord::
|
|
17
|
-
|
|
16
|
+
schema_migration = ::ActiveRecord::Base.connection_pool.schema_migration
|
|
17
|
+
schema_migration.create_table
|
|
18
|
+
schema_migration.versions.map do |version|
|
|
18
19
|
from_database_version(version)
|
|
19
20
|
end
|
|
20
21
|
end
|
|
@@ -26,8 +26,9 @@ module RedminePluginsHelper
|
|
|
26
26
|
|
|
27
27
|
# @return [Boolean]
|
|
28
28
|
def applied?
|
|
29
|
-
::ActiveRecord::
|
|
30
|
-
|
|
29
|
+
schema_migration = ::ActiveRecord::Base.connection_pool.schema_migration
|
|
30
|
+
schema_migration.create_table
|
|
31
|
+
schema_migration.versions.include?(database_version)
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
# @return [String]
|
|
@@ -57,7 +58,7 @@ module RedminePluginsHelper
|
|
|
57
58
|
if ::Rails.version < '6'
|
|
58
59
|
[plugin.migration_directory]
|
|
59
60
|
else
|
|
60
|
-
[plugin.migration_directory, ActiveRecord::Base.
|
|
61
|
+
[plugin.migration_directory, ActiveRecord::Base.connection_pool.schema_migration]
|
|
61
62
|
end
|
|
62
63
|
end
|
|
63
64
|
end
|
|
@@ -40,7 +40,7 @@ module RedminePluginsHelper
|
|
|
40
40
|
extensions.each do |extension|
|
|
41
41
|
['', '.erb'].each do |erb_extension|
|
|
42
42
|
path = ::File.join(assets_directory, "#{id}.#{extension}#{erb_extension}")
|
|
43
|
-
return id if ::File.exist?(path)
|
|
43
|
+
return id.to_s if ::File.exist?(path)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
nil
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'sprockets'
|
|
4
|
+
require 'sprockets/rails/context'
|
|
5
|
+
require 'sassc'
|
|
6
|
+
require 'sassc/rails/version'
|
|
7
|
+
require 'sassc/rails/functions'
|
|
8
|
+
require 'sassc/rails/importer'
|
|
9
|
+
require 'sassc/rails/template'
|
|
10
|
+
|
|
11
|
+
module RedminePluginsHelper
|
|
12
|
+
# Compiles "plugins_autoload.css"/".js", bundling every registered Redmine plugin's main
|
|
13
|
+
# stylesheet/javascript asset, and writes the result as static files that Propshaft serves.
|
|
14
|
+
class PluginsAutoloadAssets
|
|
15
|
+
include ::Singleton
|
|
16
|
+
|
|
17
|
+
enable_memoized
|
|
18
|
+
|
|
19
|
+
CSS_OUTPUT_SUBPATH = 'plugins_autoload.css'
|
|
20
|
+
JS_OUTPUT_SUBPATH = 'plugins_autoload.js'
|
|
21
|
+
OUTPUT_DIRECTORY_SUBPATH = 'tmp/plugins_autoload_assets'
|
|
22
|
+
|
|
23
|
+
# @return [void]
|
|
24
|
+
def generate
|
|
25
|
+
Rails.application.config.sass = ActiveSupport::OrderedOptions.new
|
|
26
|
+
output_directory.join(CSS_OUTPUT_SUBPATH).write(environment[CSS_OUTPUT_SUBPATH].to_s)
|
|
27
|
+
output_directory.join(JS_OUTPUT_SUBPATH).write(environment[JS_OUTPUT_SUBPATH].to_s)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @return [Pathname]
|
|
31
|
+
memoize def output_directory
|
|
32
|
+
Rails.root.join(OUTPUT_DIRECTORY_SUBPATH).tap do |v|
|
|
33
|
+
v.mkpath
|
|
34
|
+
paths = ::Rails.application.config.assets.paths
|
|
35
|
+
paths << v.to_s unless paths.include?(v.to_s)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
protected
|
|
40
|
+
|
|
41
|
+
# @return [Sprockets::Environment]
|
|
42
|
+
def environment # rubocop:disable Metrics/AbcSize
|
|
43
|
+
Sprockets::Environment.new.tap do |env|
|
|
44
|
+
env.register_transformer('text/scss', 'text/css', ::SassC::Rails::ScssTemplate.new)
|
|
45
|
+
env.register_transformer('text/sass', 'text/css', ::SassC::Rails::SassTemplate.new)
|
|
46
|
+
env.context_class.class_eval { include ::Sprockets::Rails::Context }
|
|
47
|
+
env.context_class.assets_prefix = ::Rails.application.config.assets.prefix
|
|
48
|
+
env.context_class.config = ::Rails.application.config.action_controller
|
|
49
|
+
source_paths.each { |path| env.append_path(path) }
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# @return [Pathname]
|
|
54
|
+
def self_assets_directory
|
|
55
|
+
__FILE__.to_pathname.dirname.dirname.dirname.join('app/assets')
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Reuses the same load paths Propshaft already collected from every engine/gem
|
|
59
|
+
# (app/assets, lib/assets, vendor/assets) plus the ones "add_assets_paths" added for
|
|
60
|
+
# each Redmine plugin.
|
|
61
|
+
#
|
|
62
|
+
# @return [Enumerable<String>]
|
|
63
|
+
def source_paths
|
|
64
|
+
[self_assets_directory.join('stylesheets').to_path,
|
|
65
|
+
self_assets_directory.join('javascripts').to_path] +
|
|
66
|
+
::Rails.application.config.assets.paths
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: redmine_plugins_helper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.17.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- 0.
|
|
8
|
-
autorequire:
|
|
7
|
+
- 0.17.1
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: eac_rails_gem_support
|
|
@@ -19,7 +18,7 @@ dependencies:
|
|
|
19
18
|
version: '0.13'
|
|
20
19
|
- - ">="
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.13.
|
|
21
|
+
version: 0.13.2
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +28,7 @@ dependencies:
|
|
|
29
28
|
version: '0.13'
|
|
30
29
|
- - ">="
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.13.
|
|
31
|
+
version: 0.13.2
|
|
33
32
|
- !ruby/object:Gem::Dependency
|
|
34
33
|
name: eac_ruby_utils
|
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -39,7 +38,7 @@ dependencies:
|
|
|
39
38
|
version: '0.131'
|
|
40
39
|
- - ">="
|
|
41
40
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: 0.131.
|
|
41
|
+
version: 0.131.5
|
|
43
42
|
type: :runtime
|
|
44
43
|
prerelease: false
|
|
45
44
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -49,7 +48,7 @@ dependencies:
|
|
|
49
48
|
version: '0.131'
|
|
50
49
|
- - ">="
|
|
51
50
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: 0.131.
|
|
51
|
+
version: 0.131.5
|
|
53
52
|
- !ruby/object:Gem::Dependency
|
|
54
53
|
name: launchy
|
|
55
54
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -71,21 +70,45 @@ dependencies:
|
|
|
71
70
|
- !ruby/object:Gem::Version
|
|
72
71
|
version: 2.5.2
|
|
73
72
|
- !ruby/object:Gem::Dependency
|
|
74
|
-
name:
|
|
73
|
+
name: sassc-rails
|
|
75
74
|
requirement: !ruby/object:Gem::Requirement
|
|
76
75
|
requirements:
|
|
77
76
|
- - "~>"
|
|
78
77
|
- !ruby/object:Gem::Version
|
|
79
|
-
version: '
|
|
78
|
+
version: '2.1'
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: 2.1.2
|
|
80
82
|
type: :runtime
|
|
81
83
|
prerelease: false
|
|
82
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
83
85
|
requirements:
|
|
84
86
|
- - "~>"
|
|
85
87
|
- !ruby/object:Gem::Version
|
|
86
|
-
version: '
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
version: '2.1'
|
|
89
|
+
- - ">="
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: 2.1.2
|
|
92
|
+
- !ruby/object:Gem::Dependency
|
|
93
|
+
name: sprockets
|
|
94
|
+
requirement: !ruby/object:Gem::Requirement
|
|
95
|
+
requirements:
|
|
96
|
+
- - "~>"
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: '4.2'
|
|
99
|
+
- - ">="
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: 4.2.2
|
|
102
|
+
type: :runtime
|
|
103
|
+
prerelease: false
|
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
+
requirements:
|
|
106
|
+
- - "~>"
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: '4.2'
|
|
109
|
+
- - ">="
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: 4.2.2
|
|
89
112
|
executables: []
|
|
90
113
|
extensions: []
|
|
91
114
|
extra_rdoc_files: []
|
|
@@ -114,6 +137,7 @@ files:
|
|
|
114
137
|
- lib/redmine_plugins_helper/patches/redmine/plugin/initializers.rb
|
|
115
138
|
- lib/redmine_plugins_helper/patches/redmine/plugin_migration_context.rb
|
|
116
139
|
- lib/redmine_plugins_helper/patches/test_case_patch.rb
|
|
140
|
+
- lib/redmine_plugins_helper/plugins_autoload_assets.rb
|
|
117
141
|
- lib/redmine_plugins_helper/settings.rb
|
|
118
142
|
- lib/redmine_plugins_helper/status_migrations.rb
|
|
119
143
|
- lib/redmine_plugins_helper/test_config.rb
|
|
@@ -126,10 +150,8 @@ files:
|
|
|
126
150
|
- lib/redmine_plugins_helper/version.rb
|
|
127
151
|
- lib/tasks/redmine.rake
|
|
128
152
|
- lib/tasks/redmine_plugins_helper.rake
|
|
129
|
-
homepage:
|
|
130
153
|
licenses: []
|
|
131
154
|
metadata: {}
|
|
132
|
-
post_install_message:
|
|
133
155
|
rdoc_options: []
|
|
134
156
|
require_paths:
|
|
135
157
|
- lib
|
|
@@ -144,8 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
144
166
|
- !ruby/object:Gem::Version
|
|
145
167
|
version: '0'
|
|
146
168
|
requirements: []
|
|
147
|
-
rubygems_version: 3.
|
|
148
|
-
signing_key:
|
|
169
|
+
rubygems_version: 3.6.9
|
|
149
170
|
specification_version: 4
|
|
150
171
|
summary: Helper for Redmine plugins
|
|
151
172
|
test_files: []
|