useragents 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cf156f25181e846e227ef98e8be83d5de5e7e52f
4
+ data.tar.gz: c856324f156ad7200dfc9d6707241096b7db032d
5
+ SHA512:
6
+ metadata.gz: b51f0ddbce57d90c600858626590dd4f6d3d9aef35a7fa9e3e089caaf61ba6ceb92e1537ebeabc9cc41e2bc0e1d1c0c9e60354e265eb987af810682278481d7d
7
+ data.tar.gz: ea8456376609c5310ee8c99e010ce9b953a6b0c0c0c51dbc0ce19cb8d4a20b59cf69c3ceaa1a48bc0dab202d51956cd39b4d48f373343d85794bc6f69992be92
data/README.md CHANGED
@@ -12,8 +12,5 @@ require 'useragents'
12
12
 
13
13
  # Generate a random useragent for you
14
14
  UserAgents.rand()
15
- ```
16
-
17
- ``` sh
18
-
15
+ # => "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.7) Gecko/20070918 Firefox/2.0.0.7"
19
16
  ```
data/lib/fetch.rb CHANGED
@@ -2,6 +2,7 @@ module UserAgents
2
2
  def fetch
3
3
  require 'nokogiri'
4
4
  require 'open-uri'
5
+ require 'zlib'
5
6
 
6
7
  urls = [
7
8
  'http://www.useragentstring.com/pages/Chrome/',
@@ -17,7 +18,9 @@ module UserAgents
17
18
  sum + doc.css('#liste ul li a').map{|link| link.content.strip }
18
19
  end
19
20
 
20
- File.write(File.expand_path('../useragents.txt', __FILE__), agents.join("\n"))
21
+ Zlib::GzipWriter.open(File.expand_path('../useragents.dat', __FILE__)) do |gz|
22
+ gz.write agents.join("\n")
23
+ end
21
24
  puts "Fetch complete, got useragent count #{agents.length}!"
22
25
  end
23
26
  end
Binary file
data/lib/useragents.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require File.expand_path('../core_ext/blank', __FILE__)
2
+ require 'zlib'
2
3
 
3
4
  module UserAgents
4
5
 
@@ -13,7 +14,9 @@ module UserAgents
13
14
  end
14
15
 
15
16
  def init()
16
- @@list = File.read(File.expand_path("../useragents.txt", __FILE__)).split("\n")
17
+ Zlib::GzipReader.open(File.expand_path("../useragents.dat", __FILE__)) {|gz|
18
+ @@list = gz.read.split("\n")
19
+ }
17
20
  end
18
21
 
19
22
  end
data/useragents.gemspec CHANGED
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "useragents"
3
- s.version = "0.1.1"
3
+ s.version = "0.1.2"
4
4
 
5
5
  s.authors = "debbbbie"
6
6
  s.date = "2013-12-20"
7
- s.description = "Generate a random User-Agent for you. A place holder, coming soon!"
7
+ s.description = "Generate a random User-Agent for you"
8
8
  s.email = "debbbbie@163.com"
9
- s.files = ["useragents.gemspec", "lib/useragents.rb", "lib/core_ext/blank.rb", "lib/fetch.rb", "lib/useragents.txt", "spec/useragents_spec.rb", "README.md"]
9
+ s.files = ["useragents.gemspec", "lib/useragents.rb", "lib/core_ext/blank.rb", "lib/fetch.rb", "lib/useragents.dat", "spec/useragents_spec.rb", "README.md"]
10
10
  s.homepage = "https://github.com/debbbbie/useragents-rb"
11
11
  s.require_paths = ["lib"]
12
12
  s.summary = "Generate a random User-Agent for you, use for spiders or anything."
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: useragents
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ version: 0.1.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - debbbbie
@@ -14,20 +13,18 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
- description: Generate a random User-Agent for you. A place holder, coming soon!
27
+ description: Generate a random User-Agent for you
31
28
  email: debbbbie@163.com
32
29
  executables: []
33
30
  extensions: []
@@ -37,31 +34,30 @@ files:
37
34
  - lib/useragents.rb
38
35
  - lib/core_ext/blank.rb
39
36
  - lib/fetch.rb
40
- - lib/useragents.txt
37
+ - lib/useragents.dat
41
38
  - spec/useragents_spec.rb
42
39
  - README.md
43
40
  homepage: https://github.com/debbbbie/useragents-rb
44
41
  licenses: []
42
+ metadata: {}
45
43
  post_install_message:
46
44
  rdoc_options: []
47
45
  require_paths:
48
46
  - lib
49
47
  required_ruby_version: !ruby/object:Gem::Requirement
50
- none: false
51
48
  requirements:
52
- - - ! '>='
49
+ - - '>='
53
50
  - !ruby/object:Gem::Version
54
51
  version: '0'
55
52
  required_rubygems_version: !ruby/object:Gem::Requirement
56
- none: false
57
53
  requirements:
58
- - - ! '>='
54
+ - - '>='
59
55
  - !ruby/object:Gem::Version
60
56
  version: '0'
61
57
  requirements: []
62
58
  rubyforge_project:
63
- rubygems_version: 1.8.24
59
+ rubygems_version: 2.1.11
64
60
  signing_key:
65
- specification_version: 3
61
+ specification_version: 4
66
62
  summary: Generate a random User-Agent for you, use for spiders or anything.
67
63
  test_files: []