Skip to content

Commit

Permalink
Add list of plugins and themes to envs command output
Browse files Browse the repository at this point in the history
  • Loading branch information
hidakatsuya committed Sep 4, 2024
1 parent d68147f commit 53d3a75
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
18 changes: 17 additions & 1 deletion lib/rexer/commands/envs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ def initialize
end

def call
puts(*defined_envs)
envs = defined_envs
envs.each.with_index do |env_name, i|
puts env_name

definition = definition_on(env_name)
definition.then { _1.themes + _1.plugins }.each do
puts " #{_1.name} (#{Source.from_definition(_1.source).info})"
end

puts if i < envs.size - 1
end
end

private
Expand All @@ -17,6 +27,12 @@ def defined_envs
all_envs = definition.plugins.map(&:env) + definition.themes.map(&:env)
all_envs.uniq.sort
end

def definition_on(env)
Definition.load_data.tap { |data|
data.env = env
}
end
end
end
end
20 changes: 19 additions & 1 deletion test/integration/integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,25 @@ class IntegrationTest < Test::Unit::TestCase

docker_exec("rex envs").then do |result|
assert_true result.success?
assert_equal %w[default env1 env2 env3 env4], result.output
assert_equal [
"default",
" theme_a (master)",
" plugin_a (master)",
"",
"env1",
" plugin_a (v0.1.0)",
"",
"env2",
" theme_a (master)",
" plugin_a (master)",
"",
"env3",
" theme_a (master)",
" plugin_a (stable)",
"",
"env4",
" plugin_a (master)"
], result.output
end

docker_exec("rex install -q").then do |result|
Expand Down

0 comments on commit 53d3a75

Please sign in to comment.