Top Level Namespace
Instance Method Summary collapse
- #file_system_path(gem_name) ⇒ Object
- #gem_dir ⇒ Object
- #git_path(gem_name, options) ⇒ Object
- #path_gem(gem_name, options = {}) ⇒ Object
- #path_gem_env ⇒ Object
- #path_gem_git ⇒ Object
- #path_options(gem_name, options) ⇒ Object
- #print_gem_dir_error ⇒ Object
Instance Method Details
#file_system_path(gem_name) ⇒ Object
13 14 15 |
# File 'lib/path_gem/gemfile_ext.rb', line 13 def file_system_path(gem_name) File.join(File.(gem_dir), gem_name) end |
#gem_dir ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/path_gem/gemfile_ext.rb', line 27 def gem_dir if respond_to? :path_gem_dir send :path_gem_dir else ENV['PATH_GEM_DIR'] || (print_gem_dir_error && raise) end end |
#git_path(gem_name, options) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/path_gem/gemfile_ext.rb', line 17 def git_path(gem_name, ) prefix = .delete :prefix repo_name = gem_name.gsub '_', '-' path = "#{path_gem_git}/" path << "#{prefix}/" if prefix path << "#{repo_name}.git" end |
#path_gem(gem_name, options = {}) ⇒ Object
1 2 3 |
# File 'lib/path_gem/gemfile_ext.rb', line 1 def path_gem(gem_name, ={}) gem gem_name, (gem_name, ) end |
#path_gem_env ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/path_gem/gemfile_ext.rb', line 43 def path_gem_env if respond_to? :path_gem_env send :path_gem_env else ENV['PATH_GEM_ENV'] || "production" end end |
#path_gem_git ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/path_gem/gemfile_ext.rb', line 35 def path_gem_git if respond_to? :path_gem_git send :path_gem_git else ENV['PATH_GEM_GIT'] end end |
#path_options(gem_name, options) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/path_gem/gemfile_ext.rb', line 5 def (gem_name, ) if path_gem_env != "development" return { :git => git_path(gem_name, ) }.merge() else return { :path => file_system_path(gem_name) } end end |
#print_gem_dir_error ⇒ Object
51 52 53 |
# File 'lib/path_gem/gemfile_ext.rb', line 51 def print_gem_dir_error puts "The PATH_GEM_DIR environment variable must be set to the path that contains gem project directories" end |