rexer 0.11.1 → 0.12.0

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: b367d481c9b2b2c3acee47b4070f5f65b014c0de97841b556d40edf1ca5626c7
4
- data.tar.gz: fce6d233a643fa0779e03a11f2a37de8781bcb1bfbaf44a7d33a85103d5033fb
3
+ metadata.gz: 236c94fc48362e83c23049edb3b1b21311385622a66793fa19240f42fb702388
4
+ data.tar.gz: 7707f18ae6e414d9390080944292f8537a11b19f03ce93d6142dc106129f7e04
5
5
  SHA512:
6
- metadata.gz: c2577989d226043cdf48d55f4ef3ecfdfc02b030723ec449a5d27d78501a6ade52dee4bd61ddcc0fba67e1e741167bac698cde9333cd985e34196a8891791b67
7
- data.tar.gz: f5c069c050a4dc5f260c3949af7d5db1cdb47136bf4f19848d0c70302a4a96565303a260e43c066218e051c5040f862d8932ef29b5f7a8470553bece488e0900
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
- [![demo](docs/demo-v0.8.0.gif)](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 # Show the list of environments and their extensions defined in .extensions.rb
84
- rex help [COMMAND] # Describe available commands or one specific command
85
- rex init # Create a new .extensions.rb file
86
- rex install [ENV] # Install the definitions in .extensions.rb for the specified environment
87
- rex state # Show the current state of the installed extensions
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
- rex update # Update extensions for the currently installed environment to the latest version
91
- rex version # Show Rexer version
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
@@ -1,3 +1,3 @@
1
1
  module Rexer
2
- VERSION = "0.11.1"
2
+ VERSION = "0.12.0"
3
3
  end
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.11.1
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-15 00:00:00.000000000 Z
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