Skip to content

Commit e26663b

Browse files
committed
Merge branch 'ctran'
* ctran: (23 commits) Inserting newline requires double-quoted string Annotation position defaulted to 'before'. Bugfix: annotate_models.rake uses string instead of symbol. include ActiveSupport to finish build #45 include lib specs specify :rubygems source in Gemfile for Travis Gemfile for dependencies for Travis CI rake make the specs pass (one pending) fix column pattern Allow task loading from Rakefile for gems (plugin installation already auto-detects). Add skip_on_db_migrate option as well for people that don't want it. Fix options parsing to convert strings to proper booleans. Change annotate to use options hash instead of ENV. Update README.rdoc to mention Fabrication support Add support for Fabrication fabricators We had stripped the trailing newlines from our Schema Information section. This small fix supports that case. rake task is 'build', not 'gem' match indexes and column options too when comparing annotation headers Leave magic encoding comment intact Fixes issue #14 - RuntimeError: Already memoized Count a model as 'annotated' if any of its tests/fixtures are annotated Implement FactoryGirl (#47) fix gemspec and get rspecs partly working again ... Conflicts: Gemfile Rakefile VERSION.yml annotate.gemspec lib/tasks/annotate_models.rake spec/annotate/annotate_models_spec.rb spec/spec_helper.rb
2 parents f7b2c75 + ff1131d commit e26663b

File tree

11 files changed

+210
-58
lines changed

11 files changed

+210
-58
lines changed

Gemfile.lock

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
GEM
2+
remote: http://rubygems.org/
3+
specs:
4+
ParseTree (3.0.8)
5+
RubyInline (>= 3.7.0)
6+
sexp_processor (>= 3.0.0)
7+
RubyInline (3.11.2)
8+
ZenTest (~> 4.3)
9+
ZenTest (4.7.0)
10+
activesupport (3.2.2)
11+
i18n (~> 0.6)
12+
multi_json (~> 1.0)
13+
diff-lcs (1.1.3)
14+
file-tail (1.0.8)
15+
tins (~> 0.3)
16+
i18n (0.6.0)
17+
json (1.6.5)
18+
mg (0.0.8)
19+
rake
20+
multi_json (1.1.0)
21+
predicated (0.2.6)
22+
rake (0.9.2.2)
23+
rdoc (3.12)
24+
json (~> 1.4)
25+
rspec (2.9.0)
26+
rspec-core (~> 2.9.0)
27+
rspec-expectations (~> 2.9.0)
28+
rspec-mocks (~> 2.9.0)
29+
rspec-core (2.9.0)
30+
rspec-expectations (2.9.0)
31+
diff-lcs (~> 1.1.3)
32+
rspec-mocks (2.9.0)
33+
ruby2ruby (1.3.1)
34+
ruby_parser (~> 2.0)
35+
sexp_processor (~> 3.0)
36+
ruby_parser (2.0.6)
37+
sexp_processor (~> 3.0)
38+
sexp_processor (3.1.0)
39+
sourcify (0.5.0)
40+
file-tail (>= 1.0.5)
41+
ruby2ruby (>= 1.2.5)
42+
ruby_parser (>= 2.0.5)
43+
sexp_processor (>= 3.0.5)
44+
tins (0.3.12)
45+
wrong (0.6.1)
46+
ParseTree (~> 3.0)
47+
diff-lcs (~> 1.1.2)
48+
file-tail (~> 1.0)
49+
predicated (>= 0.2.3)
50+
ruby2ruby (~> 1.2)
51+
ruby_parser (~> 2.0.4)
52+
sexp_processor (~> 3.0)
53+
sourcify (>= 0.3.0)
54+
55+
PLATFORMS
56+
ruby
57+
58+
DEPENDENCIES
59+
activesupport (>= 2.1.0)
60+
mg
61+
rake
62+
rdoc
63+
rspec
64+
wrong

README.rdoc

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Add a comment summarizing the current schema to the top or bottom of each of you
77
* Tests and Specs
88
* Object Daddy exemplars
99
* Machinist blueprints
10+
* Fabrication fabricators
1011

1112
The schema comment looks like this:
1213

@@ -38,19 +39,25 @@ Also, if you pass the -r option, it'll annotate routes.rb with the output of "ra
3839

3940
== INSTALL
4041

41-
From rubyforge:
42+
Into Gemfile from Github:
4243

43-
sudo gem install annotate
44+
gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
4445

45-
From github:
46+
Into environment gems From rubygems.org:
47+
48+
gem install annotate
49+
50+
Into environment gems from Github checkout:
4651

4752
git clone git://github.com/ctran/annotate_models.git annotate
4853
cd annotate
49-
rake gem
50-
sudo gem install pkg/annotate-*.gem
54+
rake build
55+
gem install pkg/annotate-*.gem
5156

5257
== USAGE
5358

59+
(If you used the Gemfile install, prefix the below commands with `bundle exec`.)
60+
5461
To annotate all your models, tests, fixtures, etc.:
5562

5663
cd /path/to/app
@@ -70,12 +77,26 @@ To annotate routes.rb:
7077

7178
To automatically annotate after running 'rake db:migrate':
7279

73-
[needs more clarity] unpack the gem into vendor/plugins, or maybe vendor/gems, or maybe just require tasks/migrate.rake.
80+
[*needs more clarity*] unpack the gem into vendor/plugins, or maybe vendor/gems, or maybe just require tasks/migrate.rake.
7481

7582
If you install annotate_models as a plugin, it will automatically
7683
adjust your <tt>rake db:migrate</tt> tasks so that they update the
7784
annotations in your model files for you once the migration is
78-
completed.
85+
completed. To get the same behavior from a gem, add the following to
86+
your Rakefile:
87+
88+
require 'annotate/tasks'
89+
90+
To customize the behavior of annotate when it is running as a Rake
91+
task, use the following (in your Rakefile or wherever):
92+
93+
ENV['position_in_class'] = "before"
94+
ENV['position_in_fixture'] = "before"
95+
ENV['show_indexes'] = "false"
96+
ENV['include_version'] = "false"
97+
ENV['exclude_tests'] = "false"
98+
ENV['exclude_fixtures'] = "false"
99+
ENV['skip_on_db_migrate'] = "false"
79100

80101
Warning: ImageMagick installs a tool called `annotate` too (if you're using MacPorts it's in `/opt/local/bin/annotate`. So if you see Usage: annotate imagein.jpg imageout.jpg then put `/usr/bin` ahead on the path and you'll get ours instead.
81102

@@ -108,6 +129,8 @@ to an automatically created comment block.
108129

109130
* Factory Girl => http://github.com/thoughtbot/factory_girl (NOT IMPLEMENTED)
110131
* Object Daddy => http://github.com/flogic/object_daddy
132+
* Machinist => http://github.com/notahat/machinist
133+
* Fabrication => http://github.com/paulelliott/fabrication
111134
* SpatialAdapter => http://github.com/pdeffendol/spatial_adapter
112135
* PostgisAdapter => http://github.com/nofxx/postgis_adapter
113136

@@ -142,5 +165,6 @@ Modifications by:
142165
- Bob Potter - http://github.com/bpot
143166
- Gavin Montague - http://github.com/govan/
144167
- Alexander Semyonov - http://github.com/rotuka/
168+
- Ian Duggan http://github.com/ijcd/
145169

146170
and many others that I may have missed to add.

Rakefile

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,23 @@ end
3434

3535
task :default => :spec
3636

37-
require 'rdoc/task'
38-
RDoc::Task.new do |rdoc|
39-
rdoc.rdoc_dir = 'rdoc'
40-
rdoc.title = "annotate #{Annotate.version}"
41-
rdoc.rdoc_files.include('README*')
42-
rdoc.rdoc_files.include('lib/**/*.rb')
37+
require "rspec/core/rake_task" # RSpec 2.0
38+
RSpec::Core::RakeTask.new(:spec) do |t|
39+
t.pattern = ['spec/*_spec.rb', 'spec/**/*_spec.rb']
4340
end
41+
42+
# FIXME not working yet
43+
RSpec::Core::RakeTask.new(:rcov) do |t|
44+
t.pattern = 'spec/**/*_spec.rb'
45+
t.rcov = true
46+
end
47+
48+
# FIXME warns "already initialized constant Task"
49+
# FIXME throws "uninitialized constant RDoc::VISIBILITIES"
50+
# require 'rdoc/task'
51+
# RDoc::Task.new do |rdoc|
52+
# rdoc.main = "README.rdoc"
53+
# rdoc.rdoc_files.include("README.rdoc", "lib/**/*.rb")
54+
# # require 'lib/annotate'
55+
# # rdoc.title = "annotate #{Annotate.version}"
56+
# end

VERSION.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
:major: 2
33
:minor: 5
44
:patch: 0
5+
:build: 'beta1'
6+

annotate.gemspec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ require './lib/annotate'
22

33
Gem::Specification.new do |s|
44
s.name = %q{annotate}
5-
s.version = Annotate.version # "2.5.0"
5+
s.version = Annotate.version
66
s.description = %q{Annotates Rails/ActiveRecord Models, routes, fixtures, and others based on the database schema.}
77
s.summary = %q{Annotates Rails Models, routes, fixtures, and others based on the database schema.}
8-
s.authors = ["Cuong Tran", "Alex Chaffee", "Marcos Piccinini"]
9-
8+
s.authors = ["Cuong Tran", "Alex Chaffee", "Marcos Piccinini", "Turadg Aleahmad"]
9+
1010

11-
s.executables = ["annotate"] # todo: annotate_models
11+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
1212
s.extra_rdoc_files = ["README.rdoc"]
1313

1414
s.files = %w( README.rdoc VERSION.yml History.txt )
@@ -23,3 +23,4 @@ Gem::Specification.new do |s|
2323

2424
s.add_runtime_dependency 'rake' # ?
2525
end
26+

annotate_models.gemspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ require './lib/annotate'
22

33
Gem::Specification.new do |s|
44
s.name = %q{annotate_models}
5-
s.version = Annotate.version # "2.5.0"
5+
s.version = Annotate.version
66
s.description = %q{Annotates Rails/ActiveRecord Models, routes, fixtures, and others based on the database schema.}
77
s.summary = %q{Annotates Rails Models, routes, fixtures, and others based on the database schema.}
8-
s.authors = ["Cuong Tran", "Alex Chaffee", "Marcos Piccinini"]
9-
8+
s.authors = ["Cuong Tran", "Alex Chaffee", "Marcos Piccinini", "Turadg Aleahmad"]
9+
1010

11-
s.executables = ["annotate"]# todo: change to annotate_models
11+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
1212
s.extra_rdoc_files = ["README.rdoc"]
1313

1414
s.files = %w( README.rdoc VERSION.yml History.txt )

0 commit comments

Comments
 (0)