rexer 0.13.0 → 0.14.1

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: 13397d6c2ce415899b6435654c7bfabdf78c6c85aa2988a7879b64b630550dba
4
- data.tar.gz: c1edbd2a8faa415b4796218176367c5f3b97cb9c5ce755c060029c1b1e4290af
3
+ metadata.gz: 03a1f270989ff656e5fd97e105ecd8d21be59755e2f3112746db636c5b2a9e7c
4
+ data.tar.gz: 42154270a3d8684f58ec80537cd2d5237dd0cde468bd44b3db0dd89fe7084a7c
5
5
  SHA512:
6
- metadata.gz: 267698125ab41b6886d7a0f01bb4db14e0c2703de47dc8099d4f6ebe59bf18410785ddb2a11815c3cc6dbe3aa47e3c35abacc32bdefed265f003bb066ee2c4e4
7
- data.tar.gz: eb76a0f49f4c13e47855e4b3eb2443e413aa25a87d66e854eccc820d21e55a3940480af9acdb0bc729efb0b1959891245bf43ba6f41964d6a7b31f8cb9c79478
6
+ metadata.gz: 3b7544710bb51bb0a6e5cb6de61deac2c6fbea1116d11b62f064c76a844af5664037083dbe30685421af467f7346676ba9655ceb59e2310a455e435ea7f7274b
7
+ data.tar.gz: 91d31bf09b9dd719760ab4cc88c32542cc441f215ce68e7d95831e8e0789695215dbf49d70279e51d43c5a45886d6d6f6045540d0210c577153b706d3dcf0fa6
data/README.md CHANGED
@@ -28,7 +28,7 @@ gem install rexer
28
28
 
29
29
  ## Supported Redmine
30
30
 
31
- Rexer is tested with Redmine v5.1 and trunk.
31
+ Rexer is tested with Redmine v6.0 and trunk.
32
32
 
33
33
  ## Usage
34
34
 
@@ -41,9 +41,10 @@ rex init
41
41
  This command generates a `.extensions.rb`, so define the extensions you want to install in the file like below.
42
42
 
43
43
  ```ruby
44
- theme :bleuclair, github: { repo: "farend/redmine_theme_farend_bleuclair", branch: "support-propshaft" }
44
+ theme :bleuclair, github: { repo: "farend/redmine_theme_farend_bleuclair", branch: "master" }
45
45
 
46
46
  plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel", tag: "v1.0.2" }
47
+ plugin :redmica_ui_extension, github: { repo: "redmica/redmica_ui_extension", ref: "4fdc298bc310be2ab295008c0ee522b0ec0e319a" }
47
48
  ```
48
49
 
49
50
  Then, run the following command in the root directory of the Redmine application.
@@ -86,7 +87,7 @@ Commands:
86
87
  rex state # Show the current state of the installed extensions
87
88
  rex switch [ENV] # Uninstall extensions for the currently installed environment and install extensions for the specified environment
88
89
  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 update # Update extensions for the currently installed environment to the latest version if extensions are updateable
90
91
  rex version # Show Rexer version
91
92
 
92
93
  Options:
@@ -123,85 +124,6 @@ rex v # means version
123
124
  and more...
124
125
  ```
125
126
 
126
- ## Syntax of .extensions.rb file
127
-
128
- ### Plugin
129
-
130
- ```ruby
131
- plugin :plugin_name, <source>: { ... }
132
- ```
133
-
134
- ### Theme
135
-
136
- ```ruby
137
- theme :theme_name, <source>: { ... }
138
- ```
139
-
140
- ### Source
141
-
142
- #### Git
143
-
144
- ```ruby
145
- plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel" }
146
- ```
147
- ```ruby
148
- # Specify the branch
149
- plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel", branch: "main" }
150
- # Specify the tag
151
- plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel", tag: "v1.0.0" }
152
- # Specify the commit
153
- plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel", ref: "5cfb8ccbabb2fad2c8f2273a4dda3f16ef2de124" }
154
- ```
155
-
156
- #### GitHub
157
-
158
- ```ruby
159
- plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel", tag: "v1.0.0" }
160
- ```
161
-
162
- ### Env
163
-
164
- ```ruby
165
- plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel" }
166
-
167
- # This is the same as the above.
168
- env :default do
169
- plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel" }
170
- end
171
-
172
- env :stable do
173
- plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel", tag: "v1.0.2" }
174
- end
175
-
176
- env :default, :stable do
177
- theme :bleuclair, github: { repo: "farend/redmine_theme_farend_bleuclair" }
178
- end
179
- ```
180
-
181
- ### Hooks
182
-
183
- ```ruby
184
- plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel" } do
185
- installed do
186
- puts "The plugin has been installed."
187
- end
188
-
189
- uninstalled do
190
- puts "The plugin has been uninstalled."
191
- end
192
- end
193
-
194
- theme :bleuclair, github: { repo: "farend/redmine_theme_farend_bleuclair" } do
195
- installed do
196
- puts "The theme has been installed."
197
- end
198
-
199
- uninstalled do
200
- puts "The theme has been uninstalled."
201
- end
202
- end
203
- ```
204
-
205
127
  ## Advanced Usage
206
128
 
207
129
  ### Defining for each environment and extension
@@ -209,25 +131,25 @@ end
209
131
  You can define an environment and extensions for each environment using the `env ... do - end` block.
210
132
 
211
133
  ```ruby
