Sha256: 88bd36e81d3e303a790bcdc9f11311d3e7b8bad31c190c47abf3b0e2e736eb46

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

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

  namespace :tailwindcss do
    desc "Configure your Tailwind CSS"
    task :config do
      Rails::Generators.invoke("scribo:tailwind_config", ["--force"])
    end
  end

end

if Rake::Task.task_defined?("tailwindcss:build")
  Rake::Task["tailwindcss:build"].enhance(["scribo:tailwindcss:config"])
  Rake::Task["tailwindcss:watch"].enhance(["scribo:tailwindcss:config"])
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scribo-1.0.44 lib/tasks/scribo_tasks.rake
scribo-1.0.43 lib/tasks/scribo_tasks.rake
scribo-1.0.42 lib/tasks/scribo_tasks.rake
scribo-1.0.41 lib/tasks/scribo_tasks.rake
scribo-1.0.40 lib/tasks/scribo_tasks.rake
scribo-1.0.39 lib/tasks/scribo_tasks.rake