Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rails3 compatible generator

Changes routes from being part of plugin to
generated in config/routes.rb. The curent Rails3
recommendation for routes is not finalized. This
should be updated once the Rails team has a better
tie-in for routes.
  • Loading branch information...
commit 968e571dc2c7f9a9d28e57f85323c06e5302dbb1 1 parent 6ef67dc
Joe Fiorini authored Adam McCrea committed
View
12 generators/showoff/USAGE
@@ -1,12 +0,0 @@
-Description:
- The showoff generator creates the mockups directory along with
- a few samples to demonstrate how to use the plugin. It also
- creates a stylesheet that is used in the sidebar when viewing
- mockups.
-
-Example:
- script/generate showoff
-
- This will create:
- app/views/mockups (and some samples therein)
- public/stylesheets/showoff.css
View
11 generators/showoff/showoff_generator.rb
@@ -1,11 +0,0 @@
-class ShowoffGenerator < Rails::Generator::Base
- def manifest
- record do |m|
- m.directory 'app/views/mockups/basic'
-
- m.file 'sample_mockup.html.erb', 'app/views/mockups/sample_mockup.html.erb'
- m.file 'alternate_layout.html.erb', 'app/views/mockups/basic/alternate_layout.html.erb'
- m.file 'showoff.css', 'public/stylesheets/showoff.css'
- end
- end
-end
View
26 lib/generators/showoff/install/install_generator.rb
@@ -0,0 +1,26 @@
+module Showoff
+ module Generators
+ class InstallGenerator < Rails::Generators::Base
+ source_root File.expand_path(File.dirname(__FILE__) + '/templates')
+
+
+ def install_showoff
+ empty_directory 'app/views/mockups/basic'
+
+ copy_file 'sample_mockup.html.erb', 'app/views/mockups/sample_mockup.html.erb'
+ copy_file 'alternate_layout.html.erb', 'app/views/mockups/basic/alternate_layout.html.erb'
+ copy_file 'showoff.css', 'public/stylesheets/showoff.css'
+
+ end
+
+
+ def create_routes
+ route "match '/mockups', :to => 'mockups#frameset', :as => 'mockups'"
+ route "match '/mockups_index', :to => 'mockups#index', :as => 'mockups_index'"
+ route "match '/mockup/:template_name', :to => 'mockups#show', :as => 'mockup'"
+ end
+
+
+ end
+ end
+end
View
0  ...owoff/templates/alternate_layout.html.erb → ...stall/templates/alternate_layout.html.erb
File renamed without changes
View
0  .../showoff/templates/sample_mockup.html.erb → .../install/templates/sample_mockup.html.erb
File renamed without changes
View
0  generators/showoff/templates/showoff.css → ...ors/showoff/install/templates/showoff.css
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.