Commit 60fc98a2 by Cuong Tran
parent 7b5d2ed7
== 0.0.1 2008-02-27 == 1.0.2 2008-03-22
* Add contributions from Michael Bumann (http://github.com/bumi)
* added an option "position" to choose to put the annotation,
* spec/fixtures now also get annotated
* added a task to remove the annotations
* these options can be specified from command line as -d and -p [before|after]
* 1 major enhancement:
* Initial release
...@@ -28,6 +28,9 @@ created comment block. ...@@ -28,6 +28,9 @@ created comment block.
cd [your project] cd [your project]
annotate annotate
annotate -d
annotate -p [before|after]
annotate -h
== Source == Source
...@@ -41,6 +44,7 @@ Released under the same license as Ruby. No Support. No Warranty. ...@@ -41,6 +44,7 @@ Released under the same license as Ruby. No Support. No Warranty.
== Modifications == Modifications
- alex@pivotallabs.com - alex@pivotallabs.com
- ctran@pragmaquest.com - Cuong Tran - http://github.com/ctran
- Jack Danger at http://6brand.com/ - Jack Danger - http://github.com/JackDanger
- Michael Bumann - http://github.com/bumi
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'optparse'
require 'annotate_models/tasks' require 'annotate_models/tasks'
Rake::Task['annotate_models'].invoke task = "annotate_models"
OptionParser.new do |opts|
opts.banner = "Usage: annotate [options]"
opts.on('-d', '--delete') { task = "remove_annotation" }
opts.on('-p', '--position [before|after]', ['before', 'after']) { |p| ENV['position'] = p }
end.parse!
Rake::Task[task].invoke
Mon, 10 Mar 2008 02:26:29 -0500 Sat, 22 Mar 2008 21:58:55 -0500
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Last Update:</strong></td> <td><strong>Last Update:</strong></td>
<td>Mon Mar 10 01:50:15 -0500 2008</td> <td>Sat Mar 22 21:48:28 -0500 2008</td>
</tr> </tr>
</table> </table>
</div> </div>
...@@ -69,12 +69,23 @@ ...@@ -69,12 +69,23 @@
<div id="contextContent"> <div id="contextContent">
<div id="description"> <div id="description">
<h2>0.0.1 2008-02-27</h2> <h2>1.0.2 2008-03-22</h2>
<ul> <ul>
<li>1 major enhancement: <li>Add contributions from Michael Bumann (<a
href="http://github.com/bumi">github.com/bumi</a>)
<ul> <ul>
<li>Initial release <li>added an option &quot;position&quot; to choose to put the annotation,
</li>
<li>spec/fixtures now also get annotated
</li>
<li>added a task to remove the annotations
</li>
<li>these options can be specified from command line as -d and -p
[before|after]
</li> </li>
</ul> </ul>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Last Update:</strong></td> <td><strong>Last Update:</strong></td>
<td>Mon Mar 10 01:50:15 -0500 2008</td> <td>Sat Mar 22 20:47:25 -0500 2008</td>
</tr> </tr>
</table> </table>
</div> </div>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Last Update:</strong></td> <td><strong>Last Update:</strong></td>
<td>Mon Mar 10 01:50:15 -0500 2008</td> <td>Sat Mar 22 21:53:08 -0500 2008</td>
</tr> </tr>
</table> </table>
</div> </div>
...@@ -103,6 +103,9 @@ block. ...@@ -103,6 +103,9 @@ block.
<pre> <pre>
cd [your project] cd [your project]
annotate annotate
annotate -d
annotate -p [before|after]
annotate -h
</pre> </pre>
<h2>Source</h2> <h2>Source</h2>
<pre> <pre>
...@@ -119,7 +122,9 @@ Released under the same license as Ruby. No Support. No Warranty. ...@@ -119,7 +122,9 @@ Released under the same license as Ruby. No Support. No Warranty.
<h2>Modifications</h2> <h2>Modifications</h2>
<pre> <pre>
- alex@pivotallabs.com - alex@pivotallabs.com
- ctran@pragmaquest.com - Cuong Tran - http://github.com/ctran
- Jack Danger - http://github.com/JackDanger
- Michael Bumann - http://github.com/bumi
</pre> </pre>
</div> </div>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Last Update:</strong></td> <td><strong>Last Update:</strong></td>
<td>Mon Mar 10 02:16:17 -0500 2008</td> <td>Sat Mar 22 21:29:04 -0500 2008</td>
</tr> </tr>
</table> </table>
</div> </div>
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<h3 class="section-bar">Required files</h3> <h3 class="section-bar">Required files</h3>
<div class="name-list"> <div class="name-list">
optparse&nbsp;&nbsp;
annotate_models/tasks&nbsp;&nbsp; annotate_models/tasks&nbsp;&nbsp;
</div> </div>
</div> </div>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Last Update:</strong></td> <td><strong>Last Update:</strong></td>
<td>Mon Mar 10 02:16:17 -0500 2008</td> <td>Sat Mar 22 20:47:25 -0500 2008</td>
</tr> </tr>
</table> </table>
</div> </div>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Last Update:</strong></td> <td><strong>Last Update:</strong></td>
<td>Mon Mar 10 02:19:56 -0500 2008</td> <td>Sat Mar 22 21:42:43 -0500 2008</td>
</tr> </tr>
</table> </table>
</div> </div>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Last Update:</strong></td> <td><strong>Last Update:</strong></td>
<td>Mon Mar 10 02:19:56 -0500 2008</td> <td>Sat Mar 22 21:39:51 -0500 2008</td>
</tr> </tr>
</table> </table>
</div> </div>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Last Update:</strong></td> <td><strong>Last Update:</strong></td>
<td>Mon Mar 10 01:50:15 -0500 2008</td> <td>Sat Mar 22 21:56:42 -0500 2008</td>
</tr> </tr>
</table> </table>
</div> </div>
...@@ -105,7 +105,13 @@ can run from command line ...@@ -105,7 +105,13 @@ can run from command line
h2. Demonstration of usage h2. Demonstration of usage
</p> </p>
<p> <p>
Go to your RAILS_ROOT dir, then run <tt>annotate</tt> Go to your project dir (RAILS_ROOT), then run: <tt>annotate</tt>
</p>
<p>
To remove annotations: <tt>annotate -d</tt>
</p>
<p>
To add annotations at the end of files: <tt>annotate -p after</tt>
</p> </p>
<p> <p>
h2. How to submit patches h2. How to submit patches
...@@ -116,7 +122,7 @@ href="http://drnicwilliams.com/2008/02/03/using-git-within-a-team">drnicwilliams ...@@ -116,7 +122,7 @@ href="http://drnicwilliams.com/2008/02/03/using-git-within-a-team">drnicwilliams
</p> </p>
<p> <p>
The trunk repository is <tt><a The trunk repository is <tt><a
href="http://github.com/ctran/annotate_models">github.com/ctran/annotate_models</a></tt>. href="http://github.com/ctran/annotate_models">github.com/ctran/annotate_models</a></tt>
</p> </p>
<p> <p>
A svn mirror is on rubyforge A svn mirror is on rubyforge
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<!-- <!--
annotate-models's annotate-models-1.0.1 Documentation annotate-models-1.0.2 Documentation
--> -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<title> annotate-models's annotate-models-1.0.1 Documentation</title> <title> annotate-models-1.0.2 Documentation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head> </head>
<frameset rows="20%, 80%"> <frameset rows="20%, 80%">
......
...@@ -46,9 +46,14 @@ module AnnotateModels ...@@ -46,9 +46,14 @@ module AnnotateModels
end end
# Add a schema block to a file. If the file already contains # Add a schema block to a file. If the file already contains
# a schema info block (a comment starting # a schema info block (a comment starting with "Schema as of ..."), remove it first.
# with "Schema as of ..."), remove it first. #
# === Options (opts)
# :position<Symbol>:: where to place the annotated section in fixture or model file,
# "before" or "after". Default is "before".
# :position_in_class<Symbol>:: where to place the annotated section in model file
# :position_in_fixture<Symbol>:: where to place the annotated section in fixture file
#
def annotate_one_file(file_name, info_block, options={}) def annotate_one_file(file_name, info_block, options={})
if File.exist?(file_name) if File.exist?(file_name)
content = File.read(file_name) content = File.read(file_name)
...@@ -57,7 +62,7 @@ module AnnotateModels ...@@ -57,7 +62,7 @@ module AnnotateModels
content.sub!(/^# #{PREFIX}.*?\n(#.*\n)*\n/, '') content.sub!(/^# #{PREFIX}.*?\n(#.*\n)*\n/, '')
# Write it back # Write it back
new_content = options[:position] == "before" ? (info_block + content) : (content + info_block) new_content = options[:position] == "after" ? (content + info_block) : (info_block + content)
File.open(file_name, "w") { |f| f.puts new_content } File.open(file_name, "w") { |f| f.puts new_content }
end end
end end
......
...@@ -2,7 +2,7 @@ module AnnotateModels #:nodoc: ...@@ -2,7 +2,7 @@ module AnnotateModels #:nodoc:
module VERSION #:nodoc: module VERSION #:nodoc:
MAJOR = 1 MAJOR = 1
MINOR = 0 MINOR = 0
TINY = 1 TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.') STRING = [MAJOR, MINOR, TINY].join('.')
end end
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<h1>annotate-models</h1> <h1>annotate-models</h1>
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/annotate-models"; return false'> <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/annotate-models"; return false'>
<p>Get Version</p> <p>Get Version</p>
<a href="http://rubyforge.org/projects/annotate-models" class="numbers">1.0.1</a> <a href="http://rubyforge.org/projects/annotate-models" class="numbers">1.0.2</a>
</div> </div>
<h1>&#x2192; &#8216;annotate-models&#8217;</h1> <h1>&#x2192; &#8216;annotate-models&#8217;</h1>
...@@ -62,7 +62,13 @@ This is now a gem that can run from command line</p> ...@@ -62,7 +62,13 @@ This is now a gem that can run from command line</p>
<h2>Demonstration of usage</h2> <h2>Demonstration of usage</h2>
<p>Go to your <span class="caps">RAILS</span>_ROOT dir, then run <code>annotate</code></p> <p>Go to your project dir (RAILS_ROOT), then run: <code>annotate</code></p>
<p>To remove annotations: <code>annotate -d</code></p>
<p>To add annotations at the end of files: <code>annotate -p after</code></p>
<h2>How to submit patches</h2> <h2>How to submit patches</h2>
...@@ -71,7 +77,7 @@ This is now a gem that can run from command line</p> ...@@ -71,7 +77,7 @@ This is now a gem that can run from command line</p>
<p>See <a href="http://drnicwilliams.com/2008/02/03/using-git-within-a-team/">Using Git within a project</a></p> <p>See <a href="http://drnicwilliams.com/2008/02/03/using-git-within-a-team/">Using Git within a project</a></p>
<p>The trunk repository is <code>http://github.com/ctran/annotate_models</code>.</p> <p>The trunk repository is <code>http://github.com/ctran/annotate_models</code></p>
<p>A svn mirror is on rubyforge <code>svn://rubyforge.org/var/svn/annotate-models/trunk</code></p> <p>A svn mirror is on rubyforge <code>svn://rubyforge.org/var/svn/annotate-models/trunk</code></p>
...@@ -88,7 +94,7 @@ This is now a gem that can run from command line</p> ...@@ -88,7 +94,7 @@ This is now a gem that can run from command line</p>
<p>Comments are welcome. Send an email to <a href="mailto:ctran@pragmaquest.com">Cuong Tran</a></p> <p>Comments are welcome. Send an email to <a href="mailto:ctran@pragmaquest.com">Cuong Tran</a></p>
<p class="coda"> <p class="coda">
<a href="http://www.pragmaquest.com">Cuong Tran</a>, 10th March 2008<br> <a href="http://www.pragmaquest.com">Cuong Tran</a>, 22nd March 2008<br>
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a> Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
</p> </p>
</div> </div>
......
...@@ -21,13 +21,17 @@ This is now a gem that can run from command line ...@@ -21,13 +21,17 @@ This is now a gem that can run from command line
h2. Demonstration of usage h2. Demonstration of usage
Go to your RAILS_ROOT dir, then run <code>annotate</code> Go to your project dir (RAILS_ROOT), then run: <code>annotate</code>
To remove annotations: <code>annotate -d</code>
To add annotations at the end of files: <code>annotate -p after</code>
h2. How to submit patches h2. How to submit patches
See "Using Git within a project":http://drnicwilliams.com/2008/02/03/using-git-within-a-team/ See "Using Git within a project":http://drnicwilliams.com/2008/02/03/using-git-within-a-team/
The trunk repository is <code>http://github.com/ctran/annotate_models</code>. The trunk repository is <code>http://github.com/ctran/annotate_models</code>
A svn mirror is on rubyforge <code>svn://rubyforge.org/var/svn/annotate-models/trunk</code> A svn mirror is on rubyforge <code>svn://rubyforge.org/var/svn/annotate-models/trunk</code>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment