Sha256: 8675d871442fc3656ebfea125f76f1e0522ed92a208e58f106db1a7bb178dd96
Contents?: true
Size: 789 Bytes
Versions: 2
Compression:
Stored size: 789 Bytes
Contents
# 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.10.0 | lib/tty/path_helpers.rb |
tty-0.9.1 | lib/tty/path_helpers.rb |