RubySpamAssassin 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -8,7 +8,6 @@ source "http://rubygems.org"
8
8
  group :development do
9
9
  gem "rspec", "~> 2.3.0"
10
10
  gem "cucumber", ">= 0"
11
- gem "bundler", "~> 1.0.0"
12
- gem "jeweler", "~> 1.5.2"
13
- gem "rcov", ">= 0"
11
+ gem "bundler" # , "~> 1.0.0"
12
+ gem "jeweler" # , "~> 1.5.2"
14
13
  end
data/Gemfile.lock CHANGED
@@ -1,24 +1,25 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- builder (3.0.0)
5
- cucumber (0.10.0)
4
+ builder (3.1.4)
5
+ cucumber (1.2.1)
6
6
  builder (>= 2.1.2)
7
- diff-lcs (~> 1.1.2)
8
- gherkin (~> 2.3.2)
9
- json (~> 1.4.6)
10
- term-ansicolor (~> 1.0.5)
11
- diff-lcs (1.1.2)
12
- gherkin (2.3.3)
13
- json (~> 1.4.6)
7
+ diff-lcs (>= 1.1.3)
8
+ gherkin (~> 2.11.0)
9
+ json (>= 1.4.6)
10
+ diff-lcs (1.1.3)
11
+ gherkin (2.11.5)
12
+ json (>= 1.4.6)
14
13
  git (1.2.5)
15
- jeweler (1.5.2)
16
- bundler (~> 1.0.0)
14
+ jeweler (1.8.4)
15
+ bundler (~> 1.0)
17
16
  git (>= 1.2.5)
18
17
  rake
19
- json (1.4.6)
20
- rake (0.8.7)
21
- rcov (0.9.9)
18
+ rdoc
19
+ json (1.7.6)
20
+ rake (10.0.3)
21
+ rdoc (3.12)
22
+ json (~> 1.4)
22
23
  rspec (2.3.0)
23
24
  rspec-core (~> 2.3.0)
24
25
  rspec-expectations (~> 2.3.0)
@@ -27,14 +28,12 @@ GEM
27
28
  rspec-expectations (2.3.0)
28
29
  diff-lcs (~> 1.1.2)
29
30
  rspec-mocks (2.3.0)
30
- term-ansicolor (1.0.5)
31
31
 
32
32
  PLATFORMS
33
33
  ruby
34
34
 
35
35
  DEPENDENCIES
36
- bundler (~> 1.0.0)
36
+ bundler
37
37
  cucumber
38
- jeweler (~> 1.5.2)
39
- rcov
38
+ jeweler
40
39
  rspec (~> 2.3.0)
data/README.rdoc CHANGED
@@ -7,7 +7,9 @@ Now you just need to:
7
7
  include RubySpamAssassin
8
8
 
9
9
  spam_client = SpamClient.new("host_running_spamd", "port_spamd_is_listening_on", timeout)
10
- report = spam_client.report("some string here, or better yet a variable")
10
+ # MyMailer is your ActionMailer
11
+ # check will also accept a string, if you're into that kind of thing
12
+ report = spam_client.check(MyMailer.my_email.to_s)
11
13
  p report.inspect
12
14
 
13
15
  Wasn't that easy?
data/Rakefile CHANGED
@@ -41,13 +41,3 @@ require 'cucumber/rake/task'
41
41
  Cucumber::Rake::Task.new(:features)
42
42
 
43
43
  task :default => :spec
44
-
45
- require 'rake/rdoctask'
46
- Rake::RDocTask.new do |rdoc|
47
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
-
49
- rdoc.rdoc_dir = 'rdoc'
50
- rdoc.title = "RubySpamAssassin #{version}"
51
- rdoc.rdoc_files.include('README*')
52
- rdoc.rdoc_files.include('lib/**/*.rb')
53
- end
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{RubySpamAssassin}
8
- s.version = "0.1.1"
7
+ s.name = "RubySpamAssassin"
8
+ s.version = "1.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kevin Poorman"]
12
- s.date = %q{2011-01-27}
13
- s.description = %q{This gem makes it easy for developers to hand a body of text to spam assassin and ask get it's spam score, spam report etc. Supports the full Spamc protocol.}
14
- s.email = %q{kjp@brightleafsoftware.com}
12
+ s.date = "2013-01-21"
13
+ s.description = "This gem makes it easy for developers to hand a body of text to spam assassin and ask get it's spam score, spam report etc. Supports the full Spamc protocol."
14
+ s.email = "kjp@brightleafsoftware.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.rdoc"
@@ -33,39 +33,31 @@ Gem::Specification.new do |s|
33
33
  "spec/RubySpamAssassin_spec.rb",
34
34
  "spec/spec_helper.rb"
35
35
  ]
