aranha 0.4.0 → 0.5.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
  SHA256:
3
- metadata.gz: 92786506ca137fde90c898b24a9018453468cd72a5f500d50125969d4c19ce71
4
- data.tar.gz: 5cda7e665e1ec8b09ca758de1652c94cd42ab3e49fc27c447ba7d975cfe572be
3
+ metadata.gz: 0e0391fd8968a27fb7422b6311396ef730623740c0fa5f8d3bab0a520f3278fc
4
+ data.tar.gz: 0dae6f9c28a19145630482bc81ad131ac24a8285d1ff41276c7e900ff1769e01
5
5
  SHA512:
6
- metadata.gz: 2aca9aff975e8b027b17ea8e8afc2ef2edc815c8c4ae4a10eec6f7e2ec3181024c1b73702dcc4ff0ec0b40464157e9233a07b2bcbf396c1649dbf53a0dbd006d
7
- data.tar.gz: b019d925812e0c8209ba4b5d31c9737f9c72dedbff8e9b018ef0246e127afdbb0d6a1bd91ba997fcb1f473edaf76b383b3735432184f8ffd9543d3b209e71bac
6
+ metadata.gz: 422311a8f9fc05d042eccdbe5c91742ab2e8802a2aad57ed45cbce9ac39ebee75d0dc1ba179e5b4499d54b51a41f7d85717defa8f906c8df3e6a1468c995ddca
7
+ data.tar.gz: 41eaaad6cd8d1ad9fe68b926b66bbbde692befc4bd465a0ff794f74f9454ae1851961af6525edd60f911bfa560703956b8d70739ac88b962ea6485b49aa2e050
@@ -3,10 +3,13 @@
3
3
  module Aranha
4
4
  module Fixtures
5
5
  class Download
6
- def initialize(prefix, download)
7
- @prefix = prefix
6
+ attr_reader :pending
7
+
8
+ def initialize(options)
9
+ @prefix = options.fetch(:prefix)
8
10
  @prefix = '' if @prefix.blank?
9
- @download = download
11
+ @download = options.fetch(:download)
12
+ @pending = options.fetch(:pending)
10
13
  end
11
14
 
12
15
  def run
@@ -19,14 +22,15 @@ module Aranha
19
22
  private
20
23
 
21
24
  def url_files
22
- files = []
23
- Dir["#{fixtures_root}/**/*.url"].map do |path|
24
- files << path if match_pattern(path)
25
- end
26
- files
25
+ Dir["#{fixtures_root}/**/*.url"].select { |path| select_path?(path) }
26
+ end
27
+
28
+ def select_path?(path)
29
+ return false unless match_prefix_pattern(path)
30
+ !pending || !::File.exist?(target(path))
27
31
  end
28
32
 
29
- def match_pattern(path)
33
+ def match_prefix_pattern(path)
30
34
  relative_path(path).start_with?(@prefix)
31
35
  end
32
36
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aranha
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
@@ -12,7 +12,11 @@ namespace(:aranha) do
12
12
  namespace :fixtures do
13
13
  desc 'Download remote content for fixtures.'
14
14
  task download: :environment do
15
- ::Aranha::Fixtures::Download.new(ENV['PREFIX'], ENV['DOWNLOAD'].present?).run
15
+ ::Aranha::Fixtures::Download.new(
16
+ prefix: ENV['PREFIX'],
17
+ download: ENV['DOWNLOAD'].present?,
18
+ pending: ENV['PENDING'].present?
19
+ ).run
16
20
  end
17
21
  end
18
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aranha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-31 00:00:00.000000000 Z
11
+ date: 2019-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_scaffold
@@ -181,42 +181,42 @@ signing_key:
181
181
  specification_version: 4
182
182
  summary: Rails utilities for web crawling.
183
183
  test_files:
184
- - test/dummy/Rakefile
185
- - test/dummy/README.rdoc
186
- - test/dummy/config.ru
187
- - test/dummy/config/boot.rb
188
- - test/dummy/config/database.yml
189
- - test/dummy/config/secrets.yml
190
- - test/dummy/config/locales/en.yml
191
- - test/dummy/config/application.rb
192
- - test/dummy/config/environments/development.rb
193
- - test/dummy/config/environments/test.rb
194
- - test/dummy/config/environments/production.rb
195
- - test/dummy/config/environment.rb
184
+ - test/aranha_test.rb
196
185
  - test/dummy/config/routes.rb
197
186
  - test/dummy/config/initializers/assets.rb
198
187
  - test/dummy/config/initializers/cookies_serializer.rb
199
- - test/dummy/config/initializers/inflections.rb
188
+ - test/dummy/config/initializers/to_time_preserves_timezone.rb
200
189
  - test/dummy/config/initializers/session_store.rb
190
+ - test/dummy/config/initializers/backtrace_silencers.rb
201
191
  - test/dummy/config/initializers/wrap_parameters.rb
202
- - test/dummy/config/initializers/to_time_preserves_timezone.rb
203
192
  - test/dummy/config/initializers/filter_parameter_logging.rb
204
- - test/dummy/config/initializers/backtrace_silencers.rb
193
+ - test/dummy/config/initializers/inflections.rb
205
194
  - test/dummy/config/initializers/mime_types.rb
206
- - test/dummy/db/schema.rb
207
- - test/dummy/app/views/layouts/application.html.erb
208
- - test/dummy/app/controllers/application_controller.rb
209
- - test/dummy/app/helpers/application_helper.rb
210
- - test/dummy/app/assets/stylesheets/application.css
211
- - test/dummy/app/assets/javascripts/application.js
212
- - test/dummy/public/422.html
213
- - test/dummy/public/404.html
195
+ - test/dummy/config/database.yml
196
+ - test/dummy/config/secrets.yml
197
+ - test/dummy/config/locales/en.yml
198
+ - test/dummy/config/environment.rb
199
+ - test/dummy/config/boot.rb
200
+ - test/dummy/config/application.rb
201
+ - test/dummy/config/environments/production.rb
202
+ - test/dummy/config/environments/test.rb
203
+ - test/dummy/config/environments/development.rb
204
+ - test/dummy/Rakefile
214
205
  - test/dummy/public/favicon.ico
206
+ - test/dummy/public/404.html
215
207
  - test/dummy/public/500.html
216
- - test/dummy/bin/bundle
208
+ - test/dummy/public/422.html
209
+ - test/dummy/config.ru
210
+ - test/dummy/app/assets/stylesheets/application.css
211
+ - test/dummy/app/assets/javascripts/application.js
212
+ - test/dummy/app/helpers/application_helper.rb
213
+ - test/dummy/app/views/layouts/application.html.erb
214
+ - test/dummy/app/controllers/application_controller.rb
217
215
  - test/dummy/bin/setup
216
+ - test/dummy/bin/bundle
218
217
  - test/dummy/bin/rails
219
218
  - test/dummy/bin/rake
220
- - test/aranha_test.rb
221
- - test/test_helper.rb
219
+ - test/dummy/db/schema.rb
220
+ - test/dummy/README.rdoc
222
221
  - test/integration/navigation_test.rb
222
+ - test/test_helper.rb