Module: Pakyow::Support::Dependencies Private

Extended by:
Dependencies
Included in:
Dependencies
Defined in:
lib/pakyow/support/dependencies.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.bundler_gem_pathObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
# 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_pathObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/pakyow/support/dependencies.rb', line 13

def self.local_framework_path
  @local_framework_path ||= File.expand_path("../../../../../", __FILE__)
end

.regex_bundlerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
# File 'lib/pakyow/support/dependencies.rb', line 21

def self.regex_bundler
  @regex_bundler ||= /^#{Dependencies.bundler_gem_path}\//
end

.regex_local_frameworkObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/pakyow/support/dependencies.rb', line 25

def self.regex_local_framework
  @regex_local_framework ||= /^#{Dependencies.local_framework_path}\//
end

.regex_pakyow_libObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/pakyow/support/dependencies.rb', line 29

def self.regex_pakyow_lib
  @regex_pakyow_lib ||= /^#{Pakyow.config.lib}\//
end

.regex_pakyow_rootObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
# File 'lib/pakyow/support/dependencies.rb', line 33

def self.regex_pakyow_root
  @regex_pakyow_root ||= /^#{Pakyow.config.root}\//
end

.regex_rubyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'lib/pakyow/support/dependencies.rb', line 41

def self.regex_ruby
  @regex_ruby ||= /^#{RbConfig::CONFIG["libdir"]}\//
end

.regex_ruby_gemObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
# File 'lib/pakyow/support/dependencies.rb', line 37

def self.regex_ruby_gem
  @regex_ruby_gem ||= /^#{Dependencies.ruby_gem_path}\//
end

.ruby_gem_pathObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
# File 'lib/pakyow/support/dependencies.rb', line 17

def self.ruby_gem_path
  @ruby_gem_path ||= File.join(Gem.dir, "/gems")
end

Instance Method Details

#library_name(line) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# 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) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# 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) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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