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 =
%w(~/.bashrc ~/.zshrc ~/.profile)
SHELL_WRAPPER =
"#{PROJECT_HOME}/bin/warp-dir.bash"
VERSION =
'1.1.1'
SERIALIZERS =
{}

Class Method Summary collapse

Class Method Details

.absolute(path) ⇒ Object



26
27
28
# File 'lib/warp/dir.rb', line 26

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

.commanderObject



52
53
54
# File 'lib/warp/dir.rb', line 52

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

.default_configObject



30
31
32
# File 'lib/warp/dir.rb', line 30

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

.eval_context?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/warp/dir.rb', line 14

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

.on(type, &block) ⇒ Object



48
49
50
# File 'lib/warp/dir.rb', line 48

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

.pwdObject



18
19
20
# File 'lib/warp/dir.rb', line 18

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

.relative(path) ⇒ Object



22
23
24
# File 'lib/warp/dir.rb', line 22

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

.require_all_from(folder) ⇒ Object



10
11
12
# File 'lib/warp/dir.rb', line 10

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

.sort_by(collection, field) ⇒ Object



34
35
36
# File 'lib/warp/dir.rb', line 34

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