Sha256: 8ead61a2f62884795bec91404f4e30cd63304368300b4c082ffa343ae6343ad5
Contents?: true
Size: 807 Bytes
Versions: 2
Compression:
Stored size: 807 Bytes
Contents
# encoding: utf-8 # frozen_string_literal: true module TTY module PathHelpers # The root path of the app running this command # # @return [Pathname] # # @api public def root_path @root_path ||= Pathname.pwd end # Execute command within root path # # @api public def within_root_path(&block) Dir.chdir(root_path, &block) end # Extract name from a path # # @api public def name_from_path(path) Pathname(path).basename.to_s end # Extract a relative path for the app # # @api private def relative_path_from(root_path, path) project_path = Pathname.new(path) return project_path if project_path.relative? project_path.relative_path_from(root_path) end end # PathHelpers end # TTY
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tty-0.8.1 | lib/tty/path_helpers.rb |
tty-0.8.0 | lib/tty/path_helpers.rb |