rexer 0.6.0 → 0.8.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 +43 -15
- data/lib/rexer/cli.rb +8 -0
- data/lib/rexer/commands/init.rb +39 -0
- data/lib/rexer/commands.rb +4 -0
- data/lib/rexer/extension/plugin.rb +15 -4
- data/lib/rexer/extension/theme.rb +10 -4
- data/lib/rexer/source/base.rb +6 -0
- data/lib/rexer/source/git.rb +4 -0
- data/lib/rexer/version.rb +1 -1
- metadata +21 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ae1d09f4a257d7ce265f52b7e8fd30c6d2891ca1fb756b9baeaaabe23f7cde1
|
4
|
+
data.tar.gz: 37bdbb2c6181c0f37070f18abfe755077c222d784bd90444d18de62022f18f7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1646431a82235a5b9be7e267676b3a3cb4b81761ff77d9b48cd87868ee59cb242c1e034c1dd1517c568da85e9ea621b57a7161be10388f986d74c22ce39e31a7
|
7
|
+
data.tar.gz: 9730f772b7c5403adfa6e477e76a330b808d78e862cb3a032c3e516c21af85499a737d3661f55337b32d1776359749763b3a1a06095fa39657d419e3387ac99b
|
data/README.md
CHANGED
@@ -1,11 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<div align="center">
|
2
|
+
<h1>Rexer</h1>
|
3
|
+
<p>Redmine Extension (Plugin and Theme) manager</p>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<p align="center">
|
7
|
+
<a href="https://github.com/hidakatsuya/rexer/actions/workflows/build.yml">
|
8
|
+
<img src="https://github.com/hidakatsuya/rexer/actions/workflows/build.yml/badge.svg" alt="Build">
|
9
|
+
</a>
|
10
|
+
<a href="https://badge.fury.io/rb/rexer">
|
11
|
+
<img src="https://badge.fury.io/rb/rexer.svg" alt="Gem Version">
|
12
|
+
</a>
|
13
|
+
</p>
|
14
|
+
|
15
|
+
Rexer is a command-line tool for managing Redmine Extension (Plugin and Theme).
|
4
16
|
|
5
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.
|
6
18
|
|
7
|
-
[![
|
8
|
-
|
19
|
+
[![asciicast](https://asciinema.org/a/672754.svg?9)](https://asciinema.org/a/672754)
|
20
|
+
|
21
|
+
## What is Redmine Extension?
|
22
|
+
|
23
|
+
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.
|
9
24
|
|
10
25
|
## Installation
|
11
26
|
|
@@ -19,14 +34,17 @@ Rexer is tested with Redmine v5.1 and trunk.
|
|
19
34
|
|
20
35
|
## Usage
|
21
36
|
|
22
|
-
|
37
|
+
Run the following command in the root directory of the Redmine application.
|
23
38
|
|
24
|
-
|
39
|
+
```
|
40
|
+
rex init
|
41
|
+
```
|
42
|
+
|
43
|
+
This command generates a `.extensions.rb`, so define the extensions you want to install in the file like below.
|
25
44
|
|
26
45
|
```ruby
|
27
46
|
theme :bleuclair, github: { repo: "farend/redmine_theme_farend_bleuclair", branch: "support-propshaft" }
|
28
47
|
|
29
|
-
plugin :view_customize, github: { repo: "onozaty/redmine-view-customize", tag: "v3.5.2" }
|
30
48
|
plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel", tag: "v1.0.2" }
|
31
49
|
```
|
32
50
|
|
@@ -36,10 +54,18 @@ Then, run the following command in the root directory of the Redmine application
|
|
36
54
|
rex install
|
37
55
|
```
|
38
56
|
|
39
|
-
This command
|
57
|
+
This command performs the following steps for each extension defined in the `.extensions.rb` to install it and generates a `.extensions.lock`.
|
58
|
+
|
59
|
+
For plugins:
|
60
|
+
* Load the plugin from the specified `git` or `github` repository.
|
61
|
+
* Run the `bundle install` command if the plugin has a `Gemfile`.
|
62
|
+
* Run the `bundle exec rake redmine:plugins:migrate NAME=<plugin_name>` command if the plugin has any database migration.
|
63
|
+
|
64
|
+
For themes:
|
65
|
+
* Load the theme from the specified `git` or `github` repository.
|
40
66
|
|
41
67
|
> [!NOTE]
|
42
|
-
> The `.extensions.lock`
|
68
|
+
> The `.extensions.lock` is a file for preserving the state of installed extensions, but not the version of an extension.
|
43
69
|
|
44
70
|
If you want to uninstall the extensions, run the following command.
|
45
71
|
|
@@ -47,9 +73,9 @@ If you want to uninstall the extensions, run the following command.
|
|
47
73
|
rex uninstall
|
48
74
|
```
|
49
75
|
|
50
|
-
This command uninstalls the extensions and deletes the `.extensions.lock
|
76
|
+
This command uninstalls the extensions and deletes the `.extensions.lock`.
|
51
77
|
|
52
|
-
|
78
|
+
## Commands
|
53
79
|
|
54
80
|
```
|
55
81
|
$ rex
|
@@ -64,7 +90,7 @@ Commands:
|
|
64
90
|
rex version # Show Rexer version
|
65
91
|
```
|
66
92
|
|
67
|
-
|
93
|
+
### rex install [ENV]
|
68
94
|
|
69
95
|
Installs extensions in the specified ENV environment and makes them available for use. Specifically, it does the following:
|
70
96
|
|
@@ -73,12 +99,14 @@ If the specified ENV is NOT currently installed, it adds all extensions in the E
|
|
73
99
|
If the specified ENV is currently installed, it compares the current `.extensions.lock` with `.extensions.rb` and does the following:
|
74
100
|
* Installs additional extensions (the `installed` hook is executed).
|
75
101
|
* Uninstalls deleted extensions (the `uninstalled` hook is executed).
|
76
|
-
*
|
102
|
+
* Reload extensions whose source settings has changed (for example, the `branch` or `tag` has changed) and runs the database migration if necessary.
|
77
103
|
|
78
|
-
|
104
|
+
### rex update
|
79
105
|
|
80
106
|
Loads `.extensions.lock` and updates the currently installed extensions to the latest version. `.extensions.rb` is NOT referenced in this command.
|
81
107
|
|
108
|
+
## Advanced Usage
|
109
|
+
|
82
110
|
### Defining for each environment and extension
|
83
111
|
|
84
112
|
You can define an environment and extensions for each environment using the `env ... do - end` block.
|
data/lib/rexer/cli.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require "thor"
|
2
|
+
require "dotenv"
|
3
|
+
require "erb"
|
2
4
|
|
3
5
|
module Rexer
|
4
6
|
class Cli < Thor
|
@@ -7,6 +9,11 @@ module Rexer
|
|
7
9
|
class_option :verbose, type: :boolean, aliases: "-v", desc: "Detailed output"
|
8
10
|
class_option :quiet, type: :boolean, aliases: "-q", desc: "Minimal output"
|
9
11
|
|
12
|
+
desc "init", "Create a new .extensions.rb file"
|
13
|
+
def init
|
14
|
+
Commands::Init.new.call
|
15
|
+
end
|
16
|
+
|
10
17
|
desc "install [ENV]", "Install the definitions in .extensions.rb for the specified environment"
|
11
18
|
def install(env = "default")
|
12
19
|
Commands::Install.new.call(env&.to_sym)
|
@@ -44,6 +51,7 @@ module Rexer
|
|
44
51
|
|
45
52
|
def initialize(*)
|
46
53
|
super
|
54
|
+
Dotenv.load
|
47
55
|
initialize_options
|
48
56
|
end
|
49
57
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Rexer
|
2
|
+
module Commands
|
3
|
+
class Init
|
4
|
+
def call
|
5
|
+
definition_file = Definition.file
|
6
|
+
|
7
|
+
if definition_file.exist?
|
8
|
+
puts Paint["#{definition_file.basename} already exists", :red]
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
definition_file.write(template)
|
13
|
+
|
14
|
+
puts Paint["#{definition_file.expand_path} created", :green]
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def template
|
20
|
+
<<~TEMPLATE
|
21
|
+
# Define themes and plugins you want to use in your Redmine here.
|
22
|
+
#
|
23
|
+
# Syntax for defining themes and plugins is as follows.
|
24
|
+
# For theme_id and plugin_id, specify the name of the installation directory.
|
25
|
+
#
|
26
|
+
# theme :theme_a_id, github: { repo: "repo/theme_a" }
|
27
|
+
# theme :theme_b_id, github: { repo: "repo/theme_b", ref: "abcdefghi" }
|
28
|
+
# plugin :plugin_a_id, github: { repo: "repo/plugin_a", tag: "v1.0.0" }
|
29
|
+
# plugin :plugin_b_id, git: { url: "https://github.com/repo/plugin_b.git", branch: "stable" }
|
30
|
+
#
|
31
|
+
# Then, run `rex install` to install these themes and plugins.
|
32
|
+
#
|
33
|
+
# For more usage, see https://github.com/hidakatsuya/rexer.
|
34
|
+
|
35
|
+
TEMPLATE
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/rexer/commands.rb
CHANGED
@@ -36,6 +36,10 @@ module Rexer
|
|
36
36
|
Rexer.verbosity.on(:info) { puts Paint["done", :green] }
|
37
37
|
end
|
38
38
|
|
39
|
+
def skipped(reason)
|
40
|
+
Rexer.verbosity.on(:info) { puts Paint["skipped (#{reason})", :yellow] }
|
41
|
+
end
|
42
|
+
|
39
43
|
def processing(process_title)
|
40
44
|
Rexer.verbosity.on(:debug) { puts Paint[process_title, :gray] }
|
41
45
|
end
|
@@ -62,10 +62,13 @@ module Rexer
|
|
62
62
|
|
63
63
|
class Install < Base
|
64
64
|
def call
|
65
|
-
return if plugin_exists?
|
66
|
-
|
67
65
|
broadcast(:started, "Install #{name}")
|
68
66
|
|
67
|
+
if plugin_exists?
|
68
|
+
broadcast(:skipped, "Already exists")
|
69
|
+
return
|
70
|
+
end
|
71
|
+
|
69
72
|
load_from_source
|
70
73
|
run_bundle_install
|
71
74
|
run_db_migrate
|
@@ -93,10 +96,13 @@ module Rexer
|
|
93
96
|
|
94
97
|
class Uninstall < Base
|
95
98
|
def call
|
96
|
-
return unless plugin_exists?
|
97
|
-
|
98
99
|
broadcast(:started, "Uninstall #{name}")
|
99
100
|
|
101
|
+
unless plugin_exists?
|
102
|
+
broadcast(:skipped, "Not exists")
|
103
|
+
return
|
104
|
+
end
|
105
|
+
|
100
106
|
reset_db_migration
|
101
107
|
remove_plugin
|
102
108
|
hooks[:uninstalled]&.call
|
@@ -121,6 +127,11 @@ module Rexer
|
|
121
127
|
|
122
128
|
broadcast(:started, "Update #{name}")
|
123
129
|
|
130
|
+
unless source.updatable?
|
131
|
+
broadcast(:skipped, "Not updatable")
|
132
|
+
return
|
133
|
+
end
|
134
|
+
|
124
135
|
update_source
|
125
136
|
run_db_migrate
|
126
137
|
|
@@ -42,10 +42,13 @@ module Rexer
|
|
42
42
|
|
43
43
|
class Install < Base
|
44
44
|
def call
|
45
|
-
return if theme_exists?
|
46
|
-
|
47
45
|
broadcast(:started, "Install #{name}")
|
48
46
|
|
47
|
+
if theme_exists?
|
48
|
+
broadcast(:skipped, "Already exists")
|
49
|
+
return
|
50
|
+
end
|
51
|
+
|
49
52
|
load_from_source
|
50
53
|
hooks[:installed]&.call
|
51
54
|
|
@@ -61,10 +64,13 @@ module Rexer
|
|
61
64
|
|
62
65
|
class Uninstall < Base
|
63
66
|
def call
|
64
|
-
return unless theme_exists?
|
65
|
-
|
66
67
|
broadcast(:started, "Uninstall #{name}")
|
67
68
|
|
69
|
+
unless theme_exists?
|
70
|
+
broadcast(:skipped, "Not exists")
|
71
|
+
return
|
72
|
+
end
|
73
|
+
|
68
74
|
remove_theme
|
69
75
|
hooks[:uninstalled]&.call
|
70
76
|
|
data/lib/rexer/source/base.rb
CHANGED
data/lib/rexer/source/git.rb
CHANGED
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.8.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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -80,9 +80,23 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.3'
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: dotenv
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.1'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.1'
|
97
|
+
description: Rexer is a command-line tool for managing Redmine Extension (Plugin and
|
98
|
+
Themes). It allows you to define extensions in a Ruby DSL and install, uninstall,
|
99
|
+
update, and switch between different sets of the extensions.
|
86
100
|
email:
|
87
101
|
- hidakatsuya@gmail.com
|
88
102
|
executables:
|
@@ -99,6 +113,7 @@ files:
|
|
99
113
|
- lib/rexer/cli.rb
|
100
114
|
- lib/rexer/commands.rb
|
101
115
|
- lib/rexer/commands/envs.rb
|
116
|
+
- lib/rexer/commands/init.rb
|
102
117
|
- lib/rexer/commands/install.rb
|
103
118
|
- lib/rexer/commands/state.rb
|
104
119
|
- lib/rexer/commands/switch.rb
|
@@ -139,5 +154,5 @@ requirements: []
|
|
139
154
|
rubygems_version: 3.5.11
|
140
155
|
signing_key:
|
141
156
|
specification_version: 4
|
142
|
-
summary: A tool for managing Redmine Plugins and Themes
|
157
|
+
summary: A command-line tool for managing Redmine Plugins and Themes
|
143
158
|
test_files: []
|