Sha256: 3f8fccc2d7b2d472998bfd350198af68232df4e7a5edfdf434b7c7a5e9f4155f

Contents?: true

Size: 768 Bytes

Versions: 1

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

require 'scribo/preamble'

namespace :scribo do
  desc 'Download jekyllthemes.org theme for testing'
  task :download_jekyllthemes do
    `git clone git@github.com:mattvh/jekyllthemes.git`
    `mkdir -p test/files/themes`

    Dir.glob('jekyllthemes/_posts/**').each do |post|
      data = File.read(post)
      preamble = Scribo::Preamble.parse(data)
      download_url = preamble.metadata['download']
      title = preamble.metadata['title'].downcase.tr(' *', '__')

      next unless download_url.ends_with?('.zip')

      begin
        file = Down.download(download_url, destination: "test/files/themes/#{title}.zip")
      rescue OpenURI::HTTPError
      rescue Down::NotFound
      end
    end

    `rm -rf jekyllthemes`
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scribo-1.0.38 lib/tasks/scribo_tasks.rake