rexer 0.14.1 → 0.16.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03a1f270989ff656e5fd97e105ecd8d21be59755e2f3112746db636c5b2a9e7c
4
- data.tar.gz: 42154270a3d8684f58ec80537cd2d5237dd0cde468bd44b3db0dd89fe7084a7c
3
+ metadata.gz: 61d1b3b0172a3db2da03ac1f428f447a5296df8430fabaf21f4ce1cb1f96ce41
4
+ data.tar.gz: 8dc2852d1ef7f6052d2c8d09cba035276fd7b039bc109be732d0599142a27059
5
5
  SHA512:
6
- metadata.gz: 3b7544710bb51bb0a6e5cb6de61deac2c6fbea1116d11b62f064c76a844af5664037083dbe30685421af467f7346676ba9655ceb59e2310a455e435ea7f7274b
7
- data.tar.gz: 91d31bf09b9dd719760ab4cc88c32542cc441f215ce68e7d95831e8e0789695215dbf49d70279e51d43c5a45886d6d6f6045540d0210c577153b706d3dcf0fa6
6
+ metadata.gz: 72c9335b6be10bb6a7220d3b632ce2d0c20719165b5e93d17244e5f8c4412ea8fad0b36e805ae1cba51ef652d77afce8dd98676bfe1dcfb0b14e24249cf4fa8d
7
+ data.tar.gz: b708a563d706ba42aad33a1daa40a5d7a7c4365c481be516d423a2a05176f8b4c0f6ef68afae27ca571ba55a99f03b3dbf51e10de497f91f672f781ff87a762a
data/README.md CHANGED
@@ -79,23 +79,23 @@ This command uninstalls the extensions and deletes the `.extensions.lock`.
79
79
  ```
80
80
  $ rex
81
81
  Commands:
82
- rex envs # Show the list of environments and their extensions defined in .extensions.rb
83
- rex help [COMMAND] # Describe available commands or one specific command
84
- rex init # Create a new .extensions.rb file
85
- rex install [ENV] # Install the definitions in .extensions.rb for the specified environment
86
- rex reinstall [PLUGIN or THEME] # Uninstall extensions for the currently installed environment and install them again
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 if extensions are updateable
91
- rex version # Show Rexer version
82
+ rex envs # Show the list of environments and their extensions defined in .extensions.rb
83
+ rex help [COMMAND] # Describe available commands or one specific command
84
+ rex init # Create a new .extensions.rb file
85
+ rex install [env] # Install the definitions in .extensions.rb for the specified environment
86
+ rex reinstall [extension] # Uninstall extensions for the currently installed environment and install them again
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 [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
91
+ rex version # Show Rexer version
92
92
 
93
93
  Options:
94
94
  -v, [--verbose], [--no-verbose], [--skip-verbose] # Detailed output
95
95
  -q, [--quiet], [--no-quiet], [--skip-quiet] # Minimal output
96
96
  ```
97
97
 
98
- ### rex install [ENV]
98
+ ### rex install [env]
99
99
 
100
100
  Installs extensions in the specified ENV environment and makes them available for use. Specifically, it does the following:
101
101
 
