rakismet 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ .DS_Store
2
+ *.tmproj
3
+ tmtags
4
+ *.swp
5
+ *.swo
6
+ *.un~
7
+ coverage
8
+ rdoc
9
+ pkg
10
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'rake'
7
+ gem 'rspec', '~> 2'
8
+ end
data/README.md CHANGED
@@ -15,14 +15,16 @@ Getting Started
15
15
  ===============
16
16
 
17
17
  Once you've installed the Rakismet gem and added it to your application's Gemfile,
18
- you'll need an API key from the folks at WordPress. Head on over to
19
- http://wordpress.com/api-keys/ and sign up for a new username.
18
+ you'll need an API key. Head on over to http://akismet.com/wordpress/ and sign up
19
+ for a new username.
20
20
 
21
21
  Configure the Rakismet key and the URL of your application by setting the following
22
22
  in an initializer or application.rb:
23
23
 
24
- config.rakismet.key = 'your wordpress key'
25
- config.rakismet.url = 'http://yourdomain.com/'
24
+ ```ruby
25
+ config.rakismet.key = 'your wordpress key'
26
+ config.rakismet.url = 'http://yourdomain.com/'
27
+ ```
26
28
 
27
29
  If you wish to use another Akismet-compatible API provider such as TypePad's
28
30
  antispam service, you'll also need to set `config.rakismet.host` to your service
@@ -31,34 +33,28 @@ provider's endpoint.
31
33
  If you want to use a proxy to access akismet (i.e your application is behind a firewall),
32
34
  set the proxy_host and proxy_port option.
33
35
 
34
- config.rakismet.proxy_host = 'http://yourdomain.com/'
35
- config.rakismet.proxy_port = '8080'
36
+ ```ruby
37
+ config.rakismet.proxy_host = 'http://yourdomain.com/'
38
+ config.rakismet.proxy_port = '8080'
39
+ ```
36
40
 
37
41
  Checking For Spam
38
42
  -----------------
39
43
 
40
44
  First, introduce Rakismet to your model:
41
45
 
42
- class Comment
43
- include Rakismet::Model
44
- end
46
+ ```ruby
47
+ class Comment
48
+ include Rakismet::Model
49
+ end
50
+ ```
45
51
 
46
52
  With Rakismet mixed in to your model, you'll get three methods for interacting with
47
53
  Akismet:
48
54
 
49
- * `spam?`
50
-
51
- Simply call `@comment.spam?` to get a true/false response. True means it's spam,
52
- false means it's not.
53
-
54
- * `ham!` and
55
- * `spam!`
56
-
57
- Akismet works best with your feedback. If you spot a comment that was
58
- erroneously marked as spam, `@comment.ham!` will resubmit to Akismet, marked
59
- as a false positive. Likewise if they missed a spammy comment,
60
- `@comment.spam!` will resubmit marked as spam.
61
-
55
+ * `spam?` returns true if it's spam, false if it's not.
56
+ * `ham!` submits comment that Akismet erroneously marked as spam, marked as a false positive.
57
+ * `spam!` submits a comment that Akismet didn't think was spam.
62
58
 
63
59
  Configuring Your Model
64
60
  ----------------------
@@ -79,28 +75,33 @@ By default, Rakismet just looks for attributes or methods on your class that
79
75
  match these names. You don't have to have accessors that match these exactly,
80
76
  however. If yours differ, just tell Rakismet what to call them:
81
77
 
82
- class Comment
83
- include Rakismet::Model
84
- attr_accessor :commenter_name, :commenter_email
85
- rakismet_attrs :author => :commenter_name,
86
- :author_email => :commenter_email
87
- end
78
+ ```ruby
79
+ class Comment
80
+ include Rakismet::Model
81
+ attr_accessor :commenter_name, :commenter_email
82
+ rakismet_attrs :author => :commenter_name, :author_email => :commenter_email
83
+ end
84
+ ```
88
85
 
