https://github.com/cldwalker/tag-tree
Explores the wicked combo of machine tag queries + their results as trees.
https://github.com/cldwalker/tag-tree
Last synced: about 1 year ago
JSON representation
Explores the wicked combo of machine tag queries + their results as trees.
- Host: GitHub
- URL: https://github.com/cldwalker/tag-tree
- Owner: cldwalker
- Created: 2008-10-15T06:21:45.000Z (over 17 years ago)
- Default Branch: master
- Last Pushed: 2023-01-18T23:06:24.000Z (over 3 years ago)
- Last Synced: 2025-03-11T06:46:52.605Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 345 KB
- Stars: 28
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.rdoc
Awesome Lists containing this project
README
== Description
This is a machine-tag, console bookmark manager. Machine tags are
implemented using my {has_machine_tags plugin}[http://github.com/cldwalker/has_machine_tags]. To
use this app you need to know {what machine tags
are}[http://tagaholic.me/2009/03/26/what-are-machine-tags.html]. This app generates
machine tag trees from {wildcard machine
tags}[http://tagaholic.me/has_machine_tags/doc/classes/HasMachineTags/TagMethods.html]. To learn
more about machine tag trees,
{read}[http://tagaholic.me/2009/04/14/i-am-machine-tag-and-so-can-you.html] {these
posts}[http://tagaholic.me/2009/04/26/machine-tagging-with-delicious.html].
== Setup
1. Install postgres. On a mac, `brew install postgresql`.
2. Install bundler: `gem install bundler`
3. Install all gems: `bundle install`
4. Copy config/database.yml.example to config/database.yml and setup your db as needed.
5. Run migrations: `rake db:migrate`
== Usage
Note: The ascii tables are what you actually see in your console, compliments of
{the hirb gem}[http://tagaholic.me/hirb/].
$ ripl rack
# list commands that are available in console
>> 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
>> 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
>> 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:
>> 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
== Heroku
Use heroku to use this console on other computers:
# From main computer
$ heroku create myapp
$ git push heroku master
# Push your local data to heroku
$ heroku db:push
# From another computer, start the console
$ heroku run ripl rack
# When back at main computer, get your latest bookmarks
$ heroku db:pull
== 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}[http://tagaholic.me/has_machine_tags/doc/classes/HasMachineTags/TagList.html].
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.