class GemPaths::List

Public Class Methods

to_json() click to toggle source
# File lib/gem_paths/list.rb, line 28
def self.to_json
  require 'json'
  JSON.pretty_generate(Hash[*gem_name_path_map.flatten])
end
to_make() click to toggle source
# File lib/gem_paths/list.rb, line 13
def self.to_make
  gem_name_path_map.map { |pair| "export gem-path-#{pair[0]} := #{pair[1]}" }
end
to_sh() click to toggle source
# File lib/gem_paths/list.rb, line 17
def self.to_sh
  gem_name_path_map.map { |pair| "export gem_path_#{pair[0].gsub('-','_')}=\"#{pair[1]}\"" }
end
to_yaml() click to toggle source
# File lib/gem_paths/list.rb, line 21
def self.to_yaml
  str =  "---\n"
  str <<  "gem:\n"
  str << "  path:\n"
  str << gem_name_path_map.map { |pair| "    #{pair[0]}: #{pair[1]}" }.join("\n")
end

Private Class Methods

gem_name_path_map() click to toggle source
# File lib/gem_paths/list.rb, line 5
def self.gem_name_path_map
  Bundler.load.specs.sort_by(&:name).map { |s|
      [s.name, s.full_gem_path]
  }
end