lib/rbbt/util/misc/development.rb in rbbt-util-5.20.9 vs lib/rbbt/util/misc/development.rb in rbbt-util-5.20.10

- old
+ new

@@ -61,11 +61,11 @@ raise $! ensure result = RubyProf.stop printer = RubyProf::MultiPrinter.new(result) TmpFile.with_file do |dir| - FileUtils.mkdir_p dir unless File.exists? dir + FileUtils.mkdir_p dir unless File.exist? dir printer.print(:path => dir, :profile => 'profile') CMD.cmd("firefox -no-remote '#{ dir }'") end end @@ -282,11 +282,13 @@ def self.bootstrap(elems, num = :current, options = {}, &block) IndiferentHash.setup options num = :current if num.nil? cpus = case num when :current - 10 + n = 10 + n = elems.length / 2 if n > elems.length/2 + n when String num.to_i when Integer if num < 100 num @@ -361,11 +363,11 @@ PUSHBULLET_KEY=begin if ENV["PUSHBULLET_KEY"] ENV["PUSHBULLET_KEY"] else config_api = File.join(ENV['HOME'], 'config/apps/pushbullet/apikey') - if File.exists? config_api + if File.exist? config_api File.read(config_api).strip else nil end end @@ -384,10 +386,10 @@ `curl -s --header "Authorization: Bearer #{key}" -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type": "note", "title": "#{event}", "body": "#{description}"}'` end end def self.unzip_in_dir(file, dir) - raise "Target is not a directory: #{file}" if File.exists?(dir) and not File.directory?(dir) + raise "Target is not a directory: #{file}" if File.exist?(dir) and not File.directory?(dir) if Open.remote? file file = file.find if Path === file Open.open(file) do |stream| TmpFile.with_file(stream.read, true, :extension => 'zip') do |zip_file| CMD.cmd("unzip '#{zip_file}' -d '#{dir}'")