rexer 0.9.0 → 0.10.0
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/README.md +8 -3
- data/lib/rexer/cli.rb +1 -1
- data/lib/rexer/commands/envs.rb +15 -4
- data/lib/rexer/commands/install.rb +6 -3
- data/lib/rexer/definition/data.rb +5 -15
- data/lib/rexer/definition/dsl.rb +10 -3
- data/lib/rexer/definition/lock.rb +7 -4
- data/lib/rexer/extension/plugin.rb +8 -7
- data/lib/rexer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35c79e74d0ffb8e149f5d608a67bd6c9fa709bb5da7d4442e6851453e5a66a43
|
4
|
+
data.tar.gz: f216971952e8e873e7959f8861fc55c674e0e22765cc2e12cd485793b6d65c8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52467965bc3cdfe91c72af5ea5504681e2fc12d2be7179309d464e131e7b766fc0efc6aeea7affcda9c287af129550828cf64ec5cd3b94c38deb1b880cf5d7e1
|
7
|
+
data.tar.gz: bcbffc9a28d139cf185cd068bed5ca594a163d97d054c33b62463794aec39f453d162e9e9f1abf071d7f2d81efcd910aa6a25c765cb185a653234ff7c666f0e0
|
data/README.md
CHANGED
@@ -80,13 +80,13 @@ This command uninstalls the extensions and deletes the `.extensions.lock`.
|
|
80
80
|
```
|
81
81
|
$ rex
|
82
82
|
Commands:
|
83
|
-
rex envs # Show the list of defined
|
83
|
+
rex envs # Show the list of environments and their extensions defined in .extensions.rb
|
84
84
|
rex help [COMMAND] # Describe available commands or one specific command
|
85
85
|
rex init # Create a new .extensions.rb file
|
86
86
|
rex install [ENV] # Install the definitions in .extensions.rb for the specified environment
|
87
87
|
rex state # Show the current state of the installed extensions
|
88
|
-
rex switch [ENV] # Uninstall extensions for the currently installed environment and install
|
89
|
-
rex uninstall # Uninstall extensions for the currently installed environment based on the
|
88
|
+
rex switch [ENV] # Uninstall extensions for the currently installed environment and install extensions for the specified environment
|
89
|
+
rex uninstall # Uninstall extensions for the currently installed environment based on the state in .extensions.lock and remove the lock file
|
90
90
|
rex update # Update extensions for the currently installed environment to the latest version
|
91
91
|
rex version # Show Rexer version
|
92
92
|
|
@@ -166,7 +166,12 @@ In addition, you can define as many environments as you like, and list the defin
|
|
166
166
|
```
|
167
167
|
$ rex envs
|
168
168
|
default
|
169
|
+
bleuclair (support-propshaft)
|
170
|
+
redmine_issues_panel (master)
|
171
|
+
|
169
172
|
stable
|
173
|
+
bleuclair (support-propshaft)
|
174
|
+
redmine_issues_panel (v1.0.2)
|
170
175
|
```
|
171
176
|
|
172
177
|
### Defining hooks
|
data/lib/rexer/cli.rb
CHANGED
@@ -39,7 +39,7 @@ module Rexer
|
|
39
39
|
Commands::State.new.call
|
40
40
|
end
|
41
41
|
|
42
|
-
desc "envs", "Show the list of defined
|
42
|
+
desc "envs", "Show the list of environments and their extensions defined in .extensions.rb"
|
43
43
|
def envs
|
44
44
|
Commands::Envs.new.call
|
45
45
|
end
|
data/lib/rexer/commands/envs.rb
CHANGED
@@ -6,16 +6,27 @@ module Rexer
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def call
|
9
|
-
|
9
|
+
defined_envs = definition.envs
|
10
|
+
defined_envs.each.with_index do |env, i|
|
11
|
+
puts env
|
12
|
+
|
13
|
+
definition_with(env).then { _1.themes + _1.plugins }.each do
|
14
|
+
puts " #{_1.name} (#{Source.from_definition(_1.source).info})"
|
15
|
+
end
|
16
|
+
|
17
|
+
puts if i < defined_envs.size - 1
|
18
|
+
end
|
10
19
|
end
|
11
20
|
|
12
21
|
private
|
13
22
|
|
14
23
|
attr_reader :definition
|
15
24
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
25
|
+
def definition_with(env)
|
26
|
+
definition.with(
|
27
|
+
plugins: definition.plugins.select { _1.env == env },
|
28
|
+
themes: definition.themes.select { _1.env == env }
|
29
|
+
)
|
19
30
|
end
|
20
31
|
end
|
21
32
|
end
|
@@ -37,9 +37,12 @@ module Rexer
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def load_definition(env)
|
40
|
-
Definition.load_data
|
41
|
-
|
42
|
-
|
40
|
+
data = Definition.load_data
|
41
|
+
data.with(
|
42
|
+
plugins: data.plugins.select { _1.env == env },
|
43
|
+
themes: data.themes.select { _1.env == env },
|
44
|
+
env:
|
45
|
+
)
|
43
46
|
end
|
44
47
|
|
45
48
|
def load_lock_definition
|
@@ -1,22 +1,12 @@
|
|
1
1
|
module Rexer
|
2
2
|
module Definition
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def initialize(plugins, themes, env: nil, version: nil)
|
8
|
-
@plugins = plugins
|
9
|
-
@themes = themes
|
10
|
-
@env = env
|
11
|
-
@version = version
|
12
|
-
end
|
13
|
-
|
14
|
-
def plugins
|
15
|
-
env ? @plugins.select { _1.env == env } : @plugins
|
3
|
+
Data = ::Data.define(:plugins, :themes, :env, :version) do
|
4
|
+
def initialize(plugins:, themes:, env: nil, version: nil)
|
5
|
+
super
|
16
6
|
end
|
17
7
|
|
18
|
-
def
|
19
|
-
env
|
8
|
+
def envs
|
9
|
+
(plugins.map(&:env) + themes.map(&:env)).uniq.sort
|
20
10
|
end
|
21
11
|
|
22
12
|
def diff(other)
|
data/lib/rexer/definition/dsl.rb
CHANGED
@@ -1,10 +1,17 @@
|
|
1
1
|
module Rexer
|
2
2
|
module Definition
|
3
3
|
class Dsl
|
4
|
-
def initialize
|
4
|
+
def initialize
|
5
5
|
@plugins = []
|
6
6
|
@themes = []
|
7
|
-
@env =
|
7
|
+
@env = :default
|
8
|
+
end
|
9
|
+
|
10
|
+
class EnvDsl < self
|
11
|
+
def initialize(env)
|
12
|
+
super()
|
13
|
+
@env = env
|
14
|
+
end
|
8
15
|
end
|
9
16
|
|
10
17
|
def plugin(name, **opts, &hooks)
|
@@ -27,7 +34,7 @@ module Rexer
|
|
27
34
|
|
28
35
|
def env(*env_names, &dsl)
|
29
36
|
env_names.each do |env_name|
|
30
|
-
data =
|
37
|
+
data = EnvDsl.new(env_name).tap { _1.instance_eval(&dsl) }.to_data
|
31
38
|
|
32
39
|
@plugins += data.plugins
|
33
40
|
@themes += data.themes
|
@@ -23,17 +23,20 @@ module Rexer
|
|
23
23
|
|
24
24
|
class Dsl < Definition::Dsl
|
25
25
|
def lock(env:, version:)
|
26
|
-
|
26
|
+
@lock_env = env
|
27
|
+
@lock_version = version
|
27
28
|
end
|
28
29
|
|
29
30
|
def to_data
|
30
|
-
|
31
|
+
plugins = lock_by_env(@plugins)
|
32
|
+
themes = lock_by_env(@themes)
|
33
|
+
Definition::Data.new(plugins, themes, @lock_env, @lock_version)
|
31
34
|
end
|
32
35
|
|
33
36
|
private
|
34
37
|
|
35
|
-
def
|
36
|
-
@
|
38
|
+
def lock_by_env(plugins_or_themes)
|
39
|
+
plugins_or_themes.select { _1.env == @lock_env }
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|
@@ -39,14 +39,14 @@ module Rexer
|
|
39
39
|
return unless needs_db_migration?
|
40
40
|
|
41
41
|
envs = {"NAME" => name.to_s}.merge(extra_envs)
|
42
|
-
cmds =
|
42
|
+
cmds = build_cmd("bundle", "exec", "rake", Rexer.verbosity.debug? ? nil : "-q", "redmine:plugins:migrate", envs:)
|
43
43
|
|
44
|
-
broadcast(:processing, "Execute #{cmds}
|
44
|
+
broadcast(:processing, "Execute #{cmds}")
|
45
45
|
|
46
46
|
if Rexer.verbosity.debug?
|
47
|
-
system(
|
47
|
+
system(cmds, exception: true)
|
48
48
|
else
|
49
|
-
_, error, status = Open3.capture3(
|
49
|
+
_, error, status = Open3.capture3(cmds)
|
50
50
|
raise error unless status.success?
|
51
51
|
end
|
52
52
|
end
|
@@ -55,8 +55,9 @@ module Rexer
|
|
55
55
|
@source ||= Source.from_definition(definition.source)
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
[
|
58
|
+
def build_cmd(*command, envs: {})
|
59
|
+
envs_str = envs.map { [_1, _2].join("=") }
|
60
|
+
[Rexer.config.command_prefix, *command, *envs_str].compact.join(" ")
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
@@ -86,7 +87,7 @@ module Rexer
|
|
86
87
|
def run_bundle_install
|
87
88
|
return unless plugin_dir.join("Gemfile").exist?
|
88
89
|
|
89
|
-
cmds =
|
90
|
+
cmds = build_cmd("bundle", "install", Rexer.verbosity.debug? ? nil : "--quiet")
|
90
91
|
|
91
92
|
broadcast(:processing, "Execute #{cmds}")
|
92
93
|
|
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.10.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-09-
|
11
|
+
date: 2024-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|