Commit bb4a37e2 by Marcos Augusto

More lil fixes

Adds compat mode for annotate plugin version Tim Charper binary write mode back Updates history
parent 0c3673a3
......@@ -13,3 +13,15 @@
* More intuitive info messages
* Update README file with update-to-date example
== 2.0.0 2008-12-25
* Add annotate_models plugin fork additions
* Annotates Rspec and Test Unit models
* Annotates Object Daddy exemplars
* Annotates geometrical columns
* Add AnnotateRoutes rake task
* Up gem structure to newgem defaults
......@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
module Annotate
VERSION = '2.1.0'
VERSION = '2.1.1'
end
......
......@@ -7,6 +7,7 @@ module AnnotateModels
# Object Daddy http://github.com/flogic/object_daddy/tree/master
EXEMPLARS_DIR = File.join(RAILS_ROOT, "spec/exemplars")
PREFIX = "== Schema Information"
# Annotate Models as plugin use this header
COMPAT_PREFIX = "== Schema Info"
# Simple quoting for the default column value
......@@ -45,6 +46,8 @@ module AnnotateModels
col_type << "(#{col.limit})" if col.limit
end
# Check out if we got a geometric column
# and print the type and SRID
if col.respond_to?(:geometry_type)
attrs << "#{col.geometry_type}, #{col.srid}"
end
......@@ -85,7 +88,7 @@ module AnnotateModels
# Write it back
new_content = options[:position] == "before" ? (info_block + old_content) : (old_content + "\n" + info_block)
File.open(file_name, "w") { |f| f.puts new_content }
File.open(file_name, "wb") { |f| f.puts new_content }
true
end
end
......@@ -97,7 +100,7 @@ module AnnotateModels
content.sub!(/^# #{COMPAT_PREFIX}.*?\n(#.*\n)*\n/, '')
File.open(file_name, "w") { |f| f.puts content }
File.open(file_name, "wb") { |f| f.puts content }
end
end
......@@ -124,7 +127,6 @@ module AnnotateModels
File.join(EXEMPLARS_DIR, "#{model_name}_exemplar.rb"), # Object Daddy
].each { |file| annotate_one_file(file, info) }
FIXTURE_DIRS.each do |dir|
fixture_file_name = File.join(dir,klass.table_name + ".yml")
annotate_one_file(fixture_file_name, info, options.merge(:position=>(options[:position_in_fixture] || options[:position]))) if File.exist?(fixture_file_name)
......
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