212
- plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel" }
134
+ plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel", branch: "master" }
213
135
 
214
136
  env :stable do
215
- plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel", tag: "v1.0.2" }
137
+ plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel", tag: "v1.0.2" }
216
138
  end
217
139
 
218
140
  env :default, :stable do
219
- theme :bleuclair, github: { repo: "farend/redmine_theme_farend_bleuclair", branch: "support-propshaft" }
141
+ theme :bleuclair, github: { repo: "farend/redmine_theme_farend_bleuclair" }
220
142
  end
221
143
  ```
222
144
 
223
145
  Definitions other than `env ... do - end` are implicitly defined as `env :default do - end`. Therefore, the above is resolved as follows:
224
146
 
225
147
  * default env
226
- * bleuclair (support-propshaft)
227
- * redmine_issues_panel (master)
148
+ * bleuclair (farend/redmine_theme_farend_bleuclair@main)
149
+ * redmine_issues_panel (redmica/redmine_issues_panel@master)
228
150
  * stable env
229
- * bleuclair (support-propshaft)
230
- * redmine_issues_panel (v1.0.2)
151
+ * bleuclair (farend/redmine_theme_farend_bleuclair@main)
152
+ * redmine_issues_panel (redmica/redmine_issues_panel@v1.0.2)
231
153
 
232
154
  If you want to install extensions for the `default` environment, run the following command.
233
155
 
@@ -258,12 +180,12 @@ In addition, you can define as many environments as you like, and list the defin
258
180
  ```
259
181
  $ rex envs
260
182
  default
261
- bleuclair (support-propshaft)
262
- redmine_issues_panel (master)
183
+ bleuclair (farend/redmine_theme_farend_bleuclair@main)
184
+ redmine_issues_panel (redmica/redmine_issues_panel@master)
263
185
 
264
186
  stable
