merb-gen 0.9.13 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/generators/controller.rb +4 -4
- data/lib/generators/templates/application/common/merb.thor +1107 -1072
- data/lib/generators/templates/application/merb_stack/autotest/discover.rb +2 -1
- data/lib/generators/templates/application/merb_stack/autotest/merb.rb +5 -2
- data/lib/generators/templates/application/merb_stack/autotest/merb_rspec.rb +2 -2
- data/lib/generators/templates/component/controller/spec/requests/%file_name%_spec.rb +7 -0
- data/lib/generators/templates/component/controller/test/{controllers → requests}/%file_name%_test.rb +1 -2
- data/lib/generators/templates/component/resource_controller/app/views/%file_name%/edit.html.erb +1 -1
- data/lib/generators/templates/component/resource_controller/app/views/%file_name%/index.html.erb +1 -1
- data/lib/generators/templates/component/resource_controller/app/views/%file_name%/new.html.erb +1 -1
- data/lib/generators/templates/component/resource_controller/app/views/%file_name%/show.html.erb +1 -1
- data/lib/generators/templates/component/resource_controller/spec/requests/%file_name%_spec.rb +1 -1
- data/spec/controller_spec.rb +2 -2
- metadata +7 -7
- data/lib/generators/templates/component/controller/spec/controllers/%file_name%_spec.rb +0 -7
@@ -1 +1,2 @@
|
|
1
|
-
Autotest.add_discovery { "merb" }
|
1
|
+
Autotest.add_discovery { "merb" }
|
2
|
+
Autotest.add_discovery { "rspec" }
|
@@ -15,7 +15,10 @@ class Autotest::Merb < Autotest
|
|
15
15
|
initialize_test_layout
|
16
16
|
|
17
17
|
# Ignore any happenings in these directories
|
18
|
-
add_exception %r%^\./(?:doc|log|public|tmp)%
|
18
|
+
add_exception %r%^\./(?:doc|log|public|tmp|\.git|\.hg|\.svn|framework|gems|schema|\.DS_Store|autotest|bin|.*\.sqlite3)%
|
19
|
+
# Ignore SCM directories and custom Autotest mappings
|
20
|
+
%w[.svn .hg .git .autotest].each { |exception| add_exception(exception) }
|
21
|
+
|
19
22
|
|
20
23
|
# Ignore any mappings that Autotest may have already set up
|
21
24
|
clear_mappings
|
@@ -36,7 +39,7 @@ class Autotest::Merb < Autotest
|
|
36
39
|
]
|
37
40
|
end
|
38
41
|
|
39
|
-
# Any change to a test
|
42
|
+
# Any change to a test will cause it to be run
|
40
43
|
add_mapping %r%^test/(unit|models|integration|controllers|views|functional)/.*rb$% do |filename, _|
|
41
44
|
filename
|
42
45
|
end
|
@@ -14,7 +14,7 @@ class Autotest::MerbRspec < Autotest
|
|
14
14
|
super
|
15
15
|
|
16
16
|
# Ignore any happenings in these directories
|
17
|
-
add_exception %r%^\./(?:doc|log|public|tmp|\.git|\.hg|\.svn|framework|gems|schema|\.DS_Store|autotest|bin|.*\.sqlite3)%
|
17
|
+
add_exception %r%^\./(?:doc|log|public|tmp|\.git|\.hg|\.svn|framework|gems|schema|\.DS_Store|autotest|bin|.*\.sqlite3|.*\.thor)%
|
18
18
|
# Ignore SCM directories and custom Autotest mappings
|
19
19
|
%w[.svn .hg .git .autotest].each { |exception| add_exception(exception) }
|
20
20
|
|
@@ -44,7 +44,7 @@ class Autotest::MerbRspec < Autotest
|
|
44
44
|
# Any change to global_helpers will result in all view and controller
|
45
45
|
# tests being run
|
46
46
|
add_mapping %r%^app/helpers/global_helpers\.rb% do
|
47
|
-
files_matching %r%^spec/(views|controllers|helpers)/.*_spec\.rb$%
|
47
|
+
files_matching %r%^spec/(views|controllers|helpers|requests)/.*_spec\.rb$%
|
48
48
|
end
|
49
49
|
|
50
50
|
# Any change to a helper will cause its spec to be run
|
data/lib/generators/templates/component/controller/test/{controllers → requests}/%file_name%_test.rb
RENAMED
@@ -6,8 +6,7 @@ class <%= full_class_name %>; def rescue_action(e) raise e end; end
|
|
6
6
|
class <%= full_class_name %>Test < Test::Unit::TestCase
|
7
7
|
|
8
8
|
def setup
|
9
|
-
@
|
10
|
-
@controller.dispatch('index')
|
9
|
+
@resonse = request("/<%= full_class_name.to_s.to_const_path %>")
|
11
10
|
end
|
12
11
|
|
13
12
|
# Replace this with your real tests.
|
data/lib/generators/templates/component/resource_controller/app/views/%file_name%/edit.html.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
<h1><%= class_name %> controller, edit action</h1>
|
2
2
|
|
3
3
|
<p>Edit this file in <tt>app/views/<%= file_name %>/edit.html.erb</tt></p>
|
4
|
-
<p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
|
4
|
+
<p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a></p>
|
data/lib/generators/templates/component/resource_controller/app/views/%file_name%/index.html.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
<h1><%= class_name %> controller, index action</h1>
|
2
2
|
|
3
3
|
<p>Edit this file in <tt>app/views/<%= file_name %>/index.html.erb</tt></p>
|
4
|
-
<p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
|
4
|
+
<p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a></p>
|
data/lib/generators/templates/component/resource_controller/app/views/%file_name%/new.html.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
<h1><%= class_name %> controller, new action</h1>
|
2
2
|
|
3
3
|
<p>Edit this file in <tt>app/views/<%= file_name %>/new.html.erb</tt></p>
|
4
|
-
<p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
|
4
|
+
<p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a></p>
|
data/lib/generators/templates/component/resource_controller/app/views/%file_name%/show.html.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
<h1><%= class_name %> controller, show action</h1>
|
2
2
|
|
3
3
|
<p>Edit this file in <tt>app/views/<%= file_name %>/show.html.erb</tt></p>
|
4
|
-
<p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a>
|
4
|
+
<p>For more information and examples of CRUD views read <a href="http://wiki.merbivore.com/howto/crud_view_example_with_merb_using_erb"> this wiki page</a></p>
|
data/lib/generators/templates/component/resource_controller/spec/requests/%file_name%_spec.rb
CHANGED
@@ -110,7 +110,7 @@ describe "resource(@<%= singular_model %>)", :given => "a <%= singular_model %>
|
|
110
110
|
before(:each) do
|
111
111
|
@<%= singular_model %> = <%= model_class_name %>.first
|
112
112
|
@response = request(resource(@<%= singular_model %>), :method => "PUT",
|
113
|
-
:params => {
|
113
|
+
:params => { :<%= singular_model %> => {:id => @<%= singular_model %>.id} })
|
114
114
|
end
|
115
115
|
|
116
116
|
it "redirect to the article show action" do
|
data/spec/controller_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe Merb::Generators::ControllerGenerator do
|
|
19
19
|
describe "with rspec" do
|
20
20
|
|
21
21
|
it "should create a controller spec" do
|
22
|
-
@generator.should create('/tmp/spec/
|
22
|
+
@generator.should create('/tmp/spec/requests/stuff_spec.rb')
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should render templates successfully" do
|
@@ -35,7 +35,7 @@ describe Merb::Generators::ControllerGenerator do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should create a controller test" do
|
38
|
-
@generator.should create('/tmp/test/
|
38
|
+
@generator.should create('/tmp/test/requests/stuff_test.rb')
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should render templates successfully" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0
|
4
|
+
version: "1.0"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Nicklas
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-08 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0
|
23
|
+
version: "1.0"
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: templater
|
@@ -231,11 +231,11 @@ files:
|
|
231
231
|
- lib/generators/templates/component/controller/app/views/%file_name%
|
232
232
|
- lib/generators/templates/component/controller/app/views/%file_name%/index.html.erb
|
233
233
|
- lib/generators/templates/component/controller/spec
|
234
|
-
- lib/generators/templates/component/controller/spec/
|
235
|
-
- lib/generators/templates/component/controller/spec/
|
234
|
+
- lib/generators/templates/component/controller/spec/requests
|
235
|
+
- lib/generators/templates/component/controller/spec/requests/%file_name%_spec.rb
|
236
236
|
- lib/generators/templates/component/controller/test
|
237
|
-
- lib/generators/templates/component/controller/test/
|
238
|
-
- lib/generators/templates/component/controller/test/
|
237
|
+
- lib/generators/templates/component/controller/test/requests
|
238
|
+
- lib/generators/templates/component/controller/test/requests/%file_name%_test.rb
|
239
239
|
- lib/generators/templates/component/helper
|
240
240
|
- lib/generators/templates/component/helper/app
|
241
241
|
- lib/generators/templates/component/helper/app/helpers
|