rexer 0.11.1 → 0.12.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 +10 -11
- data/lib/rexer/cli.rb +5 -0
- data/lib/rexer/commands/reinstall.rb +53 -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: 236c94fc48362e83c23049edb3b1b21311385622a66793fa19240f42fb702388
|
4
|
+
data.tar.gz: 7707f18ae6e414d9390080944292f8537a11b19f03ce93d6142dc106129f7e04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12a8e53ccdb53e9da0bbd66787eb4377031353e51d3d3785d3242006cbfe7445acbd5f136664bc5e681d76333ea8e082f7b92b8f1c0fe4923fb41a8a947526bd
|
7
|
+
data.tar.gz: f487865de3c6f4064f72e0dae4fca83c9a8c17a711d26e0fb1e2c78058db44b510930cc67d856a19d71059e9cf46f95aeb3d24821266157dfd3eb2e627bfae77
|
data/README.md
CHANGED
@@ -16,8 +16,6 @@ Rexer is a command-line tool for managing Redmine Extension (Plugin and Theme).
|
|
16
16
|
|
17
17
|
It is mainly aimed at helping with the development of Redmine and its plugins, allowing you to define extensions in a Ruby DSL and install, uninstall, update, and switch between different sets of the extensions.
|
18
18
|
|
19
|
-
[](https://asciinema.org/a/672754)
|
20
|
-
|
21
19
|
## What is Redmine Extension?
|
22
20
|
|
23
21
|
Redmine [Plugin](https://www.redmine.org/projects/redmine/wiki/Plugins) and [Theme](https://www.redmine.org/projects/redmine/wiki/Themes) are called Redmine Extension in this tool.
|
@@ -80,15 +78,16 @@ This command uninstalls the extensions and deletes the `.extensions.lock`.
|
|
80
78
|
```
|
81
79
|
$ rex
|
82
80
|
Commands:
|
83
|
-
rex envs
|
84
|
-
rex help [COMMAND]
|
85
|
-
rex init
|
86
|
-
rex install [ENV]
|
87
|
-
rex
|
88
|
-
rex
|
89
|
-
rex
|
90
|
-
rex
|
91
|
-
rex
|
81
|
+
rex envs # Show the list of environments and their extensions defined in .extensions.rb
|
82
|
+
rex help [COMMAND] # Describe available commands or one specific command
|
83
|
+
rex init # Create a new .extensions.rb file
|
84
|
+
rex install [ENV] # Install the definitions in .extensions.rb for the specified environment
|
85
|
+
rex reinstall [PLUGIN or THEME] # Uninstall extensions for the currently installed environment and install them again
|
86
|
+
rex state # Show the current state of the installed extensions
|
87
|
+
rex switch [ENV] # Uninstall extensions for the currently installed environment and install extensions for the specified environment
|
88
|
+
rex uninstall # Uninstall extensions for the currently installed environment based on the state in .extensions.lock and remove the lock file
|
89
|
+
rex update # Update extensions for the currently installed environment to the latest version
|
90
|
+
rex version # Show Rexer version
|
92
91
|
|
93
92
|
Options:
|
94
93
|
-v, [--verbose], [--no-verbose], [--skip-verbose] # Detailed output
|
data/lib/rexer/cli.rb
CHANGED
@@ -24,6 +24,11 @@ module Rexer
|
|
24
24
|
Commands::Uninstall.new.call
|
25
25
|
end
|
26
26
|
|
27
|
+
desc "reinstall [PLUGIN or THEME]", "Uninstall extensions for the currently installed environment and install them again"
|
28
|
+
def reinstall(extension_name)
|
29
|
+
Commands::Reinstall.new.call(extension_name)
|
30
|
+
end
|
31
|
+
|
27
32
|
desc "switch [ENV]", "Uninstall extensions for the currently installed environment and install extensions for the specified environment"
|
28
33
|
def switch(env = "default")
|
29
34
|
Commands::Switch.new.call(env&.to_sym)
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Rexer
|
2
|
+
module Commands
|
3
|
+
class Reinstall
|
4
|
+
include ActionCallable
|
5
|
+
|
6
|
+
Action = Data.define(:install, :uninstall)
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@lock_definition = Definition::Lock.load_data
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(extension_name)
|
13
|
+
return if no_lock_file_found
|
14
|
+
|
15
|
+
extension, action = find_extension_with_action(extension_name.to_sym)
|
16
|
+
|
17
|
+
if extension.nil?
|
18
|
+
puts "#{extension_name} is not installed"
|
19
|
+
return
|
20
|
+
end
|
21
|
+
|
22
|
+
reinstall(extension, action)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
attr_reader :lock_definition
|
28
|
+
|
29
|
+
def find_extension_with_action(name)
|
30
|
+
lock_definition.plugins.find { _1.name == name }&.then do |plugin|
|
31
|
+
action = Action.new(Extension::Plugin::Install, Extension::Plugin::Uninstall)
|
32
|
+
return [plugin, action]
|
33
|
+
end
|
34
|
+
|
35
|
+
lock_definition.themes.find { _1.name == name }&.then do |theme|
|
36
|
+
action = Action.new(Extension::Theme::Install, Extension::Theme::Uninstall)
|
37
|
+
return [theme, action]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def reinstall(extension, action)
|
42
|
+
call_action action.uninstall, extension
|
43
|
+
call_action action.install, extension
|
44
|
+
end
|
45
|
+
|
46
|
+
def no_lock_file_found
|
47
|
+
lock_definition.nil?.tap { |result|
|
48
|
+
puts "No lock file found" if result
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
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.12.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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/rexer/commands/envs.rb
|
116
116
|
- lib/rexer/commands/init.rb
|
117
117
|
- lib/rexer/commands/install.rb
|
118
|
+
- lib/rexer/commands/reinstall.rb
|
118
119
|
- lib/rexer/commands/state.rb
|
119
120
|
- lib/rexer/commands/switch.rb
|
120
121
|
- lib/rexer/commands/uninstall.rb
|