site_generator 0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/USAGE +24 -0
- data/site_generator.rb +30 -0
- data/templates/apache.conf +43 -0
- data/templates/dispatch.fcgi +24 -0
- data/templates/routes.rb +11 -0
- metadata +66 -0
data/USAGE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
NAME
|
|
2
|
+
login - creates a functional login system
|
|
3
|
+
|
|
4
|
+
SYNOPSIS
|
|
5
|
+
login [Controller name]
|
|
6
|
+
|
|
7
|
+
Good names are Account Myaccount Security
|
|
8
|
+
|
|
9
|
+
DESCRIPTION
|
|
10
|
+
This generator creates a general purpose login system.
|
|
11
|
+
|
|
12
|
+
Included:
|
|
13
|
+
- a User model which uses sha1 encryption for passwords
|
|
14
|
+
- a Controller with signup, login, welcome and logoff actions
|
|
15
|
+
- a mixin which lets you easily add advanced authentication
|
|
16
|
+
features to your abstract base controller
|
|
17
|
+
- a user_model.sql with the minimal sql required to get the model to work.
|
|
18
|
+
- extensive unit and functional test cases to make sure nothing breaks.
|
|
19
|
+
|
|
20
|
+
EXAMPLE
|
|
21
|
+
./script/generate login Account
|
|
22
|
+
|
|
23
|
+
This will generate an Account controller with login and logout methods.
|
|
24
|
+
The model is always called User
|
data/site_generator.rb
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class SiteGenerator < Rails::Generator::NamedBase
|
|
2
|
+
alias :site_name :file_name
|
|
3
|
+
|
|
4
|
+
def manifest
|
|
5
|
+
site_root = File.join("sites", site_name)
|
|
6
|
+
record do |m|
|
|
7
|
+
SITE_BASEDIRS.each { |path| m.directory File.join(site_root, path) }
|
|
8
|
+
|
|
9
|
+
m.file "apache.conf", File.join(site_root, "public", ".htaccess")
|
|
10
|
+
m.file "dispatch.fcgi", File.join(site_root, "public", "dispatch.fcgi")
|
|
11
|
+
m.file "routes.rb", File.join(site_root, "config", "routes.rb")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Installation skeleton. Intermediate directories are automatically
|
|
16
|
+
# created so don't sweat their absence here.
|
|
17
|
+
SITE_BASEDIRS = %w(
|
|
18
|
+
app/controllers
|
|
19
|
+
app/helpers
|
|
20
|
+
app/models
|
|
21
|
+
app/views/layouts
|
|
22
|
+
db/migrate
|
|
23
|
+
log
|
|
24
|
+
public
|
|
25
|
+
config
|
|
26
|
+
test/fixtures
|
|
27
|
+
test/functional
|
|
28
|
+
test/unit
|
|
29
|
+
)
|
|
30
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# General Apache options
|
|
2
|
+
AddHandler fastcgi-script .fcgi
|
|
3
|
+
AddHandler cgi-script .cgi
|
|
4
|
+
Options +FollowSymLinks +ExecCGI
|
|
5
|
+
|
|
6
|
+
# If you don't want Rails to look in certain directories,
|
|
7
|
+
# use the following rewrite rules so that Apache won't rewrite certain requests
|
|
8
|
+
#
|
|
9
|
+
# Example:
|
|
10
|
+
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
|
11
|
+
# RewriteRule .* - [L]
|
|
12
|
+
|
|
13
|
+
# Redirect all requests not available on the filesystem to Rails
|
|
14
|
+
# By default the cgi dispatcher is used which is very slow
|
|
15
|
+
#
|
|
16
|
+
# For better performance replace the dispatcher with the fastcgi one
|
|
17
|
+
#
|
|
18
|
+
# Example:
|
|
19
|
+
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
|
20
|
+
RewriteEngine On
|
|
21
|
+
RewriteRule ^$ index.html [QSA]
|
|
22
|
+
|
|
23
|
+
# If the requested file does not exist in SITE_ROOT/public...
|
|
24
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
|
25
|
+
# ... then split its full path up in to manageable pieces ...
|
|
26
|
+
RewriteCond %{REQUEST_FILENAME} ^(.*)/sites/.+/public/(.*)$
|
|
27
|
+
# ... and check to see if the file exists in the RAILS_ROOT/public folder...
|
|
28
|
+
RewriteCond %1/public/%2 -f
|
|
29
|
+
# ... if so, rewrite our requested file to be the RAILS_ROOT one
|
|
30
|
+
RewriteRule ^(.*)$ /generic/$1 [NS,L]
|
|
31
|
+
|
|
32
|
+
RewriteRule ^([^.]+)$ $1.html [QSA]
|
|
33
|
+
|
|
34
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
|
35
|
+
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
|
36
|
+
|
|
37
|
+
# In case Rails experiences terminal errors
|
|
38
|
+
# Instead of displaying this message you can supply a file here which will be rendered instead
|
|
39
|
+
#
|
|
40
|
+
# Example:
|
|
41
|
+
# ErrorDocument 500 /500.html
|
|
42
|
+
|
|
43
|
+
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/local/bin/ruby
|
|
2
|
+
#
|
|
3
|
+
# You may specify the path to the FastCGI crash log (a log of unhandled
|
|
4
|
+
# exceptions which forced the FastCGI instance to exit, great for debugging)
|
|
5
|
+
# and the number of requests to process before running garbage collection.
|
|
6
|
+
#
|
|
7
|
+
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
|
|
8
|
+
# and the GC period is nil (turned off). A reasonable number of requests
|
|
9
|
+
# could range from 10-100 depending on the memory footprint of your app.
|
|
10
|
+
#
|
|
11
|
+
# Example:
|
|
12
|
+
# # Default log path, normal GC behavior.
|
|
13
|
+
# RailsFCGIHandler.process!
|
|
14
|
+
#
|
|
15
|
+
# # Default log path, 50 requests between GC.
|
|
16
|
+
# RailsFCGIHandler.process! nil, 50
|
|
17
|
+
#
|
|
18
|
+
# # Custom log path, normal GC behavior.
|
|
19
|
+
# RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
|
|
20
|
+
#
|
|
21
|
+
require File.dirname(__FILE__) + "/../../../config/environment"
|
|
22
|
+
require 'fcgi_handler'
|
|
23
|
+
|
|
24
|
+
RailsFCGIHandler.process!
|
data/templates/routes.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Note that we use 'Routes.draw_append' here instead of 'Routes.draw'. If you want to
|
|
2
|
+
# wipe clean *everything* from the base routes.rb rules, use 'Routes.draw' instead.
|
|
3
|
+
ActionController::Routing::Routes.draw_append do |map|
|
|
4
|
+
# If you want to continue to append routing rules to the base route set,
|
|
5
|
+
# use 'map.connect' just like the base routes.rb.
|
|
6
|
+
# map.connect 'custom_login/:user', :controller => 'custom_login'
|
|
7
|
+
|
|
8
|
+
# If, on the other hand, you want to replace a routing rule that already exists
|
|
9
|
+
# in the base route set, use the custom 'replace' method instead. For example:
|
|
10
|
+
# map.replace '', :controller => "special_welcome"
|
|
11
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
rubygems_version: 0.8.10
|
|
3
|
+
specification_version: 1
|
|
4
|
+
name: site_generator
|
|
5
|
+
version: !ruby/object:Gem::Version
|
|
6
|
+
version: "0.5"
|
|
7
|
+
date: 2005-07-25
|
|
8
|
+
summary: Generates a Rails site in conjunction with the rails_product gem.
|
|
9
|
+
require_paths:
|
|
10
|
+
- lib
|
|
11
|
+
email: duane.johnson@gmail.com
|
|
12
|
+
homepage: http://wiki.rubyonrails.com/rails/show/RailsProductGenerator
|
|
13
|
+
rubyforge_project: site_generator
|
|
14
|
+
description: "In a Productized Rails Application (see the rails_product gem) it is necessary
|
|
15
|
+
to add a site for each derivative application. With the site_generator gem, you
|
|
16
|
+
will be able to create a site within your application with the command:
|
|
17
|
+
./script/generate site <site_name>"
|
|
18
|
+
autorequire:
|
|
19
|
+
default_executable:
|
|
20
|
+
bindir: bin
|
|
21
|
+
has_rdoc: false
|
|
22
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
-
|
|
25
|
+
- ">"
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: 0.0.0
|
|
28
|
+
version:
|
|
29
|
+
platform: ruby
|
|
30
|
+
authors:
|
|
31
|
+
- Duane Johnson
|
|
32
|
+
files:
|
|
33
|
+
- USAGE
|
|
34
|
+
- site_generator.rb
|
|
35
|
+
- templates/apache.conf
|
|
36
|
+
- templates/dispatch.fcgi
|
|
37
|
+
- templates/routes.rb
|
|
38
|
+
test_files: []
|
|
39
|
+
rdoc_options:
|
|
40
|
+
- "--exclude"
|
|
41
|
+
- "."
|
|
42
|
+
extra_rdoc_files: []
|
|
43
|
+
executables: []
|
|
44
|
+
extensions: []
|
|
45
|
+
requirements: []
|
|
46
|
+
dependencies:
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: rake
|
|
49
|
+
version_requirement:
|
|
50
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
-
|
|
53
|
+
- ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: 0.5.3
|
|
56
|
+
version:
|
|
57
|
+
- !ruby/object:Gem::Dependency
|
|
58
|
+
name: rails_product
|
|
59
|
+
version_requirement:
|
|
60
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
|
61
|
+
requirements:
|
|
62
|
+
-
|
|
63
|
+
- "="
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: "0.5"
|
|
66
|
+
version:
|