metainspector 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,5 @@
1
+ == 1.0.0 / 2007-12-06
2
+
3
+ * MetaInspector is born!
4
+ * Birthday!
5
+
data/Manifest.txt ADDED
@@ -0,0 +1,7 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/metainspector
6
+ lib/metainspector.rb
7
+ test/test_metainspector.rb
data/README.txt ADDED
@@ -0,0 +1,48 @@
1
+ metainspector
2
+ by FIX (your name)
3
+ FIX (url)
4
+
5
+ == DESCRIPTION:
6
+
7
+ FIX (describe your package)
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * FIX (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * FIX (list of requirements)
20
+
21
+ == INSTALL:
22
+
23
+ * FIX (sudo gem install, anything else)
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2007 FIX
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require 'open-uri'
6
+ require 'hpricot'
7
+ require './lib/metainspector.rb'
8
+
9
+ Hoe.new('metainspector', MetaInspector::VERSION) do |p|
10
+ p.rubyforge_name = 'metainspector'
11
+ p.remote_rdoc_dir = '' # Release to root
12
+ # p.author = 'FIX'
13
+ # p.email = 'FIX'
14
+ # p.summary = 'FIX'
15
+ # p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
16
+ # p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
17
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
18
+ end
19
+
20
+ # vim: syntax=Ruby
data/bin/metainspector ADDED
File without changes
@@ -0,0 +1,39 @@
1
+ class MetaInspector
2
+ VERSION = '1.0.0'
3
+
4
+ Hpricot.buffer_size = 300000
5
+
6
+ def self.scrape(url)
7
+ doc = Hpricot(open(url))
8
+
9
+ # Buscamos titulo
10
+ if (!doc.at('title').nil?)
11
+ title = doc.at('title').inner_html
12
+ else
13
+ title = ""
14
+ end
15
+
16
+ # Buscamos description
17
+ if (!doc.at("meta[@name='description']").nil?)
18
+ description = doc.at("meta[@name='description']")['content']
19
+ else
20
+ description = ""
21
+ end
22
+
23
+ # Buscamos keywords
24
+ if (!doc.at("meta[@name='keywords']").nil?)
25
+ keywords = doc.at("meta[@name='keywords']")['content']
26
+ else
27
+ keywords = ""
28
+ end
29
+
30
+ # Buscamos enlaces
31
+ enlaces = []
32
+ doc.search("//a").each do |enlace|
33
+ enlaces << enlace.attributes["href"] if (!enlace.attributes["href"].nil?)
34
+ end
35
+
36
+ # Devolvemos todo
37
+ {'ok' => true, 'title' => title, 'description' => description, 'keywords' => keywords, 'enlaces' => enlaces}
38
+ end
39
+ end
@@ -0,0 +1 @@
1
+
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.2
3
+ specification_version: 1
4
+ name: metainspector
5
+ version: !ruby/object:Gem::Version
6
+ version: 1.0.0
7
+ date: 2007-12-06 00:00:00 +01:00
8
+ summary: The author was too lazy to write a summary
9
+ require_paths:
10
+ - lib
11
+ email: ryand-ruby@zenspider.com
12
+ homepage: http://www.zenspider.com/ZSS/Products/metainspector/
13
+ rubyforge_project: metainspector
14
+ description: The author was too lazy to write a description
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Ryan Davis
31
+ files:
32
+ - History.txt
33
+ - Manifest.txt
34
+ - README.txt
35
+ - Rakefile
36
+ - bin/metainspector
37
+ - lib/metainspector.rb
38
+ - test/test_metainspector.rb
39
+ test_files:
40
+ - test/test_metainspector.rb
41
+ rdoc_options:
42
+ - --main
43
+ - README.txt
44
+ extra_rdoc_files:
45
+ - History.txt
46
+ - Manifest.txt
47
+ - README.txt
48
+ executables:
49
+ - metainspector
50
+ extensions: []
51
+
52
+ requirements: []
53
+
54
+ dependencies:
55
+ - !ruby/object:Gem::Dependency
56
+ name: hoe
57
+ version_requirement:
58
+ version_requirements: !ruby/object:Gem::Version::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.3.0
63
+ version: