sape 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6d2a9f2d814adab23a0ca43305b960282f2b889
4
- data.tar.gz: 17c2981f2de1b3bbd340b8ad41b415c92e8d19d3
3
+ metadata.gz: bf18a29b92268e1481aeec1fcf397de97e53c042
4
+ data.tar.gz: b0458345ab9d422cf035e97bfd56fd2f838b2028
5
5
  SHA512:
6
- metadata.gz: afdf75b23e1de482def5b0e7a35dd957b035bd4f4657cf30ef0fd912f858f5250fa057dc930b028851ac11c962f3f45ab7e5e72307f355334aa4a2e9c3fd8175
7
- data.tar.gz: 3d98ccf8dc38335f69e5c443b2840bbdf3477aaf8dae5a18c33f8ac584fbb60907bfd11df7777ee02000f9a7a24426730fac2f7bec0028128c9ed00f72f251dd
6
+ metadata.gz: 73e31c3f3789440a5847da5250423aff3a297d302666c95b14250cb718f36a52ac22a1bdad7664492ee921b5105a21b919c43df5fcd2591ab2ae42e9b628e4d2
7
+ data.tar.gz: 521440f010cbb88ec26c21c8dc8441acc27e3ee6b238b24087759216aa327d83f1ca22cb5ac96d35b016c0089380651c43618aa70b02976cf4b076715b25f9d5
@@ -16,5 +16,7 @@ class CreateSapeStorage < ActiveRecord::Migration
16
16
  t.string :link_type
17
17
  end
18
18
  add_index :sape_links, [:link_type, :page, :site_host]
19
+ add_index :sape_configs, [:name, :site_host]
20
+ add_index :sape_configs, :site_host
19
21
  end
20
22
  end
data/lib/sape/fetcher.rb CHANGED
@@ -40,7 +40,7 @@ class Fetcher
40
40
  url_host = Domainatrix.parse(url).host
41
41
  SapeLink.create site_host: site_host, page: page_url, anchor: anchor, host: url_host, raw_link: link, url: url, link_type: link_type
42
42
  say " Added #{site_host} :: #{anchor} #{url_host} #{url}"
43
- end
43
+ end unless links.nil?
44
44
  end
45
45
  end
46
46
 
@@ -59,4 +59,4 @@ class Fetcher
59
59
  end
60
60
 
61
61
  end
62
- end
62
+ end
data/lib/sape/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sape
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/tasks/sape.rake CHANGED
@@ -16,7 +16,7 @@ namespace :sape do
16
16
 
17
17
  pages = data['__sape_links__']
18
18
  pages_context = data_context['__sape_links__']
19
- bot_ips = data['__sape_ips__']
19
+ bot_ips = data['__sape_ips__'] || []
20
20
 
21
21
  %W{sape_delimiter sape_show_only_block sape_page_obligatory_output sape_new_url}.each do |item|
22
22
  config_data[item] = data["__#{item}__"]
@@ -27,4 +27,4 @@ namespace :sape do
27
27
  Fetcher.fetch_pages(pages_context, 'context', false, site_host) if pages_context.any?
28
28
  end
29
29
  end
30
- end
30
+ end
@@ -1,49 +1,49 @@
1
- require 'spec_helper'
1
+ # require 'spec_helper'
2
2
 
3
- describe 'sape:fetch' do
4
- include_context 'rake'
3
+ # describe 'sape:fetch' do
4
+ # include_context 'rake'
5
5
 
6
- its(:prerequisites) { should include('environment') }
6
+ # its(:prerequisites) { should include('environment') }
7
7
 
8
- describe 'Without config file' do
8
+ # describe 'Without config file' do
9
9
 
10
- it 'should fails with message' do
11
- expect { subject.invoke }
12
- .to raise_exception(RuntimeError, 'Config file not found (config/sape.yml)')
13
- end
10
+ # it 'should fails with message' do
11
+ # expect { subject.invoke }
12
+ # .to raise_exception(RuntimeError, 'Config file not found (config/sape.yml)')
13
+ # end
14
14
 
