class WoolenCommon::CommonHelper
Public Class Methods
get_real_path(*args) { |block file_path| ... }
click to toggle source
# File lib/woolen_common/common_helper.rb, line 31 def get_real_path(*args, &block) file_path = File.expand_path(File.join(*args)) if block_given? yield block file_path return file_path end file_path end
run_project_bin(program,param_str)
click to toggle source
# File lib/woolen_common/common_helper.rb, line 19 def run_project_bin(program,param_str) program_name = get_real_path(WoolenCommon::ConfigManager.project_root,'bin',program) trace "need to run bin [#{program_name} #{param_str}]" if WoolenCommon::SystemHelper.windows? cmd = "#{program_name} #{param_str}".to_gbk `#{cmd}`.to_utf8 else cmd = "#{program_name} #{param_str}" `#{cmd}` end end
wait_until_stopped()
click to toggle source
# File lib/woolen_common/common_helper.rb, line 7 def wait_until_stopped info 'Press ENTER or c-C to stop it' $stdout.flush begin loop do sleep 1 end rescue Interrupt info 'Interrupt' end end