Module: Tapioca::GemHelper
- Included in:
- Tapioca::Gemfile::GemSpec, Loaders::Loader
- Defined in:
- lib/tapioca/helpers/gem_helper.rb
Instance Method Summary collapse
-
#gem_in_app_dir?(app_dir, full_gem_path) ⇒ Boolean
: ((String | Pathname) app_dir, String full_gem_path) -> bool.
-
#gem_in_bundle_path?(full_gem_path) ⇒ Boolean
: (String full_gem_path) -> bool.
-
#gem_in_ruby_path?(full_gem_path) ⇒ Boolean
: (String full_gem_path) -> bool.
-
#to_realpath(path) ⇒ Object
: ((String | Pathname) path) -> String.
Instance Method Details
#gem_in_app_dir?(app_dir, full_gem_path) ⇒ Boolean
: ((String | Pathname) app_dir, String full_gem_path) -> bool
7 8 9 10 11 12 |
# File 'lib/tapioca/helpers/gem_helper.rb', line 7 def gem_in_app_dir?(app_dir, full_gem_path) app_dir = to_realpath(app_dir) full_gem_path = to_realpath(full_gem_path) !gem_in_bundle_path?(full_gem_path) && !gem_in_ruby_path?(full_gem_path) && path_in_dir?(full_gem_path, app_dir) end |
#gem_in_bundle_path?(full_gem_path) ⇒ Boolean
: (String full_gem_path) -> bool
15 16 17 |
# File 'lib/tapioca/helpers/gem_helper.rb', line 15 def gem_in_bundle_path?(full_gem_path) path_in_dir?(full_gem_path, Bundler.bundle_path) || path_in_dir?(full_gem_path, Bundler.app_cache) end |
#gem_in_ruby_path?(full_gem_path) ⇒ Boolean
: (String full_gem_path) -> bool
20 21 22 |
# File 'lib/tapioca/helpers/gem_helper.rb', line 20 def gem_in_ruby_path?(full_gem_path) path_in_dir?(full_gem_path, RbConfig::CONFIG["rubylibprefix"]) end |
#to_realpath(path) ⇒ Object
: ((String | Pathname) path) -> String
25 26 27 28 29 |
# File 'lib/tapioca/helpers/gem_helper.rb', line 25 def to_realpath(path) path_string = path.to_s path_string = File.realpath(path_string) if File.exist?(path_string) path_string end |