sugoi-mail 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/INSTALL ADDED
@@ -0,0 +1,65 @@
1
+ This is just a quick collection of notes right now, which I shall actually
2
+ structure into a proper install document when I have something vaguely-
3
+ sensible written in the first place.
4
+
5
+ DEBIAN
6
+
7
+ First, compile Ruby from source. This is because Debian's packaging of
8
+ Ruby sucks. There are pages out there put together by people who have
9
+ carefully amassed every last little package that you need to get a
10
+ reasonably-complete Ruby installation, but until the Debian guys realize
11
+ that it's _okay_ to have a single package that installs the full core
12
+ Ruby, like they have for Python and Perl, I'll just ignore apt for now.
13
+
14
+ My recommendation:
15
+
16
+ # apt-get install libreadline-dev libncurses-dev
17
+ # mkdir /usr/local/src
18
+ # cd /usr/local/src
19
+ # wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.5-p12.tar.gz
20
+ # tar zxvf ruby-1.8.5-p12.tar.gz
21
+ # cd ruby-1.8.5-p12
22
+ # ./configure --prefix=/usr/local && make && make check && make install
23
+ # cd /usr/local/src
24
+ # wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
25
+ # tar zxvf rubygems-0.9.0.tgz
26
+ # cd rubygems-0.9.0
27
+ # /usr/local/bin/ruby setup.rb config
28
+ # /usr/local/bin/ruby setup.rb install
29
+
30
+ Wow, I bet I could put that into a shell script!
31
+
32
+ And then you'll want to install mysql if you're a mysql user. Of
33
+ course, in Debian, this is easier said than done. Set up your mysql
34
+ server, which I hope you know how to do. And then create a user who
35
+ will be allowed to make databases:
36
+
37
+ mysql> grant all on sugoi.* to sugoi identified by 'sugoi';
38
+ mysql> grant all on sugoi_test.* to sugoi identified by 'sugoi';
39
+
40
+ Then you'll need to install the Debian mysql client headers so that you
41
+ can install the mysql gem:
42
+
43
+ # apt-get install libmysqlclient15-dev
44
+
45
+ The number is subject to change as time goes by, but at the time of
46
+ writing it's 15.
47
+
48
+ Once you have all that, say:
49
+
50
+ # gem install -y sugoi-mail
51
+
52
+ If you leave off the -y, it'll ask if you really want to install every
53
+ single one of the mandatory dependencies.
54
+
55
+ mysql users will also want to install the mysql gem, and postgresql
56
+ users the postgresql gem. Let's go with mysql:
57
+
58
+ # gem install mysql
59
+
60
+ Once that's done, create a user for sugoi-mail (or just use an account
61
+ you already have) and say:
62
+
63
+ $ sugoi-mail install sugoi
64
+
65
+ This should, all being well, set up and start a sugoi-mail installation.
@@ -2,7 +2,6 @@ class SugoiAdminController < CommandlineController
2
2
  model :mailinglist
3
3
 
4
4
  private
5
-
6
5
  def get_password
7
6
  password = ask "Password: " do |q| q.echo = false end
8
7
  confirmation = ask "Confirm: " do |q| q.echo = false end
@@ -38,7 +37,7 @@ class SugoiAdminController < CommandlineController
38
37
 
39
38
  def init
40
39
  @alreadythere = []
