Sha256: d443ccf61336eaeb1459ffeefa69ddb675aeecdc1e1bc57ae923657eccebc8e5

Contents?: true

Size: 811 Bytes

Versions: 1

Compression:

Stored size: 811 Bytes

Contents

require 'rake'
require 'rake/tasklib'

module Opal
  module Rake

    class BuilderTask < ::Rake::TaskLib

      attr_accessor :files

      attr_accessor :out

      attr_accessor :main

      attr_accessor :watch

      def initialize(name = :opal)
        @name    = name
        @files   = []
        @out     = nil
        @main    = nil
        @watch   = false

        yield self if block_given?
        define_rake_task
      end

      def define_rake_task
        desc "Build opal files"
        task(@name) do
          options = {}
          options[:files] = @files
          options[:out]   = @out if @out
          options[:main]  = @main if @main
          options[:watch] = @watch

          builder = Opal::Builder.new options
          builder.build
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-0.3.2 lib/opal/rake/builder_task.rb