Sha256: 36e94547019e6a055e8dd2e687f2da70265abcd22e15a2d306a9c4dda7954207

Contents?: true

Size: 862 Bytes

Versions: 1

Compression:

Stored size: 862 Bytes

Contents

require 'middleman-core'
require 'middleman/jasmine/jasmine_sprockets_proxy'

module Middleman
  module Jasmine
    class << self
      def registered(app, options_hash={}, &block)
        @options = OpenStruct.new(default_options.merge(options_hash))

        yield @options if block_given?

        app.map(@options.jasmine_url) { run ::JasmineSprocketsProxy.new }
        jasmine_asset_folders.each do |item|
          app.map("/#{item}") { run ::JasmineSprocketsProxy.new(item) }
        end
      end

      private

      def jasmine_asset_folders
        [
          "__jasmine__", "__boot__", "__spec__", @options.fixtures_dir
        ]
      end

      def default_options
        {
          jasmine_url: "/jasmine",
          fixtures_dir: "spec/javascripts/fixtures"
        }        
      end      
    alias :included :registered
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-jasmine-0.0.3 lib/middleman/jasmine/extension.rb