Browse files

remove simple_form generators

  • Loading branch information...
1 parent 312c2b7 commit 0cdc57d960a4cc317895af55a30d865460ecc10c @negonicrac negonicrac committed Sep 10, 2012
View
1 CHANGELOG.rdoc
@@ -5,6 +5,7 @@
== Development
* optimize
* MongoMapper generators removed. MongoMapper (https://github.com/jnunemaker/mongomapper) has its own generators.
+ * SimpleForm generators removed. SimpleForm (https://github.com/plataformatec/simple_form) has its own generators.
== 0.17.5
* optimize
View
2 README.rdoc
@@ -20,6 +20,8 @@ The jQuery generators have moved to {the jquery-rails gem}[http://github.com/ind
The MongoMapper generators moved to {the mongo_mapper gem}[https://github.com/jnunemaker/mongomapper].
+The SimpleForm generators moved to {the simple_form gem}[https://github.com/plataformatec/simple_form].
+
To avoid overriding the rails built-in Erb template generators this project uses the namespace Erubis for *.erb templates
config.generators do |g|
View
30 lib/generators/simple_form.rb
@@ -1,30 +0,0 @@
-require 'rails/generators/named_base'
-
-module SimpleForm
- module Generators
- class Base < Rails::Generators::NamedBase #:nodoc:
- # include Rails::Generators::ResourceHelpers
-
- def self.source_root
- @_simple_form_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'simple_form', generator_name, 'templates'))
- end
- protected
-
- def format
- :html
- end
-
- def handler
- :erb
- end
-
- def filename_with_extensions(name)
- [name, format, handler].compact.join(".")
- end
-
- def template_filename_with_extensions(name)
- [name, format, handler, :erb].compact.join(".")
- end
- end
- end
-end
View
25 lib/generators/simple_form/scaffold/scaffold_generator.rb
@@ -1,25 +0,0 @@
-require 'generators/simple_form'
-require 'rails/generators/resource_helpers'
-
-module SimpleForm
- module Generators
- class ScaffoldGenerator < Base
- include Rails::Generators::ResourceHelpers
-
- argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
-
- class_option :template_engine
-
- def copy_form_file
- filename = filename_with_extensions("_form")
- template template_filename_with_extensions("_form"), File.join("app/views", controller_file_path, filename)
- end
-
- protected
-
- def handler
- options[:template_engine].to_s.gsub('erubis', 'erb')
- end
- end
- end
-end
View
21 lib/generators/simple_form/scaffold/templates/_form.html.erb.erb
@@ -1,21 +0,0 @@
-<%%= simple_form_for @<%= file_name %> do |form| %>
-
- <%% if @<%= file_name %>.errors.any? -%>
- <div id="errorExplanation">
- <h2><%%= "#{pluralize(@<%= file_name %>.errors.count, "error")} prohibited this #{<%= class_name %>.name.titleize} from being saved:" %></h2>
- <ul>
- <%%- @<%= file_name %>.errors.full_messages.each do |msg| -%>
- <li><%%= msg %></li>
- <%%- end -%>
- </ul>
- </div>
- <%% end -%>
-
- <%- for attribute in attributes -%>
- <%%= form.input :<%= attribute.name %>, :label => '<%= attribute.name.titleize %>' %>
- <%- end -%>
-
- <div class="actions">
- <%%= form.button :submit %>
- </div>
-<%% end %>
View
15 lib/generators/simple_form/scaffold/templates/_form.html.haml.erb
@@ -1,15 +0,0 @@
-= simple_form_for @<%= file_name %> do |form|
-
- -if @<%= file_name %>.errors.any?
- #errorExplanation
- %h2= "#{pluralize(@<%= file_name %>.errors.count, "error")} prohibited this #{<%= class_name %>.name.titleize} from being saved:"
- %ul
- - @<%= file_name %>.errors.full_messages.each do |msg|
- %li= msg
-
-<%- for attribute in attributes -%>
- = form.input :<%= attribute.name %>, :label => '<%= attribute.name.titleize %>'
-<%- end -%>
-
- .actions
- = form.button :submit
View
2 lib/rails3-generators.rb
@@ -47,7 +47,7 @@ module Rails3Generators
]
end
-%w(formtastic simple_form).each do |form_builder|
+%w(formtastic).each do |form_builder|
Rails::Generators.hidden_namespaces <<
[
"#{form_builder}:scaffold"
View
19 test/lib/generators/simple_form/scaffold_generators_test.rb
@@ -1,19 +0,0 @@
-require 'test_helper'
-
-class SimpleForm::Generators::FormBuilderGeneratorTest < Rails::Generators::TestCase
- destination File.join(Rails.root)
- tests Rails::Generators::ScaffoldGenerator
-
- setup :prepare_destination
- setup :copy_routes
-
- test "should invoke form builder and output haml form" do
- run_generator %w(product_line title:string price:integer --template-engine haml --form-builder simple_form)
- assert_file "app/views/product_lines/_form.html.haml"
- end
-
- test "should invoke form builder and output erubis form" do
- run_generator %w(product_line title:string price:integer --template-engine erubis --form-builder simple_form)
- assert_file "app/views/product_lines/_form.html.erb"
- end
-end
View
1 test/test_helper.rb
@@ -49,7 +49,6 @@ def generator_list
{
:rails => ['scaffold', 'controller'],
:erubis => ['scaffold'],
- :simple_form => ['scaffold'],
:formtastic => ['scaffold'],
:authlogic => ['session'],
:koala => ['install'],

0 comments on commit 0cdc57d

Please sign in to comment.