Module: RedminePluginsHelper::Patches::Redmine::PluginPatch::Dependencies

Defined in:
lib/redmine_plugins_helper/patches/redmine/plugin_patch/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:

  • other (Redmine::Plugin)

Returns:

  • (Integer)


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

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>)


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

def dependencies_ids
  load_dependencies_from_file
  dependencies_hash.keys
end

#dependency?(other) ⇒ Boolean

Parameters:

  • other (Redmine::Plugin)

Returns:

  • (Boolean)


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

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)


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

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