fetty-generators 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/generators/fetty.rb +40 -17
- data/lib/generators/fetty/authentication/USAGE +6 -1
- data/lib/generators/fetty/authentication/authentication_generator.rb +16 -10
- data/lib/generators/fetty/authentication/templates/controllers/sessions_controller.rb +3 -0
- data/lib/generators/fetty/authentication/templates/controllers/users_controller.rb +5 -1
- data/lib/generators/fetty/authentication/templates/lib/users_authentication.rb +1 -1
- data/lib/generators/fetty/authentication/templates/spec/controllers/sessions_controller_spec.rb +12 -2
- data/lib/generators/fetty/authentication/templates/spec/controllers/users_controller_spec.rb +13 -2
- data/lib/generators/fetty/messages/USAGE +5 -0
- data/lib/generators/fetty/messages/messages_generator.rb +21 -13
- data/lib/generators/fetty/messages/templates/spec/controllers/messages_controller_spec.rb +5 -0
- data/lib/generators/fetty/messages/templates/spec/support/message_factories.rb +3 -3
- data/lib/generators/fetty/scaffold/USAGE +13 -0
- data/lib/generators/fetty/scaffold/scaffold_generator.rb +6 -16
- data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/controller.rb +45 -14
- data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/factories.rb +0 -0
- data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/helper.rb +0 -0
- data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/model.rb +0 -0
- data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/request.rb +0 -0
- data/lib/generators/fetty/scaffold/templates/{test/rspec → spec}/routing.rb +0 -0
- data/lib/generators/fetty/scaffold/templates/views/_form.html.erb +4 -0
- data/lib/generators/fetty/setup/USAGE +12 -1
- data/lib/generators/fetty/setup/setup_generator.rb +56 -39
- data/lib/generators/fetty/setup/templates/Guardfile +45 -0
- data/lib/generators/fetty/setup/templates/env.rb +83 -44
- data/lib/generators/fetty/setup/templates/spec_helper.rb +77 -39
- data/lib/generators/fetty/views/USAGE +10 -0
- data/lib/generators/fetty/views/templates/application.css +5 -0
- data/lib/generators/fetty/views/templates/application.html.erb +19 -15
- data/lib/generators/fetty/views/templates/application.js +0 -2
- data/lib/generators/fetty/views/views_generator.rb +6 -6
- metadata +10 -14
- data/lib/generators/fetty/authentication/templates/views/layouts/application.html.erb +0 -33
- data/lib/generators/fetty/scaffold/templates/test/test_unit/controller.rb +0 -62
- data/lib/generators/fetty/scaffold/templates/test/test_unit/fixtures.yml +0 -11
- data/lib/generators/fetty/scaffold/templates/test/test_unit/helper.rb +0 -4
- data/lib/generators/fetty/scaffold/templates/test/test_unit/model.rb +0 -7
@@ -3,3 +3,13 @@ Description:
|
|
3
3
|
helper which will give some structure to starting your Rails app.
|
4
4
|
|
5
5
|
Also able to convert your template views from ERB to HAML.
|
6
|
+
|
7
|
+
Example:
|
8
|
+
|
9
|
+
to generate default layout:
|
10
|
+
|
11
|
+
rails g fetty:views layout
|
12
|
+
|
13
|
+
to convert all your views from erb to haml:
|
14
|
+
|
15
|
+
rails g fetty:views erb_to_haml
|
@@ -1,23 +1,27 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
<title><%%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
|
5
|
+
<%%= stylesheet_link_tag 'application' %>
|
6
|
+
<%- unless rails_3_1? -%>
|
7
|
+
<%%= javascript_include_tag :defaults %>
|
8
|
+
<%- else -%>
|
9
|
+
<%%= javascript_include_tag 'application' %>
|
10
|
+
<%- end -%>
|
11
|
+
<%%= csrf_meta_tag %>
|
12
|
+
<%%= yield(:head) %>
|
9
13
|
</head>
|
10
14
|
<body>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
<div id="container">
|
16
|
+
<%% flash.each do |name, msg| %>
|
17
|
+
<%%= content_tag(:div, :id => "flash_#{name}", :class => "flash closable") do %>
|
18
|
+
<%%=h msg %>
|
19
|
+
<%%= content_tag(:span, "[close]", :title => "close", :class => "closelink") %>
|
20
|
+
<%% end %>
|
21
|
+
<%% end %>
|
18
22
|
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
<%%= content_tag :h1, yield(:title) if show_title? %>
|
24
|
+
<%%= yield %>
|
25
|
+
</div>
|
22
26
|
</body>
|
23
27
|
</html>
|
@@ -20,14 +20,14 @@ module Fetty
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def generate_layout
|
23
|
-
|
24
|
-
copy_file '
|
23
|
+
template 'application.html.erb', "app/views/layouts/application.html.erb"
|
24
|
+
copy_file 'application_helper.rb', 'app/helpers/application_helper.rb'
|
25
25
|
copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'
|
26
26
|
copy_file 'error_messages_helper.rb', 'app/helpers/error_messages_helper.rb'
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
copy_asset 'application.css', 'public/stylesheets/application.css'
|
28
|
+
copy_asset 'application.js', 'public/javascripts/application.js'
|
29
|
+
copy_asset 'down_arrow.gif', 'public/images/down_arrow.gif'
|
30
|
+
copy_asset 'up_arrow.gif', 'public/images/up_arrow.gif'
|
31
31
|
rescue Exception => e
|
32
32
|
raise e
|
33
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fetty-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-22 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: This generators provide you to easily setup your Rails 3 application,
|
15
15
|
create authentication, messages, admin style scaffolding and many more
|
@@ -41,7 +41,6 @@ files:
|
|
41
41
|
- lib/generators/fetty/authentication/templates/spec/routing/sessions_routing_spec.rb
|
42
42
|
- lib/generators/fetty/authentication/templates/spec/routing/users_routing_spec.rb
|
43
43
|
- lib/generators/fetty/authentication/templates/spec/support/user_factories.rb
|
44
|
-
- lib/generators/fetty/authentication/templates/views/layouts/application.html.erb
|
45
44
|
- lib/generators/fetty/authentication/templates/views/reset_passwords/edit.html.erb
|
46
45
|
- lib/generators/fetty/authentication/templates/views/reset_passwords/new.html.erb
|
47
46
|
- lib/generators/fetty/authentication/templates/views/sessions/new.html.erb
|
@@ -84,16 +83,12 @@ files:
|
|
84
83
|
- lib/generators/fetty/scaffold/templates/models/active_record/migration.rb
|
85
84
|
- lib/generators/fetty/scaffold/templates/models/active_record/model.rb
|
86
85
|
- lib/generators/fetty/scaffold/templates/models/mongoid/model.rb
|
87
|
-
- lib/generators/fetty/scaffold/templates/
|
88
|
-
- lib/generators/fetty/scaffold/templates/
|
89
|
-
- lib/generators/fetty/scaffold/templates/
|
90
|
-
- lib/generators/fetty/scaffold/templates/
|
91
|
-
- lib/generators/fetty/scaffold/templates/
|
92
|
-
- lib/generators/fetty/scaffold/templates/
|
93
|
-
- lib/generators/fetty/scaffold/templates/test/test_unit/controller.rb
|
94
|
-
- lib/generators/fetty/scaffold/templates/test/test_unit/fixtures.yml
|
95
|
-
- lib/generators/fetty/scaffold/templates/test/test_unit/helper.rb
|
96
|
-
- lib/generators/fetty/scaffold/templates/test/test_unit/model.rb
|
86
|
+
- lib/generators/fetty/scaffold/templates/spec/controller.rb
|
87
|
+
- lib/generators/fetty/scaffold/templates/spec/factories.rb
|
88
|
+
- lib/generators/fetty/scaffold/templates/spec/helper.rb
|
89
|
+
- lib/generators/fetty/scaffold/templates/spec/model.rb
|
90
|
+
- lib/generators/fetty/scaffold/templates/spec/request.rb
|
91
|
+
- lib/generators/fetty/scaffold/templates/spec/routing.rb
|
97
92
|
- lib/generators/fetty/scaffold/templates/views/_form.html.erb
|
98
93
|
- lib/generators/fetty/scaffold/templates/views/_table.html.erb
|
99
94
|
- lib/generators/fetty/scaffold/templates/views/edit.html.erb
|
@@ -109,6 +104,7 @@ files:
|
|
109
104
|
- lib/generators/fetty/setup/templates/env.rb
|
110
105
|
- lib/generators/fetty/setup/templates/escape_utils.rb
|
111
106
|
- lib/generators/fetty/setup/templates/file_uploader.rb
|
107
|
+
- lib/generators/fetty/setup/templates/Guardfile
|
112
108
|
- lib/generators/fetty/setup/templates/image_uploader.rb
|
113
109
|
- lib/generators/fetty/setup/templates/spec_helper.rb
|
114
110
|
- lib/generators/fetty/setup/USAGE
|
@@ -147,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
143
|
version: '0'
|
148
144
|
requirements: []
|
149
145
|
rubyforge_project: fetty-generators
|
150
|
-
rubygems_version: 1.8.
|
146
|
+
rubygems_version: 1.8.10
|
151
147
|
signing_key:
|
152
148
|
specification_version: 3
|
153
149
|
summary: Simple generators to start your Rails project
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
|
5
|
-
<%= stylesheet_link_tag 'application' %>
|
6
|
-
<%= javascript_include_tag :defaults %>
|
7
|
-
<%= csrf_meta_tag %>
|
8
|
-
<%= yield(:head) %>
|
9
|
-
</head>
|
10
|
-
<body>
|
11
|
-
<div id="container">
|
12
|
-
<% flash.each do |name, msg| %>
|
13
|
-
<%= content_tag(:div, :id => "flash_#{name}", :class => "flash closable") do %>
|
14
|
-
<%=h msg %>
|
15
|
-
<%= content_tag(:span, "[close]", :title => "close", :class => "closelink") %>
|
16
|
-
<% end %>
|
17
|
-
<% end %>
|
18
|
-
|
19
|
-
<div id='loginbox'>
|
20
|
-
<% if user_signed_in? %>
|
21
|
-
Signed in as <%= link_to current_user.username, user_path(current_user) %> Not You?
|
22
|
-
<%= link_to 'Sign out', session_path, :method => :delete %>
|
23
|
-
<% else %>
|
24
|
-
<%= link_to 'Sign up', new_user_path %> or <%= link_to 'Sign in', new_session_path %>
|
25
|
-
<% end %>
|
26
|
-
</div>
|
27
|
-
|
28
|
-
|
29
|
-
<%= content_tag :h1, yield(:title) if show_title? %>
|
30
|
-
<%= yield %>
|
31
|
-
</div>
|
32
|
-
</body>
|
33
|
-
</html>
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class <%= controller_name %>Test < ActionController::TestCase
|
4
|
-
<%- if action? :index -%>
|
5
|
-
def test_index
|
6
|
-
get :index
|
7
|
-
assert_template 'index'
|
8
|
-
end
|
9
|
-
<%- end -%>
|
10
|
-
<%- if action? :show -%>
|
11
|
-
def test_show
|
12
|
-
get :show, :id => <%= class_name %>.first
|
13
|
-
assert_template 'show'
|
14
|
-
end
|
15
|
-
<%- end -%>
|
16
|
-
<%- if action? :new -%>
|
17
|
-
def test_new
|
18
|
-
get :new
|
19
|
-
assert_template 'new'
|
20
|
-
end
|
21
|
-
<%- end -%>
|
22
|
-
<%- if action? :create -%>
|
23
|
-
def test_create_invalid
|
24
|
-
<%= class_name %>.any_instance.stub(:valid?).and_return(false)
|
25
|
-
post :create
|
26
|
-
assert_template 'new'
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_create_valid
|
30
|
-
<%= class_name %>.any_instance.stubs(:valid?).returns(true)
|
31
|
-
post :create
|
32
|
-
assert_redirected_to <%= generate_route_link(:action => :show, :suffix => 'url', :object => "assigns(:#{singular_name})" ) %>
|
33
|
-
end
|
34
|
-
<%- end -%>
|
35
|
-
<%- if action? :edit -%>
|
36
|
-
def test_edit
|
37
|
-
get :edit, :id => <%= class_name %>.first
|
38
|
-
assert_template 'edit'
|
39
|
-
end
|
40
|
-
<%- end -%>
|
41
|
-
<%- if action? :update -%>
|
42
|
-
def test_update_invalid
|
43
|
-
<%= class_name %>.any_instance.stub(:valid?).and_return(false)
|
44
|
-
put :update, :id => <%= class_name %>.first
|
45
|
-
assert_template 'edit'
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_update_valid
|
49
|
-
<%= class_name %>.any_instance.stub(:valid?).and_return(true)
|
50
|
-
put :update, :id => <%= class_name %>.first
|
51
|
-
assert_redirected_to <%= generate_route_link(:action => :show, :suffix => 'url', :object => "assigns(:#{singular_name})" ) %>
|
52
|
-
end
|
53
|
-
<%- end -%>
|
54
|
-
<%- if action? :destroy -%>
|
55
|
-
def test_destroy
|
56
|
-
<%= instance_name %> = <%= class_name %>.first
|
57
|
-
delete :destroy, :id => <%= instance_name %>
|
58
|
-
assert_redirected_to <%= generate_route_link(:action => :index, :suffix => 'url') %>
|
59
|
-
assert !<%= class_name %>.exists?(<%= instance_name %>.id)
|
60
|
-
end
|
61
|
-
<%- end -%>
|
62
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
2
|
-
|
3
|
-
one:
|
4
|
-
<%- for attribute in model_attributes -%>
|
5
|
-
<%= attribute.name %>: <%= attribute.default %>
|
6
|
-
<%- end -%>
|
7
|
-
|
8
|
-
two:
|
9
|
-
<%- for attribute in model_attributes -%>
|
10
|
-
<%= attribute.name %>: <%= attribute.default %>
|
11
|
-
<%- end -%>
|