41
- [ MailinglistClass, AdminMessage, SysConfig ].each do |table|
40
+ [ MailinglistClass, AdminMessage, SysConfig, Help ].each do |table|
42
41
  fixture = YAML.load(File.read(File.join(RAILS_ROOT,
43
42
  "test",
44
43
  "fixtures",
@@ -236,4 +235,12 @@ class SugoiAdminController < CommandlineController
236
235
 
237
236
  @removed_addresses=@mailinglist.remove_addresses address
238
237
  end
238
+
239
+ def help(command=nil)
240
+ if command
241
+ @help = Help.find_by_facility_and_command self.class.name, command
242
+ else
243
+ @help = Help.find_all_by_facility self.class.name
244
+ end
245
+ end
239
246
  end
@@ -0,0 +1,2 @@
1
+ class Help < ActiveRecord::Base
2
+ end
@@ -0,0 +1,9 @@
1
+ Usage:
2
+ sugoi-admin <%= @help.command %> <%= @help.parameters %>
3
+
4
+ <%=
5
+ formatter = Text::Format.new
6
+ formatter.columns = ( ENV["COLUMNS"] || 80 ).to_i
7
+ formatter.text = @help.explanation
8
+ formatter.format
9
+ %>
@@ -0,0 +1,5 @@
1
+ Sugoi-admin is the administrative interface to sugoi-mail used to
2
+ bootstrap and configure your sugoi-mail installation. It has a
3
+ selection of subcommands:
4
+ <% @help.sort_by { |h| h.command }.each do |help| %>
5
+ <%= "%25s %s" % [ help.command, help.summary ] %><% end %>
@@ -0,0 +1,8 @@
1
+ <%=
2
+ case @help
3
+ when Array
4
+ render :partial => 'command_list'
5
+ else
6
+ render :partial => 'command_description'
7
+ end
8
+ %>
data/config/boot.rb CHANGED
@@ -25,7 +25,7 @@ unless defined?(Rails::Initializer)
25
25
  rails_gem = Gem.cache.search('rails', "=#{version}").first
26
26
 
27
27
  if rails_gem
28
- require_gem "rails", "=#{version}"
28
+ gem "rails", "=#{version}"
29
29
  require rails_gem.full_gem_path + '/lib/initializer'
30
30
  else
31
31
  STDERR.puts %(Cannot find gem for Rails =#{version}:
@@ -35,10 +35,10 @@ unless defined?(Rails::Initializer)
35
35
  exit 1
36
36
  end
37
37
  else
38
- require_gem "rails"
38
+ gem "rails"
39
39
  require 'initializer'
40
40
  end
41
41
  end
42
42
 
43
43
  Rails::Initializer.run(:set_load_path)
44
- end
44
+ end
@@ -0,0 +1,19 @@
1
+ # Doesn't calling the class "Helps" make it look just like it was written
2
+ # by a Russian guy or something? Well, I like the way it looks well enough
3
+ # to let it stand as-is.
4
+
5
+ class CreateHelps < ActiveRecord::Migration
6
+ def self.up
7
+ create_table :helps do |t|
8
+ t.column :facility, :string
9
+ t.column :command, :string
10
+ t.column :parameters, :string
11
+ t.column :summary, :string
12
+ t.column :explanation, :text
13
+ end
14
+ end
15
+
16
+ def self.down
17
+ drop_table :helps
18
+ end
19
+ end
data/db/schema.mysql.sql CHANGED
@@ -39,6 +39,15 @@ CREATE TABLE domains (
39
39
  `password` text NOT NULL
40
40
  ) ENGINE=InnoDB;
41
41
 
42
+ CREATE TABLE helps (
43
+ `id` int(11) DEFAULT NULL auto_increment PRIMARY KEY,
44
+ `facility` varchar(255),
45
+ `command` varchar(255),
46
+ `parameters` varchar(255),
47
+ `summary` varchar(255),
48
+ `explanation` text
49
+ ) ENGINE=InnoDB;
50
+
42
51
  CREATE TABLE mailinglist_classes (
43
52
  `id` int(11) DEFAULT NULL auto_increment PRIMARY KEY,
44
53
  `name` text NOT NULL,
@@ -109,4 +118,4 @@ CREATE TABLE schema_info (
109
118
  `version` int(11)
110
119
  ) ENGINE=InnoDB;
111
120
 
112
- insert into schema_info (version) values (26);
121
+ insert into schema_info (version) values (27);
@@ -39,6 +39,15 @@ CREATE TABLE domains (
39
39
  "password" text NOT NULL
40
40
  );
41
41
 
42
+ CREATE TABLE helps (
43
+ "id" serial primary key,
44
+ "facility" character varying(255),
45
+ "command" character varying(255),
46
+ "parameters" character varying(255),
47
+ "summary" character varying(255),
48
+ "explanation" text
49
+ );
50
+
42
51
  CREATE TABLE mailinglist_classes (
43
52
  "id" serial primary key,
44
53
  "name" text NOT NULL,
@@ -109,4 +118,4 @@ CREATE TABLE schema_info (
109
118
  "version" integer
110
119
  );
111
120
 
112
- insert into schema_info (version) values (26);
121
+ insert into schema_info (version) values (27);
data/db/schema.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # migrations feature of ActiveRecord to incrementally modify your database, and
3
3
  # then regenerate this schema definition.
4
4
 
5
- ActiveRecord::Schema.define(:version => 26) do
5
+ ActiveRecord::Schema.define(:version => 27) do
6
6
 
7
7
  create_table "addresses", :force => true do |t|
8
8
  t.column "address", :text
@@ -32,6 +32,14 @@ ActiveRecord::Schema.define(:version => 26) do
32
32
  t.column "password", :text, :null => false
33
33
  end
34
34
 
35
+ create_table "helps", :force => true do |t|
36
+ t.column "facility", :string
37
+ t.column "command", :string
38
+ t.column "parameters", :string
39
+ t.column "summary", :string
40
+ t.column "explanation", :text
41
+ end
42
+
35
43
  create_table "mailinglist_classes", :force => true do |t|
36
44
  t.column "name", :text, :null => false
37
45
  t.column "description", :text
data/db/schema.sqlite.sql CHANGED
@@ -39,6 +39,15 @@ CREATE TABLE domains (
39
39
  "password" text NOT NULL
40
40
  );
41
41
 
42
+ CREATE TABLE helps (
43
+ "id" INTEGER PRIMARY KEY NOT NULL,
44
+ "facility" varchar(255),
45
+ "command" varchar(255),
46
+ "parameters" varchar(255),
47
+ "summary" varchar(255),
48
+ "explanation" text
49
+ );
50
+
42
51
  CREATE TABLE mailinglist_classes (
43
52
  "id" INTEGER PRIMARY KEY NOT NULL,
44
53
  "name" text NOT NULL,
@@ -109,4 +118,4 @@ CREATE TABLE schema_info (
109
118
  "version" integer
110
119
  );
111
120
 
112
- insert into schema_info (version) values (26);
121
+ insert into schema_info (version) values (27);
@@ -43,6 +43,16 @@ CREATE TABLE domains (
43
43
  [password] text NOT NULL
44
44
  );
45
45
 
46
+ CREATE TABLE helps (
47
+ [id] int NOT NULL IDENTITY(1,
48
+ 1) PRIMARY KEY,
49
+ [facility] varchar(255),
50
+ [command] varchar(255),
51
+ [parameters] varchar(255),
52
+ [summary] varchar(255),
53
+ [explanation] text
54
+ );
55
+
46
56
  CREATE TABLE mailinglist_classes (
47
57
  [id] int NOT NULL IDENTITY(1,
48
58
  1) PRIMARY KEY,
@@ -119,4 +129,4 @@ CREATE TABLE schema_info (
119
129
  [version] int
120
130
  );
121
131
 
122
- insert into schema_info (version) values (26);
132
+ insert into schema_info (version) values (27);
data/db/schema_version CHANGED
@@ -1 +1 @@
1
- 26
1
+ 27
@@ -1,6 +1,6 @@
1
1
  require 'rake/gempackagetask'
2
2
 
3
- PKG_VERSION = "0.0.5"
3
+ PKG_VERSION = "0.1.0"
4
4
  PKG_NAME = "sugoi-mail"
5
5
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
6
6
 
@@ -0,0 +1,134 @@
1
+ ---
2
+ help_1:
3
+ command: init
4
+ parameters:
5
+ facility: SugoiAdminController
6
+ explanation: >
7
+ Sets the initial configuration for a sugoi-mail system. Once
8
+ you've run this, you need to create a domain and a user. If this
9
+ has already been run, it won't overwrite existing values.
10
+
11
+ You shouldn't need to use this at all if you've installed sugoi-mail
12
+ using the rails-app-installer.
13
+ id: 1
14
+ summary: Initializes a sugoi-mail system
15
+ help_2:
16
+ command: show_config
17
+ parameters: "[<configuration variable>]"
18
+ facility: SugoiAdminController
19
+ explanation: >
20
+ Shows the configuration of the sugoi-mail system, or shows the value of a specific configuration variable.
21
+ id: 2
22
+ summary: Shows configuration parameter(s)
23
+ help_3:
24
+ command: set_config
25
+ parameters: <configuration variable> <new value>
26
+ facility: SugoiAdminController
27
+ explanation: >
28
+ Sets a configuration variable to a new value.
29
+ id: 3
30
+ summary: Sets a configuration parameter
31
+ help_4:
32
+ command: list_domains
33
+ parameters: ""
34
+ facility: SugoiAdminController
35
+ explanation: Lists all the domains defined in the sugoi-mail system.
36
+ id: 4
37
+ summary: Lists domains
38
+ help_5:
39
+ command: list_mailinglists
40
+ parameters: <domain>
41
+ facility: SugoiAdminController
42
+ explanation: >
43
+ Lists all of the mailing lists that have been created in domain <domain>.
44
+ id: 5
45
+ summary: Lists mailing lists in a domain
46
+ help_6:
47
+ command: list_addresses
48
+ parameters: <mailinglist>
49
+ facility: SugoiAdminController
50
+ explanation: >
51
+ Lists all of the addresses that are subscribed to the mailing list whose
52
+ address is <mailinglist>.
53
+ id: 6
54
+ summary: Lists the addresses in a mailing list.
55
+ help_7:
56
+ command: create_domain
57
+ parameters: <domain>
58
+ facility: SugoiAdminController
59
+ explanation: >
60
+ Creates a new domain with the name <domain>. This will ask for a password
61
+ for the new domain.
62
+ id: 7
63
+ summary: Creates a new domain
64
+ help_8:
65
+ command: create_user
66
+ parameters: <domain> <username>
67
+ facility: SugoiAdminController
68
+ explanation: >
69
+ Creates a new user with the name <username> in the domain <domain>. This
70
+ will ask for a password for the new user.
71
+ id: 8
72
+ summary: Creates a new user
73
+ help_9:
74
+ command: list_users
75
+ parameters: <domain>
76
+ facility: SugoiAdminController
77
+ explanation: Lists the users that have been created in domain <domain>.
78
+ id: 9
79
+ summary: Lists the users in a domain.
80
+ help_10:
81
+ command: list_mailinglist_classes
82
+ parameters: ""
83
+ facility: SugoiAdminController
84
+ explanation: >
85
+ Prints out a list of mailing list classes. A mailing list class defines
86
+ the behaviour that a mailing list defined within that class will have.
87
+ id: 10
88
+ summary: Outputs a list of mailing list classes defined
89
+ help_11:
90
+ command: create_list
91
+ parameters: <mailinglist class> <mailinglist name> <domain name> <user name> [<description>]
92
+ facility: SugoiAdminController
93
+ explanation: >
94
+ Creates a mailing list of class <mailinglist class> (use the
95
+ list_mailinglist_classes command to see the available mailing list classes)
96
+ named <mailinglist name> in domain <domain name> owned by the user <user
97
+ name>.
98
+ id: 11
99
+ summary: Create a mailing list
100
+ help_12:
101
+ command: subscribe
102
+ parameters: <mailinglist address> <email address>
103
+ facility: SugoiAdminController
104
+ explanation: >
105
+ Subscribes the address <email address> to the mailing list whose address is
106
+ <mailinglist address>
107
+ id: 12
108
+ summary: Subscribe an address to a mailing list
109
+ help_13:
110
+ command: unsubscribe
111
+ parameters: <mailinglist address> <email address>
112
+ facility: SugoiAdminController
113
+ explanation: >
114
+ Unsubscribes the address <email address> from the mailing list whose
115
+ address is <mailinglist address>
116
+ id: 13
117
+ summary: Unsubscribe an address from a mailing list
118
+ help_14:
119
+ id: 14
120
+ command: help
121
+ parameters: [<command>]
122
+ facility: SugoiAdminController
123
+ summary: Explains the sugoi-admin commands
124
+ explanation: >
125
+ Gives a list of all the sugoi-admin commands, along with their
126
+ descriptions, or gives detailed help on a specific command.
127
+ help_15:
128
+ id: 15
129
+ command: list_mlclasses
130
+ parameters: ""
131
+ facility: SugoiAdminController
132
+ summary: A shortcut for list_mailinglist_classes
133
+ explanation: >
134
+ A shorter, easier-to-type alternative for "list_mailinglist_classes".
@@ -24,7 +24,7 @@ end
24
24
  class SugoiAdminControllerTest < Test::Unit::TestCase
25
25
  fixtures :domains, :users, :mailinglists, :admin_messages,
26
26
  :mailinglist_classes, :confirmationcodes, :addresses,
27
- :addresses_mailinglists, :sys_configs
27
+ :addresses_mailinglists, :sys_configs, :helps
28
28
 
29
29
  def setup
30
30
  @controller = SugoiAdminController.new
@@ -339,6 +339,7 @@ class SugoiAdminControllerTest < Test::Unit::TestCase
339
339
  MailinglistClass.delete_all
340
340
  SysConfig.delete_all
341
341
  AdminMessage.delete_all
342
+ Help.delete_all
342
343
 
343
344
  assert_nothing_raised do
344
345
  invoke "init"
@@ -352,5 +353,33 @@ class SugoiAdminControllerTest < Test::Unit::TestCase
352
353
  SysConfig.find_all.length
353
354
  assert_equal @loaded_fixtures["admin_messages"].length,
354
355
  AdminMessage.find_all.length
356
+ assert_equal @loaded_fixtures["helps"].length,
357
+ Help.find_all.length
358
+ end
359
+
360
+ def test_init_no_clobber_values
361
+ SysConfig.smtpserver="www.google.com"
362
+
363
+ assert_nothing_raised do
364
+ invoke "init"
365
+ end
366
+
367
+ assert_equal "www.google.com", SysConfig.smtpserver
368
+
369
+ assert_equal @loaded_fixtures["sys_configs"].length +
370
+ @loaded_fixtures["mailinglist_classes"].length +
371
+ @loaded_fixtures["admin_messages"].length +
372
+ @loaded_fixtures["helps"].length,
373
+ assigns["alreadythere"].length
374
+
375
+ end
376
+
377
+ def test_help_by_itself
378
+ assert_nothing_raised do
379
+ invoke "help"
380
+ end
381
+
382
+ assert Array === assigns["help"]
383
+ assert_equal @loaded_fixtures["helps"].length, assigns["help"].length
355
384
  end
356
385
  end
@@ -0,0 +1,20 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class HelpTest < Test::Unit::TestCase
4
+ fixtures :helps
5
+
6
+ # Replace this with your real tests.
7
+ def test_truth
8
+ assert true
9
+ end
10
+
11
+ def test_help_coverage_sugoi_admin
12
+ methods = SugoiAdminController.action_methods - "wsdl" - "perform_action"
13
+ commands = Help.find_all_by_facility("SugoiAdminController").map do
14
+ |h| h.command
15
+ end
16
+
17
+ assert_equal commands, commands.uniq
18
+ assert_equal methods.sort, commands.sort
19
+ end
20
+ end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.1
3
3
  specification_version: 1
4
4
  name: sugoi-mail
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.5
7
- date: 2007-01-15 00:00:00 +09:00
6
+ version: 0.1.0
7
+ date: 2007-02-01 00:00:00 +09:00
8
8
  summary: Powerful mailing list manager.
9
9
  require_paths:
10
10
  - .
@@ -42,6 +42,7 @@ files:
42
42
  - app
43
43
  - script
44
44
  - db
45
+ - INSTALL
45
46
  - test
46
47
  - vendor
47
48
  - doc/mailinglist_classes description.txt
@@ -95,7 +96,6 @@ files:
95
96
  - app/apis
96
97
  - app/controllers/account_controller.rb
97
98
  - app/controllers/mailinglist_controller.rb
98
- - app/controllers/sugoi_admin_help_controller.rb
99
99
  - app/controllers/sugoi_admin_controller.rb
100
100
  - app/controllers/mailservice_controller.rb
101
101
  - app/controllers/commandline_controller.rb
@@ -109,6 +109,7 @@ files:
109
109
  - app/models/address.rb
110
110
  - app/models/admin_message.rb
111
111
  - app/models/mailinglist.rb
112
+ - app/models/help.rb
112
113
  - app/models/proxy_link.rb
113
114
  - app/models/confirmationcode.rb
114
115
  - app/models/user.rb
@@ -127,10 +128,13 @@ files:
127
128
  - app/views/mailinglist/list.rhtml
128
129
  - app/views/mailinglist/show.rhtml
129
130
  - app/views/mailinglist/_form.rhtml
131
+ - app/views/sugoi_admin/_command_description.rhtml
130
132
  - app/views/sugoi_admin/subscribe.rhtml
131
133
  - app/views/sugoi_admin/list_addresses.rhtml
132
134
  - app/views/sugoi_admin/init.rhtml
135
+ - app/views/sugoi_admin/help.rhtml
133
136
  - app/views/sugoi_admin/list_domains.rhtml
137
+ - app/views/sugoi_admin/_command_list.rhtml
134
138
  - app/views/sugoi_admin/show_config.rhtml
135
139
  - app/views/sugoi_admin/unsubscribe.rhtml
136
140
  - app/views/sugoi_admin/list_mailinglist_classes.rhtml
@@ -193,6 +197,7 @@ files:
193
197
  - db/migrate/016_add_mailinglist_admin_to_users.rb
194
198
  - db/migrate/025_add_proxify_to_mailinglist_classes.rb
195
199
  - db/migrate/002_create_users.rb
200
+ - db/migrate/027_create_helps.rb
196
201
  - db/migrate/004_create_addresses.rb
197
202
  - db/migrate/015_add_messages_to_mailinglists.rb
198
203
  - db/migrate/014_create_admin_messages.rb
@@ -227,6 +232,7 @@ files:
227
232
  - test/unit/sys_config_test.rb
228
233
  - test/unit/address_test.rb
229
234
  - test/unit/confirmationcode_test.rb
235
+ - test/unit/help_test.rb
230
236
  - test/unit/domain_test.rb
231
237
  - test/fixtures/sys_configs.yml
232
238
  - test/fixtures/confirmationcodes.yml
@@ -238,6 +244,7 @@ files:
238
244
  - test/fixtures/mailinglists.yml
239
245
  - test/fixtures/mailinglist_classes.yml
240
246
  - test/fixtures/domains.yml
247
+ - test/fixtures/helps.yml
241
248
  - test/fixtures/users.yml
242
249
  - test/functional/sugoi_admin_controller_test.rb
243
250
  - test/functional/mailservice_controller_test.rb
@@ -1,51 +0,0 @@
1
- class SugoiAdminHelpController < CommandlineController
2
- def init
3
- end
4
-
5
- def show_config
6
- end
7
-
8
- def set_config
9
- end
10
-
11
- def list_domains
12
- end
13
- def list_mailinglists
14
-
15
- end
16
- def list_addresses
17
-
18
- end
19
- def create_domain
20
- end
21
-
22
- def create_user domain_name, username,
23
- end
24
-
25
- def list_users domain_name
26
- end
27
-
28
- def list_mailinglist_classes
29
- usage "list_mailinglist_classes",
30
- "Outputs a list of mailing list classes defined"
31
- end
32
- alias list_mlclasses list_mailinglist_classes
33
-
34
- def list_mailinglist_classes
35
- end
36
-
37
- def create_list mailinglist_name,
38
- usage "create_mailing_list <mailinglist_class_id> <mailinglist_name> " +
39
- "<domain_name> <user_name> [<description>]",
40
- "Creates a mailing list of class <mailinglist_class_id> ("
41
- "use list_mailinglist_classes to see the available mailing "+
42
- "list classes) named <mailinglist_name> in domain "+
43
- "<domain_name> owned by the user named <user_name>"
44
- end
45
-
46
- def subscribe(mailinglist_address, new_address)
47
- end
48
-
49
- def unsubscribe(mailinglist_address, address_to_remove)
50
- end
51
- end