public
Description: Explores the wicked combo of machine tag queries + their results as trees.
Homepage:
Clone URL: git://github.com/cldwalker/tag-tree.git
name age message
file README.rdoc Thu Nov 12 03:50:31 -0800 2009 cmds usable from cmdline, converted delicious l... [cldwalker]
file Rakefile Wed Oct 15 00:27:35 -0700 2008 adding default rails [cldwalker]
directory app/ Wed Nov 18 00:25:27 -0800 2009 rake rails:update [cldwalker]
directory config/ Wed Nov 18 00:25:27 -0800 2009 rake rails:update [cldwalker]
directory db/ Sat Feb 21 05:08:01 -0800 2009 updated migration [cldwalker]
directory doc/ Wed Oct 15 00:27:35 -0700 2008 adding default rails [cldwalker]
directory lib/ Sun Nov 22 02:40:13 -0800 2009 tweaks to work with 1.9 [cldwalker]
directory public/ Wed Nov 18 00:25:27 -0800 2009 rake rails:update [cldwalker]
directory script/ Wed Oct 15 00:27:35 -0700 2008 adding default rails [cldwalker]
directory test/ Wed Oct 15 00:27:35 -0700 2008 adding default rails [cldwalker]
directory vendor/ Sat Feb 21 06:06:26 -0800 2009 setup tweaks and saving old migrations [cldwalker]
README.rdoc

Description

This is a machine tag based bookmark manager, primarily for console use. Machine tags are implemented using my has_machine_tags plugin. To use this app you need to know what machine tags are. This app generates machine tag trees from wildcard machine tags. To learn more about machine tag trees, read these posts.

Setup

  1. Install necessary gems: `rake gems:install`
  2. Copy config/database.yml.example to config/database.yml and setup your db as needed.
  3. Run migrations: `rake db:migrate`
  4. Optionally setup your own commandline aliases at config/alias.yml using config/alias.yml.example as an example.

Usage

Note: The ascii tables are what you actually see in your console, compliments of the hirb gem.

  bash> script/console

  # list commands that are available in console
  irb>> commands '-q=l tag_tree'
  +--------------------------+----------------+-------+-----------------------+-----------------------------------------------------------+
  | full_name                | lib            | alias | usage                 | description                                               |
  +--------------------------+----------------+-------+-----------------------+-----------------------------------------------------------+
  | machine_tag_reload       | tag_tree_core  | mtr   |                       | reload machine tag config                                 |
  | console_find             | tag_tree_core  | uf    |                       | find urls by wildcard or ids                              |
  | search_machine_tag_names | tag_tree_core  | mtrn  |                       | find tags within machine tag fields with regex string     |
  | tag_tree                 | tag_tree_core  | tt    | [mtag][--view=VIEW]   | Displays different tag trees given a wildcard machine tag |
  | quick_create             | tag_tree_core  | uc    |                       | quickly create a url                                      |
  | rename_tag               | tag_tree_core  |       | [old_name] [new_name] |                                                           |
  | clip_url                 | tag_tree_core  | ucp   | [*args]               |                                                           |
  | tag_find_name_by_regexp  | tag_tree_core  | trn   |                       | find tags with regex string                               |
  | open_url                 | tag_tree_core  | o     | [*args]               | open url object id                                        |
  | url_find_by_regexp       | tag_tree_core  | urn   |                       | search urls with regex string                             |
  | super_tagged_with        | tag_tree_core  | ut    |                       | find urls with wildcard machine tag                       |
  | values                   | tag_tree_core  | vs    |                       |                                                           |
  | namespaces               | tag_tree_core  | nsps  |                       |                                                           |
  | query_tree               | tag_tree_core  | qt    | [mtag][--view=VIEW]   |                                                           |
  | predicates               | tag_tree_core  | ps    |                       |                                                           |
  | machine_tags             | tag_tree_core  | mt    |                       |                                                           |
  | namespace_tree           | tag_tree_core  | nt    | [mtag][--view=VIEW]   |                                                           |
  | setup_tag_tree           | tag_tree_setup |       |                       |                                                           |
  +--------------------------+----------------+-------+-----------------------+-----------------------------------------------------------+
  18 rows in set

  # Let's create a bookmark/url with machine tags
  irb>> Url.create :name=>"http://guides.rubyonrails.org/creating_plugins.html", :tag_list =>"article:tags=rails"
  +------+------------------------------------------------------+-------------------------+-------------------------------+
  | id   | name                                                 | description             | quick_mode_tag_list           |
  +------+------------------------------------------------------+-------------------------+-------------------------------+
  | 1126 | http://weblog.jamisbuck.org/2008/11/17/vim-follow-up | decent vim/rails advice | article:tutorial;rails;td=vim |
  +------+------------------------------------------------------+-------------------------+-------------------------------+
  1 row in set

  # We can retrieve urls with wildcard machine tags. To retrieve our last bookmark
  irb>> Url.tagged_with 'article:tags='
  +------+------------------------------------------------------+-------------------------+-------------------------------+
  | id   | name                                                 | description             | quick_mode_tag_list           |
  +------+------------------------------------------------------+-------------------------+-------------------------------+
  | 1126 | http://weblog.jamisbuck.org/2008/11/17/vim-follow-up | decent vim/rails advice | article:tutorial;rails;td=vim |
  +------+------------------------------------------------------+-------------------------+-------------------------------+
  1 row in set

  # Let's generate a tag tree from a wildcard machine tag.
  # This is a tree of my bookmarks under the namespace gem, with values grouped by their count:
  irb>> tag_tree 'gem: -v g'
  gem
    app
        1: textmate, vim
    plang
        1: js
    std
        1: yaml
    tags
        9: console
        4: code_check, ghpages
        3: visualize, template, api, benchmark
        2: dt_struct, couchdb, http, introspect
        1: sandbox, tag, article, rails, db, nomonkey, math, security, pattern, gem, sinatra
    type
        22: core
        17: test
        10: new, doc
        9: git
        7: task
        4: irb, monkey, misc, mix
        3: opt, debug, aop
        2: lang
        1: science
    id
        1: jekyll
    td
        7: tds
        1: gist, test
    site
        4: ghub, gg
        1: del, freebase

Inputting Machine Tags

This app facilitates inputting machine tags by assuming default predicates when none are given. For example, instead of inputting site:tags=rails you can just input site:rails (since tags is the default predicate). You can also chain together multiple machine tags from the same namespace using ’;’ i.e. app:rails;plang=ruby is the same as app:tags=rails,app:plang=ruby. Both of these features are from the configurable has_machine_tags's quick_mode.

You can setup more clever predicate defaults by copying config/machine_tags.yml.example to config/machine_tags.yml and setting it up as follows:

  • :global_predicates: Contains an array of predicates you want to use globally. All values using a global predicate are assumed to have that global predicate as a default. For example, if lang is a global predicate in the machine tag site:lang=en, en is assumed to have lang as a default predicate in all new inputs.
  • :dynamic_predicates: Same as global_predicates but restricted to a namespace.

Delicious Sync

If you want to sync these bookmarks with delicious, there’s a delicious library that depends on the www-delicious gem.

Todo

  • Tests!
  • Web interface as needed.