rexer 0.11.0 → 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 +59 -11
- data/bin/dev +36 -1
- data/lib/rexer/cli.rb +5 -0
- data/lib/rexer/commands/init.rb +0 -2
- data/lib/rexer/commands/reinstall.rb +53 -0
- data/lib/rexer/definition/dsl.rb +1 -1
- data/lib/rexer/source/base.rb +4 -0
- data/lib/rexer/source.rb +2 -0
- data/lib/rexer/version.rb +1 -1
- data/lib/rexer.rb +1 -0
- 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
|
@@ -204,6 +203,25 @@ In the above case, the `bin/rails redmine:plugins:migrate` command is executed a
|
|
204
203
|
|
205
204
|
## Developing
|
206
205
|
|
206
|
+
### Running the command
|
207
|
+
|
208
|
+
You can run the command in your local environment without installing the gem as follows.
|
209
|
+
|
210
|
+
Setting up the development environment.
|
211
|
+
|
212
|
+
```
|
213
|
+
$ git clone <this repository>
|
214
|
+
$ cd rexer
|
215
|
+
$ bundle install
|
216
|
+
```
|
217
|
+
|
218
|
+
Running the command.
|
219
|
+
|
220
|
+
```
|
221
|
+
$ cd /path/to/your-local-redmine-source
|
222
|
+
$ /your-local-rexer-source/bin/dev state
|
223
|
+
```
|
224
|
+
|
207
225
|
### Running tests
|
208
226
|
|
209
227
|
First, you need to build the docker image for the integration tests.
|
@@ -233,6 +251,36 @@ rake standard
|
|
233
251
|
rake standard:fix
|
234
252
|
```
|
235
253
|
|
254
|
+
### Profiling
|
255
|
+
|
256
|
+
Print the call-stack profile.
|
257
|
+
|
258
|
+
```
|
259
|
+
$ PROFILE=s /your-local-rexer-source/bin/dev state
|
260
|
+
...
|
261
|
+
|
262
|
+
== Profile ==
|
263
|
+
==================================
|
264
|
+
Mode: wall(1000)
|
265
|
+
Samples: 298 (1.97% miss rate)
|
266
|
+
GC: 36 (12.08%)
|
267
|
+
==================================
|
268
|
+
TOTAL (pct) SAMPLES (pct) FRAME
|
269
|
+
261 (87.6%) 147 (49.3%) Kernel#require
|
270
|
+
...
|
271
|
+
```
|
272
|
+
|
273
|
+
Print the benchmark.
|
274
|
+
|
275
|
+
```
|
276
|
+
$ PROFILE=b /your-local-rexer-source/bin/dev state
|
277
|
+
...
|
278
|
+
|
279
|
+
== Benchmark ==
|
280
|
+
user system total real
|
281
|
+
0.253115 0.030599 0.283714 ( 0.283681)
|
282
|
+
```
|
283
|
+
|
236
284
|
## Contributing
|
237
285
|
|
238
286
|
Bug reports and pull requests are welcome on GitHub at https://github.com/hidakatsuya/rexer.
|
data/bin/dev
CHANGED
@@ -2,4 +2,39 @@
|
|
2
2
|
|
3
3
|
require_relative "../lib/rexer"
|
4
4
|
|
5
|
-
|
5
|
+
def with_profiling(profile = false)
|
6
|
+
case ENV["PROFILE"]
|
7
|
+
|
8
|
+
# PROFILE=s dev state
|
9
|
+
when "s", "stack"
|
10
|
+
require "stackprof"
|
11
|
+
|
12
|
+
profile = StackProf.run(mode: :wall, interval: 1000) do
|
13
|
+
yield
|
14
|
+
end
|
15
|
+
|
16
|
+
puts
|
17
|
+
puts "== Profile =="
|
18
|
+
StackProf::Report.new(profile).print_text
|
19
|
+
|
20
|
+
# PROFILE=b dev state
|
21
|
+
when "b", "bench"
|
22
|
+
require "benchmark"
|
23
|
+
|
24
|
+
bench = Benchmark.measure do
|
25
|
+
yield
|
26
|
+
end
|
27
|
+
|
28
|
+
puts
|
29
|
+
puts "== Benchmark =="
|
30
|
+
puts Benchmark::CAPTION
|
31
|
+
puts bench
|
32
|
+
|
33
|
+
else
|
34
|
+
yield
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
with_profiling(ENV["PROFILE"]) do
|
39
|
+
Rexer::Cli.start(ARGV)
|
40
|
+
end
|
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)
|
data/lib/rexer/commands/init.rb
CHANGED
@@ -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/definition/dsl.rb
CHANGED
data/lib/rexer/source/base.rb
CHANGED
data/lib/rexer/source.rb
CHANGED
data/lib/rexer/version.rb
CHANGED
data/lib/rexer.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
|