rggen-core 0.25.0 → 0.25.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57e33c7b563198efa0e1d2c20adcb0b6896d72d4575673c9f64761aeca93779a
4
- data.tar.gz: 61e593cab9704bdc330a3767791afc9e6373020809777c7cd4f67ac18adb7b92
3
+ metadata.gz: 6b2cb2ac6ff0638f1b58234ece63f36d8ae6c0c9b370404d11767fcadd49f1ae
4
+ data.tar.gz: 8ca7963204bf42554d6c2715a0141e2a4b0fa577281f083aa3e171f9e3dee930
5
5
  SHA512:
6
- metadata.gz: 40b23ff5bd0eca3b9a53cda4cb37a220bd8e7a5648bfce598c1404031bfb43421eda997eb8a7c37868e31418a54c7267d336f72631d29522106c20dc3752433a
7
- data.tar.gz: 6918ad93d019dd22e4af13205eb5c8529b1ae8b7c71cd50352b183ae84d3c5a54682189e606859adcd7e70cd292f42d11b8621997cff95ac2e89e2b47f876d1f
6
+ metadata.gz: 0df06ca1ce1bada021e283edd6c57c39f1349d4a32cf6109e943e3f728b951a424f62928362fcf4562c3ca896853b5fd7a25d4fdeb26e4b18bcb4067f51f3454
7
+ data.tar.gz: a543383fed2f6e8a97bebe34710c3dbce0914ee25034c97a17df708cc21128172afd48381395077e71655a3d77e3cad84306c352eb23684ccba8a74f5544b4ef
@@ -30,13 +30,13 @@ module RgGen
30
30
 
31
31
  def load_plugin(setup_path_or_name)
32
32
  setup_path_or_name = setup_path_or_name.to_s.strip
33
- setup_path =
33
+ setup_path, root_dir =
34
34
  if setup_file_directly_given?(setup_path_or_name)
35
- setup_path_or_name
35
+ [setup_path_or_name, extract_root_dir(setup_path_or_name)]
36
36
  else
37
- get_setup_path(setup_path_or_name)
37
+ [get_setup_path(setup_path_or_name), nil]
38
38
  end
39
- read_setup_file(setup_path, setup_path_or_name)
39
+ read_setup_file(setup_path, setup_path_or_name, root_dir)
40
40
  end
41
41
 
42
42
  def load_plugins(plugins, no_default_plugins, activation = true)
@@ -69,13 +69,31 @@ module RgGen
69
69
  File.basename(setup_path_or_name, '.*') == 'setup'
70
70
  end
71
71
 
72
+ def extract_root_dir(setup_path)
73
+ Pathname
74
+ .new(setup_path)
75
+ .ascend.find(&method(:rggen_dir?))
76
+ &.parent
77
+ &.to_s
78
+ end
79
+
80
+ def rggen_dir?(path)
81
+ path.each_filename.to_a[-2..-1] == ['lib', 'rggen']
82
+ end
83
+
72
84
  def get_setup_path(name)
73
85
  base, sub_directory = name.split('/', 2)
74
86
  base = base.sub(/^rggen[-_]/, '').tr('-', '_')
75
87
  File.join(*['rggen', base, sub_directory, 'setup'].compact)
76
88
  end
77
89
 
78
- def read_setup_file(setup_path, setup_path_or_name)
90
+ def read_setup_file(setup_path, setup_path_or_name, root_dir)
91
+ if setup_path == DEFAULT_PLUGSINS
92
+ gem 'rggen', DEFAULT_PLUGSINS_VERSION
93
+ elsif root_dir
94
+ $LOAD_PATH.unshift(root_dir)
95
+ end
96
+
79
97
  require setup_path
80
98
  rescue ::LoadError
81
99
  message =
@@ -96,6 +114,7 @@ module RgGen
96
114
  end
97
115
 
98
116
  DEFAULT_PLUGSINS = 'rggen/setup'
117
+ DEFAULT_PLUGSINS_VERSION = "~> #{MAJOR}.#{MINOR}.0"
99
118
 
100
119
  def default_plugins(no_default_plugins)
101
120
  load_default_plugins?(no_default_plugins) && DEFAULT_PLUGSINS || nil
@@ -2,7 +2,7 @@
2
2
 
3
3
  module RgGen
4
4
  module Core
5
- VERSION = '0.25.0'
5
+ VERSION = '0.25.2'
6
6
  MAJOR, MINOR, PATCH = VERSION.split('.').map(&:to_i)
7
7
  end
8
8
  end
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.25.0
4
+ version: 0.25.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: 2021-02-28 00:00:00.000000000 Z
11
+ date: 2023-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docile
@@ -212,8 +212,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  - !ruby/object:Gem::Version
213
213
  version: '0'
214
214
  requirements: []
215
- rubygems_version: 3.2.3
215
+ rubygems_version: 3.4.19
216
216
  signing_key:
217
217
  specification_version: 4
218
- summary: rggen-core-0.25.0
218
+ summary: rggen-core-0.25.2
219
219
  test_files: []