profanalyzer 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Rakefile +5 -51
- data/config/list.yml +4 -9
- data/lib/profanalyzer.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
=== 0.2.1 / 2009-03-25
|
2
|
+
|
3
|
+
* Fixed some wordlist errors.
|
4
|
+
|
1
5
|
=== 0.2.0 / 2009-03-23
|
2
6
|
|
3
7
|
* Added an options hash to Profanalyzer#filter and Profanalyzer#profane?, letting you change settings but only within the scope of that call - using this hash won't change the global settings.
|
data/Rakefile
CHANGED
@@ -11,63 +11,17 @@ Hoe.new('profanalyzer', Profanalyzer::VERSION) do |p|
|
|
11
11
|
|
12
12
|
desc 'Post your blog announcement to blogger.'
|
13
13
|
task :post_blogger do
|
14
|
-
require '
|
15
|
-
require 'net/https'
|
14
|
+
require 'blogger'
|
16
15
|
p.with_config do |config, path|
|
17
16
|
break unless config['blogs']
|
18
17
|
subject, title, body, urls = p.announcement
|
19
|
-
#body += "\n\n#{urls}"
|
20
18
|
|
21
19
|
config['blogs'].each do |site|
|
22
20
|
next unless site['url'] =~ /www\.blogger\.com/
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
http = Net::HTTP.new('www.google.com', 443)
|
28
|
-
http.use_ssl = true
|
29
|
-
login_url = '/accounts/ClientLogin'
|
30
|
-
|
31
|
-
# Setup HTTPS request post data to obtain authentication token.
|
32
|
-
data = 'Email=' + google_email +'&Passwd=' + google_passwd + '&source=' + source + '&service=blogger'
|
33
|
-
headers = {
|
34
|
-
'Content-Type' => 'application/x-www-form-urlencoded'
|
35
|
-
}
|
36
|
-
|
37
|
-
# Submit HTTPS post request
|
38
|
-
resp, data = http.post(login_url, data, headers)
|
39
|
-
|
40
|
-
unless resp.code.eql? '200'
|
41
|
-
puts "Error during authentication, blog at #{site['url']}, ##{site['blog_id']}: #{resp.message}\n"
|
42
|
-
else
|
43
|
-
|
44
|
-
# Parse for the authentication token.
|
45
|
-
authToken = data.split("\n").map {|l| l.split("=")}.assoc("Auth")[1]
|
46
|
-
|
47
|
-
headers = {
|
48
|
-
'Authorization' => 'GoogleLogin auth=' + authToken,
|
49
|
-
'Content-Type' => 'application/atom+xml'
|
50
|
-
}
|
51
|
-
|
52
|
-
data = <<-EOF
|
53
|
-
<entry xmlns='http://www.w3.org/2005/Atom'>
|
54
|
-
<title type='text'>#{title}</title>
|
55
|
-
<content type='xhtml'>
|
56
|
-
<div xmlns="http://www.w3.org/1999/xhtml">
|
57
|
-
#{body}
|
58
|
-
</div>
|
59
|
-
</content>
|
60
|
-
#{p.blog_categories.inject("") {|acc,cat| acc + "<category scheme=\"http://www.blogger.com/atom/ns#\" term=\"#{cat}\" />\n"}}
|
61
|
-
</entry>
|
62
|
-
EOF
|
63
|
-
|
64
|
-
http = Net::HTTP.new('www.blogger.com')
|
65
|
-
path = '/feeds/' + site['blog_id'] + '/posts/default'
|
66
|
-
|
67
|
-
resp, data = http.post(path, data, headers)
|
68
|
-
puts "Error while posting, blog at #{site['url']}, ##{site['blog_id']}: #{resp.message}" unless resp.code == 200
|
69
|
-
# Expect resp.code == 200 and resp.message == 'OK' for a successful.
|
70
|
-
end
|
21
|
+
acc = Blogger::Account.new(site['user'],site['password'])
|
22
|
+
post = Blogger::Post.new(:title => title, :content => body, :categories => p.blog_categories)
|
23
|
+
acc.post(site['blog_id'], post)
|
24
|
+
# Expect resp.code == 200 and resp.message == 'OK' for a successful.
|
71
25
|
end
|
72
26
|
end
|
73
27
|
end
|
data/config/list.yml
CHANGED
@@ -217,7 +217,7 @@
|
|
217
217
|
- :sexual: false
|
218
218
|
:racist: true
|
219
219
|
:profane: true
|
220
|
-
:badness:
|
220
|
+
:badness: 3
|
221
221
|
:word: queer
|
222
222
|
- :sexual: true
|
223
223
|
:racist: false
|
@@ -334,17 +334,17 @@
|
|
334
334
|
:profane: true
|
335
335
|
:badness: 2
|
336
336
|
:word: pimp
|
337
|
-
- :sexual:
|
337
|
+
- :sexual: true
|
338
338
|
:racist: false
|
339
339
|
:profane: true
|
340
340
|
:badness: 5
|
341
341
|
:word: phuq
|
342
|
-
- :sexual:
|
342
|
+
- :sexual: true
|
343
343
|
:racist: false
|
344
344
|
:profane: true
|
345
345
|
:badness: 5
|
346
346
|
:word: phuks
|
347
|
-
- :sexual:
|
347
|
+
- :sexual: true
|
348
348
|
:racist: false
|
349
349
|
:profane: true
|
350
350
|
:badness: 5
|
@@ -434,11 +434,6 @@
|
|
434
434
|
:profane: true
|
435
435
|
:badness: 4
|
436
436
|
:word: muff
|
437
|
-
- :sexual: true
|
438
|
-
:racist: false
|
439
|
-
:profane: true
|
440
|
-
:badness: 1
|
441
|
-
:word: mound
|
442
437
|
- :sexual: true
|
443
438
|
:racist: false
|
444
439
|
:profane: true
|
data/lib/profanalyzer.rb
CHANGED
@@ -98,7 +98,7 @@ require 'yaml'
|
|
98
98
|
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
99
99
|
class Profanalyzer
|
100
100
|
|
101
|
-
VERSION = "0.2.
|
101
|
+
VERSION = "0.2.1"
|
102
102
|
|
103
103
|
@@full_list = YAML::load_file(File.dirname(__FILE__)+"/../config/list.yml")
|
104
104
|
@@racist_list = @@full_list.select {|w| w[:racist]}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: profanalyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael J. Edgar
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-25 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|