super 0.0.10 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +0 -9
- data/README.md +40 -52
- data/app/assets/javascripts/super/application.js +5672 -3671
- data/app/assets/stylesheets/super/application.css +114681 -71486
- data/app/controllers/super/application_controller.rb +31 -21
- data/app/helpers/super/form_builder_helper.rb +2 -0
- data/app/views/layouts/super/application.html.erb +15 -14
- data/app/views/super/application/{_super_schema_display_actions.html.erb → _display_actions.html.erb} +0 -0
- data/app/views/super/application/{_super_schema_display_index.html.erb → _display_index.html.erb} +4 -4
- data/app/views/super/application/_display_show.html.erb +8 -0
- data/app/views/super/application/_filter.html.erb +5 -13
- data/app/views/super/application/_filter_type_select.html.erb +5 -2
- data/app/views/super/application/_filter_type_text.html.erb +6 -4
- data/app/views/super/application/_filter_type_timestamp.html.erb +6 -5
- data/app/views/super/application/{_super_schema_form.html.erb → _form.html.erb} +2 -2
- data/app/views/super/application/_form_field.html.erb +5 -0
- data/app/views/super/application/{_super_layout.html.erb → _layout.html.erb} +8 -8
- data/app/views/super/application/{_super_pagination.html.erb → _pagination.html.erb} +1 -1
- data/app/views/super/application/{_super_panel.html.erb → _panel.html.erb} +2 -2
- data/app/views/super/application/_query.html.erb +18 -0
- data/app/views/super/application/_sort.html.erb +18 -0
- data/app/views/super/application/_sort_expression.html.erb +25 -0
- data/app/views/super/feather/README.md +1 -1
- data/app/views/super/feather/_x.html +15 -0
- data/config/routes.rb +2 -0
- data/frontend/super-frontend/dist/application.css +114681 -71486
- data/frontend/super-frontend/dist/application.js +5672 -3671
- data/lib/generators/super/action_text/action_text_generator.rb +2 -0
- data/lib/generators/super/install/install_generator.rb +18 -23
- data/lib/generators/super/install/templates/base_controller.rb.tt +9 -1
- data/lib/generators/super/install/templates/initializer.rb.tt +9 -2
- data/lib/generators/super/resource/resource_generator.rb +107 -30
- data/lib/generators/super/resource/templates/resources_controller.rb.tt +3 -9
- data/lib/generators/super/webpacker/webpacker_generator.rb +11 -5
- data/lib/super.rb +10 -2
- data/lib/super/action_inquirer.rb +13 -3
- data/lib/super/assets.rb +46 -23
- data/lib/super/badge.rb +61 -0
- data/lib/super/cheat.rb +17 -0
- data/lib/super/client_error.rb +2 -0
- data/lib/super/compatibility.rb +21 -0
- data/lib/super/configuration.rb +16 -24
- data/lib/super/controls.rb +11 -2
- data/lib/super/controls/optional.rb +44 -1
- data/lib/super/controls/steps.rb +53 -34
- data/lib/super/controls/view.rb +55 -0
- data/lib/super/display.rb +29 -13
- data/lib/super/display/guesser.rb +4 -0
- data/lib/super/display/schema_types.rb +118 -29
- data/lib/super/engine.rb +2 -0
- data/lib/super/error.rb +12 -0
- data/lib/super/filter.rb +2 -0
- data/lib/super/filter/form_object.rb +5 -8
- data/lib/super/filter/guesser.rb +2 -0
- data/lib/super/filter/operator.rb +2 -0
- data/lib/super/filter/schema_types.rb +2 -0
- data/lib/super/form.rb +3 -1
- data/lib/super/form/builder.rb +109 -27
- data/lib/super/form/guesser.rb +12 -1
- data/lib/super/form/inline_errors.rb +2 -0
- data/lib/super/form/schema_types.rb +75 -7
- data/lib/super/form/strong_params.rb +2 -0
- data/lib/super/layout.rb +3 -1
- data/lib/super/link.rb +44 -31
- data/lib/super/link_builder.rb +58 -0
- data/lib/super/navigation.rb +164 -0
- data/lib/super/pagination.rb +3 -43
- data/lib/super/panel.rb +3 -1
- data/lib/super/partial.rb +2 -0
- data/lib/super/partial/resolving.rb +2 -0
- data/lib/super/plugin.rb +2 -0
- data/lib/super/query/form_object.rb +48 -0
- data/lib/super/reset.rb +17 -0
- data/lib/super/schema.rb +2 -0
- data/lib/super/schema/common.rb +2 -0
- data/lib/super/schema/guesser.rb +2 -0
- data/lib/super/sort.rb +110 -0
- data/lib/super/useful/builder.rb +25 -0
- data/lib/super/useful/enum.rb +63 -0
- data/lib/super/version.rb +3 -1
- data/lib/super/view_helper.rb +2 -0
- data/lib/tasks/super/cheat.rake +9 -0
- metadata +45 -28
- data/CONTRIBUTING.md +0 -56
- data/Rakefile +0 -34
- data/STABILITY.md +0 -50
- data/app/views/super/application/_form_field_checkbox.html.erb +0 -1
- data/app/views/super/application/_form_field_rich_text_area.html.erb +0 -1
- data/app/views/super/application/_form_field_text.html.erb +0 -1
- data/app/views/super/application/_super_schema_display_show.html.erb +0 -8
- data/app/views/super/feather/_chevron_down.html +0 -1
- data/docs/README.md +0 -8
- data/docs/action_text.md +0 -48
- data/docs/cheat.md +0 -41
- data/docs/faq.md +0 -44
- data/docs/installation.md +0 -21
- data/docs/quick_start.md +0 -30
- data/docs/webpacker.md +0 -25
- data/docs/yard_customizations.rb +0 -41
- data/lib/super/controls/required.rb +0 -13
- data/lib/super/filter/plugin.rb +0 -47
- data/lib/super/navigation/automatic.rb +0 -71
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Super
|
2
4
|
class InstallGenerator < Rails::Generators::Base
|
3
5
|
source_root File.expand_path("templates", __dir__)
|
@@ -7,6 +9,12 @@ module Super
|
|
7
9
|
class_option :route_namespace, type: :string, default: "admin",
|
8
10
|
banner: "Specifies the route namespace for admin controllers"
|
9
11
|
|
12
|
+
def assert_not_controller_namespace_not_super
|
13
|
+
if controller_namespace == "super"
|
14
|
+
raise Super::Error::ArgumentError, "controller_namespace can not be `super`"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
10
18
|
def create_initializer
|
11
19
|
template("initializer.rb", "config/initializers/super.rb")
|
12
20
|
end
|
@@ -14,8 +22,7 @@ module Super
|
|
14
22
|
def create_base_admin_controller
|
15
23
|
template(
|
16
24
|
"base_controller.rb",
|
17
|
-
"app/controllers/#{
|
18
|
-
controller_namespace: controller_namespace
|
25
|
+
"app/controllers/#{parent_controller_name}_controller.rb"
|
19
26
|
)
|
20
27
|
end
|
21
28
|
|
@@ -29,34 +36,22 @@ module Super
|
|
29
36
|
create_file("app/controllers/#{controller_namespace}/.keep", "")
|
30
37
|
end
|
31
38
|
|
32
|
-
def copy_cheatsheet
|
33
|
-
super_path = Pathname.new(Gem.loaded_specs["super"].full_gem_path).expand_path
|
34
|
-
super_cheat_path = super_path.join("docs", "cheat.md")
|
35
|
-
|
36
|
-
path =
|
37
|
-
if options["controller_namespace"].present?
|
38
|
-
"app/controllers/#{controller_namespace}/README.md"
|
39
|
-
else
|
40
|
-
"app/controllers/README.md"
|
41
|
-
end
|
42
|
-
|
43
|
-
create_file(path) do
|
44
|
-
super_cheat_path.read.sub(%r{<!--.*?-->}m, "").strip + "\n"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
39
|
def setup_sprockets4_manifest
|
49
40
|
append_to_file "app/assets/config/manifest.js", "//= link super_manifest.js\n"
|
50
41
|
end
|
51
42
|
|
52
43
|
private
|
53
44
|
|
45
|
+
def route_namespace
|
46
|
+
options[:route_namespace].strip.gsub(%r{\A/+}, "").gsub(%r{/+\z}, "").strip.underscore
|
47
|
+
end
|
48
|
+
|
54
49
|
def controller_namespace
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
options["controller_namespace"].strip.gsub(%r{\A/+}, "").gsub(%r{/+\z}, "").strip.underscore
|
51
|
+
end
|
52
|
+
|
53
|
+
def parent_controller_name
|
54
|
+
controller_namespace.presence || "admin"
|
60
55
|
end
|
61
56
|
end
|
62
57
|
end
|
@@ -1,2 +1,10 @@
|
|
1
|
-
class <%=
|
1
|
+
class <%= parent_controller_name.classify %>Controller < Super::ApplicationController
|
2
|
+
class <%= parent_controller_name.classify.demodulize %>Controls < Super::Controls
|
3
|
+
end
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def new_controls
|
8
|
+
self.class::Controls.new
|
9
|
+
end
|
2
10
|
end
|
@@ -1,5 +1,12 @@
|
|
1
1
|
Super.configuration do |c|
|
2
2
|
c.title = "My Admin Site"
|
3
|
-
|
4
|
-
c.
|
3
|
+
<% if route_namespace != "admin" -%>
|
4
|
+
c.path = "/<%= route_namespace %>"
|
5
|
+
<% end -%>
|
6
|
+
<% if route_namespace != "admin" -%>
|
7
|
+
c.generator_as = "<%= route_namespace.gsub(%r{/}, "_") %>"
|
8
|
+
<% end -%>
|
9
|
+
<% if controller_namespace != "admin" -%>
|
10
|
+
c.generator_module = "<%= controller_namespace %>"
|
11
|
+
<% end -%>
|
5
12
|
end
|
@@ -1,52 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/resource_helpers"
|
4
|
+
|
1
5
|
module Super
|
2
6
|
class ResourceGenerator < Rails::Generators::NamedBase
|
7
|
+
include Rails::Generators::ResourceHelpers
|
3
8
|
source_root File.expand_path("templates", __dir__)
|
4
9
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
10
|
+
check_class_collision suffix: "Controller"
|
11
|
+
|
12
|
+
class_option :skip_routes, type: :boolean, desc: "Don't add routes to config/routes.rb."
|
13
|
+
|
14
|
+
def initialize(*)
|
15
|
+
super
|
12
16
|
|
17
|
+
controller_namespace = Super.configuration.generator_module
|
18
|
+
if controller_namespace.present?
|
19
|
+
controller_name =
|
20
|
+
if controller_namespace.include?("/")
|
21
|
+
"#{controller_namespace}/#{name}"
|
22
|
+
else
|
23
|
+
"#{controller_namespace}::#{name}"
|
24
|
+
end
|
25
|
+
self.options = options.dup
|
26
|
+
options[:model_name] = name
|
27
|
+
options.freeze
|
28
|
+
assign_names!(name)
|
29
|
+
assign_controller_names!(controller_name.pluralize)
|
30
|
+
else
|
31
|
+
assign_names!(name)
|
32
|
+
assign_controller_names!(name.pluralize)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_controller
|
13
37
|
template(
|
14
38
|
"resources_controller.rb",
|
15
|
-
"app/controllers
|
39
|
+
File.join("app/controllers", controller_class_path, "#{controller_file_name}_controller.rb")
|
16
40
|
)
|
17
41
|
end
|
18
42
|
|
19
|
-
|
43
|
+
def create_route_namespace
|
44
|
+
data = route_scope
|
45
|
+
return if data.nil?
|
46
|
+
return if File.read(File.join(destination_root, "config", "routes.rb")).include?(data)
|
20
47
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
48
|
+
inject_into_file(
|
49
|
+
"config/routes.rb",
|
50
|
+
"#{data}\nend\n".indent(2),
|
51
|
+
after: /^Rails\.application\.routes\.draw\b.*$\r?\n\r?/,
|
52
|
+
verbose: true,
|
53
|
+
force: false
|
54
|
+
)
|
55
|
+
end
|
28
56
|
|
29
|
-
|
30
|
-
|
57
|
+
def add_admin_route
|
58
|
+
data = route_scope
|
31
59
|
|
32
|
-
if
|
33
|
-
|
60
|
+
if data.nil?
|
61
|
+
route("resources :#{file_name.pluralize}")
|
62
|
+
else
|
63
|
+
inject_into_file(
|
64
|
+
"config/routes.rb",
|
65
|
+
"resources :#{file_name.pluralize}\n".indent(4),
|
66
|
+
after: /#{data}.*$\r?\n\r?/,
|
67
|
+
verbose: true,
|
68
|
+
force: false
|
69
|
+
)
|
34
70
|
end
|
71
|
+
end
|
35
72
|
|
36
|
-
|
37
|
-
concat("\n")
|
73
|
+
private
|
38
74
|
|
39
|
-
|
40
|
-
|
41
|
-
end
|
75
|
+
def parent_controller_name
|
76
|
+
controller_namespace.presence || "admin"
|
42
77
|
end
|
43
78
|
|
44
|
-
def
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
79
|
+
def controller_namespace
|
80
|
+
Super.configuration.generator_module.strip.gsub(%r{\A/+}, "").gsub(%r{/+\z}, "").strip.underscore
|
81
|
+
end
|
82
|
+
|
83
|
+
def route_scope
|
84
|
+
return nil if no_scope?
|
85
|
+
|
86
|
+
if use_scope?
|
87
|
+
kwargs = []
|
88
|
+
kwargs.push(%(path: "/#{g_path}")) if g_path.present?
|
89
|
+
kwargs.push(%(module: "#{g_module}")) if g_module.present?
|
90
|
+
kwargs.push(%(as: "#{g_as}")) if g_as.present?
|
91
|
+
return %(scope #{kwargs.join(", ")} do)
|
49
92
|
end
|
93
|
+
|
94
|
+
%(namespace :#{g_module} do)
|
95
|
+
end
|
96
|
+
|
97
|
+
def use_scope?
|
98
|
+
return true if !same?
|
99
|
+
return true if g_module.include?("/")
|
100
|
+
return true if g_path.include?("/")
|
101
|
+
|
102
|
+
false
|
103
|
+
end
|
104
|
+
|
105
|
+
def no_scope?
|
106
|
+
g_module.blank? && g_path.blank? && g_as.blank?
|
107
|
+
end
|
108
|
+
|
109
|
+
def same?
|
110
|
+
g_module == g_path && g_path == g_as
|
111
|
+
end
|
112
|
+
|
113
|
+
def g_module
|
114
|
+
normalized_scope_part(Super.configuration.generator_module || "")
|
115
|
+
end
|
116
|
+
|
117
|
+
def g_path
|
118
|
+
normalized_scope_part(Super.configuration.path || "")
|
119
|
+
end
|
120
|
+
|
121
|
+
def g_as
|
122
|
+
normalized_scope_part(Super.configuration.generator_as || "")
|
123
|
+
end
|
124
|
+
|
125
|
+
def normalized_scope_part(part)
|
126
|
+
part.strip.gsub(%r{\A/+}, "").gsub(%r{/+\z}, "").strip
|
50
127
|
end
|
51
128
|
end
|
52
129
|
end
|
@@ -1,12 +1,6 @@
|
|
1
|
-
<%
|
2
|
-
class <%=
|
3
|
-
|
4
|
-
|
5
|
-
def new_controls
|
6
|
-
Controls.new
|
7
|
-
end
|
8
|
-
|
9
|
-
class Controls < Super::Controls
|
1
|
+
<% module_namespacing do -%>
|
2
|
+
class <%= controller_class_name %>Controller < <%= parent_controller_name.classify %>Controller
|
3
|
+
class Controls < <%= parent_controller_name.classify.demodulize %>Controls
|
10
4
|
def model
|
11
5
|
<%= class_name %>
|
12
6
|
end
|
@@ -1,12 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Super
|
2
4
|
class WebpackerGenerator < Rails::Generators::Base
|
3
5
|
source_root File.expand_path("templates", __dir__)
|
4
6
|
|
5
7
|
def copy_the_pack_file
|
6
|
-
|
7
|
-
"
|
8
|
-
|
9
|
-
|
8
|
+
path =
|
9
|
+
if Gem::Dependency.new("webpacker", ">= 6.0.0.beta2", "!= 6.0.0.pre1", "!= 6.0.0.pre2").matching_specs.any?
|
10
|
+
"app/packs/entrypoints/super/application.js.erb"
|
11
|
+
else
|
12
|
+
"app/javascript/packs/super/application.js.erb"
|
13
|
+
end
|
14
|
+
|
15
|
+
template("pack_super_application.js.erb", path)
|
10
16
|
end
|
11
17
|
|
12
18
|
def set_asset_handler_to_webpacker
|
@@ -14,7 +20,7 @@ module Super
|
|
14
20
|
"config/initializers/super.rb",
|
15
21
|
" c.javascripts = Super::Assets.use_webpacker(c.javascripts)\n" \
|
16
22
|
" c.stylesheets = Super::Assets.use_webpacker(c.stylesheets)\n",
|
17
|
-
before:
|
23
|
+
before: /^end\b/
|
18
24
|
)
|
19
25
|
end
|
20
26
|
|
data/lib/super.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "tsort"
|
2
4
|
|
3
5
|
require "rails/engine"
|
4
6
|
|
5
7
|
require "super/schema/common"
|
8
|
+
require "super/useful/builder"
|
9
|
+
require "super/useful/enum"
|
6
10
|
|
7
11
|
require "super/action_inquirer"
|
8
12
|
require "super/assets"
|
13
|
+
require "super/badge"
|
9
14
|
require "super/client_error"
|
10
15
|
require "super/compatibility"
|
11
16
|
require "super/configuration"
|
@@ -18,7 +23,6 @@ require "super/filter"
|
|
18
23
|
require "super/filter/form_object"
|
19
24
|
require "super/filter/guesser"
|
20
25
|
require "super/filter/operator"
|
21
|
-
require "super/filter/plugin"
|
22
26
|
require "super/filter/schema_types"
|
23
27
|
require "super/form"
|
24
28
|
require "super/form/builder"
|
@@ -28,13 +32,17 @@ require "super/form/schema_types"
|
|
28
32
|
require "super/form/strong_params"
|
29
33
|
require "super/layout"
|
30
34
|
require "super/link"
|
31
|
-
require "super/
|
35
|
+
require "super/link_builder"
|
36
|
+
require "super/navigation"
|
32
37
|
require "super/pagination"
|
33
38
|
require "super/panel"
|
34
39
|
require "super/partial"
|
35
40
|
require "super/plugin"
|
41
|
+
require "super/query/form_object"
|
42
|
+
require "super/reset"
|
36
43
|
require "super/schema"
|
37
44
|
require "super/schema/guesser"
|
45
|
+
require "super/sort"
|
38
46
|
require "super/version"
|
39
47
|
require "super/view_helper"
|
40
48
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Super
|
2
4
|
# ```ruby
|
3
5
|
# action = Super::ActionInquirer.new(
|
@@ -17,12 +19,20 @@ module Super
|
|
17
19
|
#
|
18
20
|
def self.default_for_resources
|
19
21
|
{
|
20
|
-
read
|
21
|
-
write
|
22
|
-
delete
|
22
|
+
"read" => %w[index show new edit],
|
23
|
+
"write" => %w[create update destroy],
|
24
|
+
"delete" => %w[destroy],
|
23
25
|
}
|
24
26
|
end
|
25
27
|
|
28
|
+
def self.index!; new(default_for_resources, "index"); end
|
29
|
+
def self.show!; new(default_for_resources, "show"); end
|
30
|
+
def self.new!; new(default_for_resources, "new"); end
|
31
|
+
def self.edit!; new(default_for_resources, "edit"); end
|
32
|
+
def self.create!; new(default_for_resources, "create"); end
|
33
|
+
def self.update!; new(default_for_resources, "update"); end
|
34
|
+
def self.destroy!; new(default_for_resources, "destroy"); end
|
35
|
+
|
26
36
|
def initialize(categories_and_their_actions, action)
|
27
37
|
@categories = categories_and_their_actions.keys.map(&:to_s)
|
28
38
|
@actions = categories_and_their_actions.values.flatten.uniq.map(&:to_s)
|
data/lib/super/assets.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Super
|
2
4
|
# Utilities for determining whether to use Sprockets or Webpacker
|
3
5
|
class Assets
|
@@ -19,7 +21,7 @@ module Super
|
|
19
21
|
assets.map do |asset|
|
20
22
|
grep_matches = grep && asset === grep
|
21
23
|
if grep_matches || !grep
|
22
|
-
asset.
|
24
|
+
asset.send(:handler=, Handler.webpacker)
|
23
25
|
end
|
24
26
|
|
25
27
|
asset
|
@@ -32,7 +34,7 @@ module Super
|
|
32
34
|
assets.map do |asset|
|
33
35
|
grep_matches = grep && asset === grep
|
34
36
|
if grep_matches || !grep
|
35
|
-
asset.
|
37
|
+
asset.send(:handler=, Handler.sprockets)
|
36
38
|
end
|
37
39
|
|
38
40
|
asset
|
@@ -50,6 +52,14 @@ module Super
|
|
50
52
|
attr_reader :path
|
51
53
|
attr_reader :arguments
|
52
54
|
|
55
|
+
def ==(other)
|
56
|
+
return false if handler != other.handler
|
57
|
+
return false if path != other.path
|
58
|
+
return false if arguments != other.arguments
|
59
|
+
|
60
|
+
true
|
61
|
+
end
|
62
|
+
|
53
63
|
def ===(other)
|
54
64
|
return true if path == other
|
55
65
|
return true if other.is_a?(Regexp) && path.match?(other)
|
@@ -59,6 +69,10 @@ module Super
|
|
59
69
|
|
60
70
|
false
|
61
71
|
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
attr_writer :handler
|
62
76
|
end
|
63
77
|
|
64
78
|
def self.dist(gem_name, package_name)
|
@@ -72,29 +86,34 @@ module Super
|
|
72
86
|
end
|
73
87
|
|
74
88
|
class Handler
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
elsif Gem::Dependency.new("webpacker", "~> 6.0").matching_specs.any?
|
84
|
-
webpacker
|
85
|
-
elsif Gem::Dependency.new("webpacker", "~> 5.0").matching_specs.any?
|
86
|
-
webpacker
|
87
|
-
elsif Gem::Dependency.new("webpacker", "~> 4.0").matching_specs.any?
|
88
|
-
webpacker
|
89
|
-
elsif Gem::Dependency.new("webpacker", "~> 3.0").matching_specs.any?
|
90
|
-
webpacker
|
91
|
-
else
|
92
|
-
none
|
89
|
+
class << self
|
90
|
+
def auto
|
91
|
+
sprockets_spec = gem_specification("sprockets")
|
92
|
+
if sprockets_spec
|
93
|
+
major = sprockets_spec.version.segments.first
|
94
|
+
if major >= 2
|
95
|
+
return sprockets
|
96
|
+
end
|
93
97
|
end
|
94
|
-
end
|
95
98
|
|
96
|
-
|
97
|
-
|
99
|
+
webpacker_spec = gem_specification("webpacker")
|
100
|
+
if webpacker_spec
|
101
|
+
major = webpacker_spec.version.segments.first
|
102
|
+
if major >= 4
|
103
|
+
return webpacker
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
none
|
108
|
+
end
|
109
|
+
|
110
|
+
def sprockets_available?
|
111
|
+
!gem_specification("sprockets").nil? && defined?(Sprockets)
|
112
|
+
end
|
113
|
+
|
114
|
+
def gem_specification(gem_name)
|
115
|
+
Gem::Dependency.new(gem_name).matching_specs&.sort_by(&:version)&.first
|
116
|
+
end
|
98
117
|
end
|
99
118
|
|
100
119
|
def self.sprockets
|
@@ -113,6 +132,10 @@ module Super
|
|
113
132
|
@asset_handler = asset_handler
|
114
133
|
end
|
115
134
|
|
135
|
+
def ==(other)
|
136
|
+
to_sym == other.to_sym
|
137
|
+
end
|
138
|
+
|
116
139
|
def sprockets?
|
117
140
|
@asset_handler == :sprockets
|
118
141
|
end
|