Class: JasmineSprocketsProxy
- Inherits:
-
Object
- Object
- JasmineSprocketsProxy
- Defined in:
- lib/middleman/jasmine/jasmine_sprockets_proxy.rb
Class Method Summary collapse
- .configure(middleman_sprockets, config_file, debug_assets) ⇒ Object
- .jasmine_app ⇒ Object
- .sprockets_app ⇒ Object
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(path = "") ⇒ JasmineSprocketsProxy
constructor
A new instance of JasmineSprocketsProxy.
Constructor Details
#initialize(path = "") ⇒ JasmineSprocketsProxy
Returns a new instance of JasmineSprocketsProxy.
42 43 44 45 46 47 48 49 50 |
# File 'lib/middleman/jasmine/jasmine_sprockets_proxy.rb', line 42 def initialize(path="") @path = path @app = if setup_for_spec_files? self.class.sprockets_app else self.class.jasmine_app end end |
Class Method Details
.configure(middleman_sprockets, config_file, debug_assets) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/middleman/jasmine/jasmine_sprockets_proxy.rb', line 13 def configure(middleman_sprockets, config_file, debug_assets) raise "Config file not found" unless valid_config_file?(config_file) Jasmine.load_configuration_from_yaml(config_file) @@jasmine_app = Jasmine::Application.app(Jasmine.config) @@sprockets_app = if defined?(::Sprockets::Environment) sprockets = ::Sprockets::Environment.new middleman_sprockets.paths.each do |path| sprockets.append_path(path) end sprockets.append_path(Jasmine.config.spec_dir) sprockets else @@jasmine_app end if debug_assets Jasmine.config.add_path_mapper(lambda { |config| DebugAssetMapper.new(@@sprockets_app) } ) end end |
.jasmine_app ⇒ Object
5 6 7 |
# File 'lib/middleman/jasmine/jasmine_sprockets_proxy.rb', line 5 def jasmine_app @@jasmine_app end |
.sprockets_app ⇒ Object
9 10 11 |
# File 'lib/middleman/jasmine/jasmine_sprockets_proxy.rb', line 9 def sprockets_app @@sprockets_app end |
Instance Method Details
#call(env) ⇒ Object
52 53 54 55 |
# File 'lib/middleman/jasmine/jasmine_sprockets_proxy.rb', line 52 def call(env) env["PATH_INFO"] = "/#{@path}#{env["PATH_INFO"]}" unless serving_spec_via_sprockets? @app.call(env) end |