qiita_mail 0.1.0 → 0.3.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/Gemfile CHANGED
@@ -2,3 +2,5 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in qiita_mail.gemspec
4
4
  gemspec
5
+
6
+ gem 'rake'
@@ -0,0 +1,24 @@
1
+ =================
2
+ QiitaMail
3
+ =================
4
+
5
+ Copyright (c) 2012 ongaeshi
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -32,17 +32,19 @@ module QiitaMail
32
32
 
33
33
  def deliver
34
34
  # ピックアップ
35
+ puts "-- #{Time.now} --"
35
36
  puts "Pickup <---- Qiita.com"
36
37
  mail_body = pickup_and_format(:html)
37
38
 
38
39
  # メールの送信
39
40
  puts "Send mail -> #{@settings.email}"
40
- mailer = Mailer.new(@settings.email, mail_body)
41
+ mailer = Mailer.new(@settings.email_from, @settings.email, mail_body)
41
42
  mailer.deliver
42
43
  end
43
44
 
44
45
  def file(format, filename = nil)
45
46
  # ピックアップ
47
+ puts "-- #{Time.now} --"
46
48
  puts "Pickup <------ Qiita.com"
47
49
  mail_body = pickup_and_format(format)
48
50
 
@@ -10,8 +10,9 @@ require 'mail'
10
10
 
11
11
  module QiitaMail
12
12
  class Mailer
13
- def initialize(to, body)
13
+ def initialize(from, to, body)
14
14
  @mail = Mail.new do
15
+ from from
15
16
  to to
16
17
  subject 'Qiita Mail'
17
18
  # body mail_body
@@ -39,6 +39,10 @@ module QiitaMail
39
39
  @data['email']
40
40
  end
41
41
 
42
+ def email_from
43
+ @data['email_from'] || @data['email']
44
+ end
45
+
42
46
  def keywords
43
47
  @data['keywords']
44
48
  end
@@ -1,3 +1,3 @@
1
1
  module QiitaMail
2
- VERSION = "0.1.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,9 @@
1
+ ---
2
+ email: 'qiita_mail@example.com'
3
+ email_from: 'qiita_mail_from@example.com'
4
+
5
+ keywords:
6
+ - ruby
7
+ - javascript
8
+
9
+
@@ -19,6 +19,7 @@ module QiitaMail
19
19
  def test_empty
20
20
  obj = Settings.new('.qiita_mail.yaml') # データが無い場合は新規作成
21
21
  assert_equal "", obj.email
22
+ assert_equal "", obj.email_from
22
23
  assert_equal [], obj.keywords
23
24
  assert_equal true, obj.empty?
24
25
  obj.save
@@ -27,10 +28,17 @@ module QiitaMail
27
28
  def test_exist_yaml
28
29
  obj = Settings.new(tmp_path('../data/qiita_mail.yaml'))
29
30
  assert_equal "qiita_mail@example.com", obj.email
31
+ assert_equal "qiita_mail@example.com", obj.email_from
30
32
  assert_equal ['ruby', 'javascript'], obj.keywords
31
33
  assert_equal false, obj.empty?
32
34
  end
33
35
 
36
+ def test_exist_yaml_from
37
+ obj = Settings.new(tmp_path('../data/qiita_mail_from.yaml'))
38
+ assert_equal "qiita_mail@example.com", obj.email
39
+ assert_equal "qiita_mail_from@example.com", obj.email_from
40
+ end
41
+
34
42
  def teardown
35
43
  teardown_custom(true)
36
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qiita_mail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-26 00:00:00.000000000 Z
12
+ date: 2013-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &2153154780 !ruby/object:Gem::Requirement
16
+ requirement: &2157687640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153154780
24
+ version_requirements: *2157687640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: qiita
27
- requirement: &2153154260 !ruby/object:Gem::Requirement
27
+ requirement: &2157687220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153154260
35
+ version_requirements: *2157687220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mail
38
- requirement: &2153153620 !ruby/object:Gem::Requirement
38
+ requirement: &2157686800 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153153620
46
+ version_requirements: *2157686800
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: nokogiri
49
- requirement: &2153152780 !ruby/object:Gem::Requirement
49
+ requirement: &2157686380 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2153152780
57
+ version_requirements: *2157686380
58
58
  description: Write a gem description
59
59
  email:
60
60
  - ongaeshi0621@gmail.com
@@ -65,6 +65,7 @@ extra_rdoc_files: []
65
65
  files:
66
66
  - .gitignore
67
67
  - Gemfile
68
+ - LICENSE.txt
68
69
  - Rakefile
69
70
  - bin/qiita_mail
70
71
  - lib/qiita_mail.rb
@@ -82,6 +83,7 @@ files:
82
83
  - qiita_mail.gemspec
83
84
  - test/data/pickup_cache.marshal
84
85
  - test/data/qiita_mail.yaml
86
+ - test/data/qiita_mail_from.yaml
85
87
  - test/file_test_utils.rb
86
88
  - test/test_cli.rb
87
89
  - test/test_helper.rb
@@ -114,6 +116,7 @@ summary: Write a gem summary
114
116
  test_files:
115
117
  - test/data/pickup_cache.marshal
116
118
  - test/data/qiita_mail.yaml
119
+ - test/data/qiita_mail_from.yaml
117
120
  - test/file_test_utils.rb
118
121
  - test/test_cli.rb
119
122
  - test/test_helper.rb