Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuong Tran committed Mar 23, 2008
1 parent 7b5d2ed commit 60fc98a
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 34 deletions.
11 changes: 8 additions & 3 deletions History.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
== 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
8 changes: 6 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ created comment block.

cd [your project]
annotate
annotate -d
annotate -p [before|after]
annotate -h

== Source

Expand All @@ -41,6 +44,7 @@ Released under the same license as Ruby. No Support. No Warranty.

== Modifications
- [email protected]
- [email protected]
- Jack Danger at http://6brand.com/
- Cuong Tran - http://github.com/ctran
- Jack Danger - http://github.com/JackDanger
- Michael Bumann - http://github.com/bumi

11 changes: 10 additions & 1 deletion bin/annotate
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/usr/bin/env ruby

require 'optparse'
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
2 changes: 1 addition & 1 deletion doc/created.rid
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Mon, 10 Mar 2008 02:26:29 -0500
Sat, 22 Mar 2008 21:58:55 -0500
19 changes: 15 additions & 4 deletions doc/files/History_txt.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>History.txt</h1>
</tr>
<tr class="top-aligned-row">
<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>
</table>
</div>
Expand All @@ -69,12 +69,23 @@ <h1>History.txt</h1>
<div id="contextContent">

<div id="description">
<h2>0.0.1 2008-02-27</h2>
<h2>1.0.2 2008-03-22</h2>
<ul>
<li>1 major enhancement:
<li>Add contributions from Michael Bumann (<a
href="http://github.com/bumi">github.com/bumi</a>)

<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>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion doc/files/License_txt.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>License.txt</h1>
</tr>
<tr class="top-aligned-row">
<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>
</table>
</div>
Expand Down
9 changes: 7 additions & 2 deletions doc/files/README_txt.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>README.txt</h1>
</tr>
<tr class="top-aligned-row">
<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>
</table>
</div>
Expand Down Expand Up @@ -103,6 +103,9 @@ <h2>Usage</h2>
<pre>
cd [your project]
annotate
annotate -d
annotate -p [before|after]
annotate -h
</pre>
<h2>Source</h2>
<pre>
Expand All @@ -119,7 +122,9 @@ <h2>Author</h2>
<h2>Modifications</h2>
<pre>
- [email protected]
- [email protected]
- Cuong Tran - http://github.com/ctran
- Jack Danger - http://github.com/JackDanger
- Michael Bumann - http://github.com/bumi
</pre>

</div>
Expand Down
3 changes: 2 additions & 1 deletion doc/files/bin/annotate.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>annotate</h1>
</tr>
<tr class="top-aligned-row">
<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>
</table>
</div>
Expand All @@ -73,6 +73,7 @@ <h1>annotate</h1>
<h3 class="section-bar">Required files</h3>

<div class="name-list">
optparse&nbsp;&nbsp;
annotate_models/tasks&nbsp;&nbsp;
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/files/lib/annotate_models/tasks_rb.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>tasks.rb</h1>
</tr>
<tr class="top-aligned-row">
<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>
</table>
</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/files/lib/annotate_models/version_rb.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>version.rb</h1>
</tr>
<tr class="top-aligned-row">
<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>
</table>
</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/files/lib/annotate_models_rb.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>annotate_models.rb</h1>
</tr>
<tr class="top-aligned-row">
<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>
</table>
</div>
Expand Down
12 changes: 9 additions & 3 deletions doc/files/website/index_txt.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>index.txt</h1>
</tr>
<tr class="top-aligned-row">
<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>
</table>
</div>
Expand Down Expand Up @@ -105,7 +105,13 @@ <h1>index.txt</h1>
h2. Demonstration of usage
</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>
h2. How to submit patches
Expand All @@ -116,7 +122,7 @@ <h1>index.txt</h1>
</p>
<p>
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>
A svn mirror is on rubyforge
Expand Down
4 changes: 2 additions & 2 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<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" />
</head>
<frameset rows="20%, 80%">
Expand Down
13 changes: 9 additions & 4 deletions lib/annotate_models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ def get_schema_info(klass, header)
end

# Add a schema block to a file. If the file already contains
# a schema info block (a comment starting
# with "Schema as of ..."), remove it first.

# a schema info block (a comment starting 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={})
if File.exist?(file_name)
content = File.read(file_name)
Expand All @@ -57,7 +62,7 @@ def annotate_one_file(file_name, info_block, options={})
content.sub!(/^# #{PREFIX}.*?\n(#.*\n)*\n/, '')

# 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 }
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/annotate_models/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module AnnotateModels #:nodoc:
module VERSION #:nodoc:
MAJOR = 1
MINOR = 0
TINY = 1
TINY = 2

STRING = [MAJOR, MINOR, TINY].join('.')
end
Expand Down
14 changes: 10 additions & 4 deletions website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<h1>annotate-models</h1>
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/annotate-models"; return false'>
<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>
<h1>&#x2192; &#8216;annotate-models&#8217;</h1>

Expand Down Expand Up @@ -62,7 +62,13 @@ <h2>The basics</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>
Expand All @@ -71,7 +77,7 @@ <h2>How to submit patches</h2>
<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>
Expand All @@ -88,7 +94,7 @@ <h2>Contact</h2>

<p>Comments are welcome. Send an email to <a href="mailto:[email protected]">Cuong Tran</a></p>
<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>
</p>
</div>
Expand Down
8 changes: 6 additions & 2 deletions website/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ This is now a gem that can run from command line

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

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>

Expand Down

0 comments on commit 60fc98a

Please sign in to comment.