Top Level Namespace
Instance Method Summary collapse
- #_file_system_path(gem_name) ⇒ Object
- #_gem_dir ⇒ Object
- #_git_path(gem_name, options) ⇒ Object
- #_options(gem_name, options = {}) ⇒ Object
- #_print_gem_dir_error ⇒ Object
- #_print_git_repo_uri_error ⇒ Object
- #_print_mode_error(mode) ⇒ Object
- #_prox_gem_git_uri ⇒ Object
- #_prox_gem_mode ⇒ Object
- #_set(val) ⇒ Object
- #prox_gem(gem_name, options = {}) ⇒ Object
Instance Method Details
#_file_system_path(gem_name) ⇒ Object
47 48 49 |
# File 'lib/prox_gem/prox_gem.rb', line 47 def _file_system_path(gem_name) File.join(File.(_gem_dir), gem_name) end |
#_gem_dir ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/prox_gem/prox_gem.rb', line 25 def _gem_dir gem_dir = ENV['PROX_GEM_DIR'] return gem_dir if _set? gem_dir _print_gem_dir_error raise end |
#_git_path(gem_name, options) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/prox_gem/prox_gem.rb', line 51 def _git_path(gem_name, ) prefix = .delete :prefix repo_name = gem_name.gsub '_', '-' path = "#{_prox_gem_git_uri}/" path << "#{prefix}/" if prefix path << "#{repo_name}.git" end |
#_options(gem_name, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/prox_gem/prox_gem.rb', line 6 def (gem_name, ={}) mode = _prox_gem_mode if mode == "path" return { :path => _file_system_path(gem_name) } elsif mode == "git" return { :git => _git_path(gem_name, ) }.merge() elsif mode == 'off' return else _print_mode_error && raise end end |
#_print_gem_dir_error ⇒ Object
65 66 67 |
# File 'lib/prox_gem/prox_gem.rb', line 65 def _print_gem_dir_error puts 'The PROX_GEM_DIR environment variable must be set to the path that contains gem project directories' end |
#_print_git_repo_uri_error ⇒ Object
69 70 71 |
# File 'lib/prox_gem/prox_gem.rb', line 69 def _print_git_repo_uri_error puts 'The PROX_GEM_GIT_URI environment variable must be set to the URI of the Git repository where the gem project is housed' end |
#_print_mode_error(mode) ⇒ Object
61 62 63 |
# File 'lib/prox_gem/prox_gem.rb', line 61 def _print_mode_error(mode) puts "The PROX_GEM_MODE \"#{mode}\" environment variable is wrong. It must be one of \"path\", \"git\", or \"off\"." end |
#_prox_gem_git_uri ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/prox_gem/prox_gem.rb', line 34 def _prox_gem_git_uri get_uri = ENV['PROX_GEM_GIT_URI'] return git_uri if _set? git_uri _print_git_repo_uri_error raise end |
#_prox_gem_mode ⇒ Object
19 20 21 22 23 |
# File 'lib/prox_gem/prox_gem.rb', line 19 def _prox_gem_mode mode = ENV['PROX_GEM_MODE'] return mode if _set? mode "off" end |
#_set(val) ⇒ Object
43 44 45 |
# File 'lib/prox_gem/prox_gem.rb', line 43 def _set(val) !val.nil? && !val.strip.empty? end |
#prox_gem(gem_name, options = {}) ⇒ Object
1 2 3 4 |
# File 'lib/prox_gem/prox_gem.rb', line 1 def prox_gem(gem_name, ={}) opts = (gem_name, ) gem gem_name, opts end |