Skip to content
Browse files

Moved layout into being includined without having to be generated. He…

…re's hoping that I can get rid of almost all of the generation.
  • Loading branch information...
1 parent 8fcc28a commit 3d9a322c25f859e447dd9498256605ca162054b2 @commondream committed Aug 9, 2010
View
2 Rakefile
@@ -7,7 +7,7 @@ task :default => :test
desc 'Test the control_center plugin.'
task :test do
- sh 'cd test/rails && rake test'
+ sh 'cd test/rails && script/plugin remove control_center && rsync -r --exclude=test/ ../../. vendor/plugins/control_center/ && script/destroy control_center && script/generate control_center && rake test'
end
desc 'Build the gem'
View
0 generate_gemspec 100755 → 100644
File mode changed.
View
4 generators/control_center/control_center_generator.rb
@@ -17,12 +17,10 @@ def manifest
File.join(layouts_path, "_tabs.html.erb"))
m.file('_header_links.html.erb',
File.join(layouts_path, "_header_links.html.erb"))
- m.file('control_center.html.erb',
- File.join(layouts_path, "control_center.html.erb"))
# copy the initializer over
m.file 'control_center.rb',
File.join("config", "initializers", "control_center.rb")
end
end
-end
+end
View
64 layouts/control_center.html.erb
@@ -0,0 +1,64 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title><%= ControlCenter::Config.app_title %> - <%= @control_center_title %></title>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Language" content="en-us" />
+
+ <%= stylesheet_link_tag 'control_center' %>
+ <style type="text/css">
+ #header { background: <%= ControlCenter::Config.theme_color %>; }
+ #sub_tabs li {background-color: <%= ControlCenter::Config.theme_color %>; }
+ .pagination span.current { background: <%= ControlCenter::Config.theme_color %> };
+ </style>
+ <% ControlCenter::Config.custom_css.each do |key, value| %>
+ <%= stylesheet_link_tag key, value || {} %>
+ <% end %>
+ </head>
+ <body>
+ <div id="header">
+ <h1><%= ControlCenter::Config.app_title %></h1>
+ <ul id="header_links">
+ <%= render :partial => "layouts/header_links" %>
+ </ul>
+ </div>
+
+ <ul id="tabs">
+ <%= render :partial => "layouts/tabs" %>
+ </ul>
+
+ <% if flash[:message] %>
+ <div id="message"><%= flash[:message] %></div>
+ <% end %>
+
+ <% if flash[:error] %>
+ <div id="error"><%= flash[:error] %></div>
+ <% end %>
+
+ <ul id="sub_tabs" <%= "class=\"narrow\"" if sidebar? %>>
+ <%= yield :sub_tabs %>
+ </ul>
+
+ <div id="main">
+ <div id="content" <%= "class=\"narrow\"" if sidebar? %>>
+ <div id="content_inside">
+ <h2><%= @control_center_title %></h2>
+
+ <%= yield %>
+ </div>
+ </div>
+
+ <% if sidebar? %>
+ <div id="sidebar">
+ <div id="sidebar_inside">
+ <%= yield :sidebar %>
+ </div>
+ </div>
+ <% end %>
+ </div>
+
+ <%= javascript_include_tag ControlCenter::Config.include_javascript %>
+ </body>
+</html>
View
9 rails/init.rb
@@ -1,6 +1,9 @@
# Include hook code here
-require File.join(File.dirname(__FILE__), "../lib/control_center.rb")
-require File.join(File.dirname(__FILE__), "../lib/helpers.rb")
+require File.join(File.dirname(__FILE__), "..", "lib", "control_center.rb")
+require File.join(File.dirname(__FILE__), "..", "lib", "helpers.rb")
# Include the helpers we've written
-ActionView::Base.send :include, ControlCenter::Helpers
+ActionView::Base.send :include, ControlCenter::Helpers
+
+# Add our layouts folder to the layouts path
+ActionController::Base.send :append_view_path, File.join(File.dirname(__FILE__), "..", "layouts")
View
15 test/rails/app/controllers/application_controller.rb
@@ -0,0 +1,15 @@
+# Filters added to this controller apply to all controllers in the application.
+# Likewise, all the methods added will be available for all controllers.
+
+class ApplicationController < ActionController::Base
+ helper :all # include all helpers, all the time
+
+ # See ActionController::RequestForgeryProtection for details
+ # Uncomment the :secret if you're not using the cookie session store
+ protect_from_forgery # :secret => '50fafc1e38ed429580dd1235acd03744'
+
+ # See ActionController::Base for details
+ # Uncomment this to filter the contents of submitted sensitive data parameters
+ # from your application log (in this case, all fields with names like "password").
+ # filter_parameter_logging :password
+end
View
3 test/rails/config/boot.rb
@@ -44,6 +44,7 @@ class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
+ Rails::GemDependency.add_frozen_gem_path
end
end
@@ -81,8 +82,8 @@ def gem_version
end
def load_rubygems
+ min_version = '1.3.2'
require 'rubygems'
- min_version = '1.3.1'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
View
2 test/rails/config/environment.rb
@@ -5,7 +5,7 @@
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
View
11 test/rails/config/initializers/control_center.rb
@@ -2,4 +2,13 @@
# preferences
ControlCenter::Config.app_title = "Control Center"
-ControlCenter::Config.theme_color = "#0033CC"
+ControlCenter::Config.theme_color = "#0033CC"
+
+# Custom Stylesheets
+# ControlCenter::Config.custom_css = {
+# "custom_css_1" => { :media => :all },
+# "custom_css_2" => { :media => :print }
+# }
+
+# Custom JavaScript Includes
+#ControlCenter::Config.include_javascript = [:defaults]
View
133 test/rails/log/development.log
@@ -116,3 +116,136 @@ ActionController::RoutingError (No route matches "/realms/2/orders" with {:metho
script/server:3
Rendering /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/layout.erb (not_found)
+
+
+Processing TestController#index (for 127.0.0.1 at 2010-08-09 22:59:31) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.6ms)
+Rendered layouts/_tabs (1.1ms)
+Completed in 152ms (View: 149, DB: 0) | 200 OK [http://localhost/]
+
+
+Processing ApplicationController#index (for 127.0.0.1 at 2010-08-09 22:59:34) [GET]
+
+ActionController::RoutingError (No route matches "/2" with {:method=>:get}):
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:162:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:95:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:92:in `each'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:92:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:23:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:82:in `start'
+
+Rendering rescues/layout (not_found)
+
+
+Processing TestController#index (for 127.0.0.1 at 2010-08-09 22:59:36) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.4ms)
+Completed in 6ms (View: 4, DB: 0) | 200 OK [http://localhost/]
+
+
+Processing ApplicationController#index (for 127.0.0.1 at 2010-08-09 22:59:45) [GET]
+
+ActionController::RoutingError (No route matches "/tab2" with {:method=>:get}):
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:162:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:95:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:92:in `each'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:92:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:23:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:82:in `start'
+
+Rendering rescues/layout (not_found)
+
+
+Processing TestController#index (for 127.0.0.1 at 2010-08-09 22:59:47) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.5ms)
+Completed in 5ms (View: 4, DB: 0) | 200 OK [http://localhost/]
+
+
+Processing ApplicationController#index (for 127.0.0.1 at 2010-08-09 22:59:50) [GET]
+
+ActionController::RoutingError (No route matches "/tab3" with {:method=>:get}):
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:162:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:95:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:92:in `each'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:92:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:23:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:82:in `start'
+
+Rendering rescues/layout (not_found)
+
+
+Processing TestController#index (for 127.0.0.1 at 2010-08-09 22:59:52) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.5ms)
+Completed in 6ms (View: 4, DB: 0) | 200 OK [http://localhost/]
+
+
+Processing ApplicationController#index (for 127.0.0.1 at 2010-08-09 22:59:59) [GET]
+
+ActionController::RoutingError (No route matches "/some" with {:method=>:get}):
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:162:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:95:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:92:in `each'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:92:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:23:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:82:in `start'
+
+Rendering rescues/layout (not_found)
+
+
+Processing TestController#index (for 127.0.0.1 at 2010-08-09 23:00:01) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.5ms)
+Completed in 6ms (View: 4, DB: 0) | 200 OK [http://localhost/]
+
+
+Processing ApplicationController#index (for 127.0.0.1 at 2010-08-09 23:00:03) [GET]
+
+ActionController::RoutingError (No route matches "/link" with {:method=>:get}):
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:162:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:95:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:92:in `each'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:92:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:23:in `start'
+ /Users/alan/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/webrick/server.rb:82:in `start'
+
+Rendering rescues/layout (not_found)
+
+
+Processing TestController#index (for 127.0.0.1 at 2010-08-09 23:00:04) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.8ms)
+Completed in 85ms (View: 83, DB: 0) | 200 OK [http://localhost/]
View
96 test/rails/log/test.log
@@ -182,3 +182,99 @@ Rendering test/index
Rendered layouts/_header_links (0.1ms)
Rendered layouts/_tabs (0.4ms)
Completed in 3ms (View: 2, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:56:39) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.5ms)
+Rendered layouts/_tabs (0.7ms)
+Completed in 48ms (View: 46, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:56:39) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.6ms)
+Completed in 4ms (View: 4, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:56:39) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.8ms)
+Completed in 5ms (View: 4, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:56:39) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.7ms)
+Completed in 5ms (View: 5, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:57:29) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.4ms)
+Rendered layouts/_tabs (0.7ms)
+Completed in 15ms (View: 13, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:57:29) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.4ms)
+Completed in 3ms (View: 3, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:57:29) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.4ms)
+Completed in 3ms (View: 3, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:57:29) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.5ms)
+Completed in 3ms (View: 3, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:59:09) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.4ms)
+Rendered layouts/_tabs (0.9ms)
+Completed in 17ms (View: 15, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:59:09) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.4ms)
+Completed in 4ms (View: 4, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:59:09) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.4ms)
+Completed in 4ms (View: 3, DB: 0) | 200 OK [http://test.host/]
+
+
+Processing TestController#index (for 0.0.0.0 at 2010-08-09 22:59:09) [GET]
+Rendering template within layouts/control_center
+Rendering test/index
+Rendered layouts/_header_links (0.2ms)
+Rendered layouts/_tabs (0.5ms)
+Completed in 5ms (View: 5, DB: 0) | 200 OK [http://test.host/]
View
0 test/rails/public/dispatch.cgi 100755 → 100644
File mode changed.
View
0 test/rails/public/dispatch.fcgi 100755 → 100644
File mode changed.
View
0 test/rails/public/dispatch.rb 100755 → 100644
File mode changed.
View
0 test/rails/script/performance/benchmarker 100755 → 100644
File mode changed.
View
0 test/rails/script/performance/profiler 100755 → 100644
File mode changed.
View
0 test/rails/script/performance/request 100755 → 100644
File mode changed.
View
0 test/rails/script/process/inspector 100755 → 100644
File mode changed.
View
0 test/rails/script/process/reaper 100755 → 100644
File mode changed.
View
0 test/rails/script/process/spawner 100755 → 100644
File mode changed.
View
27 test/rails/test/test_helper.rb
@@ -2,32 +2,7 @@
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
-class Test::Unit::TestCase
- # Transactional fixtures accelerate your tests by wrapping each test method
- # in a transaction that's rolled back on completion. This ensures that the
- # test database remains unchanged so your fixtures don't have to be reloaded
- # between every test method. Fewer database queries means faster tests.
- #
- # Read Mike Clark's excellent walkthrough at
- # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
- #
- # Every Active Record database supports transactions except MyISAM tables
- # in MySQL. Turn off transactional fixtures in this case; however, if you
- # don't care one way or the other, switching from MyISAM to InnoDB tables
- # is recommended.
- #
- # The only drawback to using transactional fixtures is when you actually
- # need to test transactions. Since your test is bracketed by a transaction,
- # any transactions started in your code will be automatically rolled back.
- self.use_transactional_fixtures = true
-
- # Instantiated fixtures are slow, but give you @david where otherwise you
- # would need people(:david). If you don't want to migrate your existing
- # test cases which use the @david style and don't mind the speed hit (each
- # instantiated fixtures translates to a database query per test method),
- # then set this back to true.
- self.use_instantiated_fixtures = false
-
+class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
View
0 test/rails/update 100755 → 100644
File mode changed.

0 comments on commit 3d9a322

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