annotate 2.4.1.beta1 → 2.5.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +75 -1
- data/README.rdoc +80 -57
- data/bin/annotate +46 -19
- data/lib/annotate.rb +4 -14
- data/lib/annotate/active_record_patch.rb +9 -0
- data/lib/annotate/annotate_models.rb +188 -112
- data/lib/annotate/annotate_routes.rb +11 -11
- data/lib/annotate/tasks.rb +6 -0
- data/lib/annotate/version.rb +5 -0
- data/lib/generators/annotate_models/USAGE +4 -0
- data/lib/generators/annotate_models/install_generator.rb +14 -0
- data/lib/generators/annotate_models/templates/auto_annotate_models.rake +20 -0
- data/lib/tasks/annotate_models.rake +29 -9
- data/lib/tasks/annotate_routes.rake +3 -2
- data/tasks/migrate.rake +4 -4
- metadata +31 -29
- data/Rakefile +0 -51
- data/VERSION.yml +0 -5
- data/annotate.gemspec +0 -58
- data/spec/annotate/annotate_models_spec.rb +0 -92
- data/spec/annotate/annotate_routes_spec.rb +0 -47
- data/spec/annotate_spec.rb +0 -9
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -10
- data/todo.txt +0 -5
@@ -1,47 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
-
require 'annotate/annotate_routes'
|
3
|
-
|
4
|
-
describe AnnotateRoutes do
|
5
|
-
|
6
|
-
def mock_file(stubs={})
|
7
|
-
@mock_file ||= mock(File, stubs)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "Annotate Job" do
|
11
|
-
|
12
|
-
before(:each) do
|
13
|
-
File.should_receive(:join).with("config", "routes.rb").and_return("config/routes.rb")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should check if routes.rb exists" do
|
17
|
-
File.should_receive(:exists?).with("config/routes.rb").and_return(false)
|
18
|
-
AnnotateRoutes.should_receive(:puts).with("Can`t find routes.rb")
|
19
|
-
AnnotateRoutes.do_annotate
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "When Annotating" do
|
23
|
-
|
24
|
-
before(:each) do
|
25
|
-
File.should_receive(:exists?).with("config/routes.rb").and_return(true)
|
26
|
-
AnnotateRoutes.should_receive(:`).with("rake routes").and_return("bad line\ngood line")
|
27
|
-
File.should_receive(:open).with("config/routes.rb", "wb").and_yield(mock_file)
|
28
|
-
AnnotateRoutes.should_receive(:puts).with("Route file annotated.")
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should annotate and add a newline!" do
|
32
|
-
File.should_receive(:read).with("config/routes.rb").and_return("ActionController::Routing...\nfoo")
|
33
|
-
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n#== Route Map\n# Generated on .*\n#\n# good line/)
|
34
|
-
AnnotateRoutes.do_annotate
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should not add a newline if there are empty lines" do
|
38
|
-
File.should_receive(:read).with("config/routes.rb").and_return("ActionController::Routing...\nfoo\n")
|
39
|
-
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n#== Route Map\n# Generated on .*\n#\n# good line/)
|
40
|
-
AnnotateRoutes.do_annotate
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
data/spec/annotate_spec.rb
DELETED
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour
|
data/spec/spec_helper.rb
DELETED