Module: Warp::Dir

Defined in:
lib/warp/dir.rb,
lib/warp/dir.rb,
lib/warp/dir/point.rb,
lib/warp/dir/store.rb,
lib/warp/dir/config.rb,
lib/warp/dir/errors.rb,
lib/warp/dir/app/cli.rb,
lib/warp/dir/command.rb,
lib/warp/dir/version.rb,
lib/warp/dir/commander.rb,
lib/warp/dir/formatter.rb,
lib/warp/dir/command/ls.rb,
lib/warp/dir/serializer.rb,
lib/warp/dir/app/response.rb,
lib/warp/dir/command/warp.rb,
lib/warp/dir/serializer/base.rb,
lib/warp/dir/serializer/dotfile.rb

Defined Under Namespace

Modules: App, Errors, Serializer Classes: Command, Commander, Config, Formatter, Point, Store

Constant Summary collapse

DOTFILES =

tried in order.

%w(.bash_profile .bashrc .profile .bash_login).map{|f| "~/#{f}" }
DOTFILE_CREATED =
'.bash_profile'
SHELL_WRAPPER =
"#{PROJECT_HOME}/bin/warp-dir.bash"
VERSION =
'1.2.0'
INSTALL_NOTICE =
@install_notice
SERIALIZERS =
{}

Class Method Summary collapse

Class Method Details

.absolute(path) ⇒ Object



28
29
30
# File 'lib/warp/dir.rb', line 28

def absolute(path)
  path.gsub '~', ENV['HOME']
end

.commanderObject



54
55
56
# File 'lib/warp/dir.rb', line 54

def commander
  ::Warp::Dir::Commander.instance
end

.default_configObject



32
33
34
# File 'lib/warp/dir.rb', line 32

def default_config
  relative Warp::Dir::Config::DEFAULTS[:warprc]
end

.eval_context?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/warp/dir.rb', line 16

def eval_context?
  ENV['WARP_DIR_SHELL'] == 'yes'
end

.on(type, &block) ⇒ Object



50
51
52
# File 'lib/warp/dir.rb', line 50

def on(type, &block)
  Warp::Dir::App::Response.new.type(type).configure(&block)
end

.pwdObject



20
21
22
# File 'lib/warp/dir.rb', line 20

def pwd
  %x(pwd).chomp.gsub ENV['HOME'], '~'
end

.relative(path) ⇒ Object



24
25
26
# File 'lib/warp/dir.rb', line 24

def relative(path)
  path.gsub ENV['HOME'], '~'
end

.require_all_from(folder) ⇒ Object



12
13
14
# File 'lib/warp/dir.rb', line 12

def require_all_from(folder)
  ::Dir.glob(Warp::PROJECT_LIBS + folder + '/*.rb') { |file| Kernel.require file }
end

.sort_by(collection, field) ⇒ Object



36
37
38
# File 'lib/warp/dir.rb', line 36

def sort_by(collection, field)
  collection.sort { |a, b| a.send(field) <=> b.send(field) }
end