rexer 0.15.0 → 0.17.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 +13 -12
- data/lib/rexer/cli.rb +11 -6
- data/lib/rexer/commands/edit.rb +28 -0
- data/lib/rexer/commands/init.rb +10 -1
- data/lib/rexer/commands/update.rb +15 -7
- data/lib/rexer/definition/lock.rb +3 -1
- data/lib/rexer/definition.rb +26 -1
- data/lib/rexer/extension/entity.rb +8 -6
- data/lib/rexer/extension/plugin/action.rb +1 -5
- data/lib/rexer/extension/plugin/install.rb +1 -1
- data/lib/rexer/extension/plugin/uninstall.rb +1 -1
- data/lib/rexer/extension/theme/install.rb +1 -1
- data/lib/rexer/extension/theme/uninstall.rb +1 -1
- data/lib/rexer/version.rb +1 -1
- data/lib/rexer.rb +8 -0
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0aa31136277eb6010005efd6b949d33791f40c43cf2c10e4c59aaa63f7635874
|
4
|
+
data.tar.gz: 7782364e1ae8e1c068d89c416feb8f058f39babfa9a4bf949c238cf828f51975
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a657e3d3ace4b1134d455b05fc9dabc1905e96fb88870b41d0b771c4bd7e7803949b333a422a724a8d15937613cba04a692105a51c7332ba74f35dc996010459
|
7
|
+
data.tar.gz: ec8fed06a4d98da769d42c99266caa91f6250f738e71ca39536f66f0ed1a570594b8b3f5c96166ee4563137a9e7c6a008842582138af70412e96e6438a9ffcf2
|
data/README.md
CHANGED
@@ -79,23 +79,24 @@ This command uninstalls the extensions and deletes the `.extensions.lock`.
|
|
79
79
|
```
|
80
80
|
$ rex
|
81
81
|
Commands:
|
82
|
-
rex
|
83
|
-
rex
|
84
|
-
rex
|
85
|
-
rex
|
86
|
-
rex
|
87
|
-
rex
|
88
|
-
rex
|
89
|
-
rex
|
90
|
-
rex
|
91
|
-
rex
|
82
|
+
rex edit # Edit .extensions.rb
|
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 reinstall [extension] # Uninstall extensions for the currently installed environment and install them again
|
88
|
+
rex state # Show the current state of the installed extensions
|
89
|
+
rex switch [env] # Uninstall extensions for the currently installed environment and install extensions for the specified environment
|
90
|
+
rex uninstall # Uninstall extensions for the currently installed environment based on the state in .extensions.lock and remove the lock file
|
91
|
+
rex update [extensions...] # Update extensions for the currently installed environment to the latest version if extensions are updateable. If no extensions are specified, all extensions are updated
|
92
|
+
rex version # Show Rexer version
|
92
93
|
|
93
94
|
Options:
|
94
95
|
-v, [--verbose], [--no-verbose], [--skip-verbose] # Detailed output
|
95
96
|
-q, [--quiet], [--no-quiet], [--skip-quiet] # Minimal output
|
96
97
|
```
|
97
98
|
|
98
|
-
### rex install [
|
99
|
+
### rex install [env]
|
99
100
|
|
100
101
|
Installs extensions in the specified ENV environment and makes them available for use. Specifically, it does the following:
|
101
102
|
|
@@ -106,7 +107,7 @@ If the specified ENV is currently installed, it compares the current `.extension
|
|
106
107
|
* Uninstalls deleted extensions (the `uninstalled` hook is executed).
|
107
108
|
* Reload extensions whose source settings has changed (for example, the `branch` or `tag` has changed) and runs the database migration if necessary.
|
108
109
|
|
109
|
-
### rex update
|
110
|
+
### rex update [extensions...]
|
110
111
|
|
111
112
|
Loads `.extensions.lock` and updates the currently installed extensions to the latest version. `.extensions.rb` is NOT referenced in this command.
|
112
113
|
|
data/lib/rexer/cli.rb
CHANGED
@@ -15,7 +15,7 @@ module Rexer
|
|
15
15
|
Commands::Init.new.call
|
16
16
|
end
|
17
17
|
|
18
|
-
desc "install [
|
18
|
+
desc "install [env]", "Install the definitions in .extensions.rb for the specified environment"
|
19
19
|
def install(env = "default")
|
20
20
|
Commands::Install.new.call(env&.to_sym)
|
21
21
|
end
|
@@ -25,19 +25,19 @@ module Rexer
|
|
25
25
|
Commands::Uninstall.new.call
|
26
26
|
end
|
27
27
|
|
28
|
-
desc "reinstall [
|
28
|
+
desc "reinstall [extension]", "Uninstall extensions for the currently installed environment and install them again"
|
29
29
|
def reinstall(extension_name)
|
30
30
|
Commands::Reinstall.new.call(extension_name)
|
31
31
|
end
|
32
32
|
|
33
|
-
desc "switch [
|
33
|
+
desc "switch [env]", "Uninstall extensions for the currently installed environment and install extensions for the specified environment"
|
34
34
|
def switch(env = "default")
|
35
35
|
Commands::Switch.new.call(env&.to_sym)
|
36
36
|
end
|
37
37
|
|
38
|
-
desc "update", "Update extensions for the currently installed environment to the latest version if extensions are updateable"
|
39
|
-
def update
|
40
|
-
Commands::Update.new.call
|
38
|
+
desc "update [extensions...]", "Update extensions for the currently installed environment to the latest version if extensions are updateable. If no extensions are specified, all extensions are updated"
|
39
|
+
def update(*extension_names)
|
40
|
+
Commands::Update.new.call(extension_names)
|
41
41
|
end
|
42
42
|
|
43
43
|
desc "state", "Show the current state of the installed extensions"
|
@@ -50,6 +50,11 @@ module Rexer
|
|
50
50
|
Commands::Envs.new.call
|
51
51
|
end
|
52
52
|
|
53
|
+
desc "edit", "Edit .extensions.rb"
|
54
|
+
def edit
|
55
|
+
Commands::Edit.new.call
|
56
|
+
end
|
57
|
+
|
53
58
|
desc "version", "Show Rexer version"
|
54
59
|
def version
|
55
60
|
puts Rexer::VERSION
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "shellwords"
|
2
|
+
|
3
|
+
module Rexer
|
4
|
+
module Commands
|
5
|
+
class Edit
|
6
|
+
def call
|
7
|
+
definition_file = Definition.file
|
8
|
+
|
9
|
+
if editor.to_s.empty?
|
10
|
+
puts Paint["Please set your $VISUAL or $EDITOR environment variable.", :red]
|
11
|
+
exit 1
|
12
|
+
end
|
13
|
+
|
14
|
+
edit_system_editor(definition_file.to_s)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def editor
|
20
|
+
ENV["VISUAL"].to_s.empty? ? ENV["EDITOR"] : ENV["VISUAL"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def edit_system_editor(file_path)
|
24
|
+
system(*Shellwords.split(editor), file_path)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/rexer/commands/init.rb
CHANGED
@@ -2,7 +2,12 @@ module Rexer
|
|
2
2
|
module Commands
|
3
3
|
class Init
|
4
4
|
def call
|
5
|
-
|
5
|
+
unless redmine_root_dir?
|
6
|
+
puts Paint["Please run in the Redmine root directory.", :red]
|
7
|
+
exit 1
|
8
|
+
end
|
9
|
+
|
10
|
+
definition_file = Pathname.new(Rexer.definition_file)
|
6
11
|
|
7
12
|
if definition_file.exist?
|
8
13
|
puts Paint["#{definition_file.basename} already exists", :red]
|
@@ -34,6 +39,10 @@ module Rexer
|
|
34
39
|
|
35
40
|
TEMPLATE
|
36
41
|
end
|
42
|
+
|
43
|
+
def redmine_root_dir?
|
44
|
+
Pathname.new("README.rdoc").then { _1.exist? && _1.read.include?("Redmine") }
|
45
|
+
end
|
37
46
|
end
|
38
47
|
end
|
39
48
|
end
|
@@ -7,29 +7,37 @@ module Rexer
|
|
7
7
|
@lock_definition = Definition::Lock.load_data
|
8
8
|
end
|
9
9
|
|
10
|
-
def call
|
10
|
+
def call(extension_names)
|
11
11
|
return if no_lock_file_found
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
extension_names ||= []
|
14
|
+
extension_names.map!(&:to_sym)
|
15
|
+
|
16
|
+
update_themes(extension_names)
|
17
|
+
update_plugins(extension_names)
|
15
18
|
end
|
16
19
|
|
17
20
|
private
|
18
21
|
|
19
22
|
attr_reader :lock_definition
|
20
23
|
|
21
|
-
def update_plugins
|
22
|
-
lock_definition.plugins.each do
|
24
|
+
def update_plugins(extension_names)
|
25
|
+
filter_by_name(lock_definition.plugins, extension_names).each do
|
23
26
|
call_action Extension::Plugin::Update, _1
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
27
|
-
def update_themes
|
28
|
-
lock_definition.themes.each do
|
30
|
+
def update_themes(extension_names)
|
31
|
+
filter_by_name(lock_definition.themes, extension_names).each do
|
29
32
|
call_action Extension::Theme::Update, _1
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
36
|
+
def filter_by_name(extensions, extension_names)
|
37
|
+
return extensions unless extension_names.any?
|
38
|
+
extensions.select { extension_names.include?(_1.name) }
|
39
|
+
end
|
40
|
+
|
33
41
|
def no_lock_file_found
|
34
42
|
lock_definition.nil?.tap { |result|
|
35
43
|
puts "No lock file found" if result
|
@@ -2,7 +2,7 @@ module Rexer
|
|
2
2
|
module Definition
|
3
3
|
module Lock
|
4
4
|
def self.file
|
5
|
-
@file ||=
|
5
|
+
@file ||= Definition.dir.join(Rexer.definition_lock_file)
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.load_data
|
@@ -10,6 +10,8 @@ module Rexer
|
|
10
10
|
|
11
11
|
dsl = Dsl.new.tap { _1.instance_eval(file.read) }
|
12
12
|
dsl.to_data
|
13
|
+
rescue DefinitionFileNotFound
|
14
|
+
nil
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.create_file(env)
|
data/lib/rexer/definition.rb
CHANGED
@@ -10,6 +10,12 @@ module Rexer
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
class DefinitionFileNotFound < StandardError
|
14
|
+
def initialize
|
15
|
+
super("No definition file (#{Rexer.definition_file}) found")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
13
19
|
Source = ::Data.define(:type, :options)
|
14
20
|
|
15
21
|
Plugin = ::Data.define(:name, :source, :hooks, :env) do
|
@@ -20,13 +26,32 @@ module Rexer
|
|
20
26
|
include ExtensionComparable
|
21
27
|
end
|
22
28
|
|
29
|
+
def self.dir
|
30
|
+
@dir ||= find_difinition_dir
|
31
|
+
end
|
32
|
+
|
23
33
|
def self.file
|
24
|
-
@file ||=
|
34
|
+
@file ||= dir.join(Rexer.definition_file)
|
25
35
|
end
|
26
36
|
|
27
37
|
def self.load_data
|
28
38
|
dsl = Dsl.new.tap { _1.instance_eval(file.read) }
|
29
39
|
dsl.to_data
|
40
|
+
rescue DefinitionFileNotFound
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.find_difinition_dir
|
45
|
+
definition_file = Rexer.definition_file
|
46
|
+
dir = Pathname.pwd
|
47
|
+
|
48
|
+
until dir.join(definition_file).exist?
|
49
|
+
raise DefinitionFileNotFound if dir.root?
|
50
|
+
dir = dir.parent
|
51
|
+
end
|
52
|
+
|
53
|
+
dir
|
30
54
|
end
|
55
|
+
private_class_method :find_difinition_dir
|
31
56
|
end
|
32
57
|
end
|
@@ -1,11 +1,7 @@
|
|
1
|
-
require "active_support/core_ext/class/attribute"
|
2
|
-
|
3
1
|
module Rexer
|
4
2
|
module Extension
|
5
3
|
module Entity
|
6
4
|
class Base
|
7
|
-
class_attribute :root_dir
|
8
|
-
|
9
5
|
def initialize(definition)
|
10
6
|
@definition = definition
|
11
7
|
@hooks = definition.hooks || {}
|
@@ -14,6 +10,8 @@ module Rexer
|
|
14
10
|
|
15
11
|
attr_reader :hooks, :name
|
16
12
|
|
13
|
+
def root_dir = raise "Not implemented"
|
14
|
+
|
17
15
|
def exist?
|
18
16
|
path.exist? && !path.empty?
|
19
17
|
end
|
@@ -36,7 +34,9 @@ module Rexer
|
|
36
34
|
end
|
37
35
|
|
38
36
|
class Plugin < Base
|
39
|
-
|
37
|
+
def root_dir
|
38
|
+
@root_dir ||= Rexer.redmine_root_dir.join("plugins")
|
39
|
+
end
|
40
40
|
|
41
41
|
def contains_db_migrations?
|
42
42
|
path.join("db", "migrate").then { _1.exist? && !_1.empty? }
|
@@ -48,7 +48,9 @@ module Rexer
|
|
48
48
|
end
|
49
49
|
|
50
50
|
class Theme < Base
|
51
|
-
|
51
|
+
def root_dir
|
52
|
+
@root_dir ||= Rexer.redmine_root_dir.join("themes")
|
53
|
+
end
|
52
54
|
end
|
53
55
|
end
|
54
56
|
end
|
@@ -16,12 +16,8 @@ module Rexer
|
|
16
16
|
|
17
17
|
attr_reader :plugin
|
18
18
|
|
19
|
-
def needs_db_migration?
|
20
|
-
plugin.contains_db_migrations?
|
21
|
-
end
|
22
|
-
|
23
19
|
def run_db_migrate(extra_envs = {})
|
24
|
-
return unless
|
20
|
+
return unless plugin.contains_db_migrations?
|
25
21
|
|
26
22
|
envs = {"NAME" => plugin.name.to_s}.merge(extra_envs)
|
27
23
|
cmds = build_cmd("bundle", "exec", "rake", Rexer.verbosity.debug? ? nil : "-q", "redmine:plugins:migrate", envs:)
|
data/lib/rexer/version.rb
CHANGED
data/lib/rexer.rb
CHANGED
@@ -21,6 +21,14 @@ module Rexer
|
|
21
21
|
".extensions.lock"
|
22
22
|
end
|
23
23
|
|
24
|
+
def redmine_root_dir
|
25
|
+
if block_given?
|
26
|
+
Dir.chdir(Definition.dir) { yield }
|
27
|
+
else
|
28
|
+
Definition.dir
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
24
32
|
def config
|
25
33
|
@config ||= Config.new(command_prefix: ENV["REXER_COMMAND_PREFIX"])
|
26
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katsuya Hidaka
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-16 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: thor
|
@@ -126,6 +125,7 @@ files:
|
|
126
125
|
- lib/rexer.rb
|
127
126
|
- lib/rexer/cli.rb
|
128
127
|
- lib/rexer/commands.rb
|
128
|
+
- lib/rexer/commands/edit.rb
|
129
129
|
- lib/rexer/commands/envs.rb
|
130
130
|
- lib/rexer/commands/init.rb
|
131
131
|
- lib/rexer/commands/install.rb
|
@@ -160,7 +160,6 @@ licenses:
|
|
160
160
|
- MIT
|
161
161
|
metadata:
|
162
162
|
source_code_uri: https://github.com/hidakatsuya/rexer
|
163
|
-
post_install_message:
|
164
163
|
rdoc_options: []
|
165
164
|
require_paths:
|
166
165
|
- lib
|
@@ -168,15 +167,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
167
|
requirements:
|
169
168
|
- - ">="
|
170
169
|
- !ruby/object:Gem::Version
|
171
|
-
version: 3.
|
170
|
+
version: 3.1.0
|
172
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
172
|
requirements:
|
174
173
|
- - ">="
|
175
174
|
- !ruby/object:Gem::Version
|
176
175
|
version: '0'
|
177
176
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
179
|
-
signing_key:
|
177
|
+
rubygems_version: 3.6.2
|
180
178
|
specification_version: 4
|
181
179
|
summary: A command-line tool for managing Redmine Plugins and Themes
|
182
180
|
test_files: []
|