class Shred::Commands::PlatformDeps
Attributes
supported_dependencies[R]
Public Instance Methods
configure()
click to toggle source
# File lib/shred/commands/platform_deps.rb, line 105 def configure @supported_dependencies = command_config.each_with_object([]) do |(type, specs), m| case type.to_sym when :homebrew specs.each_with_object(m) { |svc, mm| mm << HomebrewDependency.new(sym: svc.to_sym) } when :rubygems specs.each_with_object(m) { |svc, mm| mm << RubyGemDependency.new(sym: svc.to_sym) } when :npm specs.each_with_object(m) { |svc, mm| mm << NpmDependency.new(sym: svc.to_sym) } when :shell specs.each_with_object(m) do |(svc, keys), mm| install = keys['install'] or raise "Missing 'install' config for '#{svc}' platform dependency" update = keys['update'] or raise "Missing 'update' config for '#{svc}' platform dependency" mm << ShellCommandDependency.new( sym: svc.to_sym, install_command_lines: install, update_command_lines: update ) end else raise "Unknown platform dependency type #{type}" end end end
install(*dependencies)
click to toggle source
# File lib/shred/commands/platform_deps.rb, line 88 def install(*dependencies) invoke_for_dependencies(:install, *dependencies) end
invoke_for_dependencies(meth, *dependencies)
click to toggle source
# File lib/shred/commands/platform_deps.rb, line 131 def invoke_for_dependencies(meth, *dependencies) dependencies = supported_dependencies.map { |d| d.sym.to_s} if dependencies.empty? dependencies.each do |dependency| dependency = supported_dependencies.detect { |d| d.sym.to_s == dependency } if dependency dependency.send(meth, self) else say_err("No such dependency #{dependency}") end end end
update(*dependencies)
click to toggle source
# File lib/shred/commands/platform_deps.rb, line 100 def update(*dependencies) invoke_for_dependencies(:update, *dependencies) end