89
86
  Or you can pass in a proc, to access associations:
90
87
 
91
- class Comment < ActiveRecord::Base
92
- include Rakismet::Model
93
- belongs_to :author
94
- rakismet_attrs :author => proc { author.name },
95
- :author_email => proc { author.email }
96
- end
88
+ ```ruby
89
+ class Comment < ActiveRecord::Base
90
+ include Rakismet::Model
91
+ belongs_to :author
92
+ rakismet_attrs :author => proc { author.name },
93
+ :author_email => proc { author.email }
94
+ end
95
+ ```
97
96
 
98
97
  You can even hard-code specific fields:
99
98
 
100
- class Trackback
101
- include Rakismet::Model
102
- rakismet_attrs :comment_type => "trackback"
103
- end
99
+ ```ruby
100
+ class Trackback
101
+ include Rakismet::Model
102
+ rakismet_attrs :comment_type => "trackback"
103
+ end
104
+ ```
104
105
 
105
106
  Optional Request Variables
106
107
  --------------------------
@@ -126,7 +127,9 @@ If you've decided to handle the request variables yourself, you can add this to
126
127
  app initialization to disable the middleware responsible for tracking the request
127
128
  information:
128
129
 
129
- config.rakismet.use_middleware = false
130
+ ```ruby
131
+ config.rakismet.use_middleware = false
132
+ ```
130
133
 
131
134
  Verifying Responses
132
135
  -------------------
