fetty-generators 1.7.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/README.rdoc +42 -36
- data/Rakefile +1 -3
- data/lib/generators/fetty.rb +160 -10
- data/lib/generators/fetty/authentication/USAGE +4 -0
- data/lib/generators/fetty/authentication/authentication_generator.rb +171 -0
- data/lib/generators/fetty/authentication/templates/controllers/reset_passwords_controller.rb +45 -0
- data/lib/generators/fetty/authentication/templates/controllers/sessions_controller.rb +30 -0
- data/lib/generators/fetty/authentication/templates/controllers/users_controller.rb +78 -0
- data/lib/generators/fetty/authentication/templates/helpers/reset_passwords_helper.rb +2 -0
- data/lib/generators/fetty/authentication/templates/helpers/sessions_helper.rb +2 -0
- data/lib/generators/fetty/authentication/templates/helpers/users_helper.rb +2 -0
- data/lib/generators/fetty/authentication/templates/lib/sessions_authentication.rb +53 -0
- data/lib/generators/fetty/authentication/templates/lib/users_authentication.rb +110 -0
- data/lib/generators/fetty/authentication/templates/mailers/setup_mail.rb +11 -0
- data/lib/generators/fetty/authentication/templates/mailers/user_mailer.rb +14 -0
- data/lib/generators/fetty/authentication/templates/models/active_record/create_users.rb +17 -0
- data/lib/generators/fetty/authentication/templates/models/active_record/user.rb +15 -0
- data/lib/generators/fetty/authentication/templates/models/mongoid/user.rb +23 -0
- data/lib/generators/fetty/authentication/templates/spec/controllers/reset_passwords_controller_spec.rb +93 -0
- data/lib/generators/fetty/authentication/templates/spec/controllers/sessions_controller_spec.rb +61 -0
- data/lib/generators/fetty/authentication/templates/spec/controllers/users_controller_spec.rb +158 -0
- data/lib/generators/fetty/authentication/templates/spec/models/user_spec.rb +108 -0
- data/lib/generators/fetty/authentication/templates/spec/routing/reset_passwords_routing_spec.rb +21 -0
- data/lib/generators/fetty/authentication/templates/spec/routing/sessions_routing_spec.rb +17 -0
- data/lib/generators/fetty/authentication/templates/spec/routing/users_routing_spec.rb +37 -0
- data/lib/generators/fetty/authentication/templates/spec/support/user_factories.rb +6 -0
- data/lib/generators/fetty/authentication/templates/views/layouts/application.html.erb +33 -0
- data/lib/generators/fetty/authentication/templates/views/reset_passwords/edit.html.erb +19 -0
- data/lib/generators/fetty/authentication/templates/views/reset_passwords/new.html.erb +14 -0
- data/lib/generators/fetty/authentication/templates/views/sessions/new.html.erb +22 -0
- data/lib/generators/fetty/authentication/templates/views/user_mailer/user_activation.text.erb +4 -0
- data/lib/generators/fetty/authentication/templates/views/user_mailer/user_forgot_password.text.erb +7 -0
- data/lib/generators/fetty/authentication/templates/views/users/_table.html.erb +23 -0
- data/lib/generators/fetty/authentication/templates/views/users/edit.html.erb +21 -0
- data/lib/generators/fetty/authentication/templates/views/users/index.html.erb +7 -0
- data/lib/generators/fetty/authentication/templates/views/users/index.js.erb +1 -0
- data/lib/generators/fetty/authentication/templates/views/users/new.html.erb +23 -0
- data/lib/generators/fetty/authentication/templates/views/users/show.html.erb +19 -0
- data/lib/generators/fetty/messages/USAGE +4 -0
- data/lib/generators/fetty/messages/messages_generator.rb +136 -0
- data/lib/generators/fetty/messages/templates/assets/javascripts/jquery.tokeninput.js +718 -0
- data/lib/generators/fetty/messages/templates/assets/javascripts/messages.js +19 -0
- data/lib/generators/fetty/messages/templates/assets/stylesheets/messages.css +87 -0
- data/lib/generators/fetty/messages/templates/assets/stylesheets/token-input-facebook.css +122 -0
- data/lib/generators/fetty/messages/templates/controllers/messages_controller.rb +109 -0
- data/lib/generators/fetty/messages/templates/helpers/messages_helper.rb +2 -0
- data/lib/generators/fetty/messages/templates/lib/users_messages.rb +67 -0
- data/lib/generators/fetty/messages/templates/models/active_record/create_messages.rb +24 -0
- data/lib/generators/fetty/messages/templates/models/active_record/message.rb +67 -0
- data/lib/generators/fetty/messages/templates/models/mongoid/message.rb +81 -0
- data/lib/generators/fetty/messages/templates/spec/controllers/messages_controller_spec.rb +78 -0
- data/lib/generators/fetty/messages/templates/spec/models/message_spec.rb +53 -0
- data/lib/generators/fetty/messages/templates/spec/routing/messages_routing_spec.rb +61 -0
- data/lib/generators/fetty/messages/templates/spec/support/message_factories.rb +8 -0
- data/lib/generators/fetty/messages/templates/views/_head.html.erb +20 -0
- data/lib/generators/fetty/messages/templates/views/_messages.html.erb +56 -0
- data/lib/generators/fetty/messages/templates/views/_tabs_panel.html.erb +11 -0
- data/lib/generators/fetty/messages/templates/views/index.html.erb +10 -0
- data/lib/generators/fetty/messages/templates/views/index.js.erb +1 -0
- data/lib/generators/fetty/messages/templates/views/new.html.erb +26 -0
- data/lib/generators/fetty/messages/templates/views/show.html.erb +35 -0
- data/lib/generators/fetty/scaffold/USAGE +2 -52
- data/lib/generators/fetty/scaffold/scaffold_generator.rb +96 -329
- data/lib/generators/fetty/scaffold/templates/controllers/active_record/controller.rb +60 -0
- data/lib/generators/fetty/scaffold/templates/controllers/mongoid/controller.rb +60 -0
- data/lib/generators/fetty/scaffold/templates/helpers/helper.rb +2 -0
- data/lib/generators/fetty/scaffold/templates/models/active_record/migration.rb +16 -0
- data/lib/generators/fetty/scaffold/templates/models/active_record/model.rb +10 -0
- data/lib/generators/fetty/scaffold/templates/models/mongoid/model.rb +16 -0
- data/lib/generators/fetty/scaffold/templates/test/rspec/controller.rb +98 -0
- data/lib/generators/fetty/scaffold/templates/test/rspec/factories.rb +26 -0
- data/lib/generators/fetty/scaffold/templates/test/rspec/helper.rb +15 -0
- data/lib/generators/fetty/scaffold/templates/test/rspec/model.rb +9 -0
- data/lib/generators/fetty/scaffold/templates/test/rspec/request.rb +11 -0
- data/lib/generators/fetty/scaffold/templates/test/rspec/routing.rb +41 -0
- data/lib/generators/fetty/scaffold/templates/test/test_unit/controller.rb +62 -0
- data/lib/generators/fetty/scaffold/templates/{fixtures.yml → test/test_unit/fixtures.yml} +2 -0
- data/lib/generators/fetty/scaffold/templates/test/test_unit/helper.rb +4 -0
- data/lib/generators/fetty/scaffold/templates/test/test_unit/model.rb +7 -0
- data/lib/generators/fetty/scaffold/templates/views/_form.html.erb +20 -0
- data/lib/generators/fetty/scaffold/templates/views/_table.html.erb +48 -0
- data/lib/generators/fetty/scaffold/templates/views/edit.html.erb +13 -0
- data/lib/generators/fetty/scaffold/templates/views/index.html.erb +15 -0
- data/lib/generators/fetty/scaffold/templates/views/{erb/index.js.erb → index.js.erb} +0 -0
- data/lib/generators/fetty/scaffold/templates/views/new.html.erb +9 -0
- data/lib/generators/fetty/scaffold/templates/views/show.html.erb +28 -0
- data/lib/generators/fetty/setup/USAGE +3 -20
- data/lib/generators/fetty/setup/setup_generator.rb +122 -61
- data/lib/generators/fetty/setup/templates/ability.rb +0 -0
- data/lib/generators/fetty/setup/templates/ckeditor.rb +54 -0
- data/lib/generators/fetty/setup/templates/ckeditor.tar.gz +0 -0
- data/lib/generators/fetty/setup/templates/escape_utils.rb +7 -0
- data/lib/generators/fetty/setup/templates/file_uploader.rb +15 -0
- data/lib/generators/fetty/setup/templates/image_uploader.rb +48 -0
- data/lib/generators/fetty/setup/templates/spec_helper.rb +44 -0
- data/lib/generators/fetty/views/USAGE +5 -0
- data/lib/generators/fetty/{layout/templates/stylesheet.css → views/templates/application.css} +184 -166
- data/lib/generators/fetty/views/templates/application.html.erb +23 -0
- data/lib/generators/fetty/{layout → views}/templates/application.js +0 -0
- data/lib/generators/fetty/views/templates/application_helper.rb +10 -0
- data/lib/generators/fetty/views/templates/down_arrow.gif +0 -0
- data/lib/generators/fetty/{layout → views}/templates/error_messages_helper.rb +0 -0
- data/lib/generators/fetty/{layout → views}/templates/layout_helper.rb +0 -0
- data/lib/generators/fetty/views/templates/up_arrow.gif +0 -0
- data/lib/generators/fetty/views/views_generator.rb +51 -0
- data/lib/generators/scaffold.rb +204 -0
- metadata +126 -111
- data/LICENSE +0 -20
- data/lib/generators/fetty/layout/USAGE +0 -26
- data/lib/generators/fetty/layout/layout_generator.rb +0 -44
- data/lib/generators/fetty/layout/templates/layout.html.erb +0 -32
- data/lib/generators/fetty/layout/templates/layout.html.haml +0 -34
- data/lib/generators/fetty/layout/templates/no-devise-links-layout.html.erb +0 -23
- data/lib/generators/fetty/layout/templates/no-devise-links-layout.html.haml +0 -23
- data/lib/generators/fetty/layout/templates/stylesheet.sass +0 -163
- data/lib/generators/fetty/scaffold/templates/actions/create.rb +0 -8
- data/lib/generators/fetty/scaffold/templates/actions/destroy.rb +0 -5
- data/lib/generators/fetty/scaffold/templates/actions/edit.rb +0 -3
- data/lib/generators/fetty/scaffold/templates/actions/index.rb +0 -10
- data/lib/generators/fetty/scaffold/templates/actions/new.rb +0 -3
- data/lib/generators/fetty/scaffold/templates/actions/show.rb +0 -3
- data/lib/generators/fetty/scaffold/templates/actions/update.rb +0 -8
- data/lib/generators/fetty/scaffold/templates/controller.rb +0 -7
- data/lib/generators/fetty/scaffold/templates/helper.rb +0 -2
- data/lib/generators/fetty/scaffold/templates/migration.rb +0 -16
- data/lib/generators/fetty/scaffold/templates/model.rb +0 -7
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/create.rb +0 -11
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/destroy.rb +0 -6
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/edit.rb +0 -4
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/index.rb +0 -4
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/new.rb +0 -4
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/show.rb +0 -4
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/update.rb +0 -11
- data/lib/generators/fetty/scaffold/templates/tests/rspec/controller.rb +0 -8
- data/lib/generators/fetty/scaffold/templates/tests/rspec/model.rb +0 -7
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/create.rb +0 -13
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/destroy.rb +0 -8
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/edit.rb +0 -6
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/index.rb +0 -6
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/new.rb +0 -6
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/show.rb +0 -6
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/update.rb +0 -13
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/controller.rb +0 -5
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/model.rb +0 -7
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/create.rb +0 -11
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/destroy.rb +0 -6
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/edit.rb +0 -4
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/index.rb +0 -4
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/new.rb +0 -4
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/show.rb +0 -4
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/update.rb +0 -11
- data/lib/generators/fetty/scaffold/templates/tests/testunit/controller.rb +0 -5
- data/lib/generators/fetty/scaffold/templates/tests/testunit/model.rb +0 -7
- data/lib/generators/fetty/scaffold/templates/views/erb/_form.html.erb +0 -22
- data/lib/generators/fetty/scaffold/templates/views/erb/_table.html.erb +0 -50
- data/lib/generators/fetty/scaffold/templates/views/erb/edit.html.erb +0 -12
- data/lib/generators/fetty/scaffold/templates/views/erb/index.html.erb +0 -13
- data/lib/generators/fetty/scaffold/templates/views/erb/new.html.erb +0 -9
- data/lib/generators/fetty/scaffold/templates/views/erb/show.html.erb +0 -26
- data/lib/generators/fetty/scaffold/templates/views/haml/_form.html.haml +0 -8
- data/lib/generators/fetty/scaffold/templates/views/haml/_table.html.haml +0 -33
- data/lib/generators/fetty/scaffold/templates/views/haml/edit.html.haml +0 -14
- data/lib/generators/fetty/scaffold/templates/views/haml/index.html.haml +0 -12
- data/lib/generators/fetty/scaffold/templates/views/haml/index.js.haml +0 -1
- data/lib/generators/fetty/scaffold/templates/views/haml/new.html.haml +0 -8
- data/lib/generators/fetty/scaffold/templates/views/haml/show.html.haml +0 -23
@@ -0,0 +1,23 @@
|
|
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
|
+
<%= content_tag :h1, yield(:title) if show_title? %>
|
20
|
+
<%= yield %>
|
21
|
+
</div>
|
22
|
+
</body>
|
23
|
+
</html>
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module ApplicationHelper
|
2
|
+
|
3
|
+
def sortable(column, title = nil)
|
4
|
+
title ||= column.titleize
|
5
|
+
direction = column == params[:sort] && params[:direction] == "asc" ? "desc" : "asc"
|
6
|
+
css_class = column == params[:sort] ? "current #{direction}" : nil
|
7
|
+
link_to title, params.merge(:sort => column, :direction => direction, :page => nil), { :class => css_class }
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
Binary file
|
File without changes
|
File without changes
|
Binary file
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'generators/fetty'
|
2
|
+
|
3
|
+
module Fetty
|
4
|
+
module Generators
|
5
|
+
class ViewsGenerator < Base
|
6
|
+
|
7
|
+
argument :arg, :type => :string, :required => true, :banner => 'layout | erb:to:haml | haml:to:erb'
|
8
|
+
|
9
|
+
def generate_views
|
10
|
+
case arg
|
11
|
+
when "layout"
|
12
|
+
generate_layout
|
13
|
+
when "erb:to:haml"
|
14
|
+
erb_to_haml
|
15
|
+
when "haml:to:erb"
|
16
|
+
haml_to_erb
|
17
|
+
end
|
18
|
+
rescue Exception => e
|
19
|
+
print_notes(e.message,"error",:red)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def generate_layout
|
25
|
+
copy_file 'application.html.erb', "app/views/layouts/application.html.erb"
|
26
|
+
copy_file 'application.css', "public/stylesheets/application.css"
|
27
|
+
copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'
|
28
|
+
copy_file 'error_messages_helper.rb', 'app/helpers/error_messages_helper.rb'
|
29
|
+
copy_file 'application.js', 'public/javascripts/application.js'
|
30
|
+
copy_file 'application_helper.rb', 'app/helpers/application_helper.rb'
|
31
|
+
copy_file 'down_arrow.gif', 'public/images/down_arrow.gif'
|
32
|
+
copy_file 'up_arrow.gif', 'public/images/up_arrow.gif'
|
33
|
+
rescue Exception => e
|
34
|
+
raise e
|
35
|
+
end
|
36
|
+
|
37
|
+
def erb_to_haml
|
38
|
+
print_notes("It will convert your *.html.erb files in 'app/views' to *.html.haml")
|
39
|
+
rescue Exception => e
|
40
|
+
raise e
|
41
|
+
end
|
42
|
+
|
43
|
+
def haml_to_erb
|
44
|
+
print_notes("It will convert your *.html.haml files in 'app/views' to *.html.erb")
|
45
|
+
rescue Exception => e
|
46
|
+
raise e
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,204 @@
|
|
1
|
+
module Fetty
|
2
|
+
module Generators
|
3
|
+
module Scaffold
|
4
|
+
|
5
|
+
mattr_accessor :model_attributes, :controller_actions, :special_types
|
6
|
+
|
7
|
+
# setting variable & initialize mixins
|
8
|
+
|
9
|
+
def self.included(base)
|
10
|
+
self.model_attributes = []
|
11
|
+
self.controller_actions = %w[index show new create edit update destroy]
|
12
|
+
self.special_types = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def setting_model_attributes
|
16
|
+
attributes.each do |arg|
|
17
|
+
if arg.include?(':')
|
18
|
+
if arg.include?(':file') || arg.include?(':image') || arg.include?(':editor')
|
19
|
+
self.special_types[arg.split(':').first] = arg.split(':').last.to_sym
|
20
|
+
if arg.include?(':editor')
|
21
|
+
self.model_attributes << Rails::Generators::GeneratedAttribute.new(arg.split(':').first, "text")
|
22
|
+
else
|
23
|
+
self.model_attributes << Rails::Generators::GeneratedAttribute.new(arg.split(':').first, "string")
|
24
|
+
end
|
25
|
+
else
|
26
|
+
self.model_attributes << Rails::Generators::GeneratedAttribute.new(*arg.split(':'))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
self.model_attributes.uniq!
|
31
|
+
rescue Exception => e
|
32
|
+
raise e
|
33
|
+
end
|
34
|
+
|
35
|
+
def setting_controller_attributes
|
36
|
+
unless options.except.empty?
|
37
|
+
options.except.each do |action|
|
38
|
+
self.controller_actions.delete(action)
|
39
|
+
if action == 'new'
|
40
|
+
self.controller_actions.delete(:create)
|
41
|
+
elsif action == 'edit'
|
42
|
+
self.controller_actions.delete(:update)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
self.controller_actions.uniq!
|
47
|
+
rescue Exception => e
|
48
|
+
raise e
|
49
|
+
end
|
50
|
+
|
51
|
+
# public method generator
|
52
|
+
|
53
|
+
def generate_routes
|
54
|
+
namespaces = plural_name.split('/')
|
55
|
+
resource = namespaces.pop
|
56
|
+
route namespaces.reverse.inject("resources :#{resource}") { |acc, namespace|
|
57
|
+
"namespace :#{namespace} do #{acc} end"
|
58
|
+
}
|
59
|
+
rescue Exception => e
|
60
|
+
raise e
|
61
|
+
end
|
62
|
+
|
63
|
+
def generate_action_links(action, authorize, object, link_text)
|
64
|
+
out = ""
|
65
|
+
out << "\t<% if can? :#{authorize}, #{object} %>\n\t" if using_cancan?
|
66
|
+
|
67
|
+
link_path = generate_route_link(:action => action, :object => object, :suffix => 'path')
|
68
|
+
|
69
|
+
unless action == :destroy
|
70
|
+
out << "\t<%= link_to '#{link_text}', #{link_path} %>\n"
|
71
|
+
else
|
72
|
+
out << "\t<%= link_to '#{link_text}', #{link_path}, :confirm => 'Are you sure?', :method => :delete %>\n"
|
73
|
+
end
|
74
|
+
out << "\t<% end %>" if using_cancan?
|
75
|
+
out.html_safe
|
76
|
+
rescue Exception => e
|
77
|
+
raise e
|
78
|
+
end
|
79
|
+
|
80
|
+
def generate_route_link(options ={})
|
81
|
+
case options[:action]
|
82
|
+
when :new
|
83
|
+
"new_#{resource_name}_#{options[:suffix]}"
|
84
|
+
when :edit
|
85
|
+
"edit_#{resource_name}_#{options[:suffix]}(#{options[:object]})"
|
86
|
+
when :index
|
87
|
+
"#{resources_name}_#{options[:suffix]}"
|
88
|
+
else
|
89
|
+
"#{resource_name}_#{options[:suffix]}(#{options[:object]})"
|
90
|
+
end
|
91
|
+
rescue Exception => e
|
92
|
+
raise e
|
93
|
+
end
|
94
|
+
|
95
|
+
def record_or_name_or_array
|
96
|
+
unless has_namespace?
|
97
|
+
instance_name('@')
|
98
|
+
else
|
99
|
+
namespace = singular_name.split('/')[0..-2]
|
100
|
+
"[:#{namespace.join(', :')}, #{instance_name('@')}]"
|
101
|
+
end
|
102
|
+
rescue Exception => e
|
103
|
+
raise e
|
104
|
+
end
|
105
|
+
|
106
|
+
# public boolean function
|
107
|
+
|
108
|
+
def has_namespace?
|
109
|
+
scaffold_name.include?('::')
|
110
|
+
end
|
111
|
+
|
112
|
+
def has_type?(type)
|
113
|
+
self.special_types.has_value? type
|
114
|
+
end
|
115
|
+
|
116
|
+
def special_select(type)
|
117
|
+
self.special_types.select { |k,v| v == type }.keys
|
118
|
+
end
|
119
|
+
|
120
|
+
def action?(name)
|
121
|
+
self.controller_actions.include? name.to_s
|
122
|
+
end
|
123
|
+
|
124
|
+
def actions?(*names)
|
125
|
+
names.all? { |name| action? name }
|
126
|
+
end
|
127
|
+
|
128
|
+
# playing with names
|
129
|
+
|
130
|
+
def simple_name
|
131
|
+
class_name.underscore.humanize.downcase
|
132
|
+
end
|
133
|
+
|
134
|
+
def class_name
|
135
|
+
scaffold_name.split('::').last.camelize.singularize
|
136
|
+
end
|
137
|
+
|
138
|
+
def table_name
|
139
|
+
scaffold_name.split('::').last.pluralize.downcase
|
140
|
+
end
|
141
|
+
|
142
|
+
def singular_name
|
143
|
+
scaffold_name.underscore.singularize
|
144
|
+
end
|
145
|
+
|
146
|
+
def plural_name
|
147
|
+
singular_name.pluralize
|
148
|
+
end
|
149
|
+
|
150
|
+
def instance_name(suffix = '')
|
151
|
+
suffix += singular_name.split('/').last
|
152
|
+
end
|
153
|
+
|
154
|
+
def instances_name(suffix = '')
|
155
|
+
instance_name(suffix).pluralize
|
156
|
+
end
|
157
|
+
|
158
|
+
def resource_name
|
159
|
+
scaffold_name.underscore.gsub('/','_').singularize
|
160
|
+
end
|
161
|
+
|
162
|
+
def resources_name
|
163
|
+
resource_name.pluralize
|
164
|
+
end
|
165
|
+
|
166
|
+
def model_name(opt = :name)
|
167
|
+
case opt
|
168
|
+
when :name
|
169
|
+
class_name
|
170
|
+
when :path
|
171
|
+
"app/models/#{class_name.downcase}.rb"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def migration_name(opt = :name)
|
176
|
+
case opt
|
177
|
+
when :name
|
178
|
+
plural_name.camelize.delete('::').insert(0,'Create')
|
179
|
+
when :path
|
180
|
+
"db/migrate/create_#{plural_name.gsub('/', '_')}.rb"
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def controller_name(opt = :name)
|
185
|
+
case opt
|
186
|
+
when :name
|
187
|
+
plural_name.camelize.insert(-1,'Controller')
|
188
|
+
when :path
|
189
|
+
"app/controllers/#{plural_name}_controller.rb"
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def helper_name(opt = :name)
|
194
|
+
case opt
|
195
|
+
when :name
|
196
|
+
plural_name.camelize.insert(-1,'Helper')
|
197
|
+
when :path
|
198
|
+
"app/helpers/#{plural_name}_helper.rb"
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
metadata
CHANGED
@@ -1,137 +1,152 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: fetty-generators
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 7
|
8
|
-
- 1
|
9
|
-
version: 1.7.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Fajri Fachriansyah
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2011-04-12 00:00:00 +07:00
|
18
|
-
default_executable:
|
12
|
+
date: 2011-08-04 00:00:00.000000000Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
description: Simple generator to start your Rails project
|
15
|
+
email:
|
16
|
+
- fajri82@gmail.com
|
23
17
|
executables: []
|
24
|
-
|
25
18
|
extensions: []
|
26
|
-
|
27
19
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
|
30
|
-
- lib/generators/fetty.rb
|
31
|
-
- lib/generators/fetty/
|
20
|
+
files:
|
21
|
+
- lib/generators/fetty/authentication/authentication_generator.rb
|
22
|
+
- lib/generators/fetty/authentication/templates/controllers/reset_passwords_controller.rb
|
23
|
+
- lib/generators/fetty/authentication/templates/controllers/sessions_controller.rb
|
24
|
+
- lib/generators/fetty/authentication/templates/controllers/users_controller.rb
|
25
|
+
- lib/generators/fetty/authentication/templates/helpers/reset_passwords_helper.rb
|
26
|
+
- lib/generators/fetty/authentication/templates/helpers/sessions_helper.rb
|
27
|
+
- lib/generators/fetty/authentication/templates/helpers/users_helper.rb
|
28
|
+
- lib/generators/fetty/authentication/templates/lib/sessions_authentication.rb
|
29
|
+
- lib/generators/fetty/authentication/templates/lib/users_authentication.rb
|
30
|
+
- lib/generators/fetty/authentication/templates/mailers/setup_mail.rb
|
31
|
+
- lib/generators/fetty/authentication/templates/mailers/user_mailer.rb
|
32
|
+
- lib/generators/fetty/authentication/templates/models/active_record/create_users.rb
|
33
|
+
- lib/generators/fetty/authentication/templates/models/active_record/user.rb
|
34
|
+
- lib/generators/fetty/authentication/templates/models/mongoid/user.rb
|
35
|
+
- lib/generators/fetty/authentication/templates/spec/controllers/reset_passwords_controller_spec.rb
|
36
|
+
- lib/generators/fetty/authentication/templates/spec/controllers/sessions_controller_spec.rb
|
37
|
+
- lib/generators/fetty/authentication/templates/spec/controllers/users_controller_spec.rb
|
38
|
+
- lib/generators/fetty/authentication/templates/spec/models/user_spec.rb
|
39
|
+
- lib/generators/fetty/authentication/templates/spec/routing/reset_passwords_routing_spec.rb
|
40
|
+
- lib/generators/fetty/authentication/templates/spec/routing/sessions_routing_spec.rb
|
41
|
+
- lib/generators/fetty/authentication/templates/spec/routing/users_routing_spec.rb
|
42
|
+
- lib/generators/fetty/authentication/templates/spec/support/user_factories.rb
|
43
|
+
- lib/generators/fetty/authentication/templates/views/layouts/application.html.erb
|
44
|
+
- lib/generators/fetty/authentication/templates/views/reset_passwords/edit.html.erb
|
45
|
+
- lib/generators/fetty/authentication/templates/views/reset_passwords/new.html.erb
|
46
|
+
- lib/generators/fetty/authentication/templates/views/sessions/new.html.erb
|
47
|
+
- lib/generators/fetty/authentication/templates/views/user_mailer/user_activation.text.erb
|
48
|
+
- lib/generators/fetty/authentication/templates/views/user_mailer/user_forgot_password.text.erb
|
49
|
+
- lib/generators/fetty/authentication/templates/views/users/_table.html.erb
|
50
|
+
- lib/generators/fetty/authentication/templates/views/users/edit.html.erb
|
51
|
+
- lib/generators/fetty/authentication/templates/views/users/index.html.erb
|
52
|
+
- lib/generators/fetty/authentication/templates/views/users/index.js.erb
|
53
|
+
- lib/generators/fetty/authentication/templates/views/users/new.html.erb
|
54
|
+
- lib/generators/fetty/authentication/templates/views/users/show.html.erb
|
55
|
+
- lib/generators/fetty/authentication/USAGE
|
56
|
+
- lib/generators/fetty/messages/messages_generator.rb
|
57
|
+
- lib/generators/fetty/messages/templates/assets/javascripts/jquery.tokeninput.js
|
58
|
+
- lib/generators/fetty/messages/templates/assets/javascripts/messages.js
|
59
|
+
- lib/generators/fetty/messages/templates/assets/stylesheets/messages.css
|
60
|
+
- lib/generators/fetty/messages/templates/assets/stylesheets/token-input-facebook.css
|
61
|
+
- lib/generators/fetty/messages/templates/controllers/messages_controller.rb
|
62
|
+
- lib/generators/fetty/messages/templates/helpers/messages_helper.rb
|
63
|
+
- lib/generators/fetty/messages/templates/lib/users_messages.rb
|
64
|
+
- lib/generators/fetty/messages/templates/models/active_record/create_messages.rb
|
65
|
+
- lib/generators/fetty/messages/templates/models/active_record/message.rb
|
66
|
+
- lib/generators/fetty/messages/templates/models/mongoid/message.rb
|
67
|
+
- lib/generators/fetty/messages/templates/spec/controllers/messages_controller_spec.rb
|
68
|
+
- lib/generators/fetty/messages/templates/spec/models/message_spec.rb
|
69
|
+
- lib/generators/fetty/messages/templates/spec/routing/messages_routing_spec.rb
|
70
|
+
- lib/generators/fetty/messages/templates/spec/support/message_factories.rb
|
71
|
+
- lib/generators/fetty/messages/templates/views/_head.html.erb
|
72
|
+
- lib/generators/fetty/messages/templates/views/_messages.html.erb
|
73
|
+
- lib/generators/fetty/messages/templates/views/_tabs_panel.html.erb
|
74
|
+
- lib/generators/fetty/messages/templates/views/index.html.erb
|
75
|
+
- lib/generators/fetty/messages/templates/views/index.js.erb
|
76
|
+
- lib/generators/fetty/messages/templates/views/new.html.erb
|
77
|
+
- lib/generators/fetty/messages/templates/views/show.html.erb
|
78
|
+
- lib/generators/fetty/messages/USAGE
|
32
79
|
- lib/generators/fetty/scaffold/scaffold_generator.rb
|
33
|
-
- lib/generators/fetty/scaffold/templates/
|
34
|
-
- lib/generators/fetty/scaffold/templates/
|
35
|
-
- lib/generators/fetty/scaffold/templates/
|
36
|
-
- lib/generators/fetty/scaffold/templates/
|
37
|
-
- lib/generators/fetty/scaffold/templates/
|
38
|
-
- lib/generators/fetty/scaffold/templates/
|
39
|
-
- lib/generators/fetty/scaffold/templates/
|
40
|
-
- lib/generators/fetty/scaffold/templates/
|
41
|
-
- lib/generators/fetty/scaffold/templates/
|
42
|
-
- lib/generators/fetty/scaffold/templates/
|
43
|
-
- lib/generators/fetty/scaffold/templates/
|
44
|
-
- lib/generators/fetty/scaffold/templates/
|
45
|
-
- lib/generators/fetty/scaffold/templates/
|
46
|
-
- lib/generators/fetty/scaffold/templates/
|
47
|
-
- lib/generators/fetty/scaffold/templates/
|
48
|
-
- lib/generators/fetty/scaffold/templates/
|
49
|
-
- lib/generators/fetty/scaffold/templates/
|
50
|
-
- lib/generators/fetty/scaffold/templates/
|
51
|
-
- lib/generators/fetty/scaffold/templates/
|
52
|
-
- lib/generators/fetty/scaffold/templates/
|
53
|
-
- lib/generators/fetty/scaffold/templates/
|
54
|
-
- lib/generators/fetty/scaffold/templates/
|
55
|
-
- lib/generators/fetty/scaffold/templates/
|
56
|
-
- lib/generators/fetty/scaffold/
|
57
|
-
- lib/generators/fetty/scaffold/templates/tests/shoulda/actions/destroy.rb
|
58
|
-
- lib/generators/fetty/scaffold/templates/tests/shoulda/actions/edit.rb
|
59
|
-
- lib/generators/fetty/scaffold/templates/tests/shoulda/actions/create.rb
|
60
|
-
- lib/generators/fetty/scaffold/templates/tests/shoulda/actions/show.rb
|
61
|
-
- lib/generators/fetty/scaffold/templates/tests/testunit/model.rb
|
62
|
-
- lib/generators/fetty/scaffold/templates/tests/testunit/controller.rb
|
63
|
-
- lib/generators/fetty/scaffold/templates/tests/testunit/actions/index.rb
|
64
|
-
- lib/generators/fetty/scaffold/templates/tests/testunit/actions/new.rb
|
65
|
-
- lib/generators/fetty/scaffold/templates/tests/testunit/actions/update.rb
|
66
|
-
- lib/generators/fetty/scaffold/templates/tests/testunit/actions/destroy.rb
|
67
|
-
- lib/generators/fetty/scaffold/templates/tests/testunit/actions/edit.rb
|
68
|
-
- lib/generators/fetty/scaffold/templates/tests/testunit/actions/create.rb
|
69
|
-
- lib/generators/fetty/scaffold/templates/tests/testunit/actions/show.rb
|
70
|
-
- lib/generators/fetty/scaffold/templates/tests/rspec/model.rb
|
71
|
-
- lib/generators/fetty/scaffold/templates/tests/rspec/controller.rb
|
72
|
-
- lib/generators/fetty/scaffold/templates/tests/rspec/actions/index.rb
|
73
|
-
- lib/generators/fetty/scaffold/templates/tests/rspec/actions/new.rb
|
74
|
-
- lib/generators/fetty/scaffold/templates/tests/rspec/actions/update.rb
|
75
|
-
- lib/generators/fetty/scaffold/templates/tests/rspec/actions/destroy.rb
|
76
|
-
- lib/generators/fetty/scaffold/templates/tests/rspec/actions/edit.rb
|
77
|
-
- lib/generators/fetty/scaffold/templates/tests/rspec/actions/create.rb
|
78
|
-
- lib/generators/fetty/scaffold/templates/tests/rspec/actions/show.rb
|
79
|
-
- lib/generators/fetty/scaffold/templates/actions/index.rb
|
80
|
-
- lib/generators/fetty/scaffold/templates/actions/new.rb
|
81
|
-
- lib/generators/fetty/scaffold/templates/actions/update.rb
|
82
|
-
- lib/generators/fetty/scaffold/templates/actions/destroy.rb
|
83
|
-
- lib/generators/fetty/scaffold/templates/actions/edit.rb
|
84
|
-
- lib/generators/fetty/scaffold/templates/actions/create.rb
|
85
|
-
- lib/generators/fetty/scaffold/templates/actions/show.rb
|
86
|
-
- lib/generators/fetty/setup/USAGE
|
87
|
-
- lib/generators/fetty/setup/templates/ability.rb
|
80
|
+
- lib/generators/fetty/scaffold/templates/controllers/active_record/controller.rb
|
81
|
+
- lib/generators/fetty/scaffold/templates/controllers/mongoid/controller.rb
|
82
|
+
- lib/generators/fetty/scaffold/templates/helpers/helper.rb
|
83
|
+
- lib/generators/fetty/scaffold/templates/models/active_record/migration.rb
|
84
|
+
- lib/generators/fetty/scaffold/templates/models/active_record/model.rb
|
85
|
+
- lib/generators/fetty/scaffold/templates/models/mongoid/model.rb
|
86
|
+
- lib/generators/fetty/scaffold/templates/test/rspec/controller.rb
|
87
|
+
- lib/generators/fetty/scaffold/templates/test/rspec/factories.rb
|
88
|
+
- lib/generators/fetty/scaffold/templates/test/rspec/helper.rb
|
89
|
+
- lib/generators/fetty/scaffold/templates/test/rspec/model.rb
|
90
|
+
- lib/generators/fetty/scaffold/templates/test/rspec/request.rb
|
91
|
+
- lib/generators/fetty/scaffold/templates/test/rspec/routing.rb
|
92
|
+
- lib/generators/fetty/scaffold/templates/test/test_unit/controller.rb
|
93
|
+
- lib/generators/fetty/scaffold/templates/test/test_unit/fixtures.yml
|
94
|
+
- lib/generators/fetty/scaffold/templates/test/test_unit/helper.rb
|
95
|
+
- lib/generators/fetty/scaffold/templates/test/test_unit/model.rb
|
96
|
+
- lib/generators/fetty/scaffold/templates/views/_form.html.erb
|
97
|
+
- lib/generators/fetty/scaffold/templates/views/_table.html.erb
|
98
|
+
- lib/generators/fetty/scaffold/templates/views/edit.html.erb
|
99
|
+
- lib/generators/fetty/scaffold/templates/views/index.html.erb
|
100
|
+
- lib/generators/fetty/scaffold/templates/views/index.js.erb
|
101
|
+
- lib/generators/fetty/scaffold/templates/views/new.html.erb
|
102
|
+
- lib/generators/fetty/scaffold/templates/views/show.html.erb
|
103
|
+
- lib/generators/fetty/scaffold/USAGE
|
88
104
|
- lib/generators/fetty/setup/setup_generator.rb
|
89
|
-
- lib/generators/fetty/
|
90
|
-
- lib/generators/fetty/
|
91
|
-
- lib/generators/fetty/
|
92
|
-
- lib/generators/fetty/
|
93
|
-
- lib/generators/fetty/
|
94
|
-
- lib/generators/fetty/
|
95
|
-
- lib/generators/fetty/
|
96
|
-
- lib/generators/fetty/
|
97
|
-
- lib/generators/fetty/
|
98
|
-
- lib/generators/fetty/
|
99
|
-
- lib/generators/fetty/
|
100
|
-
-
|
105
|
+
- lib/generators/fetty/setup/templates/ability.rb
|
106
|
+
- lib/generators/fetty/setup/templates/ckeditor.rb
|
107
|
+
- lib/generators/fetty/setup/templates/ckeditor.tar.gz
|
108
|
+
- lib/generators/fetty/setup/templates/escape_utils.rb
|
109
|
+
- lib/generators/fetty/setup/templates/file_uploader.rb
|
110
|
+
- lib/generators/fetty/setup/templates/image_uploader.rb
|
111
|
+
- lib/generators/fetty/setup/templates/spec_helper.rb
|
112
|
+
- lib/generators/fetty/setup/USAGE
|
113
|
+
- lib/generators/fetty/views/templates/application.css
|
114
|
+
- lib/generators/fetty/views/templates/application.html.erb
|
115
|
+
- lib/generators/fetty/views/templates/application.js
|
116
|
+
- lib/generators/fetty/views/templates/application_helper.rb
|
117
|
+
- lib/generators/fetty/views/templates/down_arrow.gif
|
118
|
+
- lib/generators/fetty/views/templates/error_messages_helper.rb
|
119
|
+
- lib/generators/fetty/views/templates/layout_helper.rb
|
120
|
+
- lib/generators/fetty/views/templates/up_arrow.gif
|
121
|
+
- lib/generators/fetty/views/USAGE
|
122
|
+
- lib/generators/fetty/views/views_generator.rb
|
123
|
+
- lib/generators/fetty.rb
|
124
|
+
- lib/generators/scaffold.rb
|
125
|
+
- Gemfile
|
101
126
|
- Rakefile
|
102
127
|
- README.rdoc
|
103
|
-
- Gemfile
|
104
|
-
has_rdoc: true
|
105
128
|
homepage: http://github.com/fajrif/fetty-generators
|
106
129
|
licenses: []
|
107
|
-
|
108
130
|
post_install_message:
|
109
131
|
rdoc_options: []
|
110
|
-
|
111
|
-
require_paths:
|
132
|
+
require_paths:
|
112
133
|
- lib
|
113
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
135
|
none: false
|
115
|
-
requirements:
|
116
|
-
- -
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
|
119
|
-
|
120
|
-
version: "0"
|
121
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
141
|
none: false
|
123
|
-
requirements:
|
124
|
-
- -
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
|
127
|
-
- 0
|
128
|
-
version: "0"
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
129
146
|
requirements: []
|
130
|
-
|
131
147
|
rubyforge_project: fetty-generators
|
132
|
-
rubygems_version: 1.
|
148
|
+
rubygems_version: 1.8.5
|
133
149
|
signing_key:
|
134
150
|
specification_version: 3
|
135
|
-
summary:
|
151
|
+
summary: Simple generator to start your Rails project
|
136
152
|
test_files: []
|
137
|
-
|