Commit 0c3673a3 by Marcos Augusto

some fixes

parent b331d071
...@@ -106,7 +106,7 @@ AnnotateModels mods by: ...@@ -106,7 +106,7 @@ AnnotateModels mods by:
AnnotateRoutes originally by: AnnotateRoutes originally by:
Gavin Montague ( http://github.com/Govan/annotate-routes ) Gavin Montague ( http://github.com/govan/annotate-routes )
== Forked from: == Forked from:
......
...@@ -4,15 +4,13 @@ require File.dirname(__FILE__) + '/lib/annotate' ...@@ -4,15 +4,13 @@ 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)
$hoe = Hoe.new('annotate', Annotate::VERSION) do |p| $hoe = Hoe.new('annotate', Annotate::VERSION) do |p|
p.developer('FIXME full name', 'FIXME email') p.developer('Marcos Piccinini', 'x@nofxx.com')
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
p.rubyforge_name = p.name # TODO this is default value p.rubyforge_name = p.name
#p.summary p.url = "http://github.com/nofxx/annotate"
p.summary = "Annotates Rails Models and Routes"
p.description = "Annotates Rails Models and Routes"
# p.extra_deps = [
# ['activesupport','>= 2.0.2'],
# ]
p.extra_dev_deps = [ p.extra_dev_deps = [
['newgem', ">= #{::Newgem::VERSION}"] ['newgem', ">= #{::Newgem::VERSION}"]
] ]
......
...@@ -2,24 +2,24 @@ ...@@ -2,24 +2,24 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{annotate} s.name = %q{annotate}
s.version = "2.0.8" s.version = "2.1.0"
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 = ["FIXME full name"] s.authors = ["Marcos Piccinini"]
s.date = %q{2008-12-25} s.date = %q{2008-12-25}
s.default_executable = %q{annotate} s.default_executable = %q{annotate}
s.description = %q{} s.description = %q{Annotates Rails Models and Routes}
s.email = ["FIXME email"] s.email = ["x@nofxx.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", "License.txt", "Manifest.txt", "README.rdoc"]
s.files = ["History.txt", "License.txt", "Manifest.txt", "README.rdoc", "Rakefile", "annotate.gemspec", "bin/annotate", "config/hoe.rb", "config/requirements.rb", "lib/annotate.rb", "lib/annotate_models/annotate_models.rb", "lib/annotate_routes/annotate_routes.rb", "lib/tasks/annotate_models.rake", "lib/tasks/annotate_routes.rake", "script/console", "script/destroy", "script/generate", "setup.rb", "spec/annotate_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"] s.files = ["History.txt", "License.txt", "Manifest.txt", "README.rdoc", "Rakefile", "annotate.gemspec", "bin/annotate", "config/hoe.rb", "config/requirements.rb", "lib/annotate.rb", "lib/annotate_models/annotate_models.rb", "lib/annotate_routes/annotate_routes.rb", "lib/tasks/annotate_models.rake", "lib/tasks/annotate_routes.rake", "script/console", "script/destroy", "script/generate", "setup.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{ sudo gem install nofxx-annotate} s.homepage = %q{http://github.com/nofxx/annotate}
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}
s.rubygems_version = %q{1.3.1} s.rubygems_version = %q{1.3.1}
s.summary = %q{} s.summary = %q{Annotates Rails Models and Routes}
if s.respond_to? :specification_version then if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
......
...@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless ...@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
module Annotate module Annotate
VERSION = '2.0.8' VERSION = '2.1.0'
end end
......
...@@ -7,6 +7,7 @@ module AnnotateModels ...@@ -7,6 +7,7 @@ module AnnotateModels
# Object Daddy http://github.com/flogic/object_daddy/tree/master # Object Daddy http://github.com/flogic/object_daddy/tree/master
EXEMPLARS_DIR = File.join(RAILS_ROOT, "spec/exemplars") EXEMPLARS_DIR = File.join(RAILS_ROOT, "spec/exemplars")
PREFIX = "== Schema Information" PREFIX = "== Schema Information"
COMPAT_PREFIX = "== Schema Info"
# Simple quoting for the default column value # Simple quoting for the default column value
def quote(value) def quote(value)
...@@ -79,7 +80,7 @@ module AnnotateModels ...@@ -79,7 +80,7 @@ module AnnotateModels
false false
else else
# Remove old schema info # Remove old schema info
old_content.sub!(/^# #{PREFIX}.*?\n(#.*\n)*\n/, '') old_content.sub!(/^# #{COMPAT_PREFIX}.*?\n(#.*\n)*\n/, '')
# Write it back # Write it back
new_content = options[:position] == "before" ? (info_block + old_content) : (old_content + "\n" + info_block) new_content = options[:position] == "before" ? (info_block + old_content) : (old_content + "\n" + info_block)
...@@ -94,7 +95,7 @@ module AnnotateModels ...@@ -94,7 +95,7 @@ module AnnotateModels
if File.exist?(file_name) if File.exist?(file_name)
content = File.read(file_name) content = File.read(file_name)
content.sub!(/^# #{PREFIX}.*?\n(#.*\n)*\n/, '') content.sub!(/^# #{COMPAT_PREFIX}.*?\n(#.*\n)*\n/, '')
File.open(file_name, "w") { |f| f.puts content } File.open(file_name, "w") { |f| f.puts content }
end end
...@@ -188,7 +189,7 @@ module AnnotateModels ...@@ -188,7 +189,7 @@ module AnnotateModels
if annotated.empty? if annotated.empty?
puts "Nothing annotated!" puts "Nothing annotated!"
else else
puts "Annotated (#{annotated.length}) #{annotated.join(', ')}" puts "Annotated (#{annotated.length}): #{annotated.join(', ')}"
end end
end end
......
# == Annotate Routes # == Annotate Routes
# #
# Based on:
#
#
#
# Prepends the output of "rake routes" to the top of your routes.rb file. # Prepends the output of "rake routes" to the top of your routes.rb file.
# Yes, it's simple but I'm thick and often need a reminder of what my routes mean. # Yes, it's simple but I'm thick and often need a reminder of what my routes mean.
# #
......
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