Skip to content

Commit 9d52904

Browse files
committed
Minor fixups.
1 parent f5c1aa0 commit 9d52904

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

bin/annotate_models

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ OptionParser.new do |opts|
7373
exclusions.each { |exclusion| ENV["exclude_#{exclusion}"] = "yes" }
7474
end
7575

76-
opts.on('-f', '--format [bare|rdoc|markdown]', ['bare', 'rdoc', 'markdown'], 'rdoc: render Schema Infomation as RDoc') do |fmt|
76+
opts.on('-f', '--format [bare|rdoc|markdown]', ['bare', 'rdoc', 'markdown'], 'Render Schema Infomation as plain/RDoc/Markdown') do |fmt|
7777
ENV["format_#{fmt}"] = 'yes'
7878
end
7979

lib/annotate.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ def self.load_tasks
1616
if File.exists?('Rakefile')
1717
require 'rake'
1818
load 'Rakefile'
19-
Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each { |rake| load rake }
19+
# Rails 3 wants to load our .rake files for us.
20+
# TODO: selectively do this require on Rails 2.x?
21+
#Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each { |rake| load rake }
2022
return true
2123
else
2224
return false

lib/annotate/annotate_models.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def get_schema_info(klass, header, options = {})
6767
max_size += options[:format_rdoc] ? 5 : 1
6868

6969
if(options[:format_markdown])
70-
info<< sprintf( "# %-#{max_size + 4}.#{max_size + 4}s | %-17.17s | %s \n", 'Field', 'Type', 'Attributes' )
71-
info<< "# #{ '-' * ( max_size + 4 ) } | #{'-' * 17} | #{ '-' * 25 } \n"
70+
info<< sprintf( "# %-#{max_size + 4}.#{max_size + 4}s | %-18.18s | %s\n", 'Field', 'Type', 'Attributes' )
71+
info<< "# #{ '-' * ( max_size + 4 ) } | #{'-' * 18} | #{ '-' * 25 }\n"
7272
end
7373

7474
cols = klass.columns
@@ -109,7 +109,7 @@ def get_schema_info(klass, header, options = {})
109109
if options[:format_rdoc]
110110
info << sprintf("# %-#{max_size}.#{max_size}s<tt>%s</tt>", "*#{col.name}*::", attrs.unshift(col_type).join(", ")).rstrip + "\n"
111111
elsif options[:format_markdown]
112-
info << sprintf("# **%-#{max_size}.#{max_size}s** | `%-16.16s` | `%s `", col.name, col_type, attrs.join(", ")).rstrip + "\n"
112+
info << sprintf("# **%-#{max_size}.#{max_size}s** | `%-16.16s` | `%s`", col.name, col_type, attrs.join(", ").rstrip) + "\n"
113113
else
114114
info << sprintf("# %-#{max_size}.#{max_size}s:%-16.16s %s", col.name, col_type, attrs.join(", ")).rstrip + "\n"
115115
end

0 commit comments

Comments
 (0)