Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Made the plugin work and fix the stylesheet

  • Loading branch information...
commit e66fb273303b711e268d32ce98df121e1f12c3e8 1 parent 1d7bf44
David Heinemeier Hansson authored
1  .gitignore
... ...
@@ -0,0 +1 @@
  1
+pkg
3  app/helpers/application_helper.rb
... ...
@@ -1,3 +0,0 @@
1  
-# Methods added to this helper will be available to all templates in the application.
2  
-module ApplicationHelper
3  
-end
12  app/helpers/conductor/base_helper.rb
... ...
@@ -0,0 +1,12 @@
  1
+# Methods added to this helper will be available to all templates in the application.
  2
+module Conductor::BaseHelper
  3
+  CONDUCTOR_PLUGIN_CSS_PATH = File.join(File.dirname(__FILE__), '..', '..', 'public', 'conductor.css')
  4
+  
  5
+  def conductor_stylesheet_tag
  6
+    if File.exist?(CONDUCTOR_PLUGIN_CSS_PATH)
  7
+      content_tag(:style, File.read(CONDUCTOR_PLUGIN_CSS_PATH))
  8
+    else
  9
+      stylesheet_link_tag "conductor"
  10
+    end
  11
+  end
  12
+end
2  app/views/conductor/layouts/application.html.erb
@@ -5,7 +5,7 @@
5 5
 <head>
6 6
   <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
7 7
   <title>Rails: <%= @page_title %></title>
8  
-  <%= stylesheet_link_tag "rails" %>
  8
+  <%= conductor_stylesheet_tag %>
9 9
 </head>
10 10
 
11 11
 <body>
4  config/routes.rb
... ...
@@ -1,5 +1,5 @@
1 1
 ActionController::Routing::Routes.draw do |map|
2  
-  map.namespace :conductor do |rails|
3  
-    rails.resources :scaffolds, :routes, :annotations
  2
+  map.namespace :conductor do |conductor|
  3
+    conductor.resources :scaffolds, :routes, :annotations
4 4
   end
5 5
 end
3  lib/pluginization/init.rb
... ...
@@ -1,2 +1,3 @@
1 1
 # Add routes
2  
-# Add view paths?
  2
+
  3
+Conductor::BaseController.append_view_path(File.dirname(__FILE__) + "/views")
16  lib/tasks/pluginize.rake
... ...
@@ -1,13 +1,21 @@
1 1
 desc 'Turn conductor into a plugin.'
2  
-task :pluginize => :environment do
3  
-  mkdir_p('pkg/conductor')
  2
+task :pluginize => [ :environment, "pluginize:clobber" ] do
  3
+  mkdir_p('pkg/conductor/lib')
  4
+  mkdir_p('pkg/conductor/views')
  5
+  mkdir_p('pkg/conductor/public')
4 6
 
5  
-  cp_r 'app/controllers/conductor', 'pkg/conductor/lib'
6  
-  cp_r 'app/views/conductor', 'pkg/conductor/lib/views'
  7
+  cp_r 'app/controllers/conductor', 'pkg/conductor/lib/conductor'
  8
+  cp_r 'app/views/conductor', 'pkg/conductor/views/conductor'
7 9
   
8 10
   FileList['app/helpers/conductor/*'].each do |helper|
9 11
     cp_r helper, "pkg/conductor/lib/conductor/#{File.basename(helper)}"
10 12
   end
  13
+
  14
+  FileList['lib/pluginization/*'].each do |mechanic|
  15
+    cp_r mechanic, "pkg/conductor/#{File.basename(mechanic)}"
  16
+  end
  17
+
  18
+  cp_r 'public/stylesheets/conductor.css', 'pkg/conductor/public/conductor.css'
11 19
 end
12 20
 
13 21
 namespace :pluginize do
0  public/stylesheets/rails.css → public/stylesheets/conductor.css
File renamed without changes

0 notes on commit e66fb27

Please sign in to comment.
Something went wrong with that request. Please try again.