impressiongram 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- metadata +1 -5
- data/lib/impressionist/bots.rb +0 -18
- data/lib/impressionist/engine.rb +0 -17
- data/lib/impressionist/railties/tasks.rake +0 -0
- data/lib/impressionist.rb +0 -5
data/Rakefile
CHANGED
@@ -86,7 +86,7 @@ namespace :version do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
namespace :impressionist do
|
89
|
-
require File.dirname(__FILE__) + "/lib/
|
89
|
+
require File.dirname(__FILE__) + "/lib/impressionGRAM/bots"
|
90
90
|
|
91
91
|
desc "output the list of bots from http://www.user-agents.org/"
|
92
92
|
task :bots do
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: impressiongram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- paulkaplan
|
@@ -98,10 +98,6 @@ files:
|
|
98
98
|
- config/routes.rb
|
99
99
|
- lib/generators/impressionist/impressionist_generator.rb
|
100
100
|
- lib/generators/impressionist/templates/create_impressions_table.rb
|
101
|
-
- lib/impressionist.rb
|
102
|
-
- lib/impressionist/bots.rb
|
103
|
-
- lib/impressionist/engine.rb
|
104
|
-
- lib/impressionist/railties/tasks.rake
|
105
101
|
- logo.png
|
106
102
|
- upgrade_migrations/version_0_3_0.rb
|
107
103
|
- upgrade_migrations/version_0_4_0.rb
|
data/lib/impressionist/bots.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'httpclient'
|
2
|
-
require 'nokogiri'
|
3
|
-
|
4
|
-
module Impressionist
|
5
|
-
module Bots
|
6
|
-
LIST_URL = "http://www.user-agents.org/allagents.xml"
|
7
|
-
def self.consume
|
8
|
-
response = HTTPClient.new.get_content(LIST_URL)
|
9
|
-
doc = Nokogiri::XML(response)
|
10
|
-
list = []
|
11
|
-
doc.xpath('//user-agent').each do |agent|
|
12
|
-
type = agent.xpath("Type").text
|
13
|
-
list << agent.xpath("String").text.gsub("<","<") if ["R","S"].include?(type) #gsub hack for badly formatted data
|
14
|
-
end
|
15
|
-
list
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/impressionist/engine.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require "impressiongram"
|
2
|
-
require "rails"
|
3
|
-
|
4
|
-
module Impressiongram
|
5
|
-
class Engine < Rails::Engine
|
6
|
-
initializer 'impressionist.extend_ar' do |app|
|
7
|
-
ActiveRecord::Base.extend Impressionist::Impressionable
|
8
|
-
end
|
9
|
-
|
10
|
-
initializer 'impressionist.controller' do
|
11
|
-
ActiveSupport.on_load(:action_controller) do
|
12
|
-
include ImpressionistController::InstanceMethods
|
13
|
-
extend ImpressionistController::ClassMethods
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
File without changes
|