265
- bleuclair (support-propshaft)
266
- redmine_issues_panel (v1.0.2)
187
+ bleuclair (farend/redmine_theme_farend_bleuclair@main)
188
+ redmine_issues_panel (redmica/redmine_issues_panel@v1.0.2)
267
189
  ```
268
190
 
269
191
  ### Defining hooks
@@ -294,6 +216,85 @@ export REXER_COMMAND_PREFIX="docker compose exec -T app"
294
216
 
295
217
  In the above case, the `bin/rails redmine:plugins:migrate` command is executed as `docker compose exec -T app bin/rails redmine:plugins:migrate`.
296
218
 
219
+ ## Extensions.rb Syntax
220
+
221
+ ### Plugin
222
+
223
+ ```ruby
224
+ plugin :plugin_name, <source>: { ... }
225
+ ```
226
+
227
+ ### Theme
228
+
229
+ ```ruby
230
+ theme :theme_name, <source>: { ... }
231
+ ```
232
+
233
+ ### Source
234
+
235
+ #### Git
236
+
237
+ ```ruby
238
+ plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel" }
239
+ ```
240
+ ```ruby
241
+ # Specify the branch
242
+ plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel", branch: "main" }
243
+ # Specify the tag
244
+ plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel", tag: "v1.0.0" }
245
+ # Specify the commit
246
+ plugin :redmine_issues_panel, git: { url: "https://github.com/redmica/redmine_issues_panel", ref: "5cfb8ccbabb2fad2c8f2273a4dda3f16ef2de124" }
247
+ ```
248
+
249
+ #### GitHub
250
+
251
+ ```ruby
252
+ plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel", tag: "v1.0.0" }
253
+ ```
254
+
255
+ ### Env
256
+
257
+ ```ruby
258
+ plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel" }
259
+
260
+ # This is the same as the above.
261
+ env :default do
262
+ plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel" }
263
+ end
264
+
265
+ env :stable do
266
+ plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel", tag: "v1.0.2" }
267
+ end
268
+
269
+ env :default, :stable do
270
+ theme :bleuclair, github: { repo: "farend/redmine_theme_farend_bleuclair" }
271
+ end
272
+ ```
273
+
274
+ ### Hooks
275
+
276
+ ```ruby
277
+ plugin :redmine_issues_panel, github: { repo: "redmica/redmine_issues_panel" } do
278
+ installed do
279
+ puts "The plugin has been installed."
280
+ end
281
+
282
+ uninstalled do
283
+ puts "The plugin has been uninstalled."
284
+ end
285
+ end
286
+
287
+ theme :bleuclair, github: { repo: "farend/redmine_theme_farend_bleuclair" } do
288
+ installed do
289
+ puts "The theme has been installed."
290
+ end
291
+
292
+ uninstalled do
293
+ puts "The theme has been uninstalled."
294
+ end
295
+ end
296
+ ```
297
+
297
298
  ## Developing
298
299
 
299
300
  ### Running the command
data/lib/rexer/cli.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "thor"
2
2
  require "dotenv"
3
3
  require "erb"
4
+ require "active_support/core_ext/object/blank"
4
5
 
5
6
  module Rexer
6
7
  class Cli < Thor
@@ -34,7 +35,7 @@ module Rexer
34
35
  Commands::Switch.new.call(env&.to_sym)
35
36
  end
36
37
 
37
- desc "update", "Update extensions for the currently installed environment to the latest version"
38
+ desc "update", "Update extensions for the currently installed environment to the latest version if extensions are updateable"
38
39
  def update
39
40
  Commands::Update.new.call
40
41
  end
@@ -1,4 +1,5 @@
1
1
  require "git"
2
+ require "uri"
2
3
 
3
4
  module Rexer
4
5
  module Source
@@ -8,6 +9,7 @@ module Rexer
8
9
  @branch = branch
9
10
  @tag = tag
10
11
  @ref = ref
12
+ @reference = branch || tag || ref
11
13
  end
12
14
 
13
15
  def load(path)
@@ -20,19 +22,30 @@ module Rexer
20
22
  end
21
23
 
22
24
  def updatable?
23
- !branch.nil?
25
+ branch || reference.nil?
24
26
  end
25
27
 
26
28
  def info
27
- branch || tag || ref || "master"
29
+ URI.parse(url).then do |uri|
30
+ "#{uri.host}#{uri.path}@#{reference_name}"
31
+ end
28
32
  end
29
33
 
30
34
  private
31
35
 
32
- attr_reader :url, :branch, :tag, :ref
36
+ attr_reader :url, :reference, :branch, :tag, :ref
33
37
 
34
38
  def checkout(git)
35
- (branch || tag || ref)&.then { git.checkout(_1) }
39
+ reference&.then { git.checkout(_1) }
40
+ end
41
+
42
+ def reference_name
43
+ branch || tag || short_ref || "main"
44
+ end
45
+
46
+ def short_ref
47
+ return unless ref
48
+ ref.match?(/^[a-z0-9]+$/) ? ref.slice(0, 7) : ref
36
49
  end
37
50
  end
38
51
  end
@@ -2,8 +2,13 @@ module Rexer
2
2
  module Source
3
3
  class Github < Git
4
4
  def initialize(repo:, branch: nil, tag: nil, ref: nil)
5
+ @repo = repo
5
6
  super(url: "https://github.com/#{repo}", branch: branch, tag: tag, ref: ref)
6
7
  end
8
+
9
+ def info
10
+ "#{@repo}@#{reference_name}"
11
+ end
7
12
  end
8
13
  end
9
14
  end
data/lib/rexer/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rexer
2
- VERSION = "0.13.0"
2
+ VERSION = "0.14.1"
3
3
  end
data/lib/rexer.rb CHANGED
@@ -27,6 +27,7 @@ module Rexer
27
27
  end
28
28
  end
29
29
 
30
+ require "active_support"
30
31
  require "pathname"
31
32
  require "zeitwerk"
32
33
 
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.13.0
4
+ version: 0.14.1
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-10-20 00:00:00.000000000 Z
11
+ date: 2024-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '7.0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '7.0'
97
111
  description: Rexer is a command-line tool for managing Redmine Extension (Plugin and
98
112
  Themes). It allows you to define extensions in a Ruby DSL and install, uninstall,
99
113
  update, and switch between different sets of the extensions.