simple_mailing_list 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 876826ef49ceb87b9cde436ec1e710e201235c6b
4
- data.tar.gz: 11146f4b0668fd4a82d52ddcbddab47c44d319c0
3
+ metadata.gz: c653b1c46ea895b9c414448e4c4a576cd60af6e6
4
+ data.tar.gz: 1174fdaaa98a4bb1e57fe53d0a78ad1f001abe21
5
5
  SHA512:
6
- metadata.gz: 681ba3200cde48683fe55e9f08cff82593cbe5bf0e065608e1c5e35e76322c7a3254960a978a94d2df4ba75211cfd17d213a2fdd5b028ef3a763f853d9822df6
7
- data.tar.gz: f5ba4251379ffa68c4ce0c41db8a2e95649aba52e38d6cc2f3511bbd5b38ddce393811e730211c0fd3637ec284b06cdfed59b1f0aeb4354383e00f9914846563
6
+ metadata.gz: eac07c9e59617874a48243cb1532127f45eb3e90b6c19b0042847f2e99218ae68015a913300f5ecff2b96a1a4313b8e7fda2104d9bd491e1f9f9b3aa22f5dd83
7
+ data.tar.gz: 2475714bc2e295e96a44e2fa07173d466f0c62d14a5e083a6100ee0f94b365c4c5411c4fffa6219f208a8e9c08bfebda79f98d3bd694ec147b9628525e05d39e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_mailing_list (0.1.0)
4
+ simple_mailing_list (0.1.1)
5
5
  activerecord
6
6
  daemons
7
7
  liquid
