Commit 2813dbd9 by Cuong Tran

upgrade to newgem 1.3

fix the dependencies so it doesn't fail when multiple version of Rails is installed, reported by kuroda
parent 4aee03d3
The MIT License
Copyright (c) 2008 Dave Thomas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
History.txt History.txt
License.txt
Manifest.txt
README.rdoc README.rdoc
Rakefile Rakefile
annotate_models.gemspec annotate_models.gemspec
...@@ -9,14 +7,4 @@ lib/annotate.rb ...@@ -9,14 +7,4 @@ lib/annotate.rb
lib/annotate/annotate_models.rb lib/annotate/annotate_models.rb
lib/annotate/annotate_routes.rb lib/annotate/annotate_routes.rb
lib/tasks/annotate_models.rake lib/tasks/annotate_models.rake
lib/tasks/annotate_routes.rake lib/tasks/annotate_routes.rake
script/console \ No newline at end of file
script/destroy
script/generate
setup.rb
spec/annotate/annotate_models_spec.rb
spec/annotate/annotate_routes_spec.rb
spec/annotate_spec.rb
spec/spec.opts
spec/spec_helper.rb
tasks/rspec.rake
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f } %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
require 'lib/annotate' require File.dirname(__FILE__) + '/lib/annotate'
# Generate all the Rake tasks # Generate all the Rake tasks
# Run 'rake -T' to see list of generated tasks (from gem root directory) # Run 'rake -T' to see list of generated tasks (from gem root directory)
...@@ -21,7 +21,7 @@ $hoe = Hoe.new('annotate', Annotate::VERSION) do |p| ...@@ -21,7 +21,7 @@ $hoe = Hoe.new('annotate', Annotate::VERSION) do |p|
p.rsync_args = '-av --delete --ignore-errors' p.rsync_args = '-av --delete --ignore-errors'
end end
require 'newgem/tasks' require 'newgem/tasks' # load /tasks/*.rake
Dir['tasks/**/*.rake'].each { |t| load t } Dir['tasks/**/*.rake'].each { |t| load t }
# TODO - want other tests/tasks run by default? Add them to the list # TODO - want other tests/tasks run by default? Add them to the list
......
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{annotate}
s.version = "2.0.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Cuong Tran"]
s.date = %q{2009-04-30}
s.default_executable = %q{annotate}
s.description = %q{Annotates Rails Models, routes, and others}
s.email = ["ctran@pragmaquest.com"]
s.executables = ["annotate"]
s.extra_rdoc_files = ["History.txt", "README.rdoc"]
s.files = ["History.txt", "README.rdoc", "Rakefile", "annotate_models.gemspec", "bin/annotate", "lib/annotate.rb", "lib/annotate/annotate_models.rb", "lib/annotate/annotate_routes.rb", "lib/tasks/annotate_models.rake", "lib/tasks/annotate_routes.rake"]
s.has_rdoc = true
s.homepage = %q{http://github.com/ctran/annotate_models}
s.rdoc_options = ["--main", "README.rdoc"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{annotate-models}
s.rubygems_version = %q{1.3.1}
s.summary = %q{Annotates Rails Models, routes, and others}
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<newgem>, [">= 1.3.0"])
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
else
s.add_dependency(%q<newgem>, [">= 1.3.0"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
end
else
s.add_dependency(%q<newgem>, [">= 1.3.0"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
end
end
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{annotate} s.name = %q{annotate_models}
s.version = "2.0.0.20090212000" s.version = "2.0.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Dan Cheail", "Cuong Tran"] s.authors = ["Cuong Tran"]
s.date = %q{2009-02-03} s.date = %q{2009-04-29}
s.default_executable = %q{annotate} s.default_executable = %q{annotate}
s.description = %q{Annotates Rails Models, routes, and others} s.description = %q{Annotates Rails Models, routes, and others}
s.email = ["ctran@pragmaquest.com"] s.email = ["ctran@pragmaquest.com"]
s.executables = ["annotate"] s.executables = ["annotate"]
s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.rdoc"] s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
s.files = ["History.txt", "License.txt", "Manifest.txt", "README.rdoc", "Rakefile", "annotate_models.gemspec", "bin/annotate", "lib/annotate.rb", "lib/annotate/annotate_models.rb", "lib/annotate/annotate_routes.rb", "lib/tasks/annotate_models.rake", "lib/tasks/annotate_routes.rake", "script/console", "script/destroy", "script/generate", "setup.rb", "spec/annotate/annotate_models_spec.rb", "spec/annotate/annotate_routes_spec.rb", "spec/annotate_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"] s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "annotate_models.gemspec", "bin/annotate", "lib/annotate/annotate_models.rb", "lib/annotate/annotate_routes.rb", "lib/tasks/annotate_models.rake", "lib/tasks/annotate_routes.rake", "script/console", "script/destroy", "script/generate", "spec/annotate/annotate_models_spec.rb", "spec/annotate/annotate_routes_spec.rb", "spec/annotate_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
s.has_rdoc = true s.has_rdoc = true
s.homepage = %q{http://github.com/ctran/annotate_models} s.homepage = %q{http://github.com/ctran/annotate_models}
s.rdoc_options = ["--main", "README.rdoc"] s.rdoc_options = ["--main", "README.rdoc"]
s.require_paths = ["lib"] s.require_paths = ["lib"]
s.rubyforge_project = %q{annotate} s.rubyforge_project = %q{annotate-models}
s.rubygems_version = %q{1.3.1} s.rubygems_version = %q{1.3.1}
s.summary = %q{Annotates Rails Models, routes, and others} s.summary = %q{Annotates Rails Models, routes, and others}
...@@ -26,14 +26,14 @@ Gem::Specification.new do |s| ...@@ -26,14 +26,14 @@ Gem::Specification.new do |s|
s.specification_version = 2 s.specification_version = 2
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<newgem>, [">= 1.2.3"]) s.add_development_dependency(%q<newgem>, [">= 1.3.0"])
s.add_development_dependency(%q<hoe>, [">= 1.8.0"]) s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
else else
s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<newgem>, [">= 1.3.0"])
s.add_dependency(%q<hoe>, [">= 1.8.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"])
end end
else else
s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<newgem>, [">= 1.3.0"])
s.add_dependency(%q<hoe>, [">= 1.8.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"])
end end
end end
...@@ -14,9 +14,8 @@ OptionParser.new do |opts| ...@@ -14,9 +14,8 @@ OptionParser.new do |opts|
opts.on('-m', '--show-migration') { ENV['include_version'] = "yes" } opts.on('-m', '--show-migration') { ENV['include_version'] = "yes" }
end.parse! end.parse!
begin if Annotate.load_tasks
Rake::Task[task].invoke Rake::Task[task].invoke
#TODO: rescue only rake error else
rescue NameError => e STDERR.puts "Can't find Rakefile. Are we in a Rails folder?"
puts "Can`t find Rake. Are we in a Rails folder?" end
end \ No newline at end of file
require 'annotate_models/version'
AUTHOR = 'Dave Thomas' # can also be an array of Authors
EMAIL = "ctran@pragmaquest.com"
DESCRIPTION = "Add a comment summarizing the current schema to the top of each ActiveRecord model source file"
GEM_NAME = 'annotate-models' # what ppl will type to install your gem
RUBYFORGE_PROJECT = 'annotate-models' # The unix name for your project
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
@config_file = "~/.rubyforge/user-config.yml"
@config = nil
RUBYFORGE_USERNAME = "unknown"
def rubyforge_username
unless @config
begin
@config = YAML.load(File.read(File.expand_path(@config_file)))
rescue
puts <<-EOS
ERROR: No rubyforge config file found: #{@config_file}
Run 'rubyforge setup' to prepare your env for access to Rubyforge
- See http://newgem.rubyforge.org/rubyforge.html for more details
EOS
exit
end
end
RUBYFORGE_USERNAME.replace @config["username"]
end
REV = nil
# UNCOMMENT IF REQUIRED:
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
VERS = AnnotateModels::VERSION::STRING + (REV ? ".#{REV}" : "")
RDOC_OPTS = ['--quiet', '--title', 'annotate_models documentation',
"--opname", "index.html",
"--line-numbers",
"--main", "README",
"--inline-source"]
class Hoe
def extra_deps
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
@extra_deps
end
end
# Generate all the Rake tasks
# Run 'rake -T' to see list of generated tasks (from gem root directory)
hoe = Hoe.new(GEM_NAME, VERS) do |p|
p.developer(AUTHOR, EMAIL)
p.description = DESCRIPTION
p.summary = DESCRIPTION
p.url = HOMEPATH
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
p.test_globs = ["test/**/test_*.rb"]
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
# == Optional
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
p.spec_extras = {} # A hash of extra values to set in the gemspec.
end
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
hoe.rsync_args = '-av --delete --ignore-errors'
\ No newline at end of file
require 'fileutils'
include FileUtils
require 'rubygems'
%w[rake hoe newgem rubigen].each do |req_gem|
begin
require req_gem
rescue LoadError
puts "This Rakefile requires the '#{req_gem}' RubyGem."
puts "Installation: gem install #{req_gem} -y"
exit
end
end
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
require 'annotate_models'
\ No newline at end of file
unless defined?(Annotate) $:.unshift(File.dirname(__FILE__)) unless
$:.unshift(File.dirname(__FILE__)) $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
module Annotate module Annotate
VERSION = '2.0.1' VERSION = '2.0.2'
end
def self.load_tasks
begin if File.exists?('Rakefile')
load 'Rakefile' load 'Rakefile'
Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each { |rake| load rake } Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each { |rake| load rake }
rescue LoadError => e return true
nil else
return false
end
end end
end end
\ No newline at end of file
desc "Add schema information (as comments) to model and fixture files"
task :annotate_models => :environment do
require 'annotate_models'
options={}
options[:position_in_class] = ENV['position_in_class'] || ENV['position']
options[:position_in_fixture] = ENV['position_in_fixture'] || ENV['position']
options[:include_version] = ENV['include_version']
AnnotateModels.do_annotations(options)
end
desc "Remove schema information from model and fixture files"
task :remove_annotation => :environment do
require 'annotate_models'
AnnotateModels.remove_annotations
end
\ No newline at end of file
...@@ -4,6 +4,7 @@ task :annotate_models => :environment do ...@@ -4,6 +4,7 @@ task :annotate_models => :environment do
options={} options={}
options[:position_in_class] = ENV['position_in_class'] || ENV['position'] || :before options[:position_in_class] = ENV['position_in_class'] || ENV['position'] || :before
options[:position_in_fixture] = ENV['position_in_fixture'] || ENV['position'] || :before options[:position_in_fixture] = ENV['position_in_fixture'] || ENV['position'] || :before
options[:include_version] = ENV['include_version']
AnnotateModels.do_annotations(options) AnnotateModels.do_annotations(options)
end end
......
...@@ -5,6 +5,6 @@ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' ...@@ -5,6 +5,6 @@ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
libs = " -r irb/completion" libs = " -r irb/completion"
# Perhaps use a console_lib to store any extra methods I may want available in the cosole # Perhaps use a console_lib to store any extra methods I may want available in the cosole
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}" # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
libs << " -r #{File.dirname(__FILE__) + '/../lib/annotate.rb'}" libs << " -r #{File.dirname(__FILE__) + '/../lib/annotate_models.rb'}"
puts "Loading annotate gem" puts "Loading annotate_models gem"
exec "#{irb} #{libs} --simple-prompt" exec "#{irb} #{libs} --simple-prompt"
\ No newline at end of file
#!/usr/bin/env ruby
require 'rubygems'
begin
require 'newgem'
rescue LoadError
puts "\n\nGenerating the website requires the newgem RubyGem"
puts "Install: gem install newgem\n\n"
exit(1)
end
require 'redcloth'
require 'syntax/convertors/html'
require 'erb'
require File.dirname(__FILE__) + '/../lib/annotate_models/version.rb'
version = AnnotateModels::VERSION::STRING
download = 'http://rubyforge.org/projects/annotate-models'
class Fixnum
def ordinal
# teens
return 'th' if (10..19).include?(self % 100)
# others
case self % 10
when 1: return 'st'
when 2: return 'nd'
when 3: return 'rd'
else return 'th'
end
end
end
class Time
def pretty
return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
end
end
def convert_syntax(syntax, source)
return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
end
if ARGV.length >= 1
src, template = ARGV
template ||= File.join(File.dirname(__FILE__), '/../website/template.rhtml')
else
puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html")
exit!
end
template = ERB.new(File.open(template).read)
title = nil
body = nil
File.open(src) do |fsrc|
title_text = fsrc.readline
body_text = fsrc.read
syntax_items = []
body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
ident = syntax_items.length
element, syntax, source = $1, $2, $3
syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
"syntax-temp-#{ident}"
}
title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
body = RedCloth.new(body_text).to_html
body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
end
stat = File.stat(src)
created = stat.ctime
modified = stat.mtime
$stdout << template.result(binding)
...@@ -6,4 +6,5 @@ rescue LoadError ...@@ -6,4 +6,5 @@ rescue LoadError
require 'spec' require 'spec'
end end
require File.dirname(__FILE__) + '/../lib/annotate' $:.unshift(File.dirname(__FILE__) + '/../lib')
require 'annotate'
desc 'Release the website and new gem version'
task :deploy => [:check_version, :website, :release] do
puts "Remember to create SVN tag:"
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
puts "Suggested comment:"
puts "Tagging release #{CHANGES}"
end
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
task :local_deploy => [:website_generate, :install_gem]
task :check_version do
unless ENV['VERSION']
puts 'Must pass a VERSION=x.y.z release version'
exit
end
unless ENV['VERSION'] == VERS
puts "Please update your version.rb to match the release version, currently #{VERS}"
exit
end
end
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
task :install_gem_no_doc => [:clean, :package] do
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
end
namespace :manifest do
desc 'Recreate Manifest.txt to include ALL files'
task :refresh do
`rake check_manifest | patch -p0 > Manifest.txt`
end
end
\ No newline at end of file
task :ruby_env do
RUBY_APP = if RUBY_PLATFORM =~ /java/
"jruby"
else
"ruby"
end unless defined? RUBY_APP
end
desc 'Generate website files'
task :website_generate => :ruby_env do
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
end
end
desc 'Upload website files to rubyforge'
task :website_upload do
host = "#{rubyforge_username}@rubyforge.org"
remote_dir = "/var/www/gforge-projects/#{PATH}/"
local_dir = 'website'
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
end
desc 'Generate and upload website files'
task :website => [:website_generate, :website_upload, :publish_docs]
require File.dirname(__FILE__) + '/test_helper.rb'
class TestAnnotateModels < Test::Unit::TestCase
def setup
end
def test_truth
assert true
end
end
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/annotate_models'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
annotate-models
</title>
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
<style>
</style>
<script type="text/javascript">
window.onload = function() {
settings = {
tl: { radius: 10 },
tr: { radius: 10 },
bl: { radius: 10 },
br: { radius: 10 },
antiAlias: true,
autoPad: true,
validTags: ["div"]
}
var versionBox = new curvyCorners(settings, document.getElementById("version"));
versionBox.applyCornersToAll();
}
</script>
</head>
<body>
<div id="main">
<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.3</a>
</div>
<h1>&#x2192; &#8216;annotate-models&#8217;</h1>
<h2>What</h2>
<h2>Installing</h2>
<p><pre class='syntax'>
<span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">annotate</span><span class="punct">-</span><span class="ident">models</span>
</pre></p>
<h2>The basics</h2>
<p>Add a comment summarizing the current schema to the top of each ActiveRecord model source file.</p>
<p>This was created by Dave Thomas as a Rails plugin.
This is now a gem that can run from command line</p>
<h2>Demonstration of usage</h2>
<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>
<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>A svn mirror is on rubyforge <code>svn://rubyforge.org/var/svn/annotate-models/trunk</code></p>
<h2>License</h2>
<p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
<h2>Contact</h2>
<p>Comments are welcome. Send an email to <a href="mailto:ctran@pragmaquest.com">Cuong Tran</a></p>
<p class="coda">
<a href="http://www.pragmaquest.com">Cuong Tran</a>, 2nd May 2008<br>
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
</p>
</div>
<!-- insert site tracking codes here, like Google Urchin -->
</body>
</html>
h1. annotate-models
h1. &#x2192; 'annotate-models'
h2. What
h2. Installing
<pre syntax="ruby">
sudo gem install annotate-models
</pre>
h2. The basics
Add a comment summarizing the current schema to the top of each ActiveRecord model source file.
This was created by Dave Thomas as a Rails plugin.
This is now a gem that can run from command line
h2. Demonstration of usage
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>
A svn mirror is on rubyforge <code>svn://rubyforge.org/var/svn/annotate-models/trunk</code>
h2. License
This code is free to use under the terms of the MIT license.
h2. Contact
Comments are welcome. Send an email to "Cuong Tran":mailto:ctran@pragmaquest.com
body {
background-color: #E1D1F1;
font-family: "Georgia", sans-serif;
font-size: 16px;
line-height: 1.6em;
padding: 1.6em 0 0 0;
color: #333;
}
h1, h2, h3, h4, h5, h6 {
color: #444;
}
h1 {
font-family: sans-serif;
font-weight: normal;
font-size: 4em;
line-height: 0.8em;
letter-spacing: -0.1ex;
margin: 5px;
}
li {
padding: 0;
margin: 0;
list-style-type: square;
}
a {
color: #5E5AFF;
background-color: #DAC;
font-weight: normal;
text-decoration: underline;
}
blockquote {
font-size: 90%;
font-style: italic;
border-left: 1px solid #111;
padding-left: 1em;
}
.caps {
font-size: 80%;
}
#main {
width: 45em;
padding: 0;
margin: 0 auto;
}
.coda {
text-align: right;
color: #77f;
font-size: smaller;
}
table {
font-size: 90%;
line-height: 1.4em;
color: #ff8;
background-color: #111;
padding: 2px 10px 2px 10px;
border-style: dashed;
}
th {
color: #fff;
}
td {
padding: 2px 10px 2px 10px;
}
.success {
color: #0CC52B;
}
.failed {
color: #E90A1B;
}
.unknown {
color: #995000;
}
pre, code {
font-family: monospace;
font-size: 90%;
line-height: 1.4em;
color: #ff8;
background-color: #111;
padding: 2px 10px 2px 10px;
}
.comment { color: #aaa; font-style: italic; }
.keyword { color: #eff; font-weight: bold; }
.punct { color: #eee; font-weight: bold; }
.symbol { color: #0bb; }
.string { color: #6b4; }
.ident { color: #ff8; }
.constant { color: #66f; }
.regex { color: #ec6; }
.number { color: #F99; }
.expr { color: #227; }
#version {
float: right;
text-align: right;
font-family: sans-serif;
font-weight: normal;
background-color: #B3ABFF;
color: #141331;
padding: 15px 20px 10px 20px;
margin: 0 auto;
margin-top: 15px;
border: 3px solid #141331;
}
#version .numbers {
display: block;
font-size: 4em;
line-height: 0.8em;
letter-spacing: -0.1ex;
margin-bottom: 15px;
}
#version p {
text-decoration: none;
color: #141331;
background-color: #B3ABFF;
margin: 0;
padding: 0;
}
#version a {
text-decoration: none;
color: #141331;
background-color: #B3ABFF;
}
.clickable {
cursor: pointer;
cursor: hand;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<%= title %>
</title>
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
<style>
</style>
<script type="text/javascript">
window.onload = function() {
settings = {
tl: { radius: 10 },
tr: { radius: 10 },
bl: { radius: 10 },
br: { radius: 10 },
antiAlias: true,
autoPad: true,
validTags: ["div"]
}
var versionBox = new curvyCorners(settings, document.getElementById("version"));
versionBox.applyCornersToAll();
}
</script>
</head>
<body>
<div id="main">
<h1><%= title %></h1>
<div id="version" class="clickable" onclick='document.location = "<%= download %>"; return false'>
<p>Get Version</p>
<a href="<%= download %>" class="numbers"><%= version %></a>
</div>
<%= body %>
<p class="coda">
<a href="http://www.pragmaquest.com">Cuong Tran</a>, <%= modified.pretty %><br>
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
</p>
</div>
<!-- insert site tracking codes here, like Google Urchin -->
</body>
</html>
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