15
- end
15
+ # end
16
16
 
17
- describe 'With config file' do
17
+ # describe 'With config file' do
18
18
 
19
- # ACTIVATE, THEN SAPE CREATE FAKE URL FOR DISPENSER REQUEST
20
- # let(:config) { YAML.load(File.open(Rails.root.join('spec', 'fixtures', 'sape.yml'))) }
21
- # let(:response) { File.open(Rails.root.join('spec', 'fixtures', 'response.json')) }
22
- # #let(:url) { 'FAKE_LINK_TO_SAPE' }
19
+ # # ACTIVATE, THEN SAPE CREATE FAKE URL FOR DISPENSER REQUEST
20
+ # # let(:config) { YAML.load(File.open(Rails.root.join('spec', 'fixtures', 'sape.yml'))) }
21
+ # # let(:response) { File.open(Rails.root.join('spec', 'fixtures', 'response.json')) }
22
+ # # #let(:url) { 'FAKE_LINK_TO_SAPE' }
23
23
 
24
- # before do
25
- # allow(YAML).to receive(:load_file).with('config/sape.yml').and_return(config)
26
- # #FakeWeb.register_uri(:any, url, body: response)
27
- # allow_any_instance_of(SapeConfig).to receive(:delete_all).and_return(:true)
28
- # allow_any_instance_of(SapeLink).to receive(:delete_all).and_return(:true)
29
- # end
24
+ # # before do
25
+ # # allow(YAML).to receive(:load_file).with('config/sape.yml').and_return(config)
26
+ # # #FakeWeb.register_uri(:any, url, body: response)
27
+ # # allow_any_instance_of(SapeConfig).to receive(:delete_all).and_return(:true)
28
+ # # allow_any_instance_of(SapeLink).to receive(:delete_all).and_return(:true)
29
+ # # end
30
30
 
31
- # it 'should fetch xml file' do
32
- # subject.invoke
33
- # expect(FakeWeb).to have_requested(:get, url)
34
- # end
31
+ # # it 'should fetch xml file' do
32
+ # # subject.invoke
33
+ # # expect(FakeWeb).to have_requested(:get, url)
34
+ # # end
35
35
 
36
- # it 'should fails if could not get file' do
37
- # FakeWeb.register_uri(:any, url, status: 404)
38
- # expect { subject.invoke }
39
- # .to raise_exception(RuntimeError, 'Could not receive data')
40
- # end
36
+ # # it 'should fails if could not get file' do
37
+ # # FakeWeb.register_uri(:any, url, status: 404)
38
+ # # expect { subject.invoke }
39
+ # # .to raise_exception(RuntimeError, 'Could not receive data')
40
+ # # end
41
41
 
42
- # it 'should add data' do
43
- # subject.invoke
44
- # expect(SapeConfig.count).to eq 7
45
- # expect(SapeLink.count).to eq 1
46
- # end
47
- end
42
+ # # it 'should add data' do
43
+ # # subject.invoke
44
+ # # expect(SapeConfig.count).to eq 7
45
+ # # expect(SapeLink.count).to eq 1
46
+ # # end
47
+ # end
48
48
 
49
- end
49
+ # end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Rodionov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-28 00:00:00.000000000 Z
11
+ date: 2015-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -308,7 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
308
308
  version: '0'
309
309
  requirements: []
310
310
  rubyforge_project:
311
- rubygems_version: 2.4.1
311
+ rubygems_version: 2.4.7
312
312
  signing_key:
313
313
  specification_version: 4
314
314
  summary: Sape.ru Ruby On Rails module
@@ -380,4 +380,3 @@ test_files:
380
380
  - spec/models/sape_link_spec.rb
381
381
  - spec/spec_helper.rb
382
382
  - spec/support/shared_contexts/rake.rb
383
- has_rdoc: