module Pakyow::Support::Dependencies

@api private

Public Class Methods

bundler_gem_path() click to toggle source
# File lib/pakyow/support/dependencies.rb, line 9
def self.bundler_gem_path
  @bundler_gem_path ||= Bundler.bundle_path.to_s + "/bundler/gems"
end
local_framework_path() click to toggle source
# File lib/pakyow/support/dependencies.rb, line 13
def self.local_framework_path
  @local_framework_path ||= File.expand_path("../../../../../", __FILE__)
end
regex_bundler() click to toggle source
# File lib/pakyow/support/dependencies.rb, line 21
def self.regex_bundler
  @regex_bundler ||= /^#{Dependencies.bundler_gem_path}\//
end
regex_local_framework() click to toggle source
# File lib/pakyow/support/dependencies.rb, line 25
def self.regex_local_framework
  @regex_local_framework ||= /^#{Dependencies.local_framework_path}\//
end
regex_pakyow_lib() click to toggle source
# File lib/pakyow/support/dependencies.rb, line 29
def self.regex_pakyow_lib
  @regex_pakyow_lib ||= /^#{Pakyow.config.lib}\//
end
regex_pakyow_root() click to toggle source
# File lib/pakyow/support/dependencies.rb, line 33
def self.regex_pakyow_root
  @regex_pakyow_root ||= /^#{Pakyow.config.root}\//
end
regex_ruby() click to toggle source
# File lib/pakyow/support/dependencies.rb, line 41
def self.regex_ruby
  @regex_ruby ||= /^#{RbConfig::CONFIG["libdir"]}\//
end
regex_ruby_gem() click to toggle source
# File lib/pakyow/support/dependencies.rb, line 37
def self.regex_ruby_gem
  @regex_ruby_gem ||= /^#{Dependencies.ruby_gem_path}\//
end
ruby_gem_path() click to toggle source
# File lib/pakyow/support/dependencies.rb, line 17
def self.ruby_gem_path
  @ruby_gem_path ||= File.join(Gem.dir, "/gems")
end

Public Instance Methods

library_name(line) click to toggle source
# File lib/pakyow/support/dependencies.rb, line 63
def library_name(line)
  case library_type(line)
  when :gem
    strip_path_prefix(line).split("/")[0].split("-")[0..-2].join("-")
  when :bundler
    strip_path_prefix(line).split("/")[1]
  when :ruby
    "ruby"
  when :pakyow
    strip_path_prefix(line).split("/")[0]
  when :lib
    strip_path_prefix(line).split("/")[1]
  else
    nil
  end
end
library_type(line) click to toggle source
# File lib/pakyow/support/dependencies.rb, line 80
def library_type(line)
  if line.start_with?(Dependencies.ruby_gem_path)
    :gem
  elsif line.start_with?(Dependencies.bundler_gem_path)
    :bundler
  elsif line.start_with?(RbConfig::CONFIG["libdir"])
    :ruby
  elsif line.start_with?(Dependencies.local_framework_path)
    :pakyow
  elsif line.start_with?(Pakyow.config.lib)
    :lib
  else
    nil
  end
end
strip_path_prefix(line) click to toggle source
# File lib/pakyow/support/dependencies.rb, line 45
def strip_path_prefix(line)
  if line.start_with?(Pakyow.config.root)
    line.gsub(Dependencies.regex_pakyow_root, "")
  elsif line.start_with?(Pakyow.config.lib)
    line.gsub(Dependencies.regex_pakyow_lib, "")
  elsif line.start_with?(Dependencies.ruby_gem_path)
    line.gsub(Dependencies.regex_ruby_gem, "")
  elsif line.start_with?(Dependencies.bundler_gem_path)
    line.gsub(Dependencies.regex_bundler, "")
  elsif line.start_with?(RbConfig::CONFIG["libdir"])
    line.gsub(Dependencies.regex_ruby, "")
  elsif line.start_with?(Dependencies.local_framework_path)
    line.gsub(Dependencies.regex_local_framework, "")
  else
    line
  end
end