Permalink
Browse files

Combined the "formtastic_config" and "formtastic_stylesheets" generat…

…ors into one single "formtastic" generator that does both.
  • Loading branch information...
1 parent 2526d2c commit fc29eaafd74f7aade600ff8141d292ffe89a16d5 @justinfrench committed Oct 11, 2009
View
8 README.textile
@@ -93,10 +93,14 @@ And then add it as a dependency in your environment.rb file:
:source => 'http://gems.github.com'
</pre>
-Run the generator to add a (commented out) Formtastic config file to your app's config/initializers/:
+If you want, run the generator to copy the following files into your app:
+
+* config/initializers/formtastic.rb (a commented out Formtastic config initializer)
+* public/stylesheets/formtastic.css
+* public/stylesheets/formtastic_changes.css
<pre>
- ./script/generate formtastic_config
+ ./script/generate formtastic
</pre>
See also "What about Stylesheets?"
View
9 ...heets/formtastic_stylesheets_generator.rb → ...rators/formtastic/formtastic_generator.rb
@@ -1,21 +1,24 @@
-class FormtasticStylesheetsGenerator < Rails::Generator::Base
+class FormtasticConfigGenerator < Rails::Generator::Base
def initialize(*runtime_args)
super
end
def manifest
record do |m|
+ m.directory File.join('config', 'initializers')
+ m.template 'formtastic.rb', File.join('config', 'initializers', 'formtastic.rb')
+
m.directory File.join('public', 'stylesheets')
m.template 'formtastic.css', File.join('public', 'stylesheets', 'formtastic.css')
m.template 'formtastic_changes.css', File.join('public', 'stylesheets', 'formtastic_changes.css')
end
end
-
+
protected
def banner
- %{Usage: #{$0} #{spec.name}\nCopies formtastic.css and formtastic_changes.css to public/}
+ %{Usage: #{$0} #{spec.name}\nCopies formtastic.css and formtastic_changes.css to public/stylesheets/ and a config initializer to config/initializers/formtastic.rb}
end
end
View
0 ...stic_stylesheets/templates/formtastic.css → ...ators/formtastic/templates/formtastic.css
File renamed without changes.
View
0 ...formtastic_config/templates/formtastic.rb → ...rators/formtastic/templates/formtastic.rb
File renamed without changes.
View
0 ...lesheets/templates/formtastic_changes.css → ...rmtastic/templates/formtastic_changes.css
File renamed without changes.
View
20 generators/formtastic_config/formtastic_config_generator.rb
@@ -1,20 +0,0 @@
-class FormtasticConfigGenerator < Rails::Generator::Base
-
- def initialize(*runtime_args)
- super
- end
-
- def manifest
- record do |m|
- m.directory File.join('config', 'initializers')
- m.template 'formtastic.rb', File.join('config', 'initializers', 'formtastic.rb')
- end
- end
-
- protected
-
- def banner
- %{Usage: #{$0} #{spec.name}\nCopies a (commented out) sample Formtastic config file into config/initializers/formtastic.rb}
- end
-
-end

0 comments on commit fc29eaa

Please sign in to comment.