ero_getter 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -10,5 +10,8 @@ group :development, :test do
10
10
  gem 'guard-rspec'
11
11
  gem 'bundler'
12
12
  gem 'jeweler'
13
- gem 'fakeweb'
13
+ end
14
+
15
+ group :test do
16
+ gem 'webmock'
14
17
  end
data/README.md ADDED
@@ -0,0 +1,69 @@
1
+ EroGetter [![Build Status](https://secure.travis-ci.org/masarakki/ero_getter.png)](http://travis-ci.org/masarakki/ero_getter) [![Dependency Status](https://gemnasium.com/masarakki/ero_getter.png)](http://gemnasium.com/masarakki/ero_getter)
2
+ =========
3
+
4
+ ero_getter is downloader for ero gazou.
5
+
6
+ usage
7
+ -----
8
+ EroGetter.download(url)
9
+
10
+ automaticaly download in $HOME/ero_getter/#{site}/#{sub_directory}/
11
+
12
+ support other sites
13
+ -------------------
14
+
15
+ add lib/downloader/#{site_name}.rb
16
+
17
+ class #{SiteName} < EroGetter::Base
18
+ name 'Site Name'
19
+ url %r{http://example.com/archives/(\d+).html}
20
+ target "a > img" do |path| # use css selector
21
+ path.parent[:href] =~ /jpe?g|gif|png/ # filter like Array.select
22
+ end
23
+ sub_directory do
24
+ url.match(/(\d+)\.html/)[1]
25
+ end
26
+ filename {|attr| "%04d%s" % [attr[:index], attr[:ext]] } # if you want sequencial filename
27
+ end
28
+
29
+ make directory spec/samples/#{site_name}
30
+ and download sample of html source in spec/sample/#{site_name}/sample.html
31
+
32
+ add spec/downloader#{site_name}_spec.rb
33
+
34
+ require 'spec_helper'
35
+ describe #{SiteName} do
36
+ subject { @dl }
37
+ let(:url) { 'http://example.com/archives/01010101.html' }
38
+ before do
39
+ EroGetter.stub(:mkdir)
40
+ @dl = #{SiteName}.new(url)
41
+ fake(:get, url, '#{site_name}/sample.html')
42
+ end
43
+ its(:sub_directory) { should == '01010101' }
44
+ its("targets.count") { should == #{numbers of image} }
45
+ end
46
+
47
+ then pull request!
48
+
49
+ see also
50
+ --------
51
+ http://github.com/masarakki/ero_getter_server
52
+
53
+ Contributing to ero_getter
54
+ --------------------------
55
+
56
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
57
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
58
+ * Fork the project.
59
+ * Start a feature/bugfix branch.
60
+ * Commit and push until you are happy with your contribution.
61
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
62
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
63
+
64
+ Copyright
65
+ ---------
66
+
67
+ Copyright (c) 2012 masarakki. See LICENSE.txt for
68
+ further details.
69
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.1
1
+ 1.3.2
data/ero_getter.gemspec CHANGED
@@ -5,16 +5,16 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ero_getter"
8
- s.version = "1.3.1"
8
+ s.version = "1.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["masarakki"]
12
- s.date = "2012-06-02"
12
+ s.date = "2012-06-28"
13
13
  s.description = "ero getter"
14
14
  s.email = "masaki@hisme.net"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
@@ -24,11 +24,12 @@ Gem::Specification.new do |s|
24
24
  "Gemfile",
25
25
  "Guardfile",
26
26
  "LICENSE.txt",
27
- "README.rdoc",
27
+ "README.md",
28
28
  "Rakefile",
29
29
  "VERSION",
30
30
  "ero_getter.gemspec",
31
31
  "lib/downloader/gazou_sokuhou.rb",
32
+ "lib/downloader/mink_channel.rb",
32
33
  "lib/downloader/nijigazou_sokuhou.rb",
33
34
  "lib/downloader/pm_style.rb",
34
35
  "lib/downloader/wakuteka_sokuhou.rb",
@@ -36,12 +37,14 @@ Gem::Specification.new do |s|
36
37
  "lib/ero_getter/base.rb",
37
38
  "lib/ero_getter/utils.rb",
38
39
  "spec/downloader/gazou_sokuhou_spec.rb",
40
+ "spec/downloader/mink_channel_spec.rb",
39
41
  "spec/downloader/nijigazou_sokuhou_spec.rb",
40
42
  "spec/downloader/pm_style_spec.rb",
41
43
  "spec/downloader/wakuteka_sokuhou_spec.rb",
42
44
  "spec/ero_getter/base_spec.rb",
43
45
  "spec/ero_getter_spec.rb",
44
46
  "spec/samples/gazou_sokuhou/sample.html",
47
+ "spec/samples/mink_channel/sample.html",
45
48
  "spec/samples/nijigazou_sokuhou/first.html",
46
49
  "spec/samples/nijigazou_sokuhou/global_last.html",
47
50
  "spec/samples/nijigazou_sokuhou/last.html",
@@ -69,7 +72,6 @@ Gem::Specification.new do |s|
69
72
  s.add_development_dependency(%q<guard-rspec>, [">= 0"])
70
73
  s.add_development_dependency(%q<bundler>, [">= 0"])
71
74
  s.add_development_dependency(%q<jeweler>, [">= 0"])
72
- s.add_development_dependency(%q<fakeweb>, [">= 0"])
73
75
  else
74
76
  s.add_dependency(%q<activesupport>, [">= 0"])
75
77
  s.add_dependency(%q<httpclient>, [">= 0"])
@@ -79,7 +81,6 @@ Gem::Specification.new do |s|
79
81
  s.add_dependency(%q<guard-rspec>, [">= 0"])
80
82
  s.add_dependency(%q<bundler>, [">= 0"])
81
83
  s.add_dependency(%q<jeweler>, [">= 0"])
82
- s.add_dependency(%q<fakeweb>, [">= 0"])
83
84
  end
84
85
  else
85
86
  s.add_dependency(%q<activesupport>, [">= 0"])
@@ -90,7 +91,6 @@ Gem::Specification.new do |s|
90
91
  s.add_dependency(%q<guard-rspec>, [">= 0"])
91
92
  s.add_dependency(%q<bundler>, [">= 0"])
92
93
  s.add_dependency(%q<jeweler>, [">= 0"])
93
- s.add_dependency(%q<fakeweb>, [">= 0"])
94
94
  end
95
95
  end
96
96
 
@@ -0,0 +1,17 @@
1
+ # -*- coding: utf-8 -*-
2
+ class MinkChannel < EroGetter::Base
3
+
4
+ name 'みんくちゃんねる'
5
+ url %r{http://minkch.com/archives/(\d+).html}
6
+
7
+ target ".gold > a > img" do |path|
8
+ path.parent[:href] if path.parent[:href] =~ /jpe?g|gif|png/
9
+ end
10
+
11
+ sub_directory do
12
+ url.match(/(\d+)\.html/)[1]
13
+ end
14
+
15
+ filename {|attr| "%04d%s" % [attr[:index], attr[:ext]] }
16
+
17
+ end
@@ -0,0 +1,15 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe MinkChannel do
5
+ let(:url) { "http://minkch.com/archives/51930285.html" }
6
+ subject { @dl }
7
+ before do
8
+ EroGetter.stub(:mkdir)
9
+ @dl = MinkChannel.new(url)
10
+ fake(:get, url, 'mink_channel/sample.html')
11
+ end
12
+ its(:title) { should == '顔出しNGの現役女子大生グラドルが手ブラでおっぱい隠して話題に - みんくちゃんねる' }
13
+ its(:sub_directory) { should == '51930285' }
14
+ its('targets.count') { should == 10 }
15
+ end
@@ -8,7 +8,7 @@ describe EroGetter::Base do
8
8
  context :without_connection do
9
9
  before do
10
10
  _regex = regex
11
- fake(:get, regex, 'sample.html')
11
+ fake(:get, url, 'sample.html')
12
12
  @klazz = Class.new(EroGetter::Base) do
13
13
  name 'NijiEro BBS'
14
14
  url _regex
@@ -128,6 +128,7 @@ describe EroGetter::Base do
128
128
  end
129
129
  end
130
130
  @dl = klazz.new(url)
131
+ @dl.stub(:document).and_return(stub)
131
132
  end
132
133
 
133
134
  context :css_not_found do