sugoi-mail 0.0.0
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/README +35 -0
- data/Rakefile +10 -0
- data/app/apis/mailservice_api.rb +178 -0
- data/app/controllers/.sugoi_admin_controller.rb.swp +0 -0
- data/app/controllers/account_controller.rb +39 -0
- data/app/controllers/address_controller.rb +49 -0
- data/app/controllers/application.rb +4 -0
- data/app/controllers/commandline_controller.rb +15 -0
- data/app/controllers/domain_controller.rb +37 -0
- data/app/controllers/mailinglist_controller.rb +51 -0
- data/app/controllers/mailservice_controller.rb +497 -0
- data/app/controllers/sugoi_admin_controller.rb +93 -0
- data/app/helpers/account_helper.rb +2 -0
- data/app/helpers/address_helper.rb +2 -0
- data/app/helpers/application_helper.rb +3 -0
- data/app/helpers/domain_helper.rb +2 -0
- data/app/helpers/mailservice_helper.rb +2 -0
- data/app/helpers/sugoi_admin_helper.rb +2 -0
- data/app/models/address.rb +110 -0
- data/app/models/admin_message.rb +45 -0
- data/app/models/confirmationcode.rb +59 -0
- data/app/models/domain.rb +76 -0
- data/app/models/mailinglist.rb +336 -0
- data/app/models/mailinglist_class.rb +39 -0
- data/app/models/message.rb +293 -0
- data/app/models/proxy_link.rb +25 -0
- data/app/models/user.rb +150 -0
- data/app/views/account/login.rhtml +22 -0
- data/app/views/account/logout.rhtml +10 -0
- data/app/views/account/signup.rhtml +17 -0
- data/app/views/account/welcome.rhtml +13 -0
- data/app/views/address/_form.rhtml +7 -0
- data/app/views/address/edit.rhtml +10 -0
- data/app/views/address/list.rhtml +27 -0
- data/app/views/address/new.rhtml +8 -0
- data/app/views/address/show.rhtml +8 -0
- data/app/views/domain/login.rhtml +22 -0
- data/app/views/domain/logout.rhtml +10 -0
- data/app/views/domain/signup.rhtml +17 -0
- data/app/views/domain/welcome.rhtml +13 -0
- data/app/views/layouts/address.rhtml +13 -0
- data/app/views/layouts/scaffold.rhtml +13 -0
- data/app/views/mailinglist/_form.rhtml +28 -0
- data/app/views/mailinglist/edit.rhtml +10 -0
- data/app/views/mailinglist/list.rhtml +27 -0
- data/app/views/mailinglist/new.rhtml +8 -0
- data/app/views/mailinglist/show.rhtml +16 -0
- data/app/views/sugoi_admin/create_domain.rhtml +1 -0
- data/app/views/sugoi_admin/list_addresses.rhtml +1 -0
- data/app/views/sugoi_admin/list_domains.rhtml +2 -0
- data/app/views/sugoi_admin/list_mailinglists.rhtml +1 -0
- data/bin/mailc +32 -0
- data/bin/maild +133 -0
- data/bin/sugoi-admin +21 -0
- data/bin/sugoi-mail +20 -0
- data/config/boot.rb +44 -0
- data/config/environment.rb +54 -0
- data/config/environments/bench.rb +21 -0
- data/config/environments/coverage.rb +21 -0
- data/config/environments/development.rb +21 -0
- data/config/environments/production.rb +18 -0
- data/config/environments/test.rb +19 -0
- data/config/lighttpd.conf +46 -0
- data/config/routes.rb +29 -0
- data/db/migrate/001_mailproxy.rb +7 -0
- data/db/migrate/002_create_users.rb +13 -0
- data/db/migrate/003_create_mailinglists.rb +13 -0
- data/db/migrate/004_create_addresses.rb +12 -0
- data/db/migrate/005_create_addresses_mailinglists.rb +13 -0
- data/db/migrate/006_alter_mailinglists.rb +9 -0
- data/db/migrate/007_create_messages.rb +25 -0
- data/db/migrate/008_add_mailinglistid_to_users.rb +14 -0
- data/db/migrate/009_add_domainadmin_to_users.rb +9 -0
- data/db/migrate/010_add_domain_to_users.rb +16 -0
- data/db/migrate/011_add_active_to_addresses.rb +14 -0
- data/db/migrate/012_create_confirmationcodes.rb +14 -0
- data/db/migrate/013_add_description_to_mailinglists.rb +9 -0
- data/db/migrate/014_create_admin_messages.rb +69 -0
- data/db/migrate/015_add_messages_to_mailinglists.rb +26 -0
- data/db/migrate/016_add_mailinglist_admin_to_users.rb +9 -0
- data/db/migrate/017_add_mailinglist_types.rb +94 -0
- data/db/migrate/018_add_bounciness_to_addresses.rb +20 -0
- data/db/migrate/019_add_archived_to_mailinglist_classes.rb +25 -0
- data/db/migrate/020_add_envelope_data_to_messages.rb +11 -0
- data/db/migrate/021_add_addresses_users.rb +14 -0
- data/db/migrate/022_add_virtual_to_users.rb +14 -0
- data/db/migrate/023_drop_openposting_from_mailinglists.rb +9 -0
- data/db/migrate/024_add_proxy_links.rb +21 -0
- data/db/migrate/025_add_proxify_to_mailinglist_classes.rb +25 -0
- data/db/schema.mysql.sql +104 -0
- data/db/schema.postgresql.sql +104 -0
- data/db/schema.rb +85 -0
- data/db/schema.sqlite.sql +104 -0
- data/db/schema.sqlserver.sql +113 -0
- data/db/schema_version +1 -0
- data/doc/README_FOR_APP +179 -0
- data/doc/mailinglist_classes description.txt +28 -0
- data/installer/rails_installer_defaults.yml +5 -0
- data/lib/daemonize.rb +56 -0
- data/lib/domain_system.rb +87 -0
- data/lib/gurgitate-rules.rb +69 -0
- data/lib/limitedfork.rb +66 -0
- data/lib/login_system.rb +87 -0
- data/public/.htaccess +40 -0
- data/public/404.html +8 -0
- data/public/500.html +8 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/rails.png +0 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/controls.js +815 -0
- data/public/javascripts/dragdrop.js +913 -0
- data/public/javascripts/effects.js +958 -0
- data/public/javascripts/prototype.js +2006 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/scaffold.css +74 -0
- data/public/stylesheets/trestle.css +74 -0
- data/script/about +3 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/destroy +3 -0
- data/script/fakedeliver +19 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/plugin +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/sugoi-mail.gemspec +36 -0
- data/test/fixtures/addresses.yml +70 -0
- data/test/fixtures/addresses_mailinglists.yml +20 -0
- data/test/fixtures/admin_messages.yml +65 -0
- data/test/fixtures/confirmationcodes.yml +13 -0
- data/test/fixtures/domains.yml +9 -0
- data/test/fixtures/mailinglist_classes.yml +45 -0
- data/test/fixtures/mailinglists.yml +80 -0
- data/test/fixtures/messages.yml +154 -0
- data/test/fixtures/proxy_links.yml +5 -0
- data/test/fixtures/users.yml +50 -0
- data/test/functional/domain_controller_test.rb +74 -0
- data/test/functional/mailservice_controller_test.rb +546 -0
- data/test/integration/test_soap.rb +413 -0
- data/test/integration/test_xmlrpc.rb +198 -0
- data/test/mocks/test/net-smtp-stub.rb +24 -0
- data/test/test_helper.rb +28 -0
- data/test/unit/address_test.rb +44 -0
- data/test/unit/admin_message_test.rb +41 -0
- data/test/unit/confirmationcode_test.rb +64 -0
- data/test/unit/domain_test.rb +128 -0
- data/test/unit/mailinglist_class_test.rb +82 -0
- data/test/unit/mailinglist_test.rb +145 -0
- data/test/unit/message_test.rb +151 -0
- data/test/unit/user_test.rb +126 -0
- data/test/units.rb +4 -0
- data/vendor/plugins/active_command/init.rb +1 -0
- data/vendor/plugins/active_command/lib/active_command/request.rb +137 -0
- data/vendor/plugins/active_command/lib/active_command/response.rb +132 -0
- data/vendor/plugins/active_command/lib/active_command.rb +2 -0
- data/vendor/plugins/ar_fixtures/CHANGELOG +10 -0
- data/vendor/plugins/ar_fixtures/MIT-LICENSE +20 -0
- data/vendor/plugins/ar_fixtures/README +19 -0
- data/vendor/plugins/ar_fixtures/Rakefile +54 -0
- data/vendor/plugins/ar_fixtures/about.yml +7 -0
- data/vendor/plugins/ar_fixtures/init.rb +1 -0
- data/vendor/plugins/ar_fixtures/lib/ar_fixtures.rb +102 -0
- data/vendor/plugins/ar_fixtures/tasks/ar_fixtures.rake +39 -0
- data/vendor/plugins/ar_fixtures/test/ar_fixtures_test.rb +53 -0
- data/vendor/plugins/ar_fixtures/test/database.yml +18 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/beer.rb +5 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/beers.yml +9 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/beers_drunkards.yml +8 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/drunkard.rb +6 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/drunkards.yml +8 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/glass.rb +2 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/glasses.yml +9 -0
- data/vendor/plugins/ar_fixtures/test/schema.rb +21 -0
- data/vendor/plugins/ar_fixtures/test/test_helper.rb +37 -0
- metadata +320 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
<%= error_messages_for 'mailinglist' %>
|
2
|
+
|
3
|
+
<!--[form:mailinglist]-->
|
4
|
+
<p>
|
5
|
+
<label for="mailinglist_name">Mailinglist</label>
|
6
|
+
<br/>
|
7
|
+
<%= text_field 'mailinglist', 'name' %>
|
8
|
+
</p>
|
9
|
+
<p>
|
10
|
+
<label for="mailinglist_openposting">Open to the public?</label>
|
11
|
+
<br/>
|
12
|
+
<%= check_box "mailinglist", 'openposting', {}, "T", "F" %>
|
13
|
+
</p>
|
14
|
+
<p>
|
15
|
+
<b><%= "Addresses" %>:</b>
|
16
|
+
<ul>
|
17
|
+
<% @mailinglist.addresses.each do |address| %>
|
18
|
+
<li>
|
19
|
+
<%= check_box "mailinglist_address", address.id, {}, "T", "F" %>
|
20
|
+
<%= address.address %>
|
21
|
+
</li>
|
22
|
+
<% end %>
|
23
|
+
</ul>
|
24
|
+
</p>
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
<!--[eoform:mailinglist]-->
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<h1>Editing mailinglist</h1>
|
2
|
+
|
3
|
+
<%= start_form_tag :action => 'edit', :id => @mailinglist %>
|
4
|
+
<%= render :partial => 'form' %>
|
5
|
+
<%= submit_tag 'Save' %>
|
6
|
+
<%= end_form_tag %>
|
7
|
+
<%= button_to 'Destroy', { :action => 'destroy', :id => @mailinglist }, :confirm => 'Are you sure you want to destroy this mailinglist?' %>
|
8
|
+
|
9
|
+
<%= link_to 'Show', :action => 'show', :id => @mailinglist %> |
|
10
|
+
<%= link_to 'Back to list', :action => 'list' %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<h1>Listing mailinglists</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<% for column in Mailinglist.content_columns %>
|
6
|
+
<th><%= column.human_name %></th>
|
7
|
+
<% end %>
|
8
|
+
</tr>
|
9
|
+
|
10
|
+
<% for mailinglist in @mailinglists %>
|
11
|
+
<tr>
|
12
|
+
<% for column in Mailinglist.content_columns %>
|
13
|
+
<td><%=h mailinglist.send(column.name) %></td>
|
14
|
+
<% end %>
|
15
|
+
<td><%= link_to 'Show', :action => 'show', :id => mailinglist %></td>
|
16
|
+
<td><%= link_to 'Edit', :action => 'edit', :id => mailinglist %></td>
|
17
|
+
<td><%= link_to 'Destroy', { :action => 'destroy', :id => mailinglist }, :post => true, :confirm => 'Are you sure you want to destroy this mailinglist?' %>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<%= link_to 'Previous page', { :page => @mailinglist_pages.current.previous } if @mailinglist_pages.current.previous %>
|
23
|
+
<%= link_to 'Next page', { :page => @mailinglist_pages.current.next } if @mailinglist_pages.current.next %>
|
24
|
+
|
25
|
+
<br />
|
26
|
+
|
27
|
+
<%= link_to 'New mailinglist', :action => 'new' %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% for column in Mailinglist.content_columns %>
|
2
|
+
<p>
|
3
|
+
<b><%= column.human_name %>:</b> <%= h @mailinglist.send(column.name) %>
|
4
|
+
</p>
|
5
|
+
<% end %>
|
6
|
+
<p>
|
7
|
+
<b><%= "Addresses" %>:</b>
|
8
|
+
<ul>
|
9
|
+
<% @mailinglist.addresses.each do |address| %>
|
10
|
+
<li><%= address.address %></li>
|
11
|
+
<% end %>
|
12
|
+
</ul>
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<%= link_to 'Edit', :action => 'edit', :id => @mailinglist %> |
|
16
|
+
<%= link_to 'Back to list', :action => 'list' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<% @message.each do |message| %><%= message.chomp+"\n" %><% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<% for addr in @addresses %><%= addr.address + "\n" %><% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<% for mailinglist in @mailinglists %><%= mailinglist.address + "\n" %><% end %>
|
data/bin/mailc
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'socket'
|
4
|
+
require 'optparse'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
include Socket::Constants
|
8
|
+
include YAML
|
9
|
+
|
10
|
+
mail_sender = nil
|
11
|
+
|
12
|
+
opts=OptionParser.new do |o|
|
13
|
+
o.on "-s SENDER", "--sender SENDER",
|
14
|
+
"Explicity specify SENDER as sender" do |sender|
|
15
|
+
mail_sender = sender
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
recipients = opts.parse ARGV
|
20
|
+
|
21
|
+
serverinfo = {
|
22
|
+
:sender => mail_sender,
|
23
|
+
:recipients => recipients,
|
24
|
+
:rulesfile =>
|
25
|
+
File.expand_path(File.join(File.dirname(__FILE__), "..", "lib",
|
26
|
+
"gurgitate-rules.rb")),
|
27
|
+
:message => $stdin.read
|
28
|
+
}
|
29
|
+
|
30
|
+
s=UNIXSocket.new("/var/run/mailproxy/mailpsocket")
|
31
|
+
Marshal.dump serverinfo, s
|
32
|
+
s.close
|
data/bin/maild
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
RAILS_BASE=File.join(File.dirname(__FILE__),"..")
|
4
|
+
CONFIGDIR=File.join(RAILS_BASE,"config")
|
5
|
+
|
6
|
+
require File.join(CONFIGDIR,"boot")
|
7
|
+
require File.join(CONFIGDIR,"environment")
|
8
|
+
require "active_record"
|
9
|
+
require "daemonize"
|
10
|
+
|
11
|
+
case ENV["RAILS_ENV"]
|
12
|
+
when "development"
|
13
|
+
db = ActiveRecord::Base.establish_connection :development
|
14
|
+
else
|
15
|
+
db = ActiveRecord::Base.establish_connection :production
|
16
|
+
end
|
17
|
+
|
18
|
+
require "app/models/address.rb"
|
19
|
+
require "app/models/mailinglist.rb"
|
20
|
+
require "app/models/user.rb"
|
21
|
+
require "gurgitate/mailmessage"
|
22
|
+
# require "pp"
|
23
|
+
|
24
|
+
require "lib/limitedfork"
|
25
|
+
require "syslog"
|
26
|
+
|
27
|
+
class StderrLogger
|
28
|
+
def method_missing(meth, *args)
|
29
|
+
puts "#{meth}: #{args.join " "}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class MailDaemon
|
34
|
+
include Daemonize
|
35
|
+
|
36
|
+
def initialize(options={})
|
37
|
+
@SOCK_PATH="/var/run/mailproxy/mailpsocket"
|
38
|
+
@gurgitate_cache=Hash.new
|
39
|
+
if options[:max_processes]
|
40
|
+
@max_processes = options[:max_processes]
|
41
|
+
end
|
42
|
+
if options[:debug]
|
43
|
+
$logger=StderrLogger.new
|
44
|
+
@debug=true
|
45
|
+
else
|
46
|
+
$logger=Syslog.open
|
47
|
+
@debug=false
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def start
|
52
|
+
@server=UNIXServer.new(@SOCK_PATH)
|
53
|
+
|
54
|
+
trap("INT") do
|
55
|
+
@server.close
|
56
|
+
File.unlink(@SOCK_PATH)
|
57
|
+
end
|
58
|
+
|
59
|
+
$logger.info "Ready to accept mail"
|
60
|
+
self
|
61
|
+
end
|
62
|
+
|
63
|
+
def read_gurgitate_rules(gurgitatefile)
|
64
|
+
if File.exists? gurgitatefile
|
65
|
+
hashkey = "%s-%d" % [ gurgitatefile,
|
66
|
+
File.stat(gurgitatefile).mtime.to_i ]
|
67
|
+
|
68
|
+
if not @gurgitate_cache.has_key? hashkey
|
69
|
+
@gurgitate_cache[hashkey]=File.read(gurgitatefile)
|
70
|
+
end
|
71
|
+
|
72
|
+
rules = @gurgitate_cache[hashkey]
|
73
|
+
else
|
74
|
+
rules = ""
|
75
|
+
end
|
76
|
+
|
77
|
+
return rules
|
78
|
+
end
|
79
|
+
|
80
|
+
# This is just to provide something for the gurgitate-rules to
|
81
|
+
# return from
|
82
|
+
def gurgitate gurgitator, rules, gurgitatefile
|
83
|
+
gurgitator.instance_eval rules, gurgitatefile, 1
|
84
|
+
end
|
85
|
+
|
86
|
+
def process client_info
|
87
|
+
LimitedFork.fork do
|
88
|
+
begin
|
89
|
+
# pp client_info
|
90
|
+
g=Gurgitate::Mailmessage.new(client_info[:message],
|
91
|
+
client_info[:recipients],
|
92
|
+
client_info[:sender])
|
93
|
+
rules = read_gurgitate_rules client_info[:rulesfile]
|
94
|
+
|
95
|
+
gurgitate g, rules, client_info[:rulesfile]
|
96
|
+
rescue Exception => e
|
97
|
+
$logger.warning e
|
98
|
+
$@.each do |tr|
|
99
|
+
$logger.warning " from #{tr}"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
exit! # since we're a child process
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def run
|
107
|
+
start
|
108
|
+
|
109
|
+
begin
|
110
|
+
unless @debug
|
111
|
+
daemonize
|
112
|
+
end
|
113
|
+
|
114
|
+
loop do
|
115
|
+
client = @server.accept
|
116
|
+
client_info = Marshal.load client
|
117
|
+
process client_info
|
118
|
+
end
|
119
|
+
rescue
|
120
|
+
@server.close
|
121
|
+
File.unlink(@SOCK_PATH)
|
122
|
+
raise
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
if ARGV[0] == "-d" then
|
128
|
+
maild=MailDaemon.new :debug => true
|
129
|
+
else
|
130
|
+
maild=MailDaemon.new
|
131
|
+
end
|
132
|
+
|
133
|
+
maild.run
|
data/bin/sugoi-admin
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
RAILS_BASE=File.join(File.dirname(__FILE__),"..")
|
6
|
+
CONFIGDIR=File.join(RAILS_BASE,"config")
|
7
|
+
|
8
|
+
require File.join(CONFIGDIR,"boot")
|
9
|
+
require File.join(CONFIGDIR,"environment")
|
10
|
+
require 'application'
|
11
|
+
|
12
|
+
admin = SugoiAdminController.new
|
13
|
+
|
14
|
+
command = ARGV.shift
|
15
|
+
|
16
|
+
request = ActionController::CommandlineRequest.new(command, *ARGV)
|
17
|
+
response = ActionController::CommandlineResponse.new
|
18
|
+
|
19
|
+
admin.process(request, response)
|
20
|
+
|
21
|
+
puts response.body
|
data/bin/sugoi-mail
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rails-installer'
|
5
|
+
class AppInstaller < RailsInstaller
|
6
|
+
application_name 'sugoi-mail'
|
7
|
+
support_location 'http://invio.co.jp/'
|
8
|
+
rails_version '1.1.6'
|
9
|
+
end
|
10
|
+
|
11
|
+
# Installer program
|
12
|
+
directory = ARGV[1]
|
13
|
+
|
14
|
+
app = AppInstaller.new(directory)
|
15
|
+
|
16
|
+
app.message_proc = Proc.new do |msg|
|
17
|
+
STDERR.puts " #{msg}"
|
18
|
+
end
|
19
|
+
|
20
|
+
app.execute_command(*ARGV)
|
data/config/boot.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
|
2
|
+
|
3
|
+
unless defined?(RAILS_ROOT)
|
4
|
+
root_path = File.join(File.dirname(__FILE__), '..')
|
5
|
+
|
6
|
+
unless RUBY_PLATFORM =~ /mswin32/
|
7
|
+
require 'pathname'
|
8
|
+
root_path = Pathname.new(root_path).cleanpath(true).to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
RAILS_ROOT = root_path
|
12
|
+
end
|
13
|
+
|
14
|
+
unless defined?(Rails::Initializer)
|
15
|
+
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
16
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
17
|
+
else
|
18
|
+
require 'rubygems'
|
19
|
+
|
20
|
+
environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
|
21
|
+
environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
|
22
|
+
rails_gem_version = $1
|
23
|
+
|
24
|
+
if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
|
25
|
+
rails_gem = Gem.cache.search('rails', "=#{version}").first
|
26
|
+
|
27
|
+
if rails_gem
|
28
|
+
require_gem "rails", "=#{version}"
|
29
|
+
require rails_gem.full_gem_path + '/lib/initializer'
|
30
|
+
else
|
31
|
+
STDERR.puts %(Cannot find gem for Rails =#{version}:
|
32
|
+
Install the missing gem with 'gem install -v=#{version} rails', or
|
33
|
+
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
34
|
+
)
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
else
|
38
|
+
require_gem "rails"
|
39
|
+
require 'initializer'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
Rails::Initializer.run(:set_load_path)
|
44
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Be sure to restart your web server when you modify this file.
|
2
|
+
|
3
|
+
# Uncomment below to force Rails into production mode when
|
4
|
+
# you don't control web/app server and can't set it the proper way
|
5
|
+
# ENV['RAILS_ENV'] ||= 'production'
|
6
|
+
|
7
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
+
RAILS_GEM_VERSION = '1.1.6'
|
9
|
+
|
10
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
12
|
+
|
13
|
+
Rails::Initializer.run do |config|
|
14
|
+
# Settings in config/environments/* take precedence those specified here
|
15
|
+
|
16
|
+
# Skip frameworks you're not going to use
|
17
|
+
# config.frameworks -= [ :action_web_service, :action_mailer ]
|
18
|
+
|
19
|
+
# Add additional load paths for your own custom dirs
|
20
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
21
|
+
|
22
|
+
# Force all environments to use the same logger level
|
23
|
+
# (by default production uses :info, the others :debug)
|
24
|
+
# config.log_level = :debug
|
25
|
+
|
26
|
+
# Use the database for sessions instead of the file system (create the
|
27
|
+
# session table with 'rake db:sessions:create')
|
28
|
+
# config.action_controller.session_store = :active_record_store
|
29
|
+
|
30
|
+
# Use SQL instead of Active Record's schema dumper when creating the test
|
31
|
+
# database. This is necessary if your schema can't be completely dumped by
|
32
|
+
# the schema dumper, like if you have constraints or database-specific
|
33
|
+
# column types
|
34
|
+
# config.active_record.schema_format = :sql
|
35
|
+
|
36
|
+
# Activate observers that should always be running
|
37
|
+
# config.active_record.observers = :cacher, :garbage_collector
|
38
|
+
|
39
|
+
# Make Active Record use UTC-base instead of local time
|
40
|
+
# config.active_record.default_timezone = :utc
|
41
|
+
|
42
|
+
# See Rails::Configuration for more options
|
43
|
+
end
|
44
|
+
|
45
|
+
# Add new inflection rules using the following format
|
46
|
+
# (all these examples are active by default):
|
47
|
+
# Inflector.inflections do |inflect|
|
48
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
49
|
+
# inflect.singular /^(ox)en/i, '\1'
|
50
|
+
# inflect.irregular 'person', 'people'
|
51
|
+
# inflect.uncountable %w( fish sheep )
|
52
|
+
# end
|
53
|
+
|
54
|
+
# Include your application configuration below
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# In the development environment your application's code is reloaded on
|
4
|
+
# every request. This slows down response time but is perfect for development
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
9
|
+
config.whiny_nils = true
|
10
|
+
|
11
|
+
# Enable the breakpoint server that script/breakpointer connects to
|
12
|
+
config.breakpoint_server = false
|
13
|
+
|
14
|
+
# Show full error reports and disable caching
|
15
|
+
config.action_controller.consider_all_requests_local = true
|
16
|
+
config.action_controller.perform_caching = true
|
17
|
+
config.action_view.cache_template_extensions = true
|
18
|
+
config.action_view.debug_rjs = false
|
19
|
+
|
20
|
+
# Don't care if the mailer can't send
|
21
|
+
config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# In the development environment your application's code is reloaded on
|
4
|
+
# every request. This slows down response time but is perfect for development
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
9
|
+
config.whiny_nils = true
|
10
|
+
|
11
|
+
# Enable the breakpoint server that script/breakpointer connects to
|
12
|
+
config.breakpoint_server = true
|
13
|
+
|
14
|
+
# Show full error reports and disable caching
|
15
|
+
config.action_controller.consider_all_requests_local = false
|
16
|
+
config.action_controller.perform_caching = true
|
17
|
+
config.action_view.cache_template_extensions = true
|
18
|
+
config.action_view.debug_rjs = true
|
19
|
+
|
20
|
+
# Don't care if the mailer can't send
|
21
|
+
config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# In the development environment your application's code is reloaded on
|
4
|
+
# every request. This slows down response time but is perfect for development
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
6
|
+
config.cache_classes = false
|
7
|
+
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
9
|
+
config.whiny_nils = true
|
10
|
+
|
11
|
+
# Enable the breakpoint server that script/breakpointer connects to
|
12
|
+
config.breakpoint_server = true
|
13
|
+
|
14
|
+
# Show full error reports and disable caching
|
15
|
+
config.action_controller.consider_all_requests_local = true
|
16
|
+
config.action_controller.perform_caching = false
|
17
|
+
config.action_view.cache_template_extensions = false
|
18
|
+
config.action_view.debug_rjs = true
|
19
|
+
|
20
|
+
# Don't care if the mailer can't send
|
21
|
+
config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The production environment is meant for finished, "live" apps.
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Use a different logger for distributed setups
|
8
|
+
# config.logger = SyslogLogger.new
|
9
|
+
|
10
|
+
# Full error reports are disabled and caching is turned on
|
11
|
+
config.action_controller.consider_all_requests_local = false
|
12
|
+
config.action_controller.perform_caching = true
|
13
|
+
|
14
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
15
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
16
|
+
|
17
|
+
# Disable delivery errors if you bad email addresses should just be ignored
|
18
|
+
# config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Tell ActionMailer not to deliver emails to the real world.
|
17
|
+
# The :test delivery method accumulates sent emails in the
|
18
|
+
# ActionMailer::Base.deliveries array.
|
19
|
+
config.action_mailer.delivery_method = :test
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Default configuration file for the lighttpd web server
|
2
|
+
# Start using ./script/server lighttpd
|
3
|
+
|
4
|
+
server.port = 3000
|
5
|
+
|
6
|
+
server.modules = ( "mod_rewrite", "mod_accesslog", "mod_fastcgi" )
|
7
|
+
server.error-handler-404 = "/dispatch.fcgi"
|
8
|
+
server.document-root = CWD + "/public/"
|
9
|
+
|
10
|
+
server.errorlog = CWD + "/log/lighttpd.error.log"
|
11
|
+
accesslog.filename = CWD + "/log/lighttpd.access.log"
|
12
|
+
|
13
|
+
url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
|
14
|
+
|
15
|
+
# Change *-procs to 2 if you need to use Upload Progress or other tasks that
|
16
|
+
# *need* to execute a second request while the first is still pending.
|
17
|
+
fastcgi.server = ( ".fcgi" =>
|
18
|
+
( "localhost" =>
|
19
|
+
(
|
20
|
+
"min-procs" => 1,
|
21
|
+
"max-procs" => 1,
|
22
|
+
"socket" => CWD + "/tmp/sockets/fcgi.socket",
|
23
|
+
"bin-path" => CWD + "/public/dispatch.fcgi",
|
24
|
+
"bin-environment" => ( "RAILS_ENV" => "development" )
|
25
|
+
)
|
26
|
+
)
|
27
|
+
)
|
28
|
+
|
29
|
+
mimetype.assign = (
|
30
|
+
".css" => "text/css",
|
31
|
+
".gif" => "image/gif",
|
32
|
+
".htm" => "text/html",
|
33
|
+
".html" => "text/html",
|
34
|
+
".jpeg" => "image/jpeg",
|
35
|
+
".jpg" => "image/jpeg",
|
36
|
+
".js" => "text/javascript",
|
37
|
+
".png" => "image/png",
|
38
|
+
".swf" => "application/x-shockwave-flash",
|
39
|
+
".txt" => "text/plain"
|
40
|
+
)
|
41
|
+
|
42
|
+
# Making sure file uploads above 64k always work when using IE or Safari
|
43
|
+
# For more information, see http://trac.lighttpd.net/trac/ticket/360
|
44
|
+
$HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
|
45
|
+
server.max-keep-alive-requests = 0
|
46
|
+
}
|
data/config/routes.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
+
|
4
|
+
# Sample of regular route:
|
5
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
6
|
+
# Keep in mind you can assign values other than :controller and :action
|
7
|
+
|
8
|
+
# Sample of named route:
|
9
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
10
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
11
|
+
|
12
|
+
# You can have the root of your site routed by hooking up ''
|
13
|
+
# -- just remember to delete public/index.html.
|
14
|
+
# map.connect '', :controller => "welcome"
|
15
|
+
|
16
|
+
# Allow downloading Web Service WSDL as a file with an extension
|
17
|
+
# instead of a file named 'wsdl'
|
18
|
+
map.connect ':controller/service.wsdl', :action => 'wsdl'
|
19
|
+
|
20
|
+
map.connect '/api', :controller => 'mailservice', :action => 'api'
|
21
|
+
map.connect '/wsdl', :controller => 'mailservice', :action => 'wsdl'
|
22
|
+
map.connect '/invoke', :controller => 'mailservice', :action => 'invoke'
|
23
|
+
map.connect '/service.wsdl', :action => 'wsdl'
|
24
|
+
|
25
|
+
# Install the default route as the lowest priority.
|
26
|
+
map.connect 'mailproxy/:controller/:action/:id'
|
27
|
+
map.connect ':controller/:action/:id'
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :users do |t|
|
4
|
+
# t.column :name, :string
|
5
|
+
t.column "login", :text, :null => false
|
6
|
+
t.column "password", :text, :null => false
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
drop_table :users
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateMailinglists < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :mailinglists do |t|
|
4
|
+
t.column :user_id, :integer
|
5
|
+
t.column :name, :text, :null => false
|
6
|
+
t.column :open, :boolean
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
drop_table :mailinglists
|
12
|
+
end
|
13
|
+
end
|