sugoi-mail 0.0.0 → 0.0.1

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.
@@ -3,8 +3,9 @@ require 'highline/import'
3
3
  # Controller for command line thingies
4
4
  class CommandlineController < ApplicationController
5
5
  def perform_action
6
- if self.class.action_methods.include?(action_name.to_s) || self.class.action_methods.include?('method_missing')
7
- send(action_name,*params["args"])
6
+ if self.class.action_methods.include?(action_name.to_s) ||
7
+ self.class.action_methods.include?('method_missing')
8
+ @exitcode = send(action_name,*params["args"]) || 0
8
9
  render unless performed?
9
10
  elsif template_exists? && template_public?
10
11
  render
@@ -12,10 +12,27 @@ class SugoiAdminController < CommandlineController
12
12
 
13
13
  def format_errors errors
14
14
  errors.map do |facility, text|
15
- @messages << "#{facility}: #{text}"
15
+ " #{facility}: #{text}\n"
16
16
  end
17
17
  end
18
18
 
19
+ def error(error_text)
20
+ callername = caller[0].gsub(/.*\`(\w+)\'.*/, '\1')
21
+ @error = "#{callername}: #{error_text}"
22
+ end
23
+
24
+ def message(message_text)
25
+ callername = caller[0].gsub(/.*\`(\w+)\'.*/, '\1')
26
+ @messages ||= []
27
+ @messages << "#{callername}: #{message_text}"
28
+ end
29
+
30
+ def ask_description(thing)
31
+ description = ask "Description for #{thing}: "
32
+ if description == "" then description = nil end
33
+ description
34
+ end
35
+
19
36
  public
20
37
 
21
38
  def list_domains
@@ -23,8 +40,12 @@ class SugoiAdminController < CommandlineController
23
40
  end
24
41
 
25
42
  def list_mailinglists(domain_name)
26
- @domain = Domain.find_by_name domain_name
27
- @mailinglists = Mailinglist.find :all
43
+ domain = Domain.find_by_name(domain_name)
44
+ if domain then
45
+ @mailinglists = domain.mailinglists
46
+ else
47
+ error "#{domain_name}: not found"
48
+ end
28
49
  end
29
50
 
30
51
  def list_addresses(mailinglist_address)
@@ -33,12 +54,12 @@ class SugoiAdminController < CommandlineController
33
54
  @mailinglist=@mailinglist[0]
34
55
  @addresses = @mailinglist.addresses
35
56
  else
36
- @addresses = []
57
+ error "#{mailinglist_address}: not found"
37
58
  end
38
59
  end
39
60
 
40
61
  def create_domain(domain_name)
41
- @message = []
62
+ @messages = []
42
63
 
43
64
  domain = Domain.find_by_name domain_name
44
65
  if domain == nil then
@@ -48,29 +69,29 @@ class SugoiAdminController < CommandlineController
48
69
  domain.password = password
49
70
  domain.password_confirmation = confirmation
50
71
  if domain.save then
51
- @message = [ "Domain \"#{domain_name}\" created successfully" ]
72
+ message "Domain \"#{domain_name}\" created successfully."
52
73
  else
53
- format_errors domain.errors
74
+ error "Could not create domain \"#{domain_name}\":\n" +
75
+ format_errors(domain.errors).join
54
76
  end
55
77
  else
56
- @message = [ "Domain \"#{domain_name}\" already exists." ]
78
+ error "Domain \"#{domain_name}\" already exists."
57
79
  end
58
80
  end
59
81
 
60
- def create_user domain_name, username, email_address = nil, description = nil
82
+ def create_user domain_name, username,
83
+ email_address = nil,
84
+ description = nil
61
85
  domain = Domain.find_by_name domain_name
62
86
  if domain then
63
- password, confirmation = get_password
87
+ password, password_confirmation = get_password
64
88
 
65
89
  if email_address == nil then
66
90
  email_address = ask "Address to forward #{username}'s email to: "
67
91
  if email_address == "" then email_address = nil end
68
92
  end
69
93
 
70
- if description == nil then
71
- description = ask "Description for #{username}: "
72
- if description == "" then description = nil end
73
- end
94
+ description ||= ask_description(username)
74
95
 
75
96
  user = User.new
76
97
  user.domain = domain
@@ -79,15 +100,118 @@ class SugoiAdminController < CommandlineController
79
100
  user.password_confirmation = password_confirmation
80
101
  user.description = description
81
102
  if user.save then
82
- @message = [ "User \"#{username}@#{domain_name}\" created successfully" ]
103
+ message "User \"#{username}@#{domain_name}\" created successfully"
83
104
  if email_address then
84
- user.addresses << email_address
105
+ addr=Address.find_or_create_by_address(email_address)
106
+ user.addresses << addr
107
+ end
108
+ else
109
+ error "User \"#{username}@#{domain_name}\" was not created:\n" +
110
+ format_errors(user.errors).join("\n")
111
+ end
112
+ else
113
+ error "Domain \"#{domain_name}\" does not exist."
114
+ end
115
+ end
116
+
117
+ def list_users domain_name
118
+ domain = Domain.find_by_name domain_name
119
+ if domain then
120
+ @users = User.find_all_by_domain_id domain.id
121
+ else
122
+ error "Domain \"#{domain_name}\" does not exist."
123
+ end
124
+ end
125
+
126
+ def list_mailinglist_classes
127
+ @mailinglist_classes = MailinglistClass.find :all, :order => :id
128
+ end
129
+
130
+ def list_mlclasses
131
+ list_mailinglist_classes
132
+ render "sugoi_admin/list_mailinglist_classes"
133
+ end
134
+
135
+ def help_list_mailinglist_classes
136
+ usage "list_mailinglist_classes",
137
+ "Outputs a list of mailing list classes defined"
138
+ end
139
+
140
+ alias help_list_mlclasses help_list_mailinglist_classes
141
+
142
+ def create_mailing_list mailinglist_class_id, mailinglist_name,
143
+ domain_name, user_name, description = nil
144
+
145
+ mlclass = begin
146
+ MailinglistClass.find mailinglist_class_id.to_i
147
+ rescue ActiveRecord::RecordNotFound
148
+ nil
149
+ end
150
+ if mlclass then
151
+ domain = Domain.find_by_name domain_name
152
+ if domain then
153
+ user = User.find_by_login_and_domain_id user_name, domain.id
154
+ if user then
155
+ ml=Mailinglist.new
156
+ ml.user = user
157
+ ml.description = description
158
+ ml.mailinglist_class = mlclass
159
+ ml.name = mailinglist_name
160
+ if ml.save then
161
+ message "Mailing list \"#{ml.address}\" created successfully."
162
+ end
163
+ else
164
+ error "User \"#{user_name}\" not found in domain \"#{domain_name}\"."
85
165
  end
86
166
  else
87
- format_errors
167
+ error "Domain \"#{domain_name}\" not found."
88
168
  end
89
169
  else
90
- @message = [ "domain: Domain \"#{domain.name}\" doesn't exist." ]
170
+ error "Invalid mailing list class: #{mailinglist_class_id}"
171
+ end
172
+ end
173
+
174
+ def subscribe(mailinglist_address, new_address)
175
+ address=Address.find_or_create_by_address new_address
176
+ ml=Mailinglist.find_by_address(mailinglist_address)
177
+ unless ml
178
+ error "Mailing list \"#{mailinglist_address}\" does not exist!"
179
+ return
180
+ end
181
+ ml=ml[0]
182
+ ml.addresses << address
183
+ message "Subscribed \"#{new_address}\" to \"#{mailinglist_address}\""
184
+ end
185
+
186
+ def help_create_mailing_list
187
+ usage "create_mailing_list <mailinglist_class_id> <mailinglist_name> " +
188
+ "<domain_name> <user_name> [<description>]",
189
+ "Creates a mailing list of class <mailinglist_class_id> ("
190
+ "use list_mailinglist_classes to see the available mailing "+
191
+ "list classes) named <mailinglist_name> in domain "+
192
+ "<domain_name> owned by the user named <user_name>"
193
+ end
194
+
195
+ def unsubscribe(mailinglist_address, address_to_remove)
196
+ address = Address.find_by_address address_to_remove
197
+ unless address
198
+ error "Address \"#{address_to_remove}\" unknown."
199
+ return
91
200
  end
201
+
202
+ mailinglist = Mailinglist.find_by_address mailinglist_address
203
+ unless mailinglist
204
+ error "Mailing list \"#{mailinglist_address}\" does not exist."
205
+ return
206
+ end
207
+
208
+ @mailinglist = mailinglist[0]
209
+
210
+ unless @mailinglist.addresses.member? address
211
+ error "Address \"#{address}\" not in mailing list \"#{mailinglist_address}\""
212
+ return
213
+ end
214
+
215
+ @removed_addresses=@mailinglist.remove_addresses address
92
216
  end
93
217
  end
data/app/models/domain.rb CHANGED
@@ -18,6 +18,7 @@ class Domain < ActiveRecord::Base
18
18
  # First of all, email address stuff
19
19
  #----------------------------------------
20
20
  has_many :users
21
+ has_many :mailinglists, :through => :users
21
22
 
22
23
  # Please change the salt to something else,
23
24
  # Every application should use a different one
data/app/models/user.rb CHANGED
@@ -52,15 +52,23 @@ class User < ActiveRecord::Base
52
52
  # The user's "description"--if the user's a person, this would be
53
53
  # their real name.
54
54
  def description
55
- mailinglist.description
55
+ if new_record?
56
+ @description
57
+ else
58
+ mailinglist.description
59
+ end
56
60
  end
57
61
 
58
62
  # Change the user's description. (Actually changes the user's
59
63
  # Mailinglist's description.)
60
64
  def description=(new_description)
61
- m=mailinglist
62
- m.description = new_description
63
- m.save
65
+ if new_record?
66
+ @description = new_description
67
+ else
68
+ m=mailinglist
69
+ m.description = new_description
70
+ m.save
71
+ end
64
72
  end
65
73
 
66
74
  # Please change the salt to something else,
@@ -102,6 +110,9 @@ class User < ActiveRecord::Base
102
110
  ml.name=self.login
103
111
  ml.user_id=self.id
104
112
  ml.mailinglist_class=MailinglistClass.find 1
113
+ if @description then
114
+ ml.description = @description
115
+ end
105
116
  if ml.save then
106
117
  self.mailinglist=ml
107
118
  return true
@@ -1 +1 @@
1
- <% @message.each do |message| %><%= message.chomp+"\n" %><% end %>
1
+ <% @messages.each do |message| %><%= message.chomp+"\n" %><% end %>
@@ -0,0 +1,2 @@
1
+ <% if @error then %><%= @error %><% else %><% @messages.each do |message| %><%= message %>
2
+ <% end; end %>
@@ -0,0 +1 @@
1
+ <% if @error then %><%= @error %><% else %><% @messages.each do |message| %><%= message.chomp+"\n" %><% end %><% end %>
@@ -1 +1 @@
1
- <% for addr in @addresses %><%= addr.address + "\n" %><% end %>
1
+ <% if @addresses %><% for addr in @addresses %><%= addr.address + "\n" %><% end %><% else %><%= @error %><% end %>
@@ -1,2 +1,2 @@
1
1
  <% for domain in @domains %><%= domain.name %>
2
- <% end %>
2
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <% @mailinglist_classes.each do |mlclass| %><%= "#{mlclass.id}. #{mlclass.name}" %>
2
+ <% end %>
@@ -1 +1 @@
1
- <% for mailinglist in @mailinglists %><%= mailinglist.address + "\n" %><% end %>
1
+ <% if @error then %><%= @error %><% else %><% for mailinglist in @mailinglists %><%= mailinglist.address + "\n" %><% end %><% end %>
@@ -0,0 +1,5 @@
1
+ <% if @error then %><%= @error %><% else %><%
2
+ @users.each do |user|
3
+ %><%= user.login %>
4
+ <%
5
+ end %><% end %>
@@ -0,0 +1,2 @@
1
+ <% if @error then %><%= @error %><% else %><% @messages.each do |message| %><%= message %>
2
+ <% end; end %>
@@ -0,0 +1,7 @@
1
+ <% if @error then
2
+ %><%= @error %><%
3
+ else
4
+ @removed_addresses.each do |addr|
5
+ %>Removed "<%= addr.address %>" from "<%= @mailinglist.address %>"<%
6
+ end
7
+ end %>
data/bin/sugoi-admin CHANGED
@@ -11,7 +11,7 @@ require 'application'
11
11
 
12
12
  admin = SugoiAdminController.new
13
13
 
14
- command = ARGV.shift
14
+ command = ARGV.shift.gsub(/-/,"_")
15
15
 
16
16
  request = ActionController::CommandlineRequest.new(command, *ARGV)
17
17
  response = ActionController::CommandlineResponse.new
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  rails-environment: production
3
- database: postgres
3
+ database: sqlite
4
4
  web-server: mongrel
5
5
  threads: 2
@@ -200,7 +200,10 @@ class TC_Mailservice_AdminTasks_UserCreation < MailserviceDomainAdmin
200
200
  assert list
201
201
  assert_equal [ [ @admin_name, "Admin" ],
202
202
  [ "testuser", "Test User" ],
203
- [ "virtuser", "Virtual User" ] ], list.sort
203
+ [ "virtuser", "Virtual User" ],
204
+ [ "nodesc", nil ],
205
+ [ "proxuser", "Proxy Mailing List" ]
206
+ ].sort, list.sort
204
207
  end
205
208
 
206
209
  end
@@ -408,7 +411,8 @@ class TC_Mailservice_MailinglistClasses < MailserviceUserLogin
408
411
  end
409
412
 
410
413
  def test_get_mailinglist_classes
411
- assert_equal [ 'Distribution List', 'Mailing List' ],
414
+ assert_equal [ 'Distribution List', 'Mailing List',
415
+ 'Proxifiable LTMA' ],
412
416
  invoke(:mailinglist_classes).sort
413
417
  end
414
418
 
@@ -0,0 +1,281 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'sugoi_admin_controller'
3
+
4
+ class SugoiAdminController;
5
+ # Re-raise errors caught by the controller.
6
+ def rescue_action(e) raise e end
7
+
8
+ @@ask_responses = []
9
+
10
+ def self.stuff_ask(*responses)
11
+ @@ask_responses = responses
12
+ end
13
+
14
+ def ask(prompt)
15
+ # chuck away the prompt
16
+ return @@ask_responses.shift || "test_password"
17
+ end
18
+ end
19
+
20
+ def stuff_ask(*responses)
21
+ SugoiAdminController.stuff_ask(*responses)
22
+ end
23
+
24
+ class SugoiAdminControllerTest < Test::Unit::TestCase
25
+ def setup
26
+ @controller = SugoiAdminController.new
27
+ # @request = ActionController::TestRequest.new
28
+ @response = ActionController::TestResponse.new
29
+ end
30
+
31
+ def invoke(command, *args)
32
+ @request = ActionController::CommandlineRequest.new command, *args
33
+ @controller.process @request, @response
34
+ end
35
+
36
+ # Replace this with your real tests.
37
+ def test_truth
38
+ assert true
39
+ end
40
+
41
+ def test_list_domains
42
+ assert_nothing_raised do
43
+ invoke "list_domains"
44
+ end
45
+ assert_equal [ 1, 2 ], assigns["domains"].map { |d| d.id }.sort
46
+ assert_equal [ "confirm.domain", "test.domain" ],
47
+ assigns["domains"].map { |d| d.name }.sort
48
+ end
49
+
50
+ def test_list_mailinglists
51
+ assert_nothing_raised do
52
+ invoke "list_mailinglists", "confirm.domain"
53
+ end
54
+ assert_equal assigns["mailinglists"], []
55
+ assert_nothing_raised do
56
+ invoke "list_mailinglists", "nonexistent.domain"
57
+ end
58
+ assert_equal assigns["error"], "list_mailinglists: nonexistent.domain: not found"
59
+ end
60
+
61
+ def test_list_addresses
62
+ assert_nothing_raised do
63
+ invoke "list_addresses", "nonexistentml@confirm.domain"
64
+ end
65
+ assert_equal "list_addresses: nonexistentml@confirm.domain: not found",
66
+ assigns["error"]
67
+ assert_nothing_raised do
68
+ invoke "list_addresses", "testuser@test.domain"
69
+ end
70
+ assert_equal [ "address1@foo.test", "address2@foo.test" ],
71
+ assigns["addresses"].map {|a| a.address}.sort
72
+ end
73
+
74
+ def test_create_user_nonexistent_domain
75
+ assert_nothing_raised do
76
+ invoke "create_user", "nonexistent.domain", "newuser"
77
+ end
78
+ assert_equal "create_user: Domain \"nonexistent.domain\" does not exist.",
79
+ assigns["error"]
80
+ end
81
+
82
+ def test_create_user_normally
83
+ assert_nothing_raised do
84
+ invoke "create_user", "test.domain", "newuser", "newuser@foo.test",
85
+ "New User"
86
+ end
87
+ assert_equal [ "create_user: User \"newuser@test.domain\" created successfully" ],
88
+ assigns["messages"]
89
+ end
90
+
91
+ def test_create_user_already_exists
92
+ assert_nothing_raised do
93
+ invoke "create_user", "test.domain", "testuser",
94
+ "testuser@foo.test", "New User"
95
+ end
96
+ assert_equal "create_user: User \"testuser@test.domain\" was not created:\n login: has already been taken\n", assigns["error"]
97
+ end
98
+
99
+ def test_create_user_interactive_description
100
+ stuff_ask "test_password", "test_password", "New 2 User"
101
+ assert_nothing_raised do
102
+ invoke "create_user", "test.domain", "new2user", "new2user@foo.test"
103
+ end
104
+ assert_equal [ "create_user: User \"new2user@test.domain\" created successfully" ],
105
+ assigns["messages"]
106
+ end
107
+
108
+ def test_create_user_interactive_email_address_and_description
109
+ stuff_ask "test_password", "test_password", "new3user@foo.test", "New 3 User"
110
+ assert_nothing_raised do
111
+ invoke "create_user", "test.domain", "new3user"
112
+ end
113
+ assert_equal [ "create_user: User \"new3user@test.domain\" created successfully" ],
114
+ assigns["messages"]
115
+ end
116
+
117
+ def test_create_domain_normally
118
+ assert_nothing_raised do
119
+ invoke "create_domain", "new.domain"
120
+ end
121
+ assert !assigns["error"]
122
+ assert_equal [ "create_domain: Domain \"new.domain\" created successfully." ],
123
+ assigns["messages"]
124
+
125
+ assert_nothing_raised do
126
+ invoke "list_domains"
127
+ end
128
+ assert_equal assigns["domains"].map { |d| d.name }.sort,
129
+ [ "confirm.domain", "new.domain", "test.domain" ]
130
+ end
131
+
132
+ def test_create_domain_collision
133
+ assert_nothing_raised do
134
+ invoke "create_domain", "test.domain"
135
+ end
136
+ assert_equal "create_domain: Domain \"test.domain\" already exists.",
137
+ assigns["error"]
138
+ end
139
+
140
+ def test_create_mistyped_password
141
+ assert_nothing_raised do
142
+ stuff_ask "test_password", "mismatch_password"
143
+ end
144
+ invoke "create_domain", "new.domain"
145
+ assert_equal "create_domain: Could not create domain \"new.domain\":" +
146
+ "\n password: doesn't match confirmation\n", assigns["error"]
147
+ end
148
+
149
+ def test_list_users_no_users_in_domain
150
+ assert_nothing_raised do
151
+ invoke "list_users", "confirm.domain"
152
+ end
153
+ assert_equal [], assigns["users"]
154
+ assert !assigns["error"]
155
+ end
156
+
157
+ def test_list_users_invalid_domain
158
+ assert_nothing_raised do
159
+ invoke "list_users", "bogus.domain"
160
+ end
161
+ assert assigns["error"]
162
+ assert_equal "list_users: Domain \"bogus.domain\" does not exist.",
163
+ assigns["error"]
164
+ end
165
+
166
+ def test_list_users_valid_with_users
167
+ assert_nothing_raised do
168
+ invoke "list_users", "test.domain"
169
+ end
170
+ assert !assigns["error"]
171
+ assert_equal [ "nodesc", "proxuser", "root", "testuser", "virtuser"],
172
+ assigns["users"].map { |u| u.login }.sort
173
+ end
174
+
175
+ def test_list_mailinglist_classes
176
+ assert_nothing_raised do
177
+ invoke "list_mailinglist_classes"
178
+ end
179
+ assert assigns["mailinglist_classes"]
180
+ end
181
+
182
+ def test_list_mlclasses
183
+ assert_nothing_raised do
184
+ invoke "list_mlclasses"
185
+ end
186
+ assert assigns["mailinglist_classes"]
187
+ end
188
+
189
+ def test_create_mailing_list_wrong_class
190
+ assert_nothing_raised do
191
+ invoke "create_mailing_list", 100, "newmailinglist", "test.domain",
192
+ "testuser", "New Mailing List"
193
+ end
194
+ assert assigns["error"]
195
+ assert_equal "create_mailing_list: Invalid mailing list class: 100",
196
+ assigns["error"]
197
+ assert_nil Mailinglist.find_by_address("newmailinglist@test.domain")
198
+ end
199
+
200
+ def test_create_mailing_list_wrong_domain
201
+ assert_nothing_raised do
202
+ invoke "create_mailing_list", 2, "newmailinglist",
203
+ "nonexistent.domain", "testuser", "New Mailing List"
204
+ end
205
+ assert assigns["error"]
206
+ assert_equal "create_mailing_list: Domain \"nonexistent.domain\" not found.",
207
+ assigns["error"]
208
+ assert_nil Mailinglist.find_by_address("newmailinglist@test.domain")
209
+ end
210
+
211
+ def test_create_Mailing_list_wrong_user
212
+ assert_nothing_raised do
213
+ invoke "create_mailing_list", 2, "newmailinglist",
214
+ "test.domain", "nonexistentuser", "New Mailing List"
215
+ end
216
+
217
+ assert assigns["error"]
218
+ assert_equal "create_mailing_list: User \"nonexistentuser\" not found in domain \"test.domain\".",
219
+ assigns["error"]
220
+ assert_nil Mailinglist.find_by_address("newmailinglist@test.domain")
221
+ end
222
+
223
+ def test_create_mailing_list_normal
224
+ assert_nothing_raised do
225
+ invoke "create_mailing_list", 2, "newmailinglist", "test.domain",
226
+ "testuser"
227
+ end
228
+
229
+ assert assigns["messages"]
230
+ assert_equal ["create_mailing_list: Mailing list \"newmailinglist@test.domain\" created successfully."],
231
+ assigns["messages"]
232
+ assert Mailinglist.find_by_address("newmailinglist@test.domain")
233
+ end
234
+
235
+ def test_subscribe_address_to_mailing_list
236
+ assert_nothing_raised do
237
+ invoke "subscribe", "testuser@test.domain",
238
+ "newaddress@foo.test"
239
+ end
240
+
241
+ assert assigns["messages"]
242
+ assert_equal [ "subscribe: Subscribed \"newaddress@foo.test\" to \"testuser@test.domain\""], assigns["messages"]
243
+ assert_nil assigns["error"]
244
+
245
+ a=Address.find_by_address "newaddress@foo.test"
246
+ assert a
247
+ assert Mailinglist.find_by_address("testuser@test.domain")[0].addresses.member?(a)
248
+ end
249
+
250
+ def test_subscribe_address_to_nonexistent_mailing_list
251
+ assert_nothing_raised do
252
+ invoke "subscribe", "nonexistent@test.domain", "newaddress@foo.test"
253
+ end
254
+ assert_nil assigns["messages"]
255
+ assert assigns["error"]
256
+ assert_equal "subscribe: Mailing list \"nonexistent@test.domain\" does not exist!", assigns["error"]
257
+ end
258
+
259
+ def test_unsubscribe_address_from_mailing_list
260
+ assert_nothing_raised do
261
+ invoke "unsubscribe", "testuser@test.domain", "address1@foo.test"
262
+ end
263
+
264
+ assert_nil assigns["error"]
265
+
266
+ ml=Mailinglist.find_by_address("testuser@test.domain")[0]
267
+
268
+ assert_equal ["address2@foo.test"], ml.addresses.map { |a| a.address }
269
+ end
270
+
271
+ def test_unsubscribe_address_from_mailinglist_its_not_a_member_of
272
+ assert_nothing_raised do
273
+ invoke "unsubscribe", "testuser@test.domain", "nonexistent@foo.test"
274
+ end
275
+
276
+ assert assigns["error"]
277
+ assert_equal "unsubscribe: Address \"nonexistent@foo.test\" unknown.",
278
+ assigns["error"]
279
+ assert_nil assigns["removed_addresses"]
280
+ end
281
+ end
@@ -0,0 +1,4 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+ Dir["functional/*.rb"].each do |file|
3
+ require file.sub(/.rb$/,'')
4
+ end
@@ -11,7 +11,7 @@ require "rubygems"
11
11
  File.unlink *%w{Mailservice.rb
12
12
  MailserviceServiceClient.rb
13
13
  MailserviceDriver.rb} rescue nil
14
- system "wsdl2ruby --wsdl http://localhost:3001/wsdl --type client"
14
+ system "wsdl2ruby.rb --wsdl http://localhost:3001/wsdl --type client"
15
15
  system "rake db:fixtures:load"
16
16
  require "MailserviceDriver"
17
17
  require "test/unit"
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: sugoi-mail
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.0
7
- date: 2006-12-13 00:00:00 +09:00
6
+ version: 0.0.1
7
+ date: 2006-12-28 00:00:00 +09:00
8
8
  summary: Powerful mailing list manager.
9
9
  require_paths:
10
10
  - .
@@ -18,9 +18,9 @@ bindir: bin
18
18
  has_rdoc: false
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
- - - ">"
21
+ - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.0.0
23
+ version: 1.8.2
24
24
  version:
25
25
  platform: ruby
26
26
  signing_key:
@@ -34,7 +34,6 @@ files:
34
34
  - Rakefile
35
35
  - lib
36
36
  - config
37
- - sugoi-mail.gemspec
38
37
  - public
39
38
  - bin
40
39
  - components
@@ -96,7 +95,6 @@ files:
96
95
  - app/controllers/mailinglist_controller.rb
97
96
  - app/controllers/sugoi_admin_controller.rb
98
97
  - app/controllers/mailservice_controller.rb
99
- - app/controllers/.sugoi_admin_controller.rb.swp
100
98
  - app/controllers/commandline_controller.rb
101
99
  - app/controllers/address_controller.rb
102
100
  - app/controllers/application.rb
@@ -125,9 +123,15 @@ files:
125
123
  - app/views/mailinglist/list.rhtml
126
124
  - app/views/mailinglist/show.rhtml
127
125
  - app/views/mailinglist/_form.rhtml
126
+ - app/views/sugoi_admin/subscribe.rhtml
128
127
  - app/views/sugoi_admin/list_addresses.rhtml
129
128
  - app/views/sugoi_admin/list_domains.rhtml
129
+ - app/views/sugoi_admin/create_mailing_list.rhtml
130
+ - app/views/sugoi_admin/unsubscribe.rhtml
131
+ - app/views/sugoi_admin/list_mailinglist_classes.rhtml
130
132
  - app/views/sugoi_admin/list_mailinglists.rhtml
133
+ - app/views/sugoi_admin/list_users.rhtml
134
+ - app/views/sugoi_admin/create_user.rhtml
131
135
  - app/views/sugoi_admin/create_domain.rhtml
132
136
  - app/views/layouts/scaffold.rhtml
133
137
  - app/views/layouts/address.rhtml
@@ -201,6 +205,7 @@ files:
201
205
  - test/fixtures
202
206
  - test/functional
203
207
  - test/test_helper.rb
208
+ - test/functionals.rb
204
209
  - test/mocks/test
205
210
  - test/mocks/development
206
211
  - test/mocks/test/net-smtp-stub.rb
@@ -224,8 +229,8 @@ files:
224
229
  - test/fixtures/mailinglist_classes.yml
225
230
  - test/fixtures/domains.yml
226
231
  - test/fixtures/users.yml
232
+ - test/functional/sugoi_admin_controller_test.rb
227
233
  - test/functional/mailservice_controller_test.rb
228
- - test/functional/domain_controller_test.rb
229
234
  - vendor/plugins
230
235
  - vendor/plugins/active_command
231
236
  - vendor/plugins/ar_fixtures
@@ -266,8 +271,6 @@ extra_rdoc_files: []
266
271
 
267
272
  executables:
268
273
  - sugoi-mail
269
- - mailc
270
- - maild
271
274
  extensions: []
272
275
 
273
276
  requirements: []
@@ -318,3 +321,12 @@ dependencies:
318
321
  - !ruby/object:Gem::Version
319
322
  version: 1.2.3
320
323
  version:
324
+ - !ruby/object:Gem::Dependency
325
+ name: sqlite3-ruby
326
+ version_requirement:
327
+ version_requirements: !ruby/object:Gem::Version::Requirement
328
+ requirements:
329
+ - - ">="
330
+ - !ruby/object:Gem::Version
331
+ version: 1.1.0
332
+ version:
data/sugoi-mail.gemspec DELETED
@@ -1,36 +0,0 @@
1
- $:.unshift '../lib'
2
-
3
- require 'rubygems'
4
- require 'rake'
5
-
6
- spec = Gem::Specification.new do |s|
7
- s.name = "sugoi-mail"
8
- s.version = "0.0.0"
9
- s.summary = "Powerful mailing list manager."
10
- s.has_rdoc = false
11
- s.files = Dir.glob('**/*', File::FNM_DOTMATCH).reject do |f|
12
- [ /\.$/, /config\/database.yml$/, /config\/database.yml-/,
13
- /\.log$/, /^pkg/, /\.svn/, /^vendor\/rails/,
14
- /^public\/(files|xml|articles|pages|index.html)/,
15
- /^public\/(stylesheets|javascripts|images)\/theme/, /\~$/,
16
- /\/\._/, /\/#/ ].any? {|regex| f =~ regex }
17
- end
18
-
19
- s.require_path = '.'
20
- s.author = "Dave Brown"
21
- s.email = "dagbrown@invio.co.jp"
22
- s.homepage = "http://sugoi-mail.rubyforge.org/"
23
- s.rubyforge_project = "sugoi-mail"
24
- s.platform = Gem::Platform::RUBY
25
- s.executables = ['sugoi-mail', 'mailc', 'maild']
26
- s.add_dependency("rails", "= 1.1.6")
27
- s.add_dependency("rails-app-installer", ">= 0.1.2")
28
- s.add_dependency("gurgitate-mail", ">=1.8.0")
29
- s.add_dependency("termios", ">=0.9.4")
30
- s.add_dependency("highline", ">=1.2.3")
31
- end
32
-
33
- if $0==__FILE__
34
- Gem::manage_gems
35
- Gem::Builder.new(spec).build
36
- end
@@ -1,74 +0,0 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
2
- require 'domain_controller'
3
-
4
- # Set salt to 'change-me' because thats what the fixtures assume.
5
- User.salt = 'change-me'
6
-
7
- # Raise errors beyond the default web-based presentation
8
- class DomainController; def rescue_action(e) raise e end; end
9
-
10
- class DomainControllerTest < Test::Unit::TestCase
11
-
12
- fixtures :domains
13
-
14
- def setup
15
- @controller = DomainController.new
16
- @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
17
- @request.host = "localhost"
18
- end
19
-
20
- def test_auth_bob
21
- @request.session[:return_to] = "/bogus/location"
22
-
23
- post :login, :domain_name => "bob", :domain_password => "test"
24
- assert_session_has :domain
25
-
26
- assert_equal @bob, @response.session[:user]
27
-
28
- assert_redirect_url "/bogus/location"
29
- end
30
-
31
- def test_signup
32
- @request.session[:return_to] = "/bogus/location"
33
-
34
- post :signup, :user => { :login => "newbob", :password => "newpassword", :password_confirmation => "newpassword" }
35
- assert_session_has :user
36
-
37
- assert_redirect_url "/bogus/location"
38
- end
39
-
40
- def test_bad_signup
41
- @request.session[:return_to] = "/bogus/location"
42
-
43
- post :signup, :user => { :login => "newbob", :password => "newpassword", :password_confirmation => "wrong" }
44
- assert_invalid_column_on_record "user", :password
45
- assert_success
46
-
47
- post :signup, :user => { :login => "yo", :password => "newpassword", :password_confirmation => "newpassword" }
48
- assert_invalid_column_on_record "user", :login
49
- assert_success
50
-
51
- post :signup, :user => { :login => "yo", :password => "newpassword", :password_confirmation => "wrong" }
52
- assert_invalid_column_on_record "user", [:login, :password]
53
- assert_success
54
- end
55
-
56
- def test_invalid_login
57
- post :login, :user_login => "bob", :user_password => "not_correct"
58
-
59
- assert_session_has_no :user
60
-
61
- assert_template_has "login"
62
- end
63
-
64
- def test_login_logoff
65
-
66
- post :login, :user_login => "bob", :user_password => "test"
67
- assert_session_has :user
68
-
69
- get :logout
70
- assert_session_has_no :user
71
-
72
- end
73
-
74
- end