rggen-core 0.31.0 → 0.31.2
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/lib/rggen/core/builder/plugin_manager.rb +44 -19
- data/lib/rggen/core/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45a9b6397155e93d65c0c171ec0ac17440baac57ec595e26029c657c1f775766
|
4
|
+
data.tar.gz: a8da50f308ac9eb4ca9079571b69cbb5c8c630abc59f02962e5547f63605ef98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d6e431128bdeb4977c546a2911147666aa47f922e396bf2a575efafb569213511bb789ba39d3fbbb89e9fc24838f144fa91ff727118bb5ecaf57a96a3a45a51
|
7
|
+
data.tar.gz: afdbe15fec9f8b40ab17054113769b4d4cc3889942da24dc6eeb10aa147bd3e82e39cd69817b09c161ab1ed19b439472562db6d0d58729563756de0a49a9aa71
|
@@ -18,8 +18,8 @@ module RgGen
|
|
18
18
|
|
19
19
|
def parse(path_or_name, version)
|
20
20
|
@name, @path, @gemname, @version =
|
21
|
-
if plugin_path?(path_or_name)
|
22
|
-
[nil, path_or_name
|
21
|
+
if path_or_name == DEFAULT_PLUGSINS || plugin_path?(path_or_name)
|
22
|
+
[nil, path_or_name]
|
23
23
|
else
|
24
24
|
[
|
25
25
|
path_or_name, get_plugin_path(path_or_name),
|
@@ -41,17 +41,7 @@ module RgGen
|
|
41
41
|
private
|
42
42
|
|
43
43
|
def plugin_path?(path_or_name)
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
def find_gemspec_by_path(path)
|
48
|
-
Gem::Specification
|
49
|
-
.each.find { |spec| match_gemspec_path?(spec, path) }
|
50
|
-
.then { |spec| spec && [spec.name, spec.version] }
|
51
|
-
end
|
52
|
-
|
53
|
-
def match_gemspec_path?(gemspec, path)
|
54
|
-
gemspec.full_require_paths.any?(&path.method(:start_with?))
|
44
|
+
File.ext(path_or_name) == 'rb'
|
55
45
|
end
|
56
46
|
|
57
47
|
def get_plugin_path(name)
|
@@ -93,9 +83,11 @@ module RgGen
|
|
93
83
|
end
|
94
84
|
|
95
85
|
def activate_plugin_by_name(plugin_name)
|
96
|
-
|
97
|
-
|
98
|
-
|
86
|
+
@plugins.find { |plugin| plugin.name == plugin_name }
|
87
|
+
&.then do |plugin|
|
88
|
+
plugin.activate(@builder)
|
89
|
+
plugin.activate_additionally(@builder)
|
90
|
+
end
|
99
91
|
end
|
100
92
|
|
101
93
|
def version_info
|
@@ -105,12 +97,46 @@ module RgGen
|
|
105
97
|
private
|
106
98
|
|
107
99
|
def read_plugin_file(info)
|
108
|
-
|
100
|
+
activate_plugin_gem(info)
|
109
101
|
require info.path
|
110
102
|
rescue ::LoadError
|
111
103
|
raise Core::PluginError.new("cannot load such plugin: #{info}")
|
112
104
|
end
|
113
105
|
|
106
|
+
def activate_plugin_gem(info)
|
107
|
+
if (gemspec = find_gemspec(info))
|
108
|
+
gem gemspec.name, gemspec.version
|
109
|
+
elsif info.gemname
|
110
|
+
gem info.gemname, info.version
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def find_gemspec(info)
|
115
|
+
if info.path == DEFAULT_PLUGSINS
|
116
|
+
find_default_plugins_gemspec
|
117
|
+
elsif info.gemname
|
118
|
+
find_gemspec_by_name(info.gemname, info.version)
|
119
|
+
else
|
120
|
+
find_gemspec_by_path(info.path)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def find_default_plugins_gemspec
|
125
|
+
find_gemspec_by_name('rggen', "~> #{MAJOR}.#{MINOR}.0")
|
126
|
+
end
|
127
|
+
|
128
|
+
def find_gemspec_by_name(name, version)
|
129
|
+
Gem::Specification
|
130
|
+
.find_all_by_name(name, version)
|
131
|
+
.find { |s| !s.has_conflicts? }
|
132
|
+
end
|
133
|
+
|
134
|
+
def find_gemspec_by_path(path)
|
135
|
+
Gem::Specification
|
136
|
+
.each
|
137
|
+
.find { |spec| spec.full_require_paths.any?(&path.method(:start_with?)) }
|
138
|
+
end
|
139
|
+
|
114
140
|
def merge_plugins(plugins, no_default_plugins)
|
115
141
|
[
|
116
142
|
*default_plugins(no_default_plugins),
|
@@ -126,8 +152,7 @@ module RgGen
|
|
126
152
|
def load_default_plugins?(no_default_plugins)
|
127
153
|
return false if no_default_plugins
|
128
154
|
return false if ENV.key?('RGGEN_NO_DEFAULT_PLUGINS')
|
129
|
-
|
130
|
-
true
|
155
|
+
!find_default_plugins_gemspec.nil?
|
131
156
|
end
|
132
157
|
|
133
158
|
def plugins_from_env
|
data/lib/rggen/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rggen-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.31.
|
4
|
+
version: 0.31.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taichi Ishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docile
|
@@ -222,8 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '0'
|
224
224
|
requirements: []
|
225
|
-
rubygems_version: 3.4.
|
225
|
+
rubygems_version: 3.4.19
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
|
-
summary: rggen-core-0.31.
|
228
|
+
summary: rggen-core-0.31.2
|
229
229
|
test_files: []
|