jumpstart 0.1.0
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/.bundle/config +2 -0
- data/.document +5 -0
- data/.gitignore +28 -0
- data/Gemfile +8 -0
- data/LICENSE +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/bin/jumpstart +5 -0
- data/config/jumpstart_setup.yml +2 -0
- data/jumpstart.gemspec +222 -0
- data/jumpstart_templates/i0n_rails_3/.gitignore +11 -0
- data/jumpstart_templates/i0n_rails_3/_._Gemfile +5 -0
- data/jumpstart_templates/i0n_rails_3/app/views/home/index.haml +4 -0
- data/jumpstart_templates/i0n_rails_3/app/views/layouts/application.haml +32 -0
- data/jumpstart_templates/i0n_rails_3/config/_2._routes.rb +1 -0
- data/jumpstart_templates/i0n_rails_3/config/_L._database.yml +1 -0
- data/jumpstart_templates/i0n_rails_3/config/deploy.rb +62 -0
- data/jumpstart_templates/i0n_rails_3/config/environments/_18._development.rb +5 -0
- data/jumpstart_templates/i0n_rails_3/config/environments/_27._test.rb +1 -0
- data/jumpstart_templates/i0n_rails_3/config/environments/_41._production.rb +3 -0
- data/jumpstart_templates/i0n_rails_3/config/initializers/setup_mail.rb +14 -0
- data/jumpstart_templates/i0n_rails_3/jumpstart_config/i0n_rails_3.yml +40 -0
- data/jumpstart_templates/i0n_rails_3/jumpstart_config/nginx.local.conf +11 -0
- data/jumpstart_templates/i0n_rails_3/jumpstart_config/nginx.remote.conf +37 -0
- data/jumpstart_templates/i0n_rails_3/lib/development_mail_interceptor.rb +8 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/authlogic.rb +11 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/authlogic/session/session_generator.rb +18 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/authlogic/session/templates/session.rb +2 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper.rb +80 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/migration/migration_generator.rb +26 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/migration/templates/migration.rb +21 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/model/model_generator.rb +29 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/model/templates/migration.rb +17 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/model/templates/model.rb +10 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/observer/observer_generator.rb +15 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/observer/templates/observer.rb +5 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/factory_girl.rb +11 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/factory_girl/model/model_generator.rb +14 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/factory_girl/model/templates/fixtures.rb +7 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb.rb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/USAGE +8 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/controller/controller_generator.rb +24 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/controller/templates/view.html.erb +0 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/scaffold_generator.rb +27 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/_form.html.erb +12 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/edit.html.erb +6 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/index.html.erb +27 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/layout.html.erb +16 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/new.html.erb +5 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/show.html.erb +10 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml.rb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/USAGE +8 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/controller/controller_generator.rb +24 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/controller/templates/view.html.haml +0 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/scaffold_generator.rb +23 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/_form.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/edit.haml.erb +7 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/index.haml.erb +23 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/layout.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/new.haml.erb +5 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/show.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml.rb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/controller/controller_generator.rb +24 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/controller/templates/view.html.haml +0 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/scaffold_generator.rb +26 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/_form.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/edit.haml.erb +7 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/index.haml.erb +23 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/layout.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/new.haml.erb +5 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/show.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist.rb +11 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist/model/model_generator.rb +19 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist/model/templates/blueprint.rb +5 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist/model/templates/machinist_initializer.rb +19 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper.rb +80 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper/model/model_generator.rb +29 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper/model/templates/model.rb +24 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper/observer/observer_generator.rb +15 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda.rb +11 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/controller/controller_generator.rb +16 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/controller/templates/controller.rb +84 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/model/model_generator.rb +16 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/model/templates/model.rb +7 -0
- data/jumpstart_templates/i0n_rails_3/lib/tasks/populate.rake +91 -0
- data/jumpstart_templates/i0n_rails_3/public/javascripts/init.js +6 -0
- data/jumpstart_templates/i0n_rails_3/public/javascripts/jquery-1.4.2.min.js +154 -0
- data/jumpstart_templates/i0n_rails_3/public/javascripts/jquery-ui-1.8.custom.min.js +404 -0
- data/jumpstart_templates/i0n_rails_3/public/javascripts/rails.js +126 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/_setup.sass +86 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/global.sass +58 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/handheld.sass +7 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/ie.sass +40 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/print.sass +57 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/screen.sass +170 -0
- data/lib/jumpstart.rb +71 -0
- data/lib/jumpstart/base.rb +547 -0
- data/lib/jumpstart/doc/JumpStart.html +139 -0
- data/lib/jumpstart/doc/JumpStart/Base.html +1566 -0
- data/lib/jumpstart/doc/base_rb.html +52 -0
- data/lib/jumpstart/doc/created.rid +2 -0
- data/lib/jumpstart/doc/index.html +101 -0
- data/lib/jumpstart/doc/rdoc.css +706 -0
- data/lib/jumpstart/filetools.rb +270 -0
- data/source_templates/template_config.yml +77 -0
- data/test/fake_nginx_path/local_nginx_1.conf +81 -0
- data/test/fake_nginx_path/remote_nginx_1.conf +54 -0
- data/test/helper.rb +31 -0
- data/test/jumpstart/test_base.rb +422 -0
- data/test/jumpstart/test_filetools.rb +350 -0
- data/test/test_jumpstart.rb +9 -0
- data/test/test_jumpstart_templates/test_base/_._test_file.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_._test_file_.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_1._test_file1.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_1._test_file1_.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_10._test_file2.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_99999._test_file3.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_a._test_file4.txt +0 -0
- data/test/test_jumpstart_templates/test_base/test_file +0 -0
- data/test/test_jumpstart_templates/test_base/test_file5.txt +0 -0
- data/test/test_jumpstart_templates/test_base/test_file_.6txt +0 -0
- data/test/test_jumpstart_templates/test_fileutils/append_after_line_test.txt +6 -0
- data/test/test_jumpstart_templates/test_fileutils/append_to_end_of_file_source.txt +1 -0
- data/test/test_jumpstart_templates/test_fileutils/append_to_end_of_file_test.txt +5 -0
- data/test/test_jumpstart_templates/test_fileutils/check_source_type +5 -0
- data/test/test_jumpstart_templates/test_fileutils/check_source_type.txt +10 -0
- data/test/test_jumpstart_templates/test_fileutils/config_capistrano_source.rb +62 -0
- data/test/test_jumpstart_templates/test_fileutils/config_capistrano_test.rb +62 -0
- data/test/test_jumpstart_templates/test_fileutils/config_nginx_source.txt +1 -0
- data/test/test_jumpstart_templates/test_fileutils/config_nginx_test.txt +82 -0
- data/test/test_jumpstart_templates/test_fileutils/hosts_test +11 -0
- data/test/test_jumpstart_templates/test_fileutils/insert_text_at_line_number_source.txt +1 -0
- data/test/test_jumpstart_templates/test_fileutils/insert_text_at_line_number_test.txt +4 -0
- data/test/test_jumpstart_templates/test_fileutils/remove_files_test_2.txt +0 -0
- data/test/test_jumpstart_templates/test_fileutils/remove_files_test_3.txt +0 -0
- data/test/test_jumpstart_templates/test_fileutils/remove_lines_test.txt +10 -0
- data/test/test_jumpstart_templates/test_fileutils/replace_strings_test.rb +62 -0
- data/test/test_jumpstart_templates/test_template_1/_._test_append_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/_._test_append_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/_20._test_line_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/_5._test_line_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/_L._test_append_to_end_of_file_remove_last_line_1.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/_l._test_append_to_end_of_file_remove_last_line_2.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/_._test_append_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/_._test_append_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/_5._test_line_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/_50._test_line_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/test_whole_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/test_whole_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/jumpstart_config/test_template_1.yml +31 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/_._test_append_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/_._test_append_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/_5._test_line_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/_50._test_line_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/test_whole_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/test_whole_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/test_append_to_end_of_file_remove_last_line_1.txt +10 -0
- data/test/test_jumpstart_templates/test_template_1/test_append_to_end_of_file_remove_last_line_2.txt +10 -0
- data/test/test_jumpstart_templates/test_template_1/test_remove_files/file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/test_remove_files/file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/test_replace_strings/replace_strings_1.rb +62 -0
- data/test/test_jumpstart_templates/test_template_1/test_replace_strings/replace_strings_2.txt +23 -0
- data/test/test_jumpstart_templates/test_template_1/test_whole_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/test_whole_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_2/jumpstart_config/test_template_2.yml +8 -0
- data/test/test_jumpstart_templates/test_template_3/jumpstart_config/test_template_3.yml +22 -0
- metadata +254 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'rails/generators/named_base'
|
|
2
|
+
|
|
3
|
+
module FactoryGirl
|
|
4
|
+
module Generators
|
|
5
|
+
class Base < Rails::Generators::NamedBase #:nodoc:
|
|
6
|
+
def self.source_root
|
|
7
|
+
@_factory_girl_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'factory_girl', generator_name, 'templates'))
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'generators/factory_girl'
|
|
2
|
+
|
|
3
|
+
module FactoryGirl
|
|
4
|
+
module Generators
|
|
5
|
+
class ModelGenerator < Base
|
|
6
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
|
7
|
+
class_option :dir, :type => :string, :default => "test/factories", :desc => "The directory where the factories should go"
|
|
8
|
+
|
|
9
|
+
def create_fixture_file
|
|
10
|
+
template 'fixtures.rb', File.join(options[:dir], "#{table_name}.rb")
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'generators/formtastic'
|
|
2
|
+
require 'rails/generators/named_base'
|
|
3
|
+
|
|
4
|
+
module FormtasticErb
|
|
5
|
+
module Generators
|
|
6
|
+
class ControllerGenerator < Rails::Generators::NamedBase
|
|
7
|
+
extend TemplatePath
|
|
8
|
+
|
|
9
|
+
argument :actions, :type => :array, :default => [], :banner => "action action"
|
|
10
|
+
|
|
11
|
+
def create_view_files
|
|
12
|
+
base_path = File.join("app/views", class_path, file_name)
|
|
13
|
+
empty_directory base_path
|
|
14
|
+
|
|
15
|
+
actions.each do |action|
|
|
16
|
+
@action = action
|
|
17
|
+
@path = File.join(base_path, "#{action}.html.haml")
|
|
18
|
+
|
|
19
|
+
template 'view.html.haml', @path
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
File without changes
|
data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/scaffold_generator.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'generators/formtastic_erb'
|
|
2
|
+
require 'generators/erb/scaffold/scaffold_generator'
|
|
3
|
+
|
|
4
|
+
module FormtasticErb
|
|
5
|
+
module Generators
|
|
6
|
+
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
7
|
+
extend TemplatePath
|
|
8
|
+
|
|
9
|
+
def copy_layout_file
|
|
10
|
+
return unless options[:layout]
|
|
11
|
+
template "layout.html.erb",
|
|
12
|
+
File.join("app/views/layouts", controller_class_path, "#{controller_file_name}.html.erb")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
protected
|
|
16
|
+
|
|
17
|
+
def copy_view(view)
|
|
18
|
+
if view =~ /^_.*/
|
|
19
|
+
template "#{view}.html.erb", File.join("app/views", controller_file_path, "#{view}.html.erb")
|
|
20
|
+
else
|
|
21
|
+
super view
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/_form.html.erb
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%% semantic_form_for @<%= singular_name %> do |form| %>
|
|
2
|
+
<%- if attributes.empty? -%>
|
|
3
|
+
<%% form.inputs %>
|
|
4
|
+
<%- else -%>
|
|
5
|
+
<%% form.inputs do %>
|
|
6
|
+
<%- for attribute in attributes -%>
|
|
7
|
+
<%%= form.input :<%= attribute.name %>, :label => '<%= attribute.name.titleize %>' %>
|
|
8
|
+
<%- end -%>
|
|
9
|
+
<%% end %>
|
|
10
|
+
<%- end -%>
|
|
11
|
+
<%%= form.buttons %>
|
|
12
|
+
<%% end %>
|
data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/index.html.erb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<h1>Listing <%= plural_name %></h1>
|
|
2
|
+
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
<% for attribute in attributes -%>
|
|
6
|
+
<th><%= attribute.human_name %></th>
|
|
7
|
+
<% end -%>
|
|
8
|
+
<th></th>
|
|
9
|
+
<th></th>
|
|
10
|
+
<th></th>
|
|
11
|
+
</tr>
|
|
12
|
+
|
|
13
|
+
<%% @<%= plural_name %>.each do |<%= singular_name %>| %>
|
|
14
|
+
<tr>
|
|
15
|
+
<% for attribute in attributes -%>
|
|
16
|
+
<td><%%= <%= singular_name %>.<%= attribute.name %> %></td>
|
|
17
|
+
<% end -%>
|
|
18
|
+
<td><%%= link_to 'Show', <%= singular_name %> %></td>
|
|
19
|
+
<td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
|
|
20
|
+
<td><%%= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
|
|
21
|
+
</tr>
|
|
22
|
+
<%% end %>
|
|
23
|
+
</table>
|
|
24
|
+
|
|
25
|
+
<br />
|
|
26
|
+
|
|
27
|
+
<%%= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path %>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title><%= controller_class_name %>: <%%= controller.action_name %></title>
|
|
5
|
+
<%%= stylesheet_link_tag 'scaffold' %>
|
|
6
|
+
<%%= javascript_include_tag :defaults %>
|
|
7
|
+
<%%= csrf_meta_tag %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<p class="notice"><%%= notice %></p>
|
|
12
|
+
|
|
13
|
+
<%%= yield %>
|
|
14
|
+
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/show.html.erb
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<% for attribute in attributes -%>
|
|
2
|
+
<p>
|
|
3
|
+
<b><%= attribute.human_name %>:</b>
|
|
4
|
+
<%%= @<%= singular_name %>.<%= attribute.name %> %>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<% end -%>
|
|
8
|
+
|
|
9
|
+
<%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) %> |
|
|
10
|
+
<%%= link_to 'Back', <%= plural_name %>_path %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'generators/formtastic'
|
|
2
|
+
require 'rails/generators/named_base'
|
|
3
|
+
|
|
4
|
+
module FormtasticHaml
|
|
5
|
+
module Generators
|
|
6
|
+
class ControllerGenerator < Rails::Generators::NamedBase
|
|
7
|
+
extend TemplatePath
|
|
8
|
+
|
|
9
|
+
argument :actions, :type => :array, :default => [], :banner => "action action"
|
|
10
|
+
|
|
11
|
+
def create_view_files
|
|
12
|
+
base_path = File.join("app/views", class_path, file_name)
|
|
13
|
+
empty_directory base_path
|
|
14
|
+
|
|
15
|
+
actions.each do |action|
|
|
16
|
+
@action = action
|
|
17
|
+
@path = File.join(base_path, "#{action}.html.haml")
|
|
18
|
+
|
|
19
|
+
template 'view.html.haml', @path
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
File without changes
|
data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/scaffold_generator.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'generators/formtastic_haml'
|
|
2
|
+
require 'generators/erb/scaffold/scaffold_generator'
|
|
3
|
+
|
|
4
|
+
module FormtasticHaml
|
|
5
|
+
module Generators
|
|
6
|
+
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
7
|
+
extend TemplatePath
|
|
8
|
+
|
|
9
|
+
def copy_layout_file
|
|
10
|
+
return unless options[:layout]
|
|
11
|
+
template "layout.haml.erb",
|
|
12
|
+
File.join("app/views/layouts", controller_class_path, "#{controller_file_name}.html.haml")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
protected
|
|
16
|
+
|
|
17
|
+
def copy_view(view)
|
|
18
|
+
template "#{view}.haml.erb", File.join("app/views", controller_file_path, "#{view}.html.haml")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
- semantic_form_for @<%= singular_name %> do |form|
|
|
2
|
+
<%- if attributes.empty? -%>
|
|
3
|
+
- form.inputs
|
|
4
|
+
<%- else -%>
|
|
5
|
+
<%- for attribute in attributes -%>
|
|
6
|
+
= form.input :<%= attribute.name %>, :label => '<%= attribute.name.titleize %>'
|
|
7
|
+
<%- end -%>
|
|
8
|
+
<%- end -%>
|
|
9
|
+
= form.buttons
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
%h1 Listing <%= plural_name %>
|
|
2
|
+
|
|
3
|
+
%table
|
|
4
|
+
%tr
|
|
5
|
+
<% for attribute in attributes -%>
|
|
6
|
+
%th <%= attribute.human_name %>
|
|
7
|
+
<% end -%>
|
|
8
|
+
%th
|
|
9
|
+
%th
|
|
10
|
+
%th
|
|
11
|
+
|
|
12
|
+
- @<%= plural_name %>.each do |<%= singular_name %>|
|
|
13
|
+
%tr
|
|
14
|
+
<% for attribute in attributes -%>
|
|
15
|
+
%td= <%= singular_name %>.<%= attribute.name %>
|
|
16
|
+
<% end -%>
|
|
17
|
+
%td= link_to 'Show', <%= singular_name %>
|
|
18
|
+
%td= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>)
|
|
19
|
+
%td= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete
|
|
20
|
+
|
|
21
|
+
%br
|
|
22
|
+
|
|
23
|
+
= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'generators/haml'
|
|
2
|
+
require 'rails/generators/named_base'
|
|
3
|
+
|
|
4
|
+
module Haml
|
|
5
|
+
module Generators
|
|
6
|
+
class ControllerGenerator < Rails::Generators::NamedBase
|
|
7
|
+
extend TemplatePath
|
|
8
|
+
|
|
9
|
+
argument :actions, :type => :array, :default => [], :banner => "action action"
|
|
10
|
+
|
|
11
|
+
def create_view_files
|
|
12
|
+
base_path = File.join("app/views", class_path, file_name)
|
|
13
|
+
empty_directory base_path
|
|
14
|
+
|
|
15
|
+
actions.each do |action|
|
|
16
|
+
@action = action
|
|
17
|
+
@path = File.join(base_path, "#{action}.html.haml")
|
|
18
|
+
|
|
19
|
+
template 'view.html.haml', @path
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'generators/haml'
|
|
2
|
+
require 'rails/generators/erb/scaffold/scaffold_generator'
|
|
3
|
+
|
|
4
|
+
module Haml
|
|
5
|
+
module Generators
|
|
6
|
+
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
|
7
|
+
extend TemplatePath
|
|
8
|
+
|
|
9
|
+
def copy_layout_file
|
|
10
|
+
return unless options[:layout]
|
|
11
|
+
template "layout.haml.erb",
|
|
12
|
+
File.join("app/views/layouts", controller_class_path, "#{controller_file_name}.html.haml")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def copy_view_files
|
|
16
|
+
views = available_views
|
|
17
|
+
views.delete("index") if options[:singleton]
|
|
18
|
+
|
|
19
|
+
views.each do |view|
|
|
20
|
+
template "#{view}.haml.erb", File.join("app/views", controller_file_path, "#{view}.html.haml")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|