Top Level Namespace

Defined Under Namespace

Classes: Array, Block, Bookmarks, Buffers, Clipboard, Code, CodeTree, Color, Console, ControlLock, ControlTab, Cursor, Deletes, DiffLog, Effects, Environment, FileTree, Files, Hide, History, Image, Incrementer, Insert, Irc, KeyBindings, Keys, Launcher, Line, Links, Location, Macros, Man, Menu, Merb, Message, Mode, Move, NilClass, Notes, Numbers, Object, Ol, OlHelper, Overlay, PauseMeansSpace, Php, Projects, RelinquishException, Remote, Requirer, RestTree, Ruby, RubyConsole, Search, SearchTerm, Snippet, Specs, String, Styles, Svn, TextUtil, Tree, TreeCursor, TroubleShooting, UrlTree, View, Window, Xiki

Constant Summary collapse

CODE_SAMPLES =

Remember something you’re searching for, and jump to the next occurrences.

%q<
  - Deprecated:
>

Instance Method Summary collapse

Instance Method Details

#require_menu(file, options = {}) ⇒ Object



1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
# File 'lib/xiki/launcher.rb', line 1338

def require_menu file, options={}
  if ! options[:ok_if_not_found]
    raise "File Not Found" if !File.exists?(file)
  end

  stem = File.basename(file)[/\A(.*)\.[^.]+\z/, 1]

  # As .menu...

  if file =~ /\.menu$/ || options[:force_as] == "menu"
    Launcher.add stem, :menu_file=>1 do |path|
      next View.flash("- Xiki couldn't find: #{file}", :times=>5) if ! File.exists?(file)
      Tree.children File.read(file), Tree.rootless(path)
    end
    return
  end

  # As class, so require and add launcher...

  result = :not_found
  begin
    result = Menu.load_if_changed file
  rescue LoadError => e
    gem_name = Requirer.extract_gem_from_exception e.to_s
    Requirer.show "The file #{file} wants to use the '#{gem_name}' gem.\n% gem install #{gem_name}\n\n"
  rescue Exception=>e
    txt = CodeTree.draw_exception e
    Requirer.show "The file #{file} had this exception:\n#{txt}\n\n"
  end

  return if result == :not_found

  Launcher.add stem if ! Launcher.menus[1][stem]
end