data/Rakefile CHANGED
@@ -1,21 +1,5 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "rakismet"
8
- gem.summary = %Q{Akismet and TypePad AntiSpam integration for Rails.}
9
- gem.description = %Q{Rakismet is the easiest way to integrate Akismet or TypePad's AntiSpam into your Rails app.}
10
- gem.email = "josh@digitalpulp.com"
11
- gem.homepage = "http://github.com/joshfrench/rakismet"
12
- gem.authors = ["Josh French"]
13
- gem.rubyforge_project = %q{rakismet}
14
- end
15
- Jeweler::GemcutterTasks.new
16
- rescue LoadError
17
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
18
- end
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
19
3
 
20
4
  require 'rspec/core/rake_task'
21
5
  RSpec::Core::RakeTask.new do |spec|
data/lib/rakismet.rb CHANGED
@@ -28,16 +28,9 @@ module Rakismet
28
28
  @request = Request.new
29
29
  end
30
30
 
31
- def version
32
- @version ||= begin
33
- version = YAML.load_file(File.join(File.dirname(__FILE__), %w(.. VERSION.yml)))
34
- [version[:major], version[:minor], version[:patch]].join('.')
35
- end
36
- end
37
-
38
31
  def headers
39
32
  @headers ||= begin
40
- user_agent = "Rakismet/#{Rakismet.version}"
33
+ user_agent = "Rakismet/#{Rakismet::VERSION}"
41
34
  user_agent = "Rails/#{Rails.version} | " + user_agent if defined?(Rails)
42
35
  { 'User-Agent' => user_agent, 'Content-Type' => 'application/x-www-form-urlencoded' }
43
36
  end
@@ -62,7 +55,7 @@ module Rakismet
62
55
  args.merge!(:blog => Rakismet.url)
63
56
  akismet = URI.parse(call_url(function))
64
57
  _, response = Net::HTTP::Proxy(proxy_host, proxy_port).start(akismet.host) do |http|
65
- data = args.map { |k,v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
58
+ data = args.map { |k,v| "#{k}=#{CGI.escape(v.to_str)}" }.join('&')
66
59
  http.post(akismet.path, data, Rakismet.headers)
67
60
  end
68
61
  response
@@ -0,0 +1,3 @@
1
+ module Rakismet
2
+ VERSION = "1.1.1"
3
+ end
data/rakismet.gemspec CHANGED
@@ -1,50 +1,24 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rakismet/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{rakismet}
8
- s.version = "1.1.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.name = "rakismet"
7
+ s.version = Rakismet::VERSION
8
+ s.platform = Gem::Platform::RUBY
11
9
  s.authors = ["Josh French"]
12
- s.date = %q{2011-07-05}
13
- s.description = %q{Rakismet is the easiest way to integrate Akismet or TypePad's AntiSpam into your Rails app.}
14
- s.email = %q{josh@digitalpulp.com}
15
- s.extra_rdoc_files = [
16
- "README.md"
17
- ]
18
- s.files = [
19
- "CHANGELOG",
20
- "MIT-LICENSE",
21
- "README.md",
22
- "Rakefile",
23
- "VERSION.yml",
24
- "lib/rakismet.rb",
25
- "lib/rakismet/middleware.rb",
26
- "lib/rakismet/model.rb",
27
- "lib/rakismet/railtie.rb",
28
- "rakismet.gemspec",
29
- "spec/.rspec",
30
- "spec/rakismet_middleware_spec.rb",
31
- "spec/rakismet_model_spec.rb",
32
- "spec/rakismet_spec.rb",
33
- "spec/spec_helper.rb"
34
- ]
35
- s.homepage = %q{http://github.com/joshfrench/rakismet}
36
- s.require_paths = ["lib"]
37
- s.rubyforge_project = %q{rakismet}
38
- s.rubygems_version = %q{1.6.2}
39
- s.summary = %q{Akismet and TypePad AntiSpam integration for Rails.}
10
+ s.email = "josh@vitamin-j.com"
11
+ s.homepage = "http://github.com/joshfrench/rakismet"
12
+ s.summary = "Akismet and TypePad AntiSpam integration for Rails."
13
+ s.description = "Rakismet is the easiest way to integrate Akismet or TypePad's AntiSpam into your Rails app."
14
+ s.date = "2011-08-11"
40
15
 
41
- if s.respond_to? :specification_version then
42
- s.specification_version = 3
16
+ s.rubyforge_project = "rakismet"
43
17
 
44
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- else
46
- end
47
- else
48
- end
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+ s.extra_rdoc_files = ["README.md"]
49
23
  end
50
24
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rakismet
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.0
5
+ version: 1.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Josh French
@@ -10,12 +10,12 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-05 00:00:00 -04:00
13
+ date: 2011-08-11 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
17
17
  description: Rakismet is the easiest way to integrate Akismet or TypePad's AntiSpam into your Rails app.
18
- email: josh@digitalpulp.com
18
+ email: josh@vitamin-j.com
19
19
  executables: []
20
20
 
21
21
  extensions: []
@@ -23,15 +23,17 @@ extensions: []
23
23
  extra_rdoc_files:
24
24
  - README.md
25
25
  files:
26
+ - .gitignore
26
27
  - CHANGELOG
28
+ - Gemfile
27
29
  - MIT-LICENSE
28
30
  - README.md
29
31
  - Rakefile
30
- - VERSION.yml
31
32
  - lib/rakismet.rb
32
33
  - lib/rakismet/middleware.rb
33
34
  - lib/rakismet/model.rb
34
35
  - lib/rakismet/railtie.rb
36
+ - lib/rakismet/version.rb
35
37
  - rakismet.gemspec
36
38
  - spec/.rspec
37
39
  - spec/rakismet_middleware_spec.rb
@@ -66,5 +68,8 @@ rubygems_version: 1.6.2
66
68
  signing_key:
67
69
  specification_version: 3
68
70
  summary: Akismet and TypePad AntiSpam integration for Rails.
69
- test_files: []
70
-
71
+ test_files:
72
+ - spec/rakismet_middleware_spec.rb
73
+ - spec/rakismet_model_spec.rb
74
+ - spec/rakismet_spec.rb
75
+ - spec/spec_helper.rb
data/VERSION.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- :minor: 1
3
- :build:
4
- :patch: 0
5
- :major: 1
6
-