diff --git a/.gemspec b/.gemspec
deleted file mode 100644
index 72f376e..0000000
--- a/.gemspec
+++ /dev/null
@@ -1,136 +0,0 @@
-# encoding: utf-8
-
-require 'yaml'
-
-metadata = YAML.load_file('.ruby')
-
-manifest = Dir.glob('manifest{,.txt}', File::FNM_CASEFOLD).first
-
-
-Gem::Specification.new do |gemspec|
-
- scm = case
- when File.directory?('.git')
- :git
- end
-
- files = case
- when manifest
- File.readlines(manifest).
- map{ |line| line.strip }.
- reject{ |line| line.empty? || line[0,1] == '#' }
- when scm == :git
- `git ls-files -z`.split("\0")
- else
- Dir.glob('{**/}{.*,*}') # TODO: be more specific using standard locations ?
- end.select{ |path| File.file?(path) }
-
- patterns = {
- :bin_files => 'bin/*',
- :lib_files => 'lib/{**/}*.rb',
- :ext_files => 'ext/{**/}extconf.rb',
- :doc_files => '*.{txt,rdoc,md,markdown,tt,textile}',
- :test_files => '{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'
- }
-
- glob_files = lambda { |pattern|
- Dir.glob(pattern).select { |path|
- File.file?(path) && files.include?(path)
- }
- }
-
- #files = glob_files[patterns[:files]]
-
- executables = glob_files[patterns[:bin_files]].map do |path|
- File.basename(path)
- end
-
- extensions = glob_files[patterns[:ext_files]].map do |path|
- File.basename(path)
- end
-
- # build-out the gemspec
-
- case metadata['revision']
- when 0
- gemspec.name = metadata['name']
- gemspec.version = metadata['version']
- gemspec.summary = metadata['summary']
- gemspec.description = metadata['description']
-
- metadata['authors'].each do |author|
- gemspec.authors << author['name']
-
- if author.has_key?('email')
- if gemspec.email
- gemspec.email << author['email']
- else
- gemspec.email = [author['email']]
- end
- end
- end
-
- gemspec.licenses = metadata['copyrights'].map{ |c| c['license'] }.compact
-
- metadata['requirements'].each do |req|
- name = req['name']
- version = req['version']
- groups = req['groups'] || []
-
- case version
- when /^(.*?)\+$/
- version = ">= #{$1}"
- when /^(.*?)\-$/
- version = "< #{$1}"
- when /^(.*?)\~$/
- version = "~> #{$1}"
- end
-
- if groups.empty? or groups.include?('runtime')
- # populate runtime dependencies
- if gemspec.respond_to?(:add_runtime_dependency)
- gemspec.add_runtime_dependency(name,*version)
- else
- gemspec.add_dependency(name,*version)
- end
- else
- # populate development dependencies
- if gemspec.respond_to?(:add_development_dependency)
- gemspec.add_development_dependency(name,*version)
- else
- gemspec.add_dependency(name,*version)
- end
- end
- end
-
- # convert external dependencies into a requirements
- if metadata['external_dependencies']
- ##gemspec.requirements = [] unless metadata['external_dependencies'].empty?
- metadata['external_dependencies'].each do |req|
- gemspec.requirements << req.to_s
- end
- end
-
- # determine homepage from resources
- homepage = metadata['resources'].find{ |key, url| key =~ /^home/ }
- gemspec.homepage = homepage.last if homepage
-
- gemspec.require_paths = metadata['load_path'] || ['lib']
- gemspec.post_install_message = metadata['install_message']
-
- # RubyGems specific metadata
- gemspec.files = files
- gemspec.extensions = extensions
- gemspec.executables = executables
-
- if Gem::VERSION < '1.7.'
- gemspec.default_executable = gemspec.executables.first
- end
-
- gemspec.test_files = glob_files[patterns[:test_files]]
-
- unless gemspec.files.include?('.document')
- gemspec.extra_rdoc_files = glob_files[patterns[:doc_files]]
- end
- end
-end
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 5fe6d03..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.reap/digest
-.yardoc
-doc
-log
-pkg
-ri
-tmp
-site/doc
-web
\ No newline at end of file
diff --git a/.reap/ignore b/.reap/ignore
deleted file mode 100644
index 0b0eadf..0000000
--- a/.reap/ignore
+++ /dev/null
@@ -1,2 +0,0 @@
-ri
-work
diff --git a/.reap/pack.reap b/.reap/pack.reap
deleted file mode 100644
index c1a379d..0000000
--- a/.reap/pack.reap
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env ruby
-
-trip :pack do
- system "gem build .gemspec"
- system "mv *.gem pkg/"
-end
-
diff --git a/.reap/spec.reap b/.reap/spec.reap
deleted file mode 100644
index 251daac..0000000
--- a/.reap/spec.reap
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env ruby
-
-file "Profile", "Version" do
- system "pom spec -u"
- system "pom gemspec -u"
-end
-
-#file "Version" do
-# system "pom spec -u"
-# system "pom gemspec -u"
-#end
-
-file "Manifest", "MANIFEST" do
- system "pom gemspec -u"
-end
-
diff --git a/.reap/test.reap b/.reap/test.reap
deleted file mode 100644
index 2792a37..0000000
--- a/.reap/test.reap
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env ruby
-
-file "lib/**/*.rb" do
- system "lemon -Ilib test/*_case.rb"
-end
-
-trip :test do
- system "lemon -Ilib test/*_case.rb"
-end
-
diff --git a/.rsync-filter b/.rsync-filter
new file mode 100644
index 0000000..62c9380
--- /dev/null
+++ b/.rsync-filter
@@ -0,0 +1,8 @@
+- .svn
+- scrap
+P wiki
+P robot.txt
+P robots.txt
+P statcvs
+P statsvn
+P usage
diff --git a/.ruby b/.ruby
deleted file mode 100644
index 1407272..0000000
--- a/.ruby
+++ /dev/null
@@ -1,55 +0,0 @@
----
-source:
-- var
-authors:
-- name: Thomas Sawyer
- email: transfire@gmail.com
-copyrights:
-- holder: Thomas Sawyer, Rubyworks
- year: '2009'
-replacements: []
-alternatives: []
-requirements:
-- name: lemon
- groups:
- - test
- development: true
-- name: ae
- groups:
- - test
- development: true
-- name: detroit
- groups:
- - build
- development: true
-- name: reap
- groups:
- - build
- development: true
-dependencies: []
-conflicts: []
-repositories:
-- uri: git://github.com/rubyworks/dnote.git
- scm: git
- name: upstream
-resources:
- home: http://rubyworks.github.com/dnote
- code: http://github.com/rubyworks/dnote
- wiki: http://wiki.github.com/rubyworks/dnote
- api: http://rubydoc.info/gems/dnote
- bugs: http://github.com/rubyworks/dnote/issues
- mail: http://groups.google.com/groups/rubyworks-mailinglist
-extra: {}
-load_path:
-- lib
-revision: 0
-created: '2009-10-09'
-summary: Extract developer's notes from source code.
-title: DNote
-version: 1.7.0
-name: dnote
-description: ! 'DNote makes it easy to extract developer''s notes from source code,
-
- and supports almost any language.'
-organization: RubyWorks
-date: '2011-11-11'
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 012d328..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
----
-rvm:
- - 1.8.7
- - 1.9.2
- - 1.9.3
- - rbx-2.0
- - jruby
- - ree
-script: "bundle exec ruby-test test/*.rb"
-
diff --git a/.yardopts b/.yardopts
deleted file mode 100644
index 9a47033..0000000
--- a/.yardopts
+++ /dev/null
@@ -1,5 +0,0 @@
---protected
---private
-lib/**/*.rb
--
-[A-Z]*.*
diff --git a/Assembly b/Assembly
deleted file mode 100644
index 2be838d..0000000
--- a/Assembly
+++ /dev/null
@@ -1,35 +0,0 @@
----
-email:
- service : Email
- mailto :
- - ruby-talk@ruby-lang.org
- - rubyworks-mailinglist@googlegroups.com
-
-gem:
- active: true
-
-github:
- gh_pages: web
-
-yard:
- priority: 2
-
-dnote:
- labels : ~
- lines : 5
- output :
- - log/NOTES.rdoc
-
-vclog:
- output:
- - log/Changes.rdoc
- - log/History.rdoc
-
-#lemon:
-# tests : ~
-# exclude : ~
-# loadpath : ~
-# requires : ~
-# live : false
-# active : false
-
diff --git a/COPYING.rdoc b/COPYING.rdoc
deleted file mode 100644
index 9930cb5..0000000
--- a/COPYING.rdoc
+++ /dev/null
@@ -1,31 +0,0 @@
-= COPYRIGHT NOTICES
-
-== DNote
-
-Copyright:: (c) 2006 Thomas Sawyer, Rubyworks
-License:: BSD-2-Clause
-Website:: http://rubyworks.github.com/tapout
-
- Copyright 2006 Thomas Sawyer, Rubyworks. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/Gemfile b/Gemfile
deleted file mode 100644
index e45e65f..0000000
--- a/Gemfile
+++ /dev/null
@@ -1,2 +0,0 @@
-source :rubygems
-gemspec
diff --git a/HISTORY.rdoc b/HISTORY.rdoc
deleted file mode 100644
index 203ce65..0000000
--- a/HISTORY.rdoc
+++ /dev/null
@@ -1,171 +0,0 @@
-= RELEASE HISTORY
-
-
-== 1.7.0 / 2011-10-25
-
-This release finishes adding code context support to all formats. Use the `-c`
-option to set the number of lines to include. Note also that the rake task has
-been moved to `dnote/rake/dnotetask`.
-
-Changes:
-
-* Support code contexts in all formats.
-* Rake task moved to `dnote/rake/dnotetask`.
-
-
-== 1.6.1 / 2011-05-18
-
-Last release reused the `-c` option for context lines. This clobbered
-the shortcut option for `--custom`. To fix, this release capitalizes
-the custom shortcut to `-C`.
-
-Changes:
-
-* Capitalize custom shortcut option (-c becomes -C).
-
-
-== 1.6.0 / 2011-05-17
-
-This release adds code conext output. Select the number of
-context lines to display with the `-c` option. Currently
-only the HTML, YAML and JSON formats support context.
-
-This release also fixes the false note match that can arise when
-a class or module name with double-colons starts a comment line.
-We have changed the regex to ALWAYS REQUIRE a space after the
-label colon. Please make a note of it!
-
-Changes:
-
-* Add code context count option and output.
-* Regex changed to REQUIRE space after label colon.
-
-
-== 1.5.0 / 2010-11-27
-
-This release adds a `--url` option for defining a URL template
-string used in certain HTML/XML formats. In addition a parsing
-bug was corrected that limited some notes to one line.
-
-Changes:
-
-* Add support for configurable URLs.
-* Fix multi-line note parsing bug.
-
-
-== 1.4.0 / 2010-06-26
-
-This release adds auto-determination of marker based on file
-extension. This means DNote can now scan multiple file types
-in a single pass. The supported types are fairly small at this
-point, but cover the command cases and will expand in the future.
-The fallback marker is '#'. You can still force a particular
-marker using the --marker option.
-
-Changes:
-
-* Add support for automatic markers.
-
-
-== 1.3.1 / 2010-06-11
-
-This release fixes a simple bug. Some version of Ruby do not have
-the Enumerable#group_by method. This release provides it if it is
-missing.
-
-Changes:
-
-* Bug fix, provide #group_by when it is not present.
-
-
-== 1.3.0 / 2010-06-04
-
-This release adds support for alternate comment markers. Simply
-supply the marker with the -m option.
-
-Changes:
-
-* Add support for languages other than Ruby.
-
-
-== 1.2.0 / 2010-02-18
-
-By request this release adds additional formats, allowing notes to be
-sorted by filename as well a label. In addition, paths can now be
-excluded from the search. To implement these changes it was necessary
-to makes some significant under-the-hood adjustments, and this required
-making some adjustments to the design of the templates and the
-command-line interface.
-
-If are using any of your own custom templates you will have to make
-adjustments accordingly --which basically entails exchanging +notes.each+
-for +notes.by_label_file.each+. Also, notice that the serialization formats
-have changed accordingly to match the improved underlying model.
-
-On the command-line, the format type itself is no longer used as the
-option name, e.g. "--yaml", but instead use "-f", e.g. "-f yaml". This
-opens DNote up to many more templates. Use "-T" to get a list of all
-template format available.
-
-Changes:
-
-* Improve underlying model by adding a Note class.
-* Add --exclude and --ignore options.
-* Add new formats and rename "gnu" formats to "text".
-* Use --format/-f to designate formats.
-* Renamed --template/-t option to --custom/-c.
-* Add --templates/-T to list all format templates.
-
-
-== 1.1.0 / 2010-02-06
-
-This relase primarily adjusts the way output it rendered
-underthehood. Serialization formats are rendered as
-before but markup formats now use Erb. In the process
-two new serialization formats have been added: soap and xoxo.
-
-Also, this release renames the lib/plugin directory to
-lib/plugins (plural) per the new convention of the latest
-Plugin gem. This only matters to Syckle users.
-
-Changes:
-
-* Add Soap and XOXO formats.
-* Add actual --output option.
-* Move lib/plugin to lib/plugins.
-
-
-== 1.0.0 / 2009-10-25
-
-This relase adds support for arbitrary note labels.
-Any all-caps word followed by a colon will be
-picked-up. Common labels like TODO and FIXME are
-recognized without the trailing ':'.
-
-Changes:
-
-* Added support for arbitrary labels.
-
-
-== 0.9.0 / 2009-10-10
-
-This release adds a syckle plugin and improves output.
-
-Changes:
-
-* Add syckle plugin, based on old Notes plugin.
-* Improved HTML output ( tag should have been ).
-* If output not specified, sends rdoc to stdout.
-* If no paths specified, will scan '**/*.rb'
-
-
-== 0.8.0 / 2009-10-09
-
-This is the initial release of DNote. DNote is a spin-off
-of a Syckle (formerlly Reap) plugin which scans source
-code and compiles a list of developer notes.
-
-Changes:
-
-* Happy Birthday!
-
diff --git a/MANIFEST b/MANIFEST
deleted file mode 100644
index 1720ec2..0000000
--- a/MANIFEST
+++ /dev/null
@@ -1,55 +0,0 @@
-#!mast .ruby .yardopts bin lib man spec test try [A-Z]*.*
-.ruby
-.yardopts
-bin/dnote
-lib/dnote/core_ext.rb
-lib/dnote/format.rb
-lib/dnote/note.rb
-lib/dnote/notes.rb
-lib/dnote/rake/dnotetask.rb
-lib/dnote/session.rb
-lib/dnote/templates/html/file.erb
-lib/dnote/templates/html/label.erb
-lib/dnote/templates/html/list.erb
-lib/dnote/templates/html.erb
-lib/dnote/templates/json/file.erb
-lib/dnote/templates/json/label.erb
-lib/dnote/templates/json/list.erb
-lib/dnote/templates/json.erb
-lib/dnote/templates/md/file.erb
-lib/dnote/templates/md/label.erb
-lib/dnote/templates/md/list.erb
-lib/dnote/templates/md.erb
-lib/dnote/templates/rdoc/file.erb
-lib/dnote/templates/rdoc/label.erb
-lib/dnote/templates/rdoc/list.erb
-lib/dnote/templates/rdoc.erb
-lib/dnote/templates/soap/file.erb
-lib/dnote/templates/soap/label.erb
-lib/dnote/templates/soap/list.erb
-lib/dnote/templates/soap.erb
-lib/dnote/templates/text/file.erb
-lib/dnote/templates/text/label.erb
-lib/dnote/templates/text/list.erb
-lib/dnote/templates/text.erb
-lib/dnote/templates/xml/file.erb
-lib/dnote/templates/xml/label.erb
-lib/dnote/templates/xml/list.erb
-lib/dnote/templates/xml.erb
-lib/dnote/templates/xoxo/file.erb
-lib/dnote/templates/xoxo/label.erb
-lib/dnote/templates/xoxo/list.erb
-lib/dnote/templates/xoxo.erb
-lib/dnote/templates/yaml/file.erb
-lib/dnote/templates/yaml/label.erb
-lib/dnote/templates/yaml/list.erb
-lib/dnote/templates/yaml.erb
-lib/dnote/version.rb
-lib/dnote.rb
-test/notes_case.rb
-try/sample.bas
-try/sample.js
-try/sample.rb
-HISTORY.rdoc
-README.rdoc
-COPYING.rdoc
diff --git a/README.rdoc b/README.rdoc
deleted file mode 100644
index d2103db..0000000
--- a/README.rdoc
+++ /dev/null
@@ -1,113 +0,0 @@
-= DNote
-
-* {Homepage}[http://rubyworks.github.com/dnote]
-* {Mailing List}[http://googlegroups.com/group/rubyworks-mailinglist]
-* {Source Code}[http://github.com/rubyworks/dnote]
-
-
-== DESCRIPTION
-
-Extract development notes from source code and generate some nice
-output formats for them.
-
-
-== SYNOPSIS
-
-=== Note Structure
-
-DNote scans for the common note patterns used by developers of many languages in the form of an
-all-caps labels followed by a colon. To be more specific, for DNote to recognize a note,
-it needs to follow this simple set of rules:
-
-1) Notes start with an all-caps label punctuated with a colon, followed by the note's text.
-
- # LABEL: description ...
-
-2) Any note that requires more than one line must remain flush to the left
-margin (the margin is set by the first line). This is done because RDoc will mistake
-the note for a pre block if it is indented.
-
- # LABEL: description ...
- # continue ...
-
-3) An alternative to the previous limitation is to indent the whole note, making it
-a <pre> block when rendered by RDoc. Then the text layout is free-form.
-
- # This is a description of something...
- #
- # LABEL: description ...
- # continue ...
-
-That's all there is to it, if I can convince the developers of RDoc to recognize labels,
-we may eventually be able to relax the flush rule too, which would be very nice.
-
-There is also a command-line option, --no-colon, which deactives the need for
-a colon after the note label. However this often produces false positives, so it's use is
-discouraged.
-
-
-=== Generating Notes
-
-As you can see the commandline interface is pretty straight-forward.
-
- USAGE:
-
- dnote [OPTIONS] path1 [path2 ...]
-
- OUTPUT FORMAT: (choose one)
- -f, --format NAME select a format [text]
- -c, --custom FILE use a custom ERB template
- --file shortcut for text/file format
- --list shortcut for text/list format
-
- OTHER OPTIONS:
- -l, --label LABEL labels to collect
- --[no-]colon match labels with/without colon suffix
- -m, --marker MARK alternative remark marker
- -u --url TEMPLATE url template for line entries (for HTML)
- -x, --exclude PATH exclude file or directory
- -i, --ignore NAME ignore based on any part of the pathname
- -t, --title TITLE title to use in header
- -o, --output PATH name of file or directory
- -n, --dryrun do not actually write to disk
- --debug debug mode
-
- COMMAND OPTIONS:
- -T, --templates list available format templates
- -h, --help show this help information
-
-The default path is **/*.rb and the default format is -f rdoc.
-Here is an example of DNote's current notes in RDoc format:
-
- = Development Notes
-
- == TODO
-
- === file://lib/dnote/notes.rb
-
- * TODO: Add ability to read header notes. They often
- have a outline format, rather then the single line. (19)
- * TODO: Need good CSS file. (22)
- * TODO: Need XSL? (24)
-
- === file://plug/syckle/services/dnote.rb
-
- * TODO: Should this service be part of the +site+ cycle? (18)
-
- (4 TODOs)
-
-
-== INSTALLATION
-
-The usual RubyGem's command will do the trick.
-
- $ sudo gem install dnote
-
-
-== COPYRIGHT
-
-Copyright (c) 2006 Thomas Sawyer, Rubyworks
-
-DNote is distributable in accordance with the terms of the *FreeBSD* license.
-
-See COPYING.rdoc for details.
diff --git a/assets/images/fork-me.png b/assets/images/fork-me.png
new file mode 100644
index 0000000..146ef8a
Binary files /dev/null and b/assets/images/fork-me.png differ
diff --git a/assets/images/logo.jpg b/assets/images/logo.jpg
new file mode 100644
index 0000000..626f6f4
Binary files /dev/null and b/assets/images/logo.jpg differ
diff --git a/bin/dnote b/bin/dnote
deleted file mode 100755
index 7db04e2..0000000
--- a/bin/dnote
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env ruby
-require "dnote"
-DNote::Session.main(*ARGV)
-
diff --git a/example.html b/example.html
new file mode 100644
index 0000000..3ce9218
--- /dev/null
+++ b/example.html
@@ -0,0 +1,81 @@
+
+
Developer's take note! All those TODO's and FIXME's floating around
+ your source code are rotting away. They are trapped, and in desperate need of your attention.
+
+
But not to fret! D'Note will help you liberate them. D'Note will scan your
+ source code for labeled comments; collect, collate and sort them; and then return them to you in a
+ format of your choosing. Wunderbar!
+
+
Note Structure
+
+
D'Note scans for the common "LABEL:" pattern (all-caps label followed by a colon) used by many
+ developers of many languages. To be more specific, for D'Note to recognize a note, it needs to
+ conform to the following simple set of rules:
+
+
1) Notes start with an all-caps label punctuated with a colon, followed by the note's text.
+
+
+ # LABEL: description ...
+
+
+
+
+
2) Any note that requires more than one line must remain flush to the left
+ margin (the margin is set by the first line). This is done because RDoc will mistake
+ the second line for a <pre> block if it is indented.
+
+
+ # LABEL: description ...
+ # continue ...
+
+
+
3) An alternative to the limitation of the last rule is to indent the whole note (making
+ the whole note a <pre> block with regards to RDoc). Then the text layout is
+ free-form.
+
+
+ # This is a description of something...
+ #
+ # LABEL: description ...
+ # continue ...
+
+
+
That's all there is to it. If I can convince the developers of RDoc to add recognition of
+ labels, we may eventually be able to relax the flush rule too, which would be very nice.
+
+
There is also a command-line option, --no-colon, which deactives the need for
+ a colon after the note label. However this often produces false positives, so it's use is
+ discouraged.
+
+
Generating Notes
+
+
As you can see the commandline interface is quite straight-forward.
+
+
+ USAGE:
+
+ dnote [OPTIONS] path1 [path2 ...]
+
+ OUTPUT FORMAT: (choose one)
+ -f, --format NAME select a format [text]
+ -C, --custom FILE use a custom ERB template
+ --file shortcut for text/file format
+ --list shortcut for text/list format
+
+ OTHER OPTIONS:
+ -l, --label LABEL labels to collect
+ --[no-]colon match labels with/without colon suffix
+ -m, --marker MARK alternative remark marker
+ -u, --url TEMPLATE url template for line entries (for HTML)
+ -c, --context INTEGER number of lines of context to display
+ -x, --exclude PATH exclude file or directory
+ -i, --ignore NAME ignore file based on any part of pathname
+ -t, --title TITLE title to use in header
+ -o, --output PATH save to file or directory
+ -n, --dryrun do not actually write to disk
+ --debug debug mode
+
+ COMMAND OPTIONS:
+ -T, --templates list available format templates
+ -h, --help show this help information
+
+
+
There are a variety of formats are available, here are examples of some of the
+ XML, HTML and YAML
+ formats. You can get a list of all available format templates using the -T option.
+
+
The default path is **/*.rb and the default format -f text.
+ Here is an example of DNote's own notes in -f rdoc format:
+
+
+ = Development Notes
+
+ == TODO
+
+ === file://lib/dnote/notes.rb
+
+ * TODO: Add ability to read header notes. They often
+ have a outline format, rather then the single line. (19)
+ * TODO: Need CSS? (22)
+ * TODO: Need XSL? (24)
+
+ === file://plug/syckle/services/dnote.rb
+
+ * TODO: Should this service be part of the +site+ cycle? (18)
+
+ (4 TODOs)
+
+
+
In the future the parsing may imnprove to allow page-top outlined notes as well.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/dnote.rb b/lib/dnote.rb
deleted file mode 100644
index aeb13c5..0000000
--- a/lib/dnote.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'dnote/version'
-require 'dnote/session'
-
-# TEST: This is a test of an arbitrary label.
diff --git a/lib/dnote.yml b/lib/dnote.yml
deleted file mode 120000
index 064ee51..0000000
--- a/lib/dnote.yml
+++ /dev/null
@@ -1 +0,0 @@
-../.ruby
\ No newline at end of file
diff --git a/lib/dnote/core_ext.rb b/lib/dnote/core_ext.rb
deleted file mode 100644
index d66abad..0000000
--- a/lib/dnote/core_ext.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-module Enumerable
-
- # Taken from Ruby Facets.
- def group_by #:yield:
- #h = k = e = nil
- r = Hash.new
- each{ |e| (r[yield(e)] ||= []) << e }
- r
- end unless method_defined?(:group_by)
-
-end
-
-module DNote
-
- # Extensions for String class.
- # These methods are taken directly from Ruby Facets.
- #
- module String
-
- # Provides a margin controlled string.
- #
- # x = %Q{
- # | This
- # | is
- # | margin controlled!
- # }.margin
- #
- #
- # NOTE: This may still need a bit of tweaking.
- #
- # CREDIT: Trans
-
- def margin(n=0)
- #d = /\A.*\n\s*(.)/.match( self )[1]
- #d = /\A\s*(.)/.match( self)[1] unless d
- d = ((/\A.*\n\s*(.)/.match(self)) ||
- (/\A\s*(.)/.match(self)))[1]
- return '' unless d
- if n == 0
- gsub(/\n\s*\Z/,'').gsub(/^\s*[#{d}]/, '')
- else
- gsub(/\n\s*\Z/,'').gsub(/^\s*[#{d}]/, ' ' * n)
- end
- end
-
- # Preserves relative tabbing.
- # The first non-empty line ends up with n spaces before nonspace.
- #
- # CREDIT: Gavin Sinclair
-
- def tabto(n)
- if self =~ /^( *)\S/
- indent(n - $1.length)
- else
- self
- end
- end
-
- # Indent left or right by n spaces.
- # (This used to be called #tab and aliased as #indent.)
- #
- # CREDIT: Gavin Sinclair
- # CREDIT: Trans
-
- def indent(n)
- if n >= 0
- gsub(/^/, ' ' * n)
- else
- gsub(/^ {0,#{-n}}/, "")
- end
- end
-
- #
- #
- def tabset(n)
- i = lines.map do |line|
- line.strip.empty? ? nil : line.index(/\S/)
- end
- x = i.compact.min
- t = n - x.to_i
- t = 0 if t < 0
- indent(t)
- end
-
- end
-
- class ::String #:nodoc:
- include DNote::String
- end
-
-end
-
diff --git a/lib/dnote/format.rb b/lib/dnote/format.rb
deleted file mode 100644
index 5f507c5..0000000
--- a/lib/dnote/format.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-module DNote
-
- # = Notes Formatter
- #
- #--
- # TODO: Need good CSS file.
- #
- # TODO: Need XSL?
- #++
- class Format
-
- require 'fileutils'
- require 'erb'
- require 'rexml/text'
- require 'dnote/core_ext'
-
- #DEFAULT_OUTPUT_DIR = "log/dnote"
-
- EXTENSIONS = { 'text'=>'txt', 'soap'=>'xml', 'xoxo'=>'xml' }
-
- #
- attr :notes
-
- #
- attr_accessor :format
-
- #
- attr_accessor :subtype
-
- #
- attr_accessor :output
-
- #
- attr_accessor :template
-
- #
- attr_accessor :title
-
- #
- attr_accessor :dryrun
-
- #
- def initialize(notes, options={})
- @notes = notes
- @format = 'text'
- @subtype = 'label'
- @title = "Developer's Notes"
- @dryrun = false
- options.each{ |k,v| __send__("#{k}=", v) if v }
- yield(self) if block_given?
- end
-
- #
- def render
- if notes.empty?
- $stderr << "No #{notes.labels.join(', ')} notes.\n"
- else
- case format
- when 'custom'
- render_custom
- else
- render_template
- end
- end
- end
-
- # C U S T O M
-
- #
- def render_custom
- #raise ArgumentError unless File.exist?(template)
- result = erb(template)
- publish(result)
- end
-
- # T E M P L A T E
-
- #
- def render_template
- template = File.join(File.dirname(__FILE__), 'templates', "#{format}.erb")
- raise "No such format - #{format}" unless File.exist?(template)
- result = erb(template)
- publish(result)
- end
-
- private
-
- #
- def erb(file)
- scope = ErbScope.new(:notes=>notes, :title=>title)
- scope.render(file)
- end
-
- #
- def publish(result, fname=nil)
- if output
- write(result, fname)
- else
- puts(result)
- end
- $stderr << "(" + notes.counts.map{|l,n| "#{n} #{l}s"}.join(', ') + ")\n"
- end
-
- #
- def write(result, fname=nil)
- if output.to_s[-1,1] == '/' || File.directory?(output)
- fmt = format.split('/').first
- ext = EXTENSIONS[fmt] || fmt
- file = File.join(output, fname || "notes.#{ext}")
- else
- file = output
- end
- if dryrun?
- puts "mkdir: #{File.dirname(file)}"
- puts "write: #{file}"
- else
- dir = File.dirname(file)
- fu.mkdir(dir) unless File.exist?(dir)
- File.open(file, 'w'){ |f| f << result }
- end
- return file
- end
-
- #
- def dryrun?
- @dryrun
- end
-
- #
- def debug?
- $DEBUG
- end
-
- #
- def fu
- @fu ||= (
- if dryrun? and debug?
- FileUtils::DryRun
- elsif dryrun?
- FileUtils::Noop
- elsif debug?
- FileUtils::Verbose
- else
- FileUtils
- end
- )
- end
-
- #
- class ErbScope
- #
- def initialize(data={})
- @data = data
- end
- #
- def render(file)
- erb = ERB.new(File.read(file), nil, '<>')
- erb.result(binding)
- end
- #
- def h(string)
- REXML::Text.normalize(string)
- end
- #
- def method_missing(s, *a)
- @data[s.to_sym]
- end
- end
-
- end
-
-end
-
diff --git a/lib/dnote/note.rb b/lib/dnote/note.rb
deleted file mode 100644
index 856769f..0000000
--- a/lib/dnote/note.rb
+++ /dev/null
@@ -1,150 +0,0 @@
-module DNote
-
- # The Note class encapsulates a single note made in a source file.
- #
- # Each note instance holds a reference, +notes+, to the set of notes
- # being generated for a given session. This allows the note to access
- # general options applicable to all notes.
- class Note
-
- # Number of lines to provide in source context.
- #CONTEXT_DEPTH = 5
-
- # Set of notes to which this note belongs.
- attr :notes
-
- # The file in which the note is made.
- attr :file
-
- # The type of note.
- attr :label
-
- # The line number of the note.
- attr :line
-
- # The verbatim text of the note.
- attr :text
-
- # Remark marker used in parsing the note.
- attr :mark
-
- # Contextual lines of code.
- attr :capture
-
- # Initialize new Note instance.
- def initialize(notes, file, label, line, text, mark)
- @notes = notes
-
- @file = file
- @label = label
- @line = line
- @text = text.rstrip
- @mark = mark
- @capture = []
- end
-
- # Convert to string representation.
- def to_s
- "#{label}: #{text}"
- end
-
- # Convert to string representation.
- def to_str
- "#{label}: #{text}"
- end
-
- # Remove newlines from note text.
- def textline
- text.gsub("\n", " ")
- end
-
- # Sort by file name and line number.
- def <=>(other)
- s = file <=> other.file
- return s unless s == 0
- line <=> other.line
- end
-
- # Convert to Hash.
- #--
- # TODO: Add +url+?
- # TODO: Add +code+? Problem is that xml needs code in CDATA.
- #++
- def to_h
- { 'label'=>label, 'text'=>textline, 'file'=>file, 'line'=>line }
- end
-
- # Convert to Hash, leaving the note text verbatim.
- def to_h_raw
- { 'label'=>label, 'text'=>text, 'file'=>file, 'line'=>line, 'code'=>code }
- end
-
- # Convert to JSON.
- def to_json(*args)
- to_h_raw.to_json(*args)
- end
-
- # Convert to YAML.
- def to_yaml(*args)
- to_h_raw.to_yaml(*args)
- end
-
- # Return line URL based on URL template. If no template was set, then
- # returns the file.
- def url
- if notes.url
- notes.url % [file, line]
- else
- file
- end
- end
-
- #
- def code
- unindent(capture).join
- end
-
- # Is there code to show?
- def code?
- !capture.empty?
- end
-
-=begin
- # This isn't being used currently b/c the URL solution as deeemd better,
- # but the code is here for custom templates.
- def capture
- @context ||= (
- lines = file_cache(file) #.lines.to_a
- count = line()
- count +=1 while /^\s*#{mark}/ =~ lines[count]
- lines[count, context_depth]
- )
- end
-
- # Read in +file+, parse into lines and cache.
- def file_cache(file)
- @@file_cache ||= {}
- @@file_cache[file] ||= File.read(file).lines.to_a
- end
-=end
-
- private
-
- # Remove blank space from lines.
- def unindent(lines)
- dents = []
- lines.each do |line|
- if md = /^([\ ]*)/.match(line)
- size = md[1].size
- dents << md[1]
- end
- end
- dent = dents.min{ |a,b| a.size <=> b.size }
- lines.map do |line|
- line.sub(dent, '')
- end
- end
-
- end
-
-end
diff --git a/lib/dnote/notes.rb b/lib/dnote/notes.rb
deleted file mode 100644
index 9a29977..0000000
--- a/lib/dnote/notes.rb
+++ /dev/null
@@ -1,320 +0,0 @@
-require 'pathname'
-require 'dnote/note'
-
-module DNote
-
- # = Developer Notes
- #
- # This class goes through you source files and compiles a list
- # of any labeled comments. Labels are all-cap single word prefixes
- # to a comment ending in a colon.
- #
- # Special labels do not require the colon. By default these are
- # +TODO+, +FIXME+, +OPTIMIZE+, +THINK+ and +DEPRECATE+.
- #
- #--
- # TODO: Add ability to read header notes. They often
- # have a outline format, rather then the single line.
- #++
- class Notes
- include Enumerable
-
- # Default paths (all ruby scripts).
- DEFAULT_PATHS = ["**/*.rb"]
-
- # Default note labels to look for in source code. (NOT CURRENTLY USED!)
- DEFAULT_LABELS = ['TODO', 'FIXME', 'OPTIMIZE', 'THINK', 'DEPRECATE']
-
- # Files to search for notes.
- attr_accessor :files
-
- # Labels to document. Defaults are: +TODO+, +FIXME+, +OPTIMIZE+ and +DEPRECATE+.
- attr_accessor :labels
-
- # Require label colon? Default is +true+.
- attr_accessor :colon
-
- # Specific remark marker (+nil+ for auto).
- attr_accessor :marker
-
- # Link template.
- attr_accessor :url
-
- # Number of lines of context to show.
- attr_accessor :context
-
- # New set of notes for give +files+ and optional special labels.
- def initialize(files, options={})
- @files = [files].flatten
- @labels = [options[:labels] || DEFAULT_LABELS].flatten.compact
- @colon = options[:colon].nil? ? true : options[:colon]
- @marker = options[:marker] #|| '#'
- @url = options[:url]
- @context = options[:context] || 0
-
- @remark = {}
-
- parse
- end
-
- # Array of notes.
- def notes
- @notes
- end
-
- # Notes counts by label.
- def counts
- @counts ||= (
- h = {}
- by_label.each do |label, notes|
- h[label] = notes.size
- end
- h
- )
- end
-
- # Iterate through notes.
- def each(&block)
- notes.each(&block)
- end
-
- # No notes?
- def empty?
- notes.empty?
- end
-
- # Gather notes.
- #--
- # TODO: Play golf with Notes#parse.
- #++
- def parse
- records = []
- files.each do |fname|
- next unless File.file?(fname)
- #next unless fname =~ /\.rb$/ # TODO: should this be done?
- mark = remark(fname)
- lineno, note, text, capt = 0, nil, nil, nil
- File.readlines(fname).each do |line|
- #while line = f.gets
- lineno += 1
- note = match(line, lineno, fname)
- if note
- #file = fname
- text = note.text
- capt = note.capture
- #note = {'label'=>label,'file'=>file,'line'=>line_no,'note'=>text}
- records << note
- else
- if text
- case line
- when /^\s*#{mark}+\s*$/, /^\s*#{mark}\-\-/, /^\s*#{mark}\+\+/
- text.strip!
- text = nil
- when /^\s*#{mark}/
- if text[-1,1] == "\n"
- text << line.gsub(/^\s*#{mark}\s*/,'')
- else
- text << "\n" << line.gsub(/^\s*#{mark}\s*/,'')
- end
- else
- text.strip!
- text = nil
- end
- else
- if line !~ /^\s*#{mark}/
- capt << line if capt && capt.size < context
- end
- end
- end
- #end
- end
- end
-
- @notes = records.sort
- end
-
- # Is this line a note?
- def match(line, lineno, file)
- if labels.empty?
- match_general(line, lineno, file)
- else
- match_special(line, lineno, file)
- end
- end
-
- # Match special notes.
- def match_special(line, lineno, file)
- rec = nil
- labels.each do |label|
- if md = match_special_regex(label, file).match(line)
- text = md[1]
- #rec = {'label'=>label,'file'=>file,'line'=>lineno,'note'=>text}
- rec = Note.new(self, file, label, lineno, text, remark(file))
- end
- end
- rec
- end
-
- #--
- # TODO: ruby-1.9.1-p378 reports: `match': invalid byte sequence in UTF-8
- #++
- def match_special_regex(label, file)
- mark = remark(file)
- if colon
- /#{mark}\s*#{Regexp.escape(label)}[:]\s+(.*?)$/
- else
- /#{mark}\s*#{Regexp.escape(label)}[:]?\s+(.*?)$/
- end
- end
-
- # Match notes that are labeled with a colon.
- def match_general(line, lineno, file)
- rec = nil
- if md = match_general_regex(file).match(line)
- label, text = md[1], md[2]
- #rec = {'label'=>label,'file'=>file,'line'=>lineno,'note'=>text}
- rec = Note.new(self, file, label, lineno, text, remark(file))
- end
- return rec
- end
-
- # Keep in mind that general non-colon matches have a higher potential
- # of false positives.
- def match_general_regex(file)
- mark = remark(file)
- if colon
- /#{mark}\s*([A-Z]+)[:]\s+(.*?)$/
- else
- /#{mark}\s*([A-Z]+)\s+(.*?)$/
- end
- end
-
- # Organize notes into a hash with labels for keys.
- def by_label
- @by_label ||= (
- list = {}
- notes.each do |note|
- list[note.label] ||= []
- list[note.label] << note
- list[note.label].sort #!{ |a,b| a.line <=> b.line }
- end
- list
- )
- end
-
- # Organize notes into a hash with filename for keys.
- def by_file
- @by_file ||= (
- list = {}
- notes.each do |note|
- list[note.file] ||= []
- list[note.file] << note
- list[note.file].sort! #!{ |a,b| a.line <=> b.line }
- end
- list
- )
- end
-
- # Organize notes into a hash with labels for keys, followed
- # by a hash with filename for keys.
- def by_label_file
- @by_label ||= (
- list = {}
- notes.each do |note|
- list[note.label] ||= {}
- list[note.label][note.file] ||= []
- list[note.label][note.file] << note
- list[note.label][note.file].sort! #{ |a,b| a.line <=> b.line }
- end
- list
- )
- end
-
- # Organize notes into a hash with filenames for keys, followed
- # by a hash with labels for keys.
- def by_file_label
- @by_file ||= (
- list = {}
- notes.each do |note|
- list[note.file] ||= {}
- list[note.file][note.label] ||= []
- list[note.file][note.label] << note
- list[note.file][note.label].sort! #{ |a,b| a.line <=> b.line }
- end
- list
- )
- end
-
- # Convert to an array of hashes.
- def to_a
- notes.map{ |n| n.to_h }
- end
-
- # Same as #by_label.
- def to_h
- by_label
- end
-
- #
- def remark(file)
- @remark[File.extname(file)] ||= (
- mark = guess_marker(file)
- Regexp.escape(mark)
- )
- end
-
- # Guess marker based on file extension. Fallsback to '#'
- # if the extension is unknown.
- #
- # TODO: Continue to add comment types.
- def guess_marker(file)
- return @marker if @marker # forced marker
- case File.extname(file)
- when '.js', '.c', 'cpp', '.css'
- '//'
- when '.bas'
- "'"
- when '.sql', '.ada'
- '--'
- when '.asm'
- ';'
- else
- '#'
- end
- end
-
- # Convert to array of hashes then to YAML.
- #def to_yaml
- # require 'yaml'
- # to_a.to_yaml
- #end
-
- # Convert to array of hashes then to JSON.
- #def to_json
- # begin
- # require 'json'
- # rescue LoadError
- # require 'json_pure'
- # end
- # to_a.to_json
- #end
-
- # Convert to array of hashes then to a SOAP XML envelope.
- #def to_soap
- # require 'soap/marshal'
- # SOAP::Marshal.marshal(to_a)
- #end
-
- # XOXO microformat.
- #--
- # TODO: Would to_xoxo be better organized by label and or file?
- #++
- #def to_xoxo
- # require 'xoxo'
- # to_a.to_xoxo
- #end
-
- end
-
-end
-
diff --git a/lib/dnote/rake/dnotetask.rb b/lib/dnote/rake/dnotetask.rb
deleted file mode 100644
index f603471..0000000
--- a/lib/dnote/rake/dnotetask.rb
+++ /dev/null
@@ -1,116 +0,0 @@
-module DNote
-
- # = Developmer's Notes Rake Task
- #
- class RakeTask < Rake::TaskLib
-
- require 'rake/clean'
-
- # Default note labels to looked for in source code.
- DEFAULT_LABELS = ['TODO', 'FIXME', 'OPTIMIZE', 'DEPRECATE']
-
- # File paths to search.
- attr_accessor :files
-
- # Labels to document. Defaults are: TODO, FIXME, OPTIMIZE and DEPRECATE.
- attr_accessor :labels
-
- # Formats (xml, html, rdoc, rdoc/list and so on).
- attr_accessor :formats
-
- # Exclude paths.
- attr_accessor :exclude
-
- # Ignore paths based on any part of pathname.
- attr_accessor :ignore
-
- # Output directory to save notes file. Defaults to dnote/ under
- # the project log directory (eg. log/dnote/).
- attr_accessor :output
-
- # Title to use if temaplte can use it.
- attr_accessor :title
-
- #
- def output=(path)
- @output = Pathname.new(path)
- end
-
- #
- def init
- require 'dnote'
- require 'dnote/format'
- @files = "**/*.rb"
- @output = 'log/dnote'
- @formats = ['index']
- @labels = nil #DEFAULT_LABELS
- end
-
- #
- def define
- desc "Collect Developer's Notes"
- task 'dnote' do
- document
- end
- task 'dnote:clobber' do
- clean
- end
- task :clobber => ['dnote:clobber']
- end
-
- # Generate notes document(s).
- def document
- abort "dnote: #{output} is not a directory" unless output.directory?
-
- session = ::DNote::Session.new do |s|
- s.paths = files
- s.exclude = exclude
- s.ignore = ignore
- s.labels = labels #|| DEFAULT_LABELS
- s.title = title
- s.output = output
- s.dryrun = application.options.dryrun #trial?
- end
-
- formats.each do |format|
- if format == 'index'
- session.format = 'html'
- session.output = File.join(self.output, 'index.html')
- else
- session.format = format
- end
- session.run
- report "Updated #{output.to_s.sub(Dir.pwd+'/','')}" unless trial?
- end
- end
-
- # Reset output directory, marking it as out-of-date.
- def reset
- #if File.directory?(output)
- File.utime(0,0,output) unless $NOOP
- puts "Marked #{output} as out-of-date"
- #end
- end
-
- # Remove output files.
- def clean
- #if File.directory?(output)
- formats.each do |format|
- if format == 'index'
- file = (output + "index.html").to_s
- else
- ext = ::DNote::Format::EXTENSIONS[format] || format
- file = (output + "notes.#{ext}").to_s
- end
- rm(file)
- report "Removed #{output}"
- end
- #else
- # rm(output)
- # report "Removed #{output}"
- #end
- end
-
- end
-
-end
diff --git a/lib/dnote/session.rb b/lib/dnote/session.rb
deleted file mode 100644
index a0c911b..0000000
--- a/lib/dnote/session.rb
+++ /dev/null
@@ -1,269 +0,0 @@
-module DNote
-
- require 'dnote/core_ext'
- require 'dnote/notes'
- require 'dnote/format'
-
- # User session which is used by commandline interface.
- #
- # By making this a class it makes it easy for external
- # libraries to use this library just as if they were
- # calling the commandline, but without the need to shellout.
- #
- class Session
-
- # Directory relative to this script. This is used
- # to lookup the available format templates.
- DIR = File.dirname(__FILE__)
-
- # Default format.
- DEFAULT_FORMAT = "text"
-
- # Default title.
- DEFAULT_TITLE = "Developer's Notes"
-
- # Paths to include.
- attr_accessor :paths
-
- # Paths to exclude (match by pathname).
- attr_reader :exclude
-
- # Paths to ignore (match by basename).
- attr_reader :ignore
-
- # Labels to lookup.
- # By default these are TODO, FIXME and OPTIMIZE.
- attr_accessor :labels
-
- # Selected labels can optionally do without the colon.
- attr_accessor :colon
-
- # Alternate remark marker. Useful to other languages besides Ruby.
- attr_accessor :marker
-
- # Output format.
- attr_accessor :format
-
- # If custom format, specify template file.
- attr_accessor :template
-
- # Some format put a title at the top of the output.
- # The default is "Developer's Notes".
- attr_accessor :title
-
- # Output to a file instead of STDOUT.
- attr_accessor :output
-
- # If output path given, don't actually write to disk.
- attr_accessor :dryrun
-
- # String template for line URLs (mainly for HTML format). For example,
- # DNote uses GitHub so we could use a link template:
- #
- # "https://github.com/rubyworks/dnote/blob/master/%s#L%s"
- #
- attr_accessor :url
-
- # Number of lines of context to display. The default is zero.
- attr_accessor :context
-
- private
-
- # New Session.
- def initialize(options={})
- options ||= {}
- initialize_defaults
- options.each{ |k,v| __send__("#{k}=", v) }
- yield(self) if block_given?
- end
-
- # Set default values for attributes.
- def initialize_defaults
- @paths = []
- @labels = []
- @exclude = []
- @ignore = []
- @format = DEFAULT_FORMAT
- @title = DEFAULT_TITLE
- @dryrun = false
- @marker = nil
- @url = nil
- @context = 0
- end
-
- public
-
- # Set exclude list ensuring that the value is an array.
- def exclude=(list)
- @exclude = [list].compact.flatten.compact
- end
-
- # Set ignore list ensuring that the value is an array.
- def ignore=(list)
- @ignore = [list].compact.flatten.compact
- end
-
- # Run session.
- def run
- notes = Notes.new(files, :labels=>labels, :colon=>colon, :marker=>marker, :url=>url, :context=>context)
- formatter = Format.new(notes) do |f|
- f.format = format
- f.template = template
- f.title = title
- f.output = output
- end
- formatter.render
- end
-
- # Collect path globs and remove exclusions.
- # This method uses #paths, #exclude and #ignore to
- # compile the list of files.
- def files
- list = [paths].flatten.compact
- list = ['**/*.rb'] if list.empty?
- list = glob(list)
- list = list - glob(exclude)
- list.reject do |path|
- path.split('/').any?{ |part| ignore.any?{ |ig| File.fnmatch?(ig, part) } }
- end
- end
-
- # Collect the file glob of each path given. If
- # a path is a directory, inclue all content.
- def glob(paths)
- paths.map do |path|
- if File.directory?(path)
- Dir.glob(File.join(path, '**/*'))
- else
- Dir.glob(path)
- end
- end.flatten.uniq
- end
-
- # Set special labels.
- #def labels=(labels)
- # @labels = (
- # case labels
- # when String
- # labels.split(/[:;,]/)
- # else
- # labels = [labels].flatten.compact.uniq.map{ |s| s.to_s }
- # end
- # )
- #end
-
- # Commandline interface.
- def self.main(*argv)
- require 'optparse'
-
- session = Session.new
-
- opts = OptionParser.new do |opt|
- opt.banner = "DNote v#{DNote::VERSION}"
-
- opt.separator(" ")
- opt.separator("USAGE:\n dnote [OPTIONS] path1 [path2 ...]")
-
- opt.separator(" ")
- opt.separator("OUTPUT FORMAT: (choose one)")
-
- opt.on("--format", "-f NAME", "select a format [text]") do |format|
- session.format = format
- end
-
- opt.on("--custom", "-C FILE", "use a custom ERB template") do |file|
- session.format = 'custom'
- session.template = file
- end
-
- opt.on("--file", "shortcut for text/file format") do
- session.format = 'text/file'
- end
-
- opt.on("--list", "shortcut for text/list format") do
- session.format = 'text/list'
- end
-
- opt.separator(" ")
- opt.separator("OTHER OPTIONS:")
-
- opt.on("--label", "-l LABEL", "labels to collect") do |lbl|
- session.labels.concat(lbl.split(':'))
- end
-
- opt.on("--[no-]colon", "match labels with/without colon suffix") do |val|
- session.colon = val
- end
-
- opt.on("--marker", "-m MARK", "alternative remark marker") do |mark|
- session.marker = mark
- end
-
- opt.on("--url", "-u TEMPLATE", "url template for line entries (for HTML)") do |url|
- session.url = url
- end
-
- opt.on("--context", "-c INTEGER", "number of lines of context to display") do |int|
- session.context = int.to_i
- end
-
- opt.on("--exclude", "-x PATH", "exclude file or directory") do |path|
- session.exclude << path
- end
-
- opt.on("--ignore", "-i NAME", "ignore file based on any part of pathname") do |name|
- session.ignore << name
- end
-
- opt.on("--title", "-t TITLE", "title to use in header") do |title|
- session.title = title
- end
-
- opt.on("--output", "-o PATH", "save to file or directory") do |path|
- session.output = path
- end
-
- opt.on("--dryrun", "-n", "do not actually write to disk") do
- session.dryrun = true
- end
-
- opt.on("--debug", "debug mode") do
- $DEBUG = true
- $VERBOSE = true
- end
-
- opt.separator(" ")
- opt.separator("COMMAND OPTIONS:")
-
- opt.on_tail('--templates', "-T", "list available format templates") do
- tdir = File.join(DIR, 'templates')
- tfiles = Dir[File.join(tdir, '**/*.erb')]
- tnames = tfiles.map{ |tname| tname.sub(tdir+'/', '').chomp('.erb') }
- groups = tnames.group_by{ |tname| tname.split('/').first }
- groups.sort.each do |(type, names)|
- puts("%-18s " * names.size % names.sort)
- end
- exit
- end
-
- opt.on_tail('--help', '-h', "show this help information") do
- puts opt
- exit
- end
- end
-
- begin
- opts.parse!(argv)
- session.paths.replace(argv)
- session.run
- rescue => err
- raise err if $DEBUG
- puts err
- exit 1
- end
- end
-
- end
-
-end
-
diff --git a/lib/dnote/templates/html.erb b/lib/dnote/templates/html.erb
deleted file mode 100644
index a16d15e..0000000
--- a/lib/dnote/templates/html.erb
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
- <%= title %>
-
-
-
-
-
-
<%= title %>
-
-<% notes.by_label_file.each do |label, per_file| %>
-