sugoi-mail 0.0.2 → 0.0.3
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.
@@ -36,6 +36,39 @@ class SugoiAdminController < CommandlineController
|
|
36
36
|
|
37
37
|
public
|
38
38
|
|
39
|
+
def init
|
40
|
+
@alreadythere = []
|
41
|
+
[ MailinglistClass, AdminMessage, SysConfig ].each do |table|
|
42
|
+
fixture = YAML.load(File.read(File.join(RAILS_ROOT,
|
43
|
+
"test",
|
44
|
+
"fixtures",
|
45
|
+
table.name.tableize +
|
46
|
+
".yml")))
|
47
|
+
fixture.each_value do |values|
|
48
|
+
if table.find_first ["id = ?", values["id"] ]
|
49
|
+
@alreadythere << "#{table.name}[#{values['id']}]"
|
50
|
+
else
|
51
|
+
configvar = table.new values
|
52
|
+
configvar.save
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def show_config(var_name=nil)
|
59
|
+
unless var_name
|
60
|
+
@config_vars = SysConfig.find_all
|
61
|
+
else
|
62
|
+
@config_vars = SysConfig.find_all_by_name(var_name)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def set_config(var_name, new_value)
|
67
|
+
@config_var = SysConfig.find_by_name(var_name)
|
68
|
+
@config_var.value = new_value
|
69
|
+
@config_var.save
|
70
|
+
end
|
71
|
+
|
39
72
|
def list_domains
|
40
73
|
@domains = Domain.find_all
|
41
74
|
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<% if @alreadythere.length == 0 then %>All configuration parameters reset to their default values.
|
2
|
+
See "sugoi-admin show-config" for more details.<% else %>The following configuration parameters already exist and were not overwriten:
|
3
|
+
<% @alreadythere.sort.each do |param|
|
4
|
+
%> <%= param %>
|
5
|
+
<% end %>
|
6
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Config variable "<%= @config_var.name %>" set to <%= @config_var.value.inspect %>.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<%
|
2
|
+
require "text/format"
|
3
|
+
|
4
|
+
var_width = @config_vars.inject("") do |longest, config|
|
5
|
+
if config.name.length > longest.length then
|
6
|
+
config.name
|
7
|
+
else
|
8
|
+
longest
|
9
|
+
end
|
10
|
+
end.length+2
|
11
|
+
|
12
|
+
val_width = @config_vars.inject("") do |longest, config|
|
13
|
+
if config.value.inspect.length > longest.length then
|
14
|
+
config.value.inspect
|
15
|
+
else
|
16
|
+
longest
|
17
|
+
end
|
18
|
+
end.length+2
|
19
|
+
|
20
|
+
desc_width = ( ENV["COLUMNS"] || 80 ).to_i - var_width - val_width
|
21
|
+
|
22
|
+
formatter = Text::Format.new
|
23
|
+
|
24
|
+
if desc_width > 20
|
25
|
+
formatstr = "%-#{var_width}s%-#{val_width}s%-#{desc_width}s"
|
26
|
+
formatter.first_indent = 0
|
27
|
+
formatter.columns = desc_width
|
28
|
+
else
|
29
|
+
formatstr = "%-#{var_width}s%-#{val_width}s"
|
30
|
+
formatter.first_indent = 4
|
31
|
+
formatter.body_indent = 4
|
32
|
+
formatter.columns = ( ENV["COLUMNS"] || 80 ).to_i
|
33
|
+
end
|
34
|
+
|
35
|
+
@config_vars.sort_by { |var| var.priority }.each do |var|
|
36
|
+
formatter.text = var.description
|
37
|
+
desctext = formatter.format.split("\n")
|
38
|
+
if desc_width > 20
|
39
|
+
%><%= formatstr % [ var.name, var.value.inspect, desctext.shift ] %>
|
40
|
+
<% desctext.each do |str|
|
41
|
+
%><%= formatstr % [ "", "", str ] %>
|
42
|
+
<% end
|
43
|
+
else
|
44
|
+
%><%=
|
45
|
+
[ formatstr % [ var.name, var.value.inspect ], *desctext].join("\n")
|
46
|
+
%>
|
47
|
+
<% end
|
48
|
+
end
|
49
|
+
%>
|
data/bin/sugoi-mail
CHANGED
@@ -7,9 +7,11 @@ class AppInstaller < RailsInstaller
|
|
7
7
|
support_location 'http://invio.co.jp/'
|
8
8
|
rails_version '1.1.6'
|
9
9
|
|
10
|
-
def
|
11
|
-
|
12
|
-
|
10
|
+
def install_post_hook
|
11
|
+
File.chmod(0755, File.join(install_directory,"bin","sugoi-admin"))
|
12
|
+
File.chmod(0755, File.join(install_directory,"bin","mailc"))
|
13
|
+
File.chmod(0755, File.join(install_directory,"bin","maild"))
|
14
|
+
system(File.join(install_directory,"bin","sugoi-admin"),"init")
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
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.
|
7
|
-
date: 2007-01-
|
6
|
+
version: 0.0.3
|
7
|
+
date: 2007-01-10 00:00:00 +09:00
|
8
8
|
summary: Powerful mailing list manager.
|
9
9
|
require_paths:
|
10
10
|
- .
|
@@ -126,9 +126,12 @@ files:
|
|
126
126
|
- app/views/mailinglist/_form.rhtml
|
127
127
|
- app/views/sugoi_admin/subscribe.rhtml
|
128
128
|
- app/views/sugoi_admin/list_addresses.rhtml
|
129
|
+
- app/views/sugoi_admin/init.rhtml
|
129
130
|
- app/views/sugoi_admin/list_domains.rhtml
|
131
|
+
- app/views/sugoi_admin/show_config.rhtml
|
130
132
|
- app/views/sugoi_admin/unsubscribe.rhtml
|
131
133
|
- app/views/sugoi_admin/list_mailinglist_classes.rhtml
|
134
|
+
- app/views/sugoi_admin/set_config.rhtml
|
132
135
|
- app/views/sugoi_admin/list_mailinglists.rhtml
|
133
136
|
- app/views/sugoi_admin/list_users.rhtml
|
134
137
|
- app/views/sugoi_admin/create_user.rhtml
|