@@ -1,87 +1,87 @@
1
- module SimpleMailingList
2
- module System
3
- DEFAULT_CONFIGFILE = "config.yaml"
4
-
5
- private
6
-
7
- def load_configfile(configfile)
8
- return if @path
9
-
10
- # basic
11
- config = YAML.load(File.read(configfile, encoding: "utf-8"))
12
- @path = Dir.getwd
13
-
14
- # log
15
- config["log"] ||= {}
16
- file = config["log"]["filename"] ?
17
- File.expand_path(Time.now.strftime(config["log"]["filename"]), @path) : STDOUT
18
- @log = (config["log"]["rotation"].is_a? Integer) ?
19
- Logger.new(file, config["log"]["rotation"], config["log"]["shift_size"] || 1048576) :
20
- Logger.new(file, config["log"]["rotation"] || 0)
21
- if config["log"]["level"]
22
- @log.level = config["log"]["level"].is_a?(String) ?
23
- %w[debug info warn error fatal].index(config["log"]["level"].downcase) :
24
- config["log"]["level"]
25
- end
26
-
27
- # others
28
- @lockfile = config["lockfile"]
29
- @maillogs_dir = File.expand_path(config["maillogs_dir"] || "maillogs", @path)
30
- @maillogs_period = config["maillogs_period"] || -1
31
-
32
- @validity_time = config["validity_time"] || 86400
33
- @max_check_times = config["max_check_times"] || 5
34
-
35
- @sleep_time1 = config["sleep_time1"] || 0.1
36
- @sleep_time2 = config["sleep_time2"] || 1.5
37
- @permitted_users = config["permitted_users"]
38
- @registered_user_only = !!config["registered_user_only"]
39
- @use_address_camouflage = !!config["use_address_camouflage"]
40
- @enable_html_mail = !!config["enable_html_mail"]
41
-
42
- @receive_servers = config["receive_servers"] || []
43
- @deliver_server = config["deliver_server"] ||
44
- { "protocol" => "sendmail", "charset" => "utf-8", "options" => {} }
45
-
46
- @register = config["register"] || []
47
- @register_confirm_subject = config["register_confirm_subject"] || ""
48
- @register_confirm_body = config["register_confirm_body"] || ""
49
- @register_success_subject = config["register_success_subject"] || ""
50
- @register_success_body = config["register_success_body"] || ""
51
-
52
- @delete = config["delete"] || []
53
- @delete_confirm_subject = config["delete_confirm_subject"] || ""
54
- @delete_confirm_body = config["delete_confirm_body"] || ""
55
- @delete_success_subject = config["delete_success_subject"] || ""
56
- @delete_success_body = config["delete_success_body"] || ""
57
-
58
- @forward = config["forward"] || []
59
- @reply_to_address = config["reply_to_address"]
60
-
61
- # database
62
- if config["database_require"]
63
- require config["database_require"]
64
- else
65
- case config["database"]["adapter"]
66
- when "mysql2"
67
- require "mysql2"
68
- when "postgresql"
69
- require "pg"
70
- when "sqlite3"
71
- require "sqlite3"
72
- else
73
- require config["database"]["adapter"]
74
- end
75
- end
76
- ActiveRecord::Base.establish_connection(config["database"])
77
-
78
- # mail server
79
- @receive_servers = Array(config["receive_server"]) if config["receive_server"]
80
- deliver_server = @deliver_server
81
- Mail.defaults do
82
- delivery_method(deliver_server["protocol"].to_sym,
83
- deliver_server["options"].symbolize_keys)
84
- end
85
- end
86
- end
87
- end
1
+ module SimpleMailingList
2
+ module System
3
+ DEFAULT_CONFIGFILE = "config.yaml"
4
+
5
+ private
6
+
7
+ def load_configfile(configfile)
8
+ return if @path
9
+
10
+ # basic
11
+ config = YAML.load(File.read(configfile, encoding: "utf-8"))
12
+ @path = Dir.getwd
13
+
14
+ # log
15
+ config["log"] ||= {}
16
+ file = config["log"]["filename"] ?
17
+ File.expand_path(Time.now.strftime(config["log"]["filename"]), @path) : STDOUT
18
+ @log = (config["log"]["rotation"].is_a? Integer) ?
19
+ Logger.new(file, config["log"]["rotation"], config["log"]["shift_size"] || 1048576) :
20
+ Logger.new(file, config["log"]["rotation"] || 0)
21
+ if config["log"]["level"]
22
+ @log.level = config["log"]["level"].is_a?(String) ?
23
+ %w[debug info warn error fatal].index(config["log"]["level"].downcase) :
24
+ config["log"]["level"]
25
+ end
26
+
27
+ # others
28
+ @lockfile = config["lockfile"]
29
+ @maillogs_dir = File.expand_path(config["maillogs_dir"] || "maillogs", @path)
30
+ @maillogs_period = config["maillogs_period"] || -1
31
+
32
+ @validity_time = config["validity_time"] || 86400
33
+ @max_check_times = config["max_check_times"] || 5
34
+
35
+ @sleep_time1 = config["sleep_time1"] || 0.1
36
+ @sleep_time2 = config["sleep_time2"] || 1.5
37
+ @permitted_users = config["permitted_users"]
38
+ @registered_user_only = !!config["registered_user_only"]
39
+ @use_address_camouflage = !!config["use_address_camouflage"]
40
+ @enable_html_mail = !!config["enable_html_mail"]
41
+
42
+ @receive_servers = config["receive_servers"] || []
43
+ @deliver_server = config["deliver_server"] ||
44
+ { "protocol" => "sendmail", "charset" => "utf-8", "options" => {} }
45
+
46
+ @register = config["register"] || []
47
+ @register_confirm_subject = config["register_confirm_subject"] || ""
48
+ @register_confirm_body = config["register_confirm_body"] || ""
49
+ @register_success_subject = config["register_success_subject"] || ""
50
+ @register_success_body = config["register_success_body"] || ""
51
+
52
+ @delete = config["delete"] || []
53
+ @delete_confirm_subject = config["delete_confirm_subject"] || ""
54
+ @delete_confirm_body = config["delete_confirm_body"] || ""
55
+ @delete_success_subject = config["delete_success_subject"] || ""
56
+ @delete_success_body = config["delete_success_body"] || ""
57
+
58
+ @forward = config["forward"] || []
59
+ @reply_to_address = config["reply_to_address"]
60
+
61
+ # database
62
+ if config["database_require"]
63
+ require config["database_require"]
64
+ else
65
+ case config["database"]["adapter"]
66
+ when "mysql2"
67
+ require "mysql2"
68
+ when "postgresql"
69
+ require "pg"
70
+ when "sqlite3"
71
+ require "sqlite3"
72
+ else
73
+ require config["database"]["adapter"]
74
+ end
75
+ end
76
+ ActiveRecord::Base.establish_connection(config["database"])
77
+
78
+ # mail server
79
+ @receive_servers = Array(config["receive_server"]) if config["receive_server"]
80
+ deliver_server = @deliver_server
81
+ Mail.defaults do
82
+ delivery_method(deliver_server["protocol"].to_sym,
83
+ deliver_server["options"].symbolize_keys)
84
+ end
85
+ end
86
+ end
87
+ end
@@ -1,22 +1,22 @@
1
- module SimpleMailingList
2
- module System
3
- private
4
-
5
- def lock()
6
- if @lockfile
7
- open(File.expand_path(@lockfile, @path), "w") do |lockfile|
8
- if lockfile.flock(File::LOCK_EX | File::LOCK_NB)
9
- @log.debug("Lock successed.")
10
- yield
11
- lockfile.flock(File::LOCK_UN)
12
- @log.debug("Unlocked.")
13
- else
14
- @log.debug("Lock failed.")
15
- end
16
- end
17
- else
18
- yield
19
- end
20
- end
21
- end
22
- end
1
+ module SimpleMailingList
2
+ module System
3
+ private
4
+
5
+ def lock()
6
+ if @lockfile
7
+ open(File.expand_path(@lockfile, @path), "w") do |lockfile|
8
+ if lockfile.flock(File::LOCK_EX | File::LOCK_NB)
9
+ @log.debug("Lock successed.")
10
+ yield
11
+ lockfile.flock(File::LOCK_UN)
12
+ @log.debug("Unlocked.")
13
+ else
14
+ @log.debug("Lock failed.")
15
+ end
16
+ end
17
+ else
18
+ yield
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module SimpleMailingList
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -108,13 +108,13 @@ module SimpleMailingList
108
108
  _delete_old_maillogs()
109
109
  end
110
110
 
111
- desc "loop", "loop main_jobs."
111
+ desc "loop_main_jobs", "loop main_jobs."
112
112
  option :sleep_time,
113
113
  aliases: "-s",
114
114
  default: 10,
115
115
  type: :numeric,
116
116
  desc: "wait time on a loop."
117
- def loop()
117
+ def loop_main_jobs()
118
118
  require "simple_mailing_list/main"
119
119
  require "simple_mailing_list/delete_old"
120
120
  load_configfile(options[:configfile])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_mailing_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nodai2hITC