@@ -106,7 +106,7 @@ If the specified ENV is currently installed, it compares the current `.extension
106
106
  * Uninstalls deleted extensions (the `uninstalled` hook is executed).
107
107
  * Reload extensions whose source settings has changed (for example, the `branch` or `tag` has changed) and runs the database migration if necessary.
108
108
 
109
- ### rex update
109
+ ### rex update [extensions...]
110
110
 
111
111
  Loads `.extensions.lock` and updates the currently installed extensions to the latest version. `.extensions.rb` is NOT referenced in this command.
112
112
 
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 [ENV]", "Install the definitions in .extensions.rb for the specified environment"
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 [PLUGIN or THEME]", "Uninstall extensions for the currently installed environment and install them again"
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 [ENV]", "Uninstall extensions for the currently installed environment and install extensions for the specified environment"
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"
@@ -10,8 +10,12 @@ module Rexer
10
10
  defined_envs.each.with_index do |env, i|
11
11
  puts env
12
12
 
13
- definition_with(env).then { _1.themes + _1.plugins }.each do
14
- puts " #{_1.name} (#{Source.from_definition(_1.source).info})"
13
+ themes_in(env) do
14
+ print_extension_definition(_1)
15
+ end
16
+
17
+ plugins_in(env) do
18
+ print_extension_definition(_1)
15
19
  end
16
20
 
17
21
  puts if i < defined_envs.size - 1
@@ -22,11 +26,20 @@ module Rexer
22
26
 
23
27
  attr_reader :definition
24
28
 
25
- def definition_with(env)
26
- definition.with(
27
- plugins: definition.plugins.select { _1.env == env },
28
- themes: definition.themes.select { _1.env == env }
29
- )
29
+ def print_extension_definition(extension_def)
30
+ puts " #{extension_def.name} (#{Source.from_definition(extension_def.source).info})"
31
+ end
32
+
33
+ def themes_in(env)
34
+ definition.themes.each do
35
+ yield _1 if _1.env == env
36
+ end
37
+ end
38
+
39
+ def plugins_in(env)
40
+ definition.plugins.each do
41
+ yield _1 if _1.env == env
42
+ end
30
43
  end
31
44
  end
32
45
  end
@@ -20,29 +20,27 @@ module Rexer
20
20
  attr_reader :lock_definition
21
21
 
22
22
  def print_plugins
23
- plugins = lock_definition.plugins
24
- return if plugins.empty?
23
+ plugin_defs = lock_definition.plugins
24
+ return if plugin_defs.empty?
25
25
 
26
26
  puts "\nPlugins:"
27
- plugins.each do
28
- puts " * #{_1.name} (#{source_info(_1.source)})"
27
+ plugin_defs.each do
28
+ plugin = Extension::Entity::Plugin.new(_1)
29
+ puts " * #{plugin.name} (#{plugin.source_info})"
29
30
  end
30
31
  end
31
32
 
32
33
  def print_themes
33
- themes = lock_definition.themes
34
- return if themes.empty?
34
+ theme_defs = lock_definition.themes
35
+ return if theme_defs.empty?
35
36
 
36
37
  puts "\nThemes:"
37
- themes.each do
38
- puts " * #{_1.name} (#{source_info(_1.source)})"
38
+ theme_defs.each do
39
+ theme = Extension::Entity::Theme.new(_1)
40
+ puts " * #{theme.name} (#{theme.source_info})"
39
41
  end
40
42
  end
41
43
 
42
- def source_info(definition_source)
43
- Source.from_definition(definition_source).info
44
- end
45
-
46
44
  def no_lock_file_found
47
45
  lock_definition.nil?.tap { |result|
48
46
  puts "No lock file found" if result
@@ -7,7 +7,7 @@ module Rexer
7
7
 
8
8
  def call(env)
9
9
  return if no_lock_file_found
10
- return if already_on(env)
10
+ return if already_in(env)
11
11
 
12
12
  Uninstall.new.call
13
13
  Install.new.call(env)
@@ -23,9 +23,9 @@ module Rexer
23
23
  }
24
24
  end
25
25
 
26
- def already_on(env)
26
+ def already_in(env)
27
27
  (lock_definition.env == env).tap do |result|
28
- puts "Already on #{env} environment" if result
28
+ puts "Already in #{env} environment" if result
29
29
  end
30
30
  end
31
31
  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
- update_themes
14
- update_plugins
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
@@ -0,0 +1,55 @@
1
+ require "active_support/core_ext/class/attribute"
2
+
3
+ module Rexer
4
+ module Extension
5
+ module Entity
6
+ class Base
7
+ class_attribute :root_dir
8
+
9
+ def initialize(definition)
10
+ @definition = definition
11
+ @hooks = definition.hooks || {}
12
+ @name = definition.name
13
+ end
14
+
15
+ attr_reader :hooks, :name
16
+
17
+ def exist?
18
+ path.exist? && !path.empty?
19
+ end
20
+
21
+ def path
22
+ @path ||= root_dir.join(name.to_s)
23
+ end
24
+
25
+ def source_info
26
+ @source_info ||= source.info(path)
27
+ end
28
+
29
+ def source
30
+ @source ||= Source.from_definition(definition.source)
31
+ end
32
+
33
+ private
34
+
35
+ attr_reader :definition
36
+ end
37
+
38
+ class Plugin < Base
39
+ self.root_dir = Pathname.new("plugins")
40
+
41
+ def contains_db_migrations?
42
+ path.join("db", "migrate").then { _1.exist? && !_1.empty? }
43
+ end
44
+
45
+ def contains_gemfile?
46
+ path.join("Gemfile").exist?
47
+ end
48
+ end
49
+
50
+ class Theme < Base
51
+ self.root_dir = Pathname.new("themes")
52
+ end
53
+ end
54
+ end
55
+ end
@@ -9,36 +9,21 @@ module Rexer
9
9
 
10
10
  def initialize(definition)
11
11
  @definition = definition
12
- @name = definition.name
13
- @hooks = definition.hooks || {}
12
+ @plugin = Entity::Plugin.new(definition)
14
13
  end
15
14
 
16
15
  private
17
16
 
18
- attr_reader :name, :hooks, :definition
19
-
20
- def plugin_root_dir
21
- Pathname.new("plugins")
22
- end
23
-
24
- def plugin_dir
25
- @plugin_dir ||= plugin_root_dir.join(name.to_s)
26
- end
27
-
28
- def plugin_exists?
29
- plugin_dir.exist? && !plugin_dir.empty?
30
- end
17
+ attr_reader :plugin
31
18
 
32
19
  def needs_db_migration?
33
- plugin_dir.join("db", "migrate").then {
34
- _1.exist? && !_1.empty?
35
- }
20
+ plugin.contains_db_migrations?
36
21
  end
37
22
 
38
23
  def run_db_migrate(extra_envs = {})
39
24
  return unless needs_db_migration?
40
25
 
41
- envs = {"NAME" => name.to_s}.merge(extra_envs)
26
+ envs = {"NAME" => plugin.name.to_s}.merge(extra_envs)
42
27
  cmds = build_cmd("bundle", "exec", "rake", Rexer.verbosity.debug? ? nil : "-q", "redmine:plugins:migrate", envs:)
43
28
 
44
29
  broadcast(:processing, "Execute #{cmds}")
@@ -51,10 +36,6 @@ module Rexer
51
36
  end
52
37
  end
53
38
 
54
- def source
55
- @source ||= Source.from_definition(definition.source)
56
- end
57
-
58
39
  def build_cmd(*command, envs: {})
59
40
  envs_str = envs.map { [_1, _2].join("=") }
60
41
  [Rexer.config.command_prefix, *command, *envs_str].compact.join(" ")
@@ -3,9 +3,9 @@ module Rexer
3
3
  module Plugin
4
4
  class Install < Action
5
5
  def call
6
- broadcast(:started, "Install #{name}")
6
+ broadcast(:started, "Install #{plugin.name}")
7
7
 
8
- if plugin_exists?
8
+ if plugin.exist?
9
9
  broadcast(:skipped, "Already exists")
10
10
  return
11
11
  end
@@ -13,7 +13,7 @@ module Rexer
13
13
  load_from_source
14
14
  run_bundle_install
15
15
  run_db_migrate
16
- hooks[:installed]&.call
16
+ call_installed_hook
17
17
 
18
18
  broadcast(:completed)
19
19
  end
@@ -21,11 +21,11 @@ module Rexer
21
21
  private
22
22
 
23
23
  def load_from_source
24
- source.load(plugin_dir.to_s)
24
+ plugin.source.load(plugin.path.to_s)
25
25
  end
26
26
 
27
27
  def run_bundle_install
28
- return unless plugin_dir.join("Gemfile").exist?
28
+ return unless plugin.contains_gemfile?
29
29
 
30
30
  cmds = build_cmd("bundle", "install", Rexer.verbosity.debug? ? nil : "--quiet")
31
31
 
@@ -33,6 +33,10 @@ module Rexer
33
33
 
34
34
  system(cmds, exception: true)
35
35
  end
36
+
37
+ def call_installed_hook
38
+ plugin.hooks[:installed]&.call
39
+ end
36
40
  end
37
41
  end
38
42
  end
@@ -3,9 +3,9 @@ module Rexer
3
3
  module Plugin
4
4
  class ReloadSource < Action
5
5
  def call
6
- return unless plugin_exists?
6
+ return unless plugin.exist?
7
7
 
8
- broadcast(:started, "Reload #{name} source")
8
+ broadcast(:started, "Reload #{plugin.name} source")
9
9
 
10
10
  reload_source
11
11
  run_db_migrate
@@ -16,10 +16,8 @@ module Rexer
16
16
  private
17
17
 
18
18
  def reload_source
19
- plugin_dir.to_s.then { |dir|
20
- FileUtils.rm_rf(dir)
21
- source.load(dir)
22
- }
19
+ plugin.path.rmtree
20
+ plugin.source.load(plugin.path.to_s)
23
21
  end
24
22
  end
25
23
  end
@@ -3,16 +3,16 @@ module Rexer
3
3
  module Plugin
4
4
  class Uninstall < Action
5
5
  def call
6
- broadcast(:started, "Uninstall #{name}")
6
+ broadcast(:started, "Uninstall #{plugin.name}")
7
7
 
8
- unless plugin_exists?
8
+ unless plugin.exist?
9
9
  broadcast(:skipped, "Not exists")
10
10
  return
11
11
  end
12
12
 
13
13
  reset_db_migration
14
14
  remove_plugin
15
- hooks[:uninstalled]&.call
15
+ call_uninstalled_hook
16
16
 
17
17
  broadcast(:completed)
18
18
  end
@@ -24,7 +24,11 @@ module Rexer
24
24
  end
25
25
 
26
26
  def remove_plugin
27
- plugin_dir.rmtree
27
+ plugin.path.rmtree
28
+ end
29
+
30
+ def call_uninstalled_hook
31
+ plugin.hooks[:uninstalled]&.call
28
32
  end
29
33
  end
30
34
  end
@@ -3,11 +3,11 @@ module Rexer
3
3
  module Plugin
4
4
  class Update < Action
5
5
  def call
6
- return unless plugin_exists?
6
+ return unless plugin.exist?
7
7
 
8
- broadcast(:started, "Update #{name}")
8
+ broadcast(:started, "Update #{plugin.name}")
9
9
 
10
- unless source.updatable?
10
+ unless plugin.source.updatable?
11
11
  broadcast(:skipped, "Not updatable")
12
12
  return
13
13
  end
@@ -21,7 +21,7 @@ module Rexer
21
21
  private
22
22
 
23
23
  def update_source
24
- source.update(plugin_dir.to_s)
24
+ plugin.source.update(plugin.path)
25
25
  end
26
26
  end
27
27
  end
@@ -8,36 +8,12 @@ module Rexer
8
8
 
9
9
  def initialize(definition)
10
10
  @definition = definition
11
- @name = definition.name
12
- @hooks = definition.hooks || {}
11
+ @theme = Entity::Theme.new(definition)
13
12
  end
14
13
 
15
14
  private
16
15
 
17
- attr_reader :name, :hooks, :definition
18
-
19
- def theme_root_dir
20
- public_themes = Pathname.pwd.join("public", "themes")
21
-
22
- if public_themes.exist?
23
- # When Redmine version is v5.1 or older, public/themes is used.
24
- public_themes
25
- else
26
- Pathname.new("themes")
27
- end
28
- end
29
-
30
- def theme_dir
31
- @theme_dir ||= theme_root_dir.join(name.to_s)
32
- end
33
-
34
- def theme_exists?
35
- theme_dir.exist? && !theme_dir.empty?
36
- end
37
-
38
- def source
39
- @source ||= Source.from_definition(definition.source)
40
- end
16
+ attr_reader :theme
41
17
  end
42
18
  end
43
19
  end
@@ -3,15 +3,15 @@ module Rexer
3
3
  module Theme
4
4
  class Install < Action
5
5
  def call
6
- broadcast(:started, "Install #{name}")
6
+ broadcast(:started, "Install #{theme.name}")
7
7
 
8
- if theme_exists?
8
+ if theme.exist?
9
9
  broadcast(:skipped, "Already exists")
10
10
  return
11
11
  end
12
12
 
13
13
  load_from_source
14
- hooks[:installed]&.call
14
+ call_installed_hook
15
15
 
16
16
  broadcast(:completed)
17
17
  end
@@ -19,7 +19,11 @@ module Rexer
19
19
  private
20
20
 
21
21
  def load_from_source
22
- source.load(theme_dir.to_s)
22
+ theme.source.load(theme.path.to_s)
23
+ end
24
+
25
+ def call_installed_hook
26
+ theme.hooks[:installed]&.call
23
27
  end
24
28
  end
25
29
  end
@@ -3,9 +3,9 @@ module Rexer
3
3
  module Theme
4
4
  class ReloadSource < Action
5
5
  def call
6
- return unless theme_exists?
6
+ return unless theme.exist?
7
7
 
8
- broadcast(:started, "Reload #{name} source")
8
+ broadcast(:started, "Reload #{theme.name} source")
9
9
 
10
10
  reload_source
11
11
 
@@ -15,10 +15,8 @@ module Rexer
15
15
  private
16
16
 
17
17
  def reload_source
18
- theme_dir.to_s.then { |dir|
19
- FileUtils.rm_rf(dir)
20
- source.load(dir)
21
- }
18
+ theme.path.rmtree
19
+ theme.source.load(theme.path.to_s)
22
20
  end
23
21
  end
24
22
  end
@@ -3,15 +3,15 @@ module Rexer
3
3
  module Theme
4
4
  class Uninstall < Action
5
5
  def call
6
- broadcast(:started, "Uninstall #{name}")
6
+ broadcast(:started, "Uninstall #{theme.name}")
7
7
 
8
- unless theme_exists?
8
+ unless theme.exist?
9
9
  broadcast(:skipped, "Not exists")
10
10
  return
11
11
  end
12
12
 
13
13
  remove_theme
14
- hooks[:uninstalled]&.call
14
+ call_uninstalled_hook
15
15
 
16
16
  broadcast(:completed)
17
17
  end
@@ -19,7 +19,11 @@ module Rexer
19
19
  private
20
20
 
21
21
  def remove_theme
22
- theme_dir.rmtree
22
+ theme.path.rmtree
23
+ end
24
+
25
+ def call_uninstalled_hook
26
+ theme.hooks[:uninstalled]&.call
23
27
  end
24
28
  end
25
29
  end
@@ -3,9 +3,9 @@ module Rexer
3
3
  module Theme
4
4
  class Update < Action
5
5
  def call
6
- return unless theme_exists?
6
+ return unless theme.exist?
7
7
 
8
- broadcast(:started, "Update #{name}")
8
+ broadcast(:started, "Update #{theme.name}")
9
9
 
10
10
  update_source
11
11
 
@@ -15,7 +15,7 @@ module Rexer
15
15
  private
16
16
 
17
17
  def update_source
18
- source.update(theme_dir.to_s)
18
+ theme.source.update(theme.path.to_s)
19
19
  end
20
20
  end
21
21
  end
@@ -17,7 +17,7 @@ module Rexer
17
17
  end
18
18
 
19
19
  # Return the status of the source.
20
- def info = ""
20
+ def info(_work_dir = nil) = ""
21
21
  end
22
22
  end
23
23
  end
@@ -9,7 +9,6 @@ module Rexer
9
9
  @branch = branch
10
10
  @tag = tag
11
11
  @ref = ref
12
- @reference = branch || tag || ref
13
12
  end
14
13
 
15
14
  def load(path)
@@ -25,27 +24,35 @@ module Rexer
25
24
  branch || reference.nil?
26
25
  end
27
26
 
28
- def info
29
- URI.parse(url).then do |uri|
30
- "#{uri.host}#{uri.path}@#{reference_name}"
31
- end
27
+ def info(work_dir = nil)
28
+ uri = URI.parse(url).then { "#{_1.host}#{_1.path}" }
29
+ ref = reference(short_ref: true) || current_branch(work_dir)
30
+
31
+ [uri, ref].compact.join("@")
32
32
  end
33
33
 
34
34
  private
35
35
 
36
- attr_reader :url, :reference, :branch, :tag, :ref
36
+ attr_reader :url, :branch, :tag
37
37
 
38
38
  def checkout(git)
39
39
  reference&.then { git.checkout(_1) }
40
40
  end
41
41
 
42
- def reference_name
43
- branch || tag || short_ref || "main"
42
+ def reference(short_ref: false)
43
+ branch || tag || ref(short: short_ref)
44
+ end
45
+
46
+ def ref(short: false)
47
+ return nil unless @ref
48
+ return @ref unless short
49
+
50
+ @ref.match?(/^[a-z0-9]+$/) ? @ref.slice(0, 7) : @ref
44
51
  end
45
52
 
46
- def short_ref
47
- return unless ref
48
- ref.match?(/^[a-z0-9]+$/) ? ref.slice(0, 7) : ref
53
+ def current_branch(work_dir)
54
+ return nil unless work_dir
55
+ ::Git.open(work_dir).current_branch
49
56
  end
50
57
  end
51
58
  end
@@ -6,8 +6,8 @@ module Rexer
6
6
  super(url: "https://github.com/#{repo}", branch: branch, tag: tag, ref: ref)
7
7
  end
8
8
 
9
- def info
10
- "#{@repo}@#{reference_name}"
9
+ def info(work_dir = nil)
10
+ [@repo, reference(short_ref: true) || current_branch(work_dir)].compact.join("@")
11
11
  end
12
12
  end
13
13
  end
data/lib/rexer/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rexer
2
- VERSION = "0.14.1"
2
+ VERSION = "0.16.0"
3
3
  end
data/lib/rexer.rb CHANGED
@@ -1,12 +1,4 @@
1
1
  module Rexer
2
- def self.definition_file
3
- ".extensions.rb"
4
- end
5
-
6
- def self.definition_lock_file
7
- ".extensions.lock"
8
- end
9
-
10
2
  Config = Data.define(
11
3
  # The prefix of the command such as bundle install and bin/rails redmine:plugins:migrate.
12
4
  #
@@ -21,6 +13,14 @@ module Rexer
21
13
  class << self
22
14
  attr_accessor :verbosity
23
15
 
16
+ def definition_file
17
+ ".extensions.rb"
18
+ end
19
+
20
+ def definition_lock_file
21
+ ".extensions.lock"
22
+ end
23
+
24
24
  def config
25
25
  @config ||= Config.new(command_prefix: ENV["REXER_COMMAND_PREFIX"])
26
26
  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.14.1
4
+ version: 0.16.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-11-25 00:00:00.000000000 Z
11
+ date: 2025-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -139,6 +139,7 @@ files:
139
139
  - lib/rexer/definition/diff.rb
140
140
  - lib/rexer/definition/dsl.rb
141
141
  - lib/rexer/definition/lock.rb
142
+ - lib/rexer/extension/entity.rb
142
143
  - lib/rexer/extension/plugin/action.rb
143
144
  - lib/rexer/extension/plugin/install.rb
144
145
  - lib/rexer/extension/plugin/reload_source.rb
@@ -167,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
168
  requirements:
168
169
  - - ">="
169
170
  - !ruby/object:Gem::Version
170
- version: 3.0.0
171
+ version: 3.1.0
171
172
  required_rubygems_version: !ruby/object:Gem::Requirement
172
173
  requirements:
173
174
  - - ">="