radiant-vhost-extension 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ Host multiple separate websites on the same Radiant installation each with their
2
+ own users, pages, snippets and layouts (soon to be supporting other extensions).
3
+ Administer users and sites from any domain using your administrative accounts
4
+ and manage website content by logging into each domain.
5
+
6
+ ## IMPORTANT NOTES ABOUT VHOST
7
+
8
+ * Not compatible with the multi_site extension
9
+ * Uses the scoped_access plugin, make sure none of your extensions have a
10
+ conflicting version of the plugin.
11
+ * Hooks into the Radiant 'bootstrap' functionality and currently overwrites the
12
+ standard templates with a modified version of the Simple Blog (i.e. no Styled
13
+ Blog or Coffee template)
14
+
15
+ ## INSTRUCTIONS
16
+
17
+ gem install radiant-vhost-extension
18
+
19
+ ## VHOST SUPPORT FOR OTHER EXTENSIONS
20
+
21
+ Vhost support for other extensions is enabled by creating a /config/vhost.yml
22
+ file containing the names of the models that should be scoped down per site. If
23
+ site scoping for an extension cannot be specified through the model (i.e. it
24
+ uses the file system to present data or otherwise doesn't use an ActiveRecord)
25
+ then currently you cannot enable site scoping.
26
+
27
+ Example vhost.yml:
28
+
29
+ models:
30
+ # Class name
31
+ ManagedFile:
32
+ # Property requiring definition of validates_uniqueness_of
33
+ filename:
34
+ # Parameters to pass to validates_uniqueness_of
35
+ scope:
36
+ - site_id
37
+ message:
38
+ 'file name is already in use'
39
+ # Any classes used in Single Table Inheritance(STI)
40
+ sti_classes:
41
+ - OneClass
42
+ - TwoClass
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0
1
+ 2.3.0
@@ -4,13 +4,27 @@ class Admin::SitesController < Admin::ResourceController
4
4
  :denied_url => { :controller => 'pages', :action => 'index' },
5
5
  :denied_message => 'You must have administrative privileges to perform this action.'
6
6
 
7
+ def new
8
+ model.hostnames.build
9
+ end
10
+
7
11
  def switch_to
8
12
  site = Site.find(params[:id])
9
13
  if site
10
- redirect_to "http://#{site.hostname}#{request.port.to_s == '80' ? '' : ":#{request.port}"}/admin"
14
+ redirect_to "http://#{site.hostnames.first.domain}#{request.port.to_s == '80' ? '' : ":#{request.port}"}/admin"
11
15
  else
12
16
  render :index
13
17
  end
14
18
  end
19
+
20
+ private
21
+
22
+ def load_model
23
+ self.model = if params[:id]
24
+ model_class.find(params[:id], :include => [:hostnames])
25
+ else
26
+ model_class.new
27
+ end
28
+ end
15
29
 
16
30
  end
@@ -0,0 +1,5 @@
1
+ class Hostname < ActiveRecord::Base
2
+ belongs_to :site
3
+
4
+ validates_uniqueness_of :domain
5
+ end
data/app/models/site.rb CHANGED
@@ -1,8 +1,26 @@
1
1
  class Site < ActiveRecord::Base
2
2
  has_and_belongs_to_many :users
3
3
  has_many :pages
4
+ has_many :hostnames
5
+
6
+ serialize :config
7
+
8
+ def title=(val)
9
+ self.config ||= {}
10
+ self.config['title'] = val
11
+ end
12
+
13
+ def title
14
+ self.config ||= {}
15
+ self.config['title']
16
+ end
17
+
18
+ def hostname=(val)
19
+ hostnames.first.update_attributes(:domain => val)
20
+ end
4
21
 
5
22
  accepts_nested_attributes_for :users
23
+ accepts_nested_attributes_for :hostnames, :allow_destroy => true
6
24
  VhostExtension.MODELS.each do |model|
7
25
  has_many model.tableize.to_sym unless model.tableize.match(/pages|users/) # unless already defined
8
26
  end
@@ -0,0 +1,4 @@
1
+ %p.hostname
2
+ = fields.label :domain
3
+ = fields.text_field :domain, :class => 'textbox domain', :maxlength => 100
4
+ = fields.hidden_field :_destroy, :class => 'delete_input'
@@ -2,10 +2,14 @@
2
2
  = render_region :form_top
3
3
  .form-area
4
4
  - render_region :form do |form|
5
+ - form.edit_title do
6
+ %p.title
7
+ = f.label :title
8
+ = f.text_field :title, :class => 'textbox', :maxlength => 100
5
9
  - form.edit_hostname do
6
- %p.hostname
7
- %label{:for=>"site_hostname"} Hostname
8
- = f.text_field "hostname", :class => 'textbox', :maxlength => 100
10
+ #hostnames
11
+ - f.fields_for :hostnames do |fields|
12
+ = render 'admin/hostnames/hostname', :fields => fields, :collection => @site.hostnames
9
13
  - form.edit_users do
10
14
  %p.users
11
15
  %label{:for=>"site_users"} Users
@@ -17,3 +21,4 @@
17
21
  = save_model_and_continue_editing_button(@site)
18
22
  or
19
23
  = link_to 'Cancel', admin_sites_url
24
+ - include_javascript 'admin/vhost'
@@ -11,7 +11,7 @@
11
11
  - for site in @sites
12
12
  %tr.node.level-1
13
13
  %td.site
14
- = link_to site.hostname, edit_admin_site_url(:id => site)
14
+ = link_to site.config['title'], edit_admin_site_url(:id => site)
15
15
  %td.site
16
16
  = link_to 'Go', switch_to_admin_site_url(site)
17
17
  %td.users= site.users.collect(&:name).join(', ')
@@ -9,8 +9,8 @@
9
9
  %tbody
10
10
  %tr.node.level-1
11
11
  %td.site
12
- = image('page', :alt => "page-icon")
13
- = @site.hostname
12
+ = @site.title
13
+ = %{(#{@site.hostnames.map(&:domain).join(', ')})}
14
14
 
15
15
  - form_for [:admin, @site], :html => {:method => :delete} do
16
16
  %p.buttons
@@ -0,0 +1,3 @@
1
+ ---
2
+ en:
3
+ vhost: Vhost
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --format progress features --tags ~@proposed,~@in_progress
@@ -0,0 +1,16 @@
1
+ class AddConfigToSites < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :sites, :config, :text
4
+ Site.reset_column_information
5
+ Site.find_in_batches do |sites|
6
+ sites.each do |site|
7
+ site.title = site.hostname
8
+ site.save
9
+ end
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ remove_column :sites, :config
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ class CreateHostnames < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :hostnames, :force => true do |t|
4
+ t.string :domain, :unique => true
5
+ t.string :port, :default => 80
6
+ t.integer :site_id
7
+ t.timestamps
8
+ end
9
+ Hostname.reset_column_information
10
+ Site.find_in_batches do |sites|
11
+ sites.each { |site|
12
+ site.hostnames.find_or_create_by_domain(:domain => site.hostname)
13
+ }
14
+ end
15
+ end
16
+
17
+ def self.down
18
+ drop_table :hostnames
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ class RemoveSiteHostnameField < ActiveRecord::Migration
2
+ def self.up
3
+ remove_column :sites, :hostname
4
+ end
5
+
6
+ def self.down
7
+ add_column :sites, :hostname, :string
8
+ Site.reset_column_information
9
+ Site.find_in_batches do |sites|
10
+ sites.each do |site|
11
+ site.hostname = site.hostnames.first.domain
12
+ site.save
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # Sets up the Rails environment for Cucumber
2
+ ENV["RAILS_ENV"] = "test"
3
+ # Extension root
4
+ extension_env = File.expand_path(File.dirname(__FILE__) + '/../../../../../config/environment')
5
+ require extension_env+'.rb'
6
+
7
+ Dir.glob(File.join(RADIANT_ROOT, "features", "**", "*.rb")).each {|step| require step}
8
+
9
+ Cucumber::Rails::World.class_eval do
10
+ include Dataset
11
+ datasets_directory "#{RADIANT_ROOT}/spec/datasets"
12
+ Dataset::Resolver.default = Dataset::DirectoryResolver.new("#{RADIANT_ROOT}/spec/datasets", File.dirname(__FILE__) + '/../../spec/datasets', File.dirname(__FILE__) + '/../datasets')
13
+ self.datasets_database_dump_path = "#{Rails.root}/tmp/dataset"
14
+
15
+ # dataset :vhost
16
+ end
@@ -0,0 +1,14 @@
1
+ def path_to(page_name)
2
+ case page_name
3
+
4
+ when /the homepage/i
5
+ root_path
6
+
7
+ when /login/i
8
+ login_path
9
+ # Add more page name => path mappings here
10
+
11
+ else
12
+ raise "Can't find mapping from \"#{page_name}\" to a path."
13
+ end
14
+ end
data/lib/site_scope.rb CHANGED
@@ -12,8 +12,7 @@ module SiteScope
12
12
  # Remove the 'www.' from the site so we don't have to always include a www.
13
13
  # in addition to the regular domain name.
14
14
  host.gsub!(/^www\./, '')
15
- @current_site ||= Site.find_by_hostname(host) || Site.find_by_hostname('*') || Site.find(:first, :conditions => ["hostname LIKE ?", "%#{host}%"])
16
- raise "No site found to match #{host}." unless @current_site
15
+ @current_site ||= Hostname.find_by_domain(host).try(:site) || Hostname.find_by_domain('*').try(:site) || begin Hostname.find(:first, :conditions => ["hostname LIKE ?", "%#{host}%"]) rescue raise "No site found to match #{host}." unless @current_site end
17
16
  Thread.current[:current_site_id] = @current_site.id
18
17
  @current_site
19
18
  end
@@ -14,6 +14,43 @@ namespace :radiant do
14
14
  VhostExtension.migrator.migrate
15
15
  end
16
16
  end
17
+
18
+ desc "Copies public assets of the Vhost to the instance public/ directory."
19
+ task :update => :environment do
20
+ is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
21
+ puts "Copying assets from VhostExtension"
22
+ Dir[VhostExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
23
+ path = file.sub(VhostExtension.root, '')
24
+ directory = File.dirname(path)
25
+ mkdir_p RAILS_ROOT + directory, :verbose => false
26
+ cp file, RAILS_ROOT + path, :verbose => false
27
+ end
28
+ unless VhostExtension.root.starts_with? RAILS_ROOT # don't need to copy vendored tasks
29
+ puts "Copying rake tasks from VhostExtension"
30
+ local_tasks_path = File.join(RAILS_ROOT, %w(lib tasks))
31
+ mkdir_p local_tasks_path, :verbose => false
32
+ Dir[File.join VhostExtension.root, %w(lib tasks *.rake)].each do |file|
33
+ cp file, local_tasks_path, :verbose => false
34
+ end
35
+ end
36
+ end
37
+
38
+ desc "Syncs all available translations for this ext to the English ext master"
39
+ task :sync => :environment do
40
+ # The main translation root, basically where English is kept
41
+ language_root = VhostExtension.root + "/config/locales"
42
+ words = TranslationSupport.get_translation_keys(language_root)
43
+
44
+ Dir["#{language_root}/*.yml"].each do |filename|
45
+ next if filename.match('_available_tags')
46
+ basename = File.basename(filename, '.yml')
47
+ puts "Syncing #{basename}"
48
+ (comments, other) = TranslationSupport.read_file(filename, basename)
49
+ words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
50
+ other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml
51
+ TranslationSupport.write_file(filename, basename, comments, other)
52
+ end
53
+ end
17
54
 
18
55
 
19
56
  # @todo the following method should accept a direction. We should also
@@ -2,7 +2,7 @@ module Vhost::AdminUsersHelperExtensions
2
2
  def self.included(receiver)
3
3
  receiver.send :alias_method_chain, :roles, :site_admin
4
4
  receiver.send :define_method, :sites do |user|
5
- sites = user.sites.collect{|site| site.hostname}
5
+ sites = user.sites.collect{|site| site.title}
6
6
  sites.join("<br/>")
7
7
  end
8
8
  end
@@ -9,14 +9,14 @@ module Vhost::ApplicationControllerExtensions
9
9
  if VhostExtension.REDIRECT_TO_PRIMARY_SITE
10
10
  site = current_site
11
11
  return if site.nil? || site.hostname.include?("*")
12
- primary_host = site.hostname.split(',')[0].strip
12
+ primary_host = site.hostnames.first.domain
13
13
  redirect_to(primary_site_url + request.request_uri) if request.host != primary_host
14
14
  end
15
15
  end
16
16
 
17
17
  def primary_site_url
18
18
  site = current_site
19
- return nil if site.nil? || site.hostname.include?("*")
19
+ return nil if site.nil? || site.hostnames.map(&:domain).include?("*")
20
20
 
21
21
  # Rebuild the current URL. Check if it matches the URL of the
22
22
  # primary site and redirect if it does not.
@@ -25,7 +25,7 @@ module Vhost::ApplicationControllerExtensions
25
25
  port = request.port_string
26
26
 
27
27
  # Primary site is the first site
28
- primary_host = site.hostname.split(',')[0].strip
28
+ primary_host = site.hostnames.first.domain
29
29
 
30
30
  # Return the concatenation
31
31
  prefix+primary_host+port
@@ -10,6 +10,6 @@ module Vhost::ApplicationHelperExtensions
10
10
  end
11
11
 
12
12
  def subtitle_with_site_hostname
13
- current_site.hostname
13
+ current_site.title
14
14
  end
15
15
  end
@@ -3,8 +3,6 @@ module Vhost::SiteScopedModelExtensions
3
3
  module InstanceMethods
4
4
  def self.included(base)
5
5
  base.class_eval {
6
- Rails.logger.debug("Applying SiteScope to '"+self.name+"'")
7
-
8
6
  self.clear_callbacks_by_calling_method_name(:validate, :validates_uniqueness_of)
9
7
  validates_presence_of :site_id
10
8
  belongs_to :site
@@ -0,0 +1,38 @@
1
+ document.observe('dom:loaded',function(){
2
+
3
+ $('hostnames').insert({
4
+ after: new Element('p').update(new Element('a',{href: '#', id: 'add_domain'}).update('Add domain'))
5
+ })
6
+
7
+ $$('p.hostname').each(function(item){
8
+ item.insert({
9
+ bottom: new Element('img', {src: '/images/admin/minus.png', className: 'domain_remover'})
10
+ });
11
+ });
12
+
13
+ Event.addBehavior({
14
+ '#add_domain:click': function(){
15
+ var new_hostname = $$('#hostnames p.hostname')[0].cloneNode(true)
16
+ var label = $(new_hostname).down('label'); $(label).writeAttribute('id','')
17
+ var input = $(new_hostname).down('input.domain'); $(input).writeAttribute('id','')
18
+ var destroy = $(new_hostname).down('input.delete_input').remove();
19
+ var new_hostname_id = $(input).identify();
20
+ $(label).writeAttribute('for',new_hostname_id)
21
+ $(input).writeAttribute('name','site[hostnames_attributes]['+ $$('input[name*=domain]').size() + '][domain]')
22
+ $(input).writeAttribute('value','')
23
+ $('hostnames').insert({bottom: new_hostname})
24
+ Event.addBehavior.reload()
25
+ return false;
26
+ },
27
+
28
+ '.domain_remover:click': function(){
29
+ p = $(this).up('p.hostname');
30
+ var destroyer = p.down('input[name*=destroy]')
31
+ if(destroyer) destroyer.setValue('1');
32
+
33
+ var removed_element = p.remove()
34
+ if(destroyer) $('hostnames').insert(removed_element.down('input[name*=destroy]'))
35
+ }
36
+ });
37
+
38
+ });
@@ -5,24 +5,26 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-vhost-extension}
8
- s.version = "2.2.0"
8
+ s.version = "2.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jason Garber", "Kaleb Walton", "Jim Gay"]
12
- s.date = %q{2010-06-13}
12
+ s.date = %q{2010-07-17}
13
13
  s.description = %q{Host more than one site in a single instance of Radiant.}
14
14
  s.email = %q{jim@saturnflyer.com}
15
15
  s.extra_rdoc_files = [
16
- "README"
16
+ "README.md"
17
17
  ]
18
18
  s.files = [
19
19
  ".gitmodules",
20
- "README",
20
+ "README.md",
21
21
  "Rakefile",
22
22
  "VERSION",
23
23
  "app/controllers/admin/sites_controller.rb",
24
+ "app/models/hostname.rb",
24
25
  "app/models/site.rb",
25
26
  "app/models/site_association_observer.rb",
27
+ "app/views/admin/hostnames/_hostname.html.haml",
26
28
  "app/views/admin/sites/_form.html.haml",
27
29
  "app/views/admin/sites/edit.html.haml",
28
30
  "app/views/admin/sites/index.html.haml",
@@ -32,13 +34,20 @@ Gem::Specification.new do |s|
32
34
  "app/views/admin/users/_site_admin_roles.html.haml",
33
35
  "app/views/admin/users/_sites_td.html.haml",
34
36
  "app/views/admin/users/_sites_th.html.haml",
37
+ "config/locales/en.yml",
35
38
  "config/routes.rb",
39
+ "cucumber.yml",
36
40
  "db/migrate/001_create_sites.rb",
37
41
  "db/migrate/002_add_sites_users.rb",
38
42
  "db/migrate/003_replace_snippet_name_unique_index.rb",
39
43
  "db/migrate/004_add_site_admin_to_users.rb",
44
+ "db/migrate/20100716175246_add_config_to_sites.rb",
45
+ "db/migrate/20100716180924_create_hostnames.rb",
46
+ "db/migrate/20100718021117_remove_site_hostname_field.rb",
40
47
  "db/templates/empty.yml",
41
48
  "db/templates/simple-blog.yml",
49
+ "features/support/env.rb",
50
+ "features/support/paths.rb",
42
51
  "lib/bootstrap_with_site_id.rb",
43
52
  "lib/radiant-vhost-extension.rb",
44
53
  "lib/site_scope.rb",
@@ -53,6 +62,7 @@ Gem::Specification.new do |s|
53
62
  "lib/vhost/radiant_cache_extensions.rb",
54
63
  "lib/vhost/site_scoped_model_extensions.rb",
55
64
  "lib/vhost_default_config.yml",
65
+ "public/javascripts/admin/vhost.js",
56
66
  "radiant-vhost-extension.gemspec",
57
67
  "spec/controllers/admin/pages_controller_spec.rb",
58
68
  "spec/controllers/admin/sites_controller_spec.rb",
@@ -4,7 +4,7 @@ describe Admin::PagesController do
4
4
  dataset :sites_site_users_and_site_pages
5
5
 
6
6
  before :each do
7
- VhostExtension.HOST = sites(:site_a).hostname # Pretend we're connected to site_a so the SiteScope works right
7
+ VhostExtension.HOST = sites(:site_a).hostnames.first.domain # Pretend we're connected to site_a so the SiteScope works right
8
8
  rescue_action_in_public! # ActionController::TestCase no longer considers this request a local request
9
9
 
10
10
  # don't bork results with stale cache items
@@ -5,7 +5,7 @@ describe SiteController do
5
5
 
6
6
  before(:each) do
7
7
  logout
8
- VhostExtension.HOST = sites(:site_a).hostname # Pretend we're connected to site_a so the SiteScope works right
8
+ VhostExtension.HOST = sites(:site_a).hostnames.first.domain # Pretend we're connected to site_a so the SiteScope works right
9
9
  rescue_action_in_public! # ActionController::TestCase no longer considers this request a local request
10
10
 
11
11
  # don't bork results with stale cache items
data/vhost_extension.rb CHANGED
@@ -140,12 +140,12 @@ class VhostExtension < Radiant::Extension
140
140
  returning OpenStruct.new do |site|
141
141
  site.edit = Radiant::AdminUI::RegionSet.new do |edit|
142
142
  edit.main.concat %w{edit_header edit_form}
143
- edit.form.concat %w{edit_hostname edit_users}
143
+ edit.form.concat %w{edit_title edit_hostname edit_users}
144
144
  edit.form_bottom.concat %w{edit_buttons}
145
145
  end
146
146
  site.new = Radiant::AdminUI::RegionSet.new do |new|
147
147
  new.main.concat %w{edit_header edit_form}
148
- new.form.concat %w{edit_hostname edit_users}
148
+ new.form.concat %w{edit_title edit_hostname edit_users}
149
149
  new.form_bottom.concat %w{edit_buttons}
150
150
  end
151
151
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-vhost-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 2.2.0
10
+ version: 2.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Garber
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-06-13 00:00:00 -04:00
20
+ date: 2010-07-17 00:00:00 -04:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -41,15 +41,17 @@ executables: []
41
41
  extensions: []
42
42
 
43
43
  extra_rdoc_files:
44
- - README
44
+ - README.md
45
45
  files:
46
46
  - .gitmodules
47
- - README
47
+ - README.md
48
48
  - Rakefile
49
49
  - VERSION
50
50
  - app/controllers/admin/sites_controller.rb
51
+ - app/models/hostname.rb
51
52
  - app/models/site.rb
52
53
  - app/models/site_association_observer.rb
54
+ - app/views/admin/hostnames/_hostname.html.haml
53
55
  - app/views/admin/sites/_form.html.haml
54
56
  - app/views/admin/sites/edit.html.haml
55
57
  - app/views/admin/sites/index.html.haml
@@ -59,13 +61,20 @@ files:
59
61
  - app/views/admin/users/_site_admin_roles.html.haml
60
62
  - app/views/admin/users/_sites_td.html.haml
61
63
  - app/views/admin/users/_sites_th.html.haml
64
+ - config/locales/en.yml
62
65
  - config/routes.rb
66
+ - cucumber.yml
63
67
  - db/migrate/001_create_sites.rb
64
68
  - db/migrate/002_add_sites_users.rb
65
69
  - db/migrate/003_replace_snippet_name_unique_index.rb
66
70
  - db/migrate/004_add_site_admin_to_users.rb
71
+ - db/migrate/20100716175246_add_config_to_sites.rb
72
+ - db/migrate/20100716180924_create_hostnames.rb
73
+ - db/migrate/20100718021117_remove_site_hostname_field.rb
67
74
  - db/templates/empty.yml
68
75
  - db/templates/simple-blog.yml
76
+ - features/support/env.rb
77
+ - features/support/paths.rb
69
78
  - lib/bootstrap_with_site_id.rb
70
79
  - lib/radiant-vhost-extension.rb
71
80
  - lib/site_scope.rb
@@ -80,6 +89,7 @@ files:
80
89
  - lib/vhost/radiant_cache_extensions.rb
81
90
  - lib/vhost/site_scoped_model_extensions.rb
82
91
  - lib/vhost_default_config.yml
92
+ - public/javascripts/admin/vhost.js
83
93
  - radiant-vhost-extension.gemspec
84
94
  - spec/controllers/admin/pages_controller_spec.rb
85
95
  - spec/controllers/admin/sites_controller_spec.rb
data/README DELETED
@@ -1,64 +0,0 @@
1
- Host multiple separate websites on the same Radiant installation each with their
2
- own users, pages, snippets and layouts (soon to be supporting other extensions).
3
- Administer users and sites from any domain using your administrative accounts
4
- and manage website content by logging into each domain.
5
-
6
- IMPORTANT NOTES ABOUT VHOST
7
- - Not compatible with the multi_site extension
8
- - Uses the scoped_access plugin, make sure none of your extensions have a
9
- conflicting version of the plugin.
10
- - Hooks into the Radiant 'bootstrap' functionality and currently overwrites the
11
- standard templates with a modified version of the Simple Blog (i.e. no Styled
12
- Blog or Coffee template)
13
-
14
- INSTRUCTIONS
15
- Currently (April 26th, 2009) you need the freshest version of Radiant (0.7.1)
16
- which includes Rails 2.2.2 to run vhost. The following instructions use git
17
- to directly check out the latest version of Radiant so you may need to adjust
18
- them slightly. Once the Radiant gem supports Rails 2.2.2 these instructions
19
- will reflect the proper way to run and install vhost.
20
-
21
- * Run 'git clone git://github.com/radiant/radiant.git yoursite'
22
- * In /yoursite run:
23
- * git submodule init
24
- * git submodule update
25
- * Create production, development and test database schemas
26
- * Update /yoursite/config/database.yml to point to the schemas
27
- * In /yoursite/vendor/extensions run:
28
- * git clone git://github.com/saturnflyer/radiant-vhost-extension.git vhost
29
- * In /yoursite/vendor/extensions/vhost run:
30
- * git submodule init
31
- * git submodule update
32
- * In /yoursite run:
33
- * rake development db:bootstrap
34
- * rake db:test:clone_structure (this one may be unnecessary)
35
- * rake db:test:clone
36
- * Finally, in /yoursite run:
37
- * rake spec:extensions EXT=vhost
38
-
39
- You should see a number of spec examples running and passing. If you don't,
40
- or they're failing, something has gone wrong!
41
-
42
- VHOST SUPPORT FOR OTHER EXTENSIONS
43
- Vhost support for other extensions is enabled by creating a /config/vhost.yml
44
- file containing the names of the models that should be scoped down per site. If
45
- site scoping for an extension cannot be specified through the model (i.e. it
46
- uses the file system to present data or otherwise doesn't use an ActiveRecord)
47
- then currently you cannot enable site scoping.
48
-
49
- Example vhost.yml:
50
-
51
- models:
52
- # Class name
53
- ManagedFile:
54
- # Property requiring definition of validates_uniqueness_of
55
- filename:
56
- # Parameters to pass to validates_uniqueness_of
57
- scope:
58
- - site_id
59
- message:
60
- 'file name is already in use'
61
- # Any classes used in Single Table Inheritance(STI)
62
- sti_classes:
63
- - OneClass
64
- - TwoClass