rexer 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -4
- data/lib/rexer/commands/install.rb +4 -4
- data/lib/rexer/commands/state.rb +2 -4
- data/lib/rexer/definition/diff.rb +6 -6
- data/lib/rexer/definition/dsl.rb +3 -3
- data/lib/rexer/extension/plugin.rb +19 -4
- data/lib/rexer/extension/theme.rb +18 -4
- data/lib/rexer/source/base.rb +3 -3
- data/lib/rexer/source.rb +9 -0
- data/lib/rexer/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b58d350ffc9bafc33b202240ed26a3ecf6228a29677ba2cca1938c81bd32576
|
4
|
+
data.tar.gz: 68d15da77b4838c6bbd97e35bd2b301c2cdf0d738176cc24fe62a07c1e486013
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ef4db2f19d7fc91b28d265b8afe6a51080553ec4d2bd8f9a02824c05ed166593a1fbe44ed7e28a3a2ec3eb40d98a255963eb953b4e900340902ec4499a619cd
|
7
|
+
data.tar.gz: 330a05a5692158e30db7a3a4f55d2b830b18265dfb1fb277e5b73f27af113002014234431a8abe2f8a2932c2ca16f65b3c76121e483f9add212bcd0e45e74de4
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ module Rexer
|
|
28
28
|
|
29
29
|
install(diff.added_themes, diff.added_plugins)
|
30
30
|
uninstall(diff.deleted_themes, diff.deleted_plugins)
|
31
|
-
|
31
|
+
reload_source(diff.source_changed_themes, diff.source_changed_plugins)
|
32
32
|
|
33
33
|
create_lock_file(definition.env)
|
34
34
|
print_state
|
@@ -64,13 +64,13 @@ module Rexer
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
def
|
67
|
+
def reload_source(themes, plugins)
|
68
68
|
themes.each do
|
69
|
-
Extension::Theme::
|
69
|
+
Extension::Theme::SourceReloader.new(_1).reload
|
70
70
|
end
|
71
71
|
|
72
72
|
plugins.each do
|
73
|
-
Extension::Plugin::
|
73
|
+
Extension::Plugin::SourceReloader.new(_1).reload
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
data/lib/rexer/commands/state.rb
CHANGED
@@ -39,10 +39,8 @@ module Rexer
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def source_info(
|
43
|
-
|
44
|
-
Source.const_get(_1.type.capitalize).new(**_1.options).info
|
45
|
-
}
|
42
|
+
def source_info(definition_source)
|
43
|
+
Source.from_definition(definition_source).info
|
46
44
|
end
|
47
45
|
|
48
46
|
def no_lock_file_found
|
@@ -22,21 +22,21 @@ module Rexer
|
|
22
22
|
old_data.themes - new_data.themes
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def source_changed_plugins
|
26
26
|
old_plugins = old_data.plugins
|
27
27
|
|
28
28
|
(new_data.plugins & old_plugins).select do |new_plugin|
|
29
29
|
old_plugin = old_plugins.find { _1.name == new_plugin.name }
|
30
|
-
|
30
|
+
plugin_source_changed?(old_plugin, new_plugin)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def source_changed_themes
|
35
35
|
old_themes = old_data.themes
|
36
36
|
|
37
37
|
(new_data.themes & old_themes).select do |new_theme|
|
38
38
|
old_theme = old_themes.find { _1.name == new_theme.name }
|
39
|
-
|
39
|
+
theme_source_changed?(old_theme, new_theme)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -44,11 +44,11 @@ module Rexer
|
|
44
44
|
|
45
45
|
attr_reader :old_data, :new_data
|
46
46
|
|
47
|
-
def
|
47
|
+
def plugin_source_changed?(old_plugin, new_plugin)
|
48
48
|
old_plugin.source != new_plugin.source
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def theme_source_changed?(old_theme, new_theme)
|
52
52
|
old_theme.source != new_theme.source
|
53
53
|
end
|
54
54
|
end
|
data/lib/rexer/definition/dsl.rb
CHANGED
@@ -11,7 +11,7 @@ module Rexer
|
|
11
11
|
@plugins << Definition::Plugin.new(
|
12
12
|
name: name,
|
13
13
|
source: build_source(opts),
|
14
|
-
hooks: build_hooks(hooks, %i[installed uninstalled
|
14
|
+
hooks: build_hooks(hooks, %i[installed uninstalled]),
|
15
15
|
env: @env
|
16
16
|
)
|
17
17
|
end
|
@@ -20,7 +20,7 @@ module Rexer
|
|
20
20
|
@themes << Definition::Theme.new(
|
21
21
|
name: name,
|
22
22
|
source: build_source(opts),
|
23
|
-
hooks: build_hooks(hooks, %i[installed uninstalled
|
23
|
+
hooks: build_hooks(hooks, %i[installed uninstalled]),
|
24
24
|
env: @env
|
25
25
|
)
|
26
26
|
end
|
@@ -54,7 +54,7 @@ module Rexer
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def build_source(opts)
|
57
|
-
type = opts.keys.find { Rexer::Source
|
57
|
+
type = opts.keys.find { Rexer::Source.names.include?(_1) }
|
58
58
|
Source.new(type, opts[type]) if type
|
59
59
|
end
|
60
60
|
end
|
@@ -42,9 +42,7 @@ module Rexer
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def source
|
45
|
-
@source ||= definition.source
|
46
|
-
Source.const_get(src.type.capitalize).new(**src.options)
|
47
|
-
end
|
45
|
+
@source ||= Source.from_definition(definition.source)
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
@@ -90,7 +88,6 @@ module Rexer
|
|
90
88
|
|
91
89
|
update_source
|
92
90
|
run_db_migrate
|
93
|
-
hooks[:updated]&.call
|
94
91
|
end
|
95
92
|
|
96
93
|
private
|
@@ -99,6 +96,24 @@ module Rexer
|
|
99
96
|
source.update(plugin_dir.to_s)
|
100
97
|
end
|
101
98
|
end
|
99
|
+
|
100
|
+
class SourceReloader < Base
|
101
|
+
def reload
|
102
|
+
return unless plugin_exists?
|
103
|
+
|
104
|
+
reload_source
|
105
|
+
run_db_migrate
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
def reload_source
|
111
|
+
plugin_dir.to_s.then { |dir|
|
112
|
+
FileUtils.rm_rf(dir)
|
113
|
+
source.load(dir)
|
114
|
+
}
|
115
|
+
end
|
116
|
+
end
|
102
117
|
end
|
103
118
|
end
|
104
119
|
end
|
@@ -32,9 +32,7 @@ module Rexer
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def source
|
35
|
-
@source ||= definition.source
|
36
|
-
Source.const_get(src.type.capitalize).new(**src.options)
|
37
|
-
end
|
35
|
+
@source ||= Source.from_definition(definition.source)
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
@@ -73,7 +71,6 @@ module Rexer
|
|
73
71
|
return unless theme_exists?
|
74
72
|
|
75
73
|
update_source
|
76
|
-
hooks[:updated]&.call
|
77
74
|
end
|
78
75
|
|
79
76
|
private
|
@@ -82,6 +79,23 @@ module Rexer
|
|
82
79
|
source.update(theme_dir.to_s)
|
83
80
|
end
|
84
81
|
end
|
82
|
+
|
83
|
+
class SourceReloader < Base
|
84
|
+
def reload
|
85
|
+
return unless theme_exists?
|
86
|
+
|
87
|
+
reload_source
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
def reload_source
|
93
|
+
theme_dir.to_s.then { |dir|
|
94
|
+
FileUtils.rm_rf(dir)
|
95
|
+
source.load(dir)
|
96
|
+
}
|
97
|
+
end
|
98
|
+
end
|
85
99
|
end
|
86
100
|
end
|
87
101
|
end
|
data/lib/rexer/source/base.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module Rexer
|
2
2
|
module Source
|
3
3
|
class Base
|
4
|
-
def self.source_names = @source_names ||= []
|
5
|
-
|
6
4
|
def self.inherited(subclass)
|
7
|
-
|
5
|
+
Source.names << subclass.name.split("::").last.downcase.to_sym
|
8
6
|
end
|
9
7
|
|
8
|
+
# Load the source to the given path.
|
10
9
|
def load(_path)
|
11
10
|
raise "Not implemented"
|
12
11
|
end
|
13
12
|
|
13
|
+
# Update to the latest version of the source.
|
14
14
|
def update(_path)
|
15
15
|
raise "Not implemented"
|
16
16
|
end
|
data/lib/rexer/source.rb
ADDED
data/lib/rexer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katsuya Hidaka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- lib/rexer/definition/lock.rb
|
83
83
|
- lib/rexer/extension/plugin.rb
|
84
84
|
- lib/rexer/extension/theme.rb
|
85
|
+
- lib/rexer/source.rb
|
85
86
|
- lib/rexer/source/base.rb
|
86
87
|
- lib/rexer/source/git.rb
|
87
88
|
- lib/rexer/source/github.rb
|