diff options
author | elijah <elijah@riseup.net> | 2012-11-28 20:14:05 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2012-11-28 20:14:05 -0800 |
commit | e5ed1ba2df6f735e32de35d9171d572dce322b7f (patch) | |
tree | 1a9120599adc7215edee5cf36ef27511823dd819 /lib/leap_cli/util.rb | |
parent | e2c31618b6f70d86c55c348436dd600b2e4ace21 (diff) | |
download | leap_cli-e5ed1ba2df6f735e32de35d9171d572dce322b7f.tar.gz leap_cli-e5ed1ba2df6f735e32de35d9171d572dce322b7f.tar.bz2 |
new system for how directory paths work. now there is a file Leapfile that manages this, instead of it always being ../leap_platform
Diffstat (limited to 'lib/leap_cli/util.rb')
-rw-r--r-- | lib/leap_cli/util.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/leap_cli/util.rb b/lib/leap_cli/util.rb index 967acca..98c3002 100644 --- a/lib/leap_cli/util.rb +++ b/lib/leap_cli/util.rb @@ -2,6 +2,7 @@ require 'digest/md5' require 'paint' require 'fileutils' require 'erb' +require 'pty' module LeapCli module Util @@ -84,9 +85,10 @@ module LeapCli def assert_files_missing!(*files) options = files.last.is_a?(Hash) ? files.pop : {} + base = options[:base] || Path.provider file_list = files.collect { |file_path| - file_path = Path.named_path(file_path) - File.exists?(file_path) ? Path.relative_path(file_path) : nil + file_path = Path.named_path(file_path, base) + File.exists?(file_path) ? Path.relative_path(file_path, base) : nil }.compact if file_list.length > 1 bail! do @@ -280,6 +282,21 @@ module LeapCli STDOUT.puts end + # + # runs a command in a pseudo terminal + # + def pty_run(cmd) + PTY.spawn(cmd) do |output, input, pid| + begin + while line = output.gets do + puts line + end + rescue Errno::EIO + end + end + rescue PTY::ChildExited + end + ## ## ERB ## |