scrapers 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/new_scraper +37 -0
- data/lib/scrapers/version.rb +1 -1
- data/templates/new_scraper.tt +18 -0
- data/templates/new_scraper_spec.tt +20 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4896b8aea0625256112a05ca839b9b9775a4ff85
|
4
|
+
data.tar.gz: 994a36cc3a5b97eda32c53838c2f519a008e8f0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94d1e19c786ed926aaaa15c56d72fffcdf0157e25ec60cea8b4dd76313b72cf112da0297f39aefed7ab41a26c18589e96706815de0469795bc749450056171ad
|
7
|
+
data.tar.gz: 7368f28e2bf91a5063acc6e37a68285a87f3cbbf8de534d66218acde300f5e6fc28b7e7935daf5c4232d6a2056fbb9b087034aa5e324ed0b1e6f3f1ccf9e9de5
|
data/bin/new_scraper
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'thor'
|
5
|
+
require 'scrapers'
|
6
|
+
require "active_support/core_ext/string/inflections"
|
7
|
+
require 'pry'
|
8
|
+
|
9
|
+
class NewScraper < Thor::Group
|
10
|
+
include Thor::Actions
|
11
|
+
|
12
|
+
argument :name
|
13
|
+
class_option :test_framework, :aliases => "-T", :default => :spec
|
14
|
+
|
15
|
+
def self.source_root
|
16
|
+
File.expand_path("../../", __FILE__)
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def create_lib_file
|
21
|
+
template("templates/new_scraper.tt", "lib/scrapers/#{name.underscore}.rb")
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_test_file
|
25
|
+
|
26
|
+
if %w[test_unit minitest test].include?(options["test_framework"])
|
27
|
+
test = "test"
|
28
|
+
else
|
29
|
+
test = "spec"
|
30
|
+
end
|
31
|
+
|
32
|
+
template("templates/new_scraper_#{test}.tt", "#{test}/scrapers/#{name.underscore}_#{test}.rb")
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
NewScraper.start
|
data/lib/scrapers/version.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'scrapers/<%= name.underscore %>'
|
4
|
+
|
5
|
+
module Scrapers
|
6
|
+
|
7
|
+
describe <%= name %> do
|
8
|
+
it{should respond_to :scrape}
|
9
|
+
context "scraping" do
|
10
|
+
before(:all) do
|
11
|
+
@comic = VCR.use_cassette('<%= name.underscore %>') do
|
12
|
+
@result = Scrapers::<%= name %>.scrape
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it {expect(@result).to_not be_nil}
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrapers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tamara Temple
|
@@ -169,6 +169,7 @@ description: A library of web site scrapers utilizing mechanize and other goodie
|
|
169
169
|
email:
|
170
170
|
- tamouse@gmail.com
|
171
171
|
executables:
|
172
|
+
- new_scraper
|
172
173
|
- rubytapas
|
173
174
|
extensions: []
|
174
175
|
extra_rdoc_files: []
|
@@ -180,6 +181,7 @@ files:
|
|
180
181
|
- LICENSE.txt
|
181
182
|
- README.md
|
182
183
|
- Rakefile
|
184
|
+
- bin/new_scraper
|
183
185
|
- bin/rubytapas
|
184
186
|
- lib/scrapers.rb
|
185
187
|
- lib/scrapers/allrecipes.rb
|
@@ -205,6 +207,8 @@ files:
|
|
205
207
|
- spec/scrapers/xkcd_spec.rb
|
206
208
|
- spec/scrapers_spec.rb
|
207
209
|
- spec/spec_helper.rb
|
210
|
+
- templates/new_scraper.tt
|
211
|
+
- templates/new_scraper_spec.tt
|
208
212
|
- vcr_cassettes/allrecipes_morning-glory-muffins-i.yml
|
209
213
|
- vcr_cassettes/disconews_history-of-space.yml
|
210
214
|
- vcr_cassettes/download-newfile.yml
|