Module: RedminePluginsHelper::Patches::Redmine::Plugin::Dependencies

Defined in:
lib/redmine_plugins_helper/patches/redmine/plugin/dependencies.rb

Constant Summary collapse

DEPENDENCIES_FILE_BASENAMES =
%w[yml yaml].map { |e| "dependencies.#{e}" }

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Integer

Parameters:

Returns:

  • (Integer)


17
18
19
20
21
22
23
24
25
# File 'lib/redmine_plugins_helper/patches/redmine/plugin/dependencies.rb', line 17

def <=>(other)
  so = dependency?(other)
  os = other.dependency?(self)

  return 1 if so && !os
  return -1 if !so && os

  super
end

#dependencies_idsArray<Symbol>

Returns:

  • (Array<Symbol>)


28
29
30
31
# File 'lib/redmine_plugins_helper/patches/redmine/plugin/dependencies.rb', line 28

def dependencies_ids
  load_dependencies_from_file
  dependencies_hash.keys
end

#dependency?(other) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/redmine_plugins_helper/patches/redmine/plugin/dependencies.rb', line 35

def dependency?(other)
  load_dependencies_from_file
  recursive_dependencies_ids.include?(other.id)
end

#requires_redmine_plugin(plugin_name, arg) ⇒ Boolean

Parameters:

  • plugin_name (Symbol)
  • arg (Hash, String)

Returns:

  • (Boolean)


43
44
45
46
47
# File 'lib/redmine_plugins_helper/patches/redmine/plugin/dependencies.rb', line 43

def requires_redmine_plugin(plugin_name, arg)
  r = super
  dependencies_hash[plugin_name.to_sym] = arg
  r
end