dummy_files 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/dummy_files.gemspec +16 -18
- data/lib/dummy_files.rb +13 -5
- data/tools/console +15 -0
- metadata +9 -9
- data/.gitignore +0 -21
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.11
|
data/dummy_files.gemspec
CHANGED
@@ -1,46 +1,44 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dummy_files}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jordi Noguera"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-17}
|
13
13
|
s.description = %q{Pull urls of random images/files from google searches to generate sample data.}
|
14
14
|
s.email = %q{jordinoguera83@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
21
|
+
".project",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"dummy_files.gemspec",
|
27
|
+
"lib/dummy_files.rb",
|
28
|
+
"test/helper.rb",
|
29
|
+
"test/test_dummy_files.rb",
|
30
|
+
"tools/console"
|
31
31
|
]
|
32
32
|
s.homepage = %q{http://github.com/jordinl/dummy_files}
|
33
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
34
33
|
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.
|
34
|
+
s.rubygems_version = %q{1.5.2}
|
36
35
|
s.summary = %q{URLs for sample data generation}
|
37
36
|
s.test_files = [
|
38
37
|
"test/helper.rb",
|
39
|
-
|
38
|
+
"test/test_dummy_files.rb"
|
40
39
|
]
|
41
40
|
|
42
41
|
if s.respond_to? :specification_version then
|
43
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
42
|
s.specification_version = 3
|
45
43
|
|
46
44
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/dummy_files.rb
CHANGED
@@ -8,17 +8,19 @@ module DummyFiles
|
|
8
8
|
def self.get(number = 100, keyword = "me", content = "face")
|
9
9
|
max = [number / 10, 1].max
|
10
10
|
nokogiri = (1..max).map{ Nokogiri::HTML(open_page(keyword, content)) }
|
11
|
-
nokogiri.map
|
11
|
+
nokogiri.map do |n|
|
12
|
+
n.search("a img").map{ |x| x["src"].split(":http://")[1] }.compact.map(&:to_url)
|
13
|
+
end.flatten[0, number]
|
12
14
|
end
|
13
15
|
|
14
16
|
private
|
15
17
|
|
16
|
-
def self.get_url(keyword, content)
|
17
|
-
"http://www.google.com/images?q=#{keyword}&hl=en&safe=active&gbv=
|
18
|
+
def self.get_url(keyword = 'me', content = 'face')
|
19
|
+
"http://www.google.com/images?q=#{keyword}&hl=en&safe=active&biw=1280&bih=653&gbv=1&as_st=y&tbs=isch:1" +
|
18
20
|
if content == "any"
|
19
|
-
"&
|
21
|
+
"&ei=Mq9dTciKKsmytAa9lKTKCg&start=#{(1..850)}&sa=N"
|
20
22
|
else
|
21
|
-
|
23
|
+
",itp:face&ei=cq5dTe7UFomLswajlbDXCg&start=#{(1..850).random}&sa=N"
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
@@ -77,3 +79,9 @@ class Range
|
|
77
79
|
first + rand(last)
|
78
80
|
end
|
79
81
|
end
|
82
|
+
|
83
|
+
class String
|
84
|
+
def to_url
|
85
|
+
"http://" + self
|
86
|
+
end
|
87
|
+
end
|
data/tools/console
ADDED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dummy_files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 9
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordi Noguera
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-17 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -59,7 +59,6 @@ extra_rdoc_files:
|
|
59
59
|
- README.rdoc
|
60
60
|
files:
|
61
61
|
- .document
|
62
|
-
- .gitignore
|
63
62
|
- .project
|
64
63
|
- LICENSE
|
65
64
|
- README.rdoc
|
@@ -69,13 +68,14 @@ files:
|
|
69
68
|
- lib/dummy_files.rb
|
70
69
|
- test/helper.rb
|
71
70
|
- test/test_dummy_files.rb
|
71
|
+
- tools/console
|
72
72
|
has_rdoc: true
|
73
73
|
homepage: http://github.com/jordinl/dummy_files
|
74
74
|
licenses: []
|
75
75
|
|
76
76
|
post_install_message:
|
77
|
-
rdoc_options:
|
78
|
-
|
77
|
+
rdoc_options: []
|
78
|
+
|
79
79
|
require_paths:
|
80
80
|
- lib
|
81
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements: []
|
100
100
|
|
101
101
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.
|
102
|
+
rubygems_version: 1.5.2
|
103
103
|
signing_key:
|
104
104
|
specification_version: 3
|
105
105
|
summary: URLs for sample data generation
|