Sha256: 901ee793dacebedabfd274603af13d0793d2257c77c2013114b237f4418f615f

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require 'bundler/setup'
require 'opal/rake_task'

Opal::RakeTask.new do |t|
  t.name = 'opal-jquery'
  t.dependencies = ['opal-spec']
end

task :default => :'opal:test'

namespace :docs do
  desc "Build docs"
  task :build do
    require 'redcarpet'
    require 'albino'

    klass = Class.new(Redcarpet::Render::HTML) do
      def block_code(code, language)
        Albino.new(code, language || :text).colorize
      end
    end

    markdown = Redcarpet::Markdown.new(klass, :fenced_code_blocks => true)

    File.open('gh-pages/index.html', 'w+') do |o|
      puts " * index.html"
      # remove first 2 lines (header/build status), as pre.html has a docs version
      src = File.read("README.md").sub(/^(?:[^\n]*\n){4}/, '')

      o.write File.read('docs/pre.html')
      o.write markdown.render(src)
      o.write File.read('docs/post.html')
    end
  end

  desc "Clone repo"
  task :clone do
    if File.exists? 'gh-pages'
     Dir.chdir('gh-pages') { sh 'git pull origin gh-pages' }
    else
      FileUtils.mkdir_p 'gh-pages'
      Dir.chdir('gh-pages') do
        sh 'git clone git@github.com:/opal/opal-jquery.git .'
        sh 'git checkout gh-pages'
      end
    end
  end

  desc "commit and push"
  task :push do
    Dir.chdir('gh-pages') do
      sh "git add ."
      sh "git commit -a -m \"Documentation update #{Time.new}\""
      sh "git push origin gh-pages"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-jquery-0.0.1 Rakefile