Skip to content

Commit

Permalink
Minor rubocop updates to Vmdb::Plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Aug 15, 2024
1 parent 69ac930 commit a871f3b
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions lib/vmdb/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class Plugins

include Enumerable

def self.method_missing(m, ...)
instance.respond_to?(m) ? instance.send(m, ...) : super
def self.method_missing(meth, ...)
instance.respond_to?(meth) ? instance.send(meth, ...) : super
end

def self.respond_to_missing?(*args)
Expand All @@ -30,8 +30,8 @@ def init
end

def details
each_with_object({}) do |engine, hash|
hash[engine] = {
index_with do |engine|
{
:name => engine.name,
:version => version(engine),
:path => engine.root.to_s
Expand Down Expand Up @@ -70,13 +70,11 @@ def ansible_content
# Ansible content (playbooks and roles) for internal use by provider plugins,
# not exposed to Automate, and to be run by ansible_runner
def ansible_runner_content
@ansible_runner_content ||= begin
map do |engine|
content_dir = engine.root.join("content", "ansible_runner")
next unless File.exist?(content_dir.join("roles/requirements.yml"))
@ansible_runner_content ||= filter_map do |engine|
content_dir = engine.root.join("content", "ansible_runner")
next unless File.exist?(content_dir.join("roles/requirements.yml"))

[engine, content_dir]
end.compact
[engine, content_dir]
end
end

Expand All @@ -96,7 +94,7 @@ def automate_domains
end

def miq_widgets_content
@miq_widgets_content ||= Dir.glob(Rails.root.join("product/dashboard/widgets/*")) + flat_map { |engine| content_directories(engine, "dashboard/widgets") }
@miq_widgets_content ||= Rails.root.join("product/dashboard/widgets").glob("*").map(&:to_s) + flat_map { |engine| content_directories(engine, "dashboard/widgets") }
end

def provider_plugins
Expand All @@ -110,7 +108,7 @@ def ui_plugins
def asset_paths
@asset_paths ||= begin
require_relative 'plugins/asset_path'
map { |engine| AssetPath.new(engine) if AssetPath.asset_path?(engine) }.compact
filter_map { |engine| AssetPath.new(engine) if AssetPath.asset_path?(engine) }
end
end

Expand All @@ -122,9 +120,7 @@ def server_role_paths
end

def systemd_units
@systemd_units ||= begin
flat_map { |engine| engine.root.join("systemd").glob("*.*") }
end
@systemd_units ||= flat_map { |engine| engine.root.join("systemd").glob("*.*") }
end

def load_inflections
Expand Down

0 comments on commit a871f3b

Please sign in to comment.