36
- s.homepage = %q{http://github.com/noeticpenguin/RubySpamAssassin}
36
+ s.homepage = "http://github.com/noeticpenguin/RubySpamAssassin"
37
37
  s.licenses = ["MIT"]
38
38
  s.require_paths = ["lib"]
39
- s.rubygems_version = %q{1.3.7}
40
- s.summary = %q{Gem provides a direct ruby interface to spamd running on localhost or remotely}
41
- s.test_files = [
42
- "spec/RubySpamAssassin_spec.rb",
43
- "spec/spec_helper.rb"
44
- ]
39
+ s.rubygems_version = "1.8.24"
40
+ s.summary = "Gem provides a direct ruby interface to spamd running on localhost or remotely"
45
41
 
46
42
  if s.respond_to? :specification_version then
47
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
48
43
  s.specification_version = 3
49
44
 
50
45
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
46
  s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
52
47
  s.add_development_dependency(%q<cucumber>, [">= 0"])
53
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
54
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
55
- s.add_development_dependency(%q<rcov>, [">= 0"])
48
+ s.add_development_dependency(%q<bundler>, [">= 0"])
49
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
56
50
  else
57
51
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
58
52
  s.add_dependency(%q<cucumber>, [">= 0"])
59
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
60
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
61
- s.add_dependency(%q<rcov>, [">= 0"])
53
+ s.add_dependency(%q<bundler>, [">= 0"])
54
+ s.add_dependency(%q<jeweler>, [">= 0"])
62
55
  end
63
56
  else
64
57
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
65
58
  s.add_dependency(%q<cucumber>, [">= 0"])
66
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
67
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
68
- s.add_dependency(%q<rcov>, [">= 0"])
59
+ s.add_dependency(%q<bundler>, [">= 0"])
60
+ s.add_dependency(%q<jeweler>, [">= 0"])
69
61
  end
70
62
  end
71
63
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 1.0.0
@@ -13,7 +13,7 @@ module RubySpamAssassin
13
13
 
14
14
  #returns true if the message was spam, otherwise false
15
15
  def spam?
16
- (@spam == "True" || @spam == "Yes") ? True : False
16
+ (@spam == "True" || @spam == "Yes") ? true : false
17
17
  end
18
18
  end
19
19
 
@@ -21,33 +21,32 @@ module RubySpamAssassin
21
21
 
22
22
  require 'socket'
23
23
  require 'timeout'
24
- # require 'spam_result'
25
24
 
26
25
  def initialize(host="localhost", port=783, timeout=5)
27
26
  @port = port
28
27
  @host = host
29
28
  @timeout =timeout
30
- @socket = TCPsocket.open(@host, @port)
29
+ @socket = TCPSocket.open(@host, @port)
31
30
  end
32
31
 
33
32
  def reconnect
34
- @socket = @socket || TCPsocket.open(@host, @port)
33
+ @socket = @socket || TCPSocket.open(@host, @port)
35
34
  end
36
35
 
37
36
  def send_symbol(message)
38
- protocol_repsonse = send_message("SYMBOLS", message)
39
- result = process_headers(SpamResult.new, protocol_repsonse[0...2])
40
- result.tags = protocol_repsonse[3...-1].join(" ").split(',')
37
+ protocol_response = send_message("SYMBOLS", message)
38
+ result = process_headers protocol_response[0...2]
39
+ result.tags = protocol_response[3...-1].join(" ").split(',')
41
40
  end
42
41
 
43
42
  def check(message)
44
- protocol_repsonse = send_message("CHECK", message)
45
- result = process_headers(SpamResult.new, protocol_repsonse[0...2])
43
+ protocol_response = send_message("CHECK", message)
44
+ result = process_headers protocol_response[0...2]
46
45
  end
47
46
 
48
47
  def report(message)
49
48
  protocol_response = send_message("REPORT", message)
50
- result = process_headers(SpamResult.new, protocol_repsonse[0...2])
49
+ result = process_headers protocol_response[0...2]
51
50
  result.report = protocol_response[3..-1].join
52
51
  end
53
52
 
@@ -61,7 +60,7 @@ module RubySpamAssassin
61
60
 
62
61
  def ping
63
62
  protocol_response = send_message("PING", message)
64
- result = process_headers(SpamResult.new, protocol_repsonse[0])
63
+ result = process_headers protocol_response[0]
65
64
  end
66
65
 
67
66
  alias :process :report
@@ -79,7 +78,8 @@ module RubySpamAssassin
79
78
  response
80
79
  end
81
80
 
82
- def process_headers(result, headers)
81
+ def process_headers(headers)
82
+ result = SpamResult.new
83
83
  headers.each do |line|
84
84
  case line.chomp
85
85
  when /(.+)\/(.+) (.+) (.+)/ then
@@ -94,6 +94,7 @@ module RubySpamAssassin
94
94
  result.content_length = $1
95
95
  end
96
96
  end
97
+ result
97
98
  end
98
99
  end
99
100
  end
metadata CHANGED
@@ -1,109 +1,89 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: RubySpamAssassin
3
- version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.0.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Kevin Poorman
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-01-27 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
12
+ date: 2013-01-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
25
17
  - - ~>
26
- - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 2
30
- - 3
31
- - 0
18
+ - !ruby/object:Gem::Version
32
19
  version: 2.3.0
33
- type: :development
34
- name: rspec
20
+ none: false
35
21
  prerelease: false
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- requirement: &id002 !ruby/object:Gem::Requirement
22
+ name: rspec
23
+ requirement: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: 2.3.0
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
47
29
  type: :development
48
- name: cucumber
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ none: false
49
37
  prerelease: false
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ name: cucumber
39
+ requirement: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
53
44
  none: false
54
- requirements:
55
- - - ~>
56
- - !ruby/object:Gem::Version
57
- hash: 23
58
- segments:
59
- - 1
60
- - 0
61
- - 0
62
- version: 1.0.0
63
45
  type: :development
64
- name: bundler
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ none: false
65
53
  prerelease: false
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- requirement: &id004 !ruby/object:Gem::Requirement
54
+ name: bundler
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
69
60
  none: false
70
- requirements:
71
- - - ~>
72
- - !ruby/object:Gem::Version
73
- hash: 7
74
- segments:
75
- - 1
76
- - 5
77
- - 2
78
- version: 1.5.2
79
61
  type: :development
80
- name: jeweler
62
+ - !ruby/object:Gem::Dependency
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ none: false
81
69
  prerelease: false
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- requirement: &id005 !ruby/object:Gem::Requirement
70
+ name: jeweler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
85
76
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
93
77
  type: :development
94
- name: rcov
95
- prerelease: false
96
- version_requirements: *id005
97
- description: This gem makes it easy for developers to hand a body of text to spam assassin and ask get it's spam score, spam report etc. Supports the full Spamc protocol.
78
+ description: This gem makes it easy for developers to hand a body of text to spam
79
+ assassin and ask get it's spam score, spam report etc. Supports the full Spamc protocol.
98
80
  email: kjp@brightleafsoftware.com
99
81
  executables: []
100
-
101
82
  extensions: []
102
-
103
- extra_rdoc_files:
83
+ extra_rdoc_files:
104
84
  - LICENSE.txt
105
85
  - README.rdoc
106
- files:
86
+ files:
107
87
  - .document
108
88
  - .rspec
109
89
  - Gemfile
@@ -119,40 +99,32 @@ files:
119
99
  - lib/RubySpamAssassin.rb
120
100
  - spec/RubySpamAssassin_spec.rb
121
101
  - spec/spec_helper.rb
122
- has_rdoc: true
123
102
  homepage: http://github.com/noeticpenguin/RubySpamAssassin
124
- licenses:
103
+ licenses:
125
104
  - MIT
126
105
  post_install_message:
127
106
  rdoc_options: []
128
-
129
- require_paths:
107
+ require_paths:
130
108
  - lib
131
- required_ruby_version: !ruby/object:Gem::Requirement
132
- none: false
133
- requirements:
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- hash: 3
137
- segments:
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ segments:
138
115
  - 0
139
- version: "0"
140
- required_rubygems_version: !ruby/object:Gem::Requirement
116
+ hash: -757903817830564775
117
+ none: false
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ! '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
141
123
  none: false
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- hash: 3
146
- segments:
147
- - 0
148
- version: "0"
149
124
  requirements: []
150
-
151
125
  rubyforge_project:
152
- rubygems_version: 1.3.7
126
+ rubygems_version: 1.8.24
153
127
  signing_key:
154
128
  specification_version: 3
155
129
  summary: Gem provides a direct ruby interface to spamd running on localhost or remotely
156
- test_files:
157
- - spec/RubySpamAssassin_spec.rb
158
- - spec/spec_helper.rb
130
+ test_files: []