jasmine-sprockets 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in jasmine-sprockets.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "jasmine-sprockets/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "jasmine-sprockets"
7
+ s.version = Jasmine::Sprockets::VERSION
8
+ s.authors = ["Scott Gonyea"]
9
+ s.email = ["sgonyea@truecar.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Adds Sprockets to Jasmine's Asset Serving}
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.require_paths = ["lib"]
17
+
18
+ s.add_runtime_dependency "jasmine", '~>1.0.2.1'
19
+ s.add_runtime_dependency "sprockets", '~>2.0.0'
20
+ s.add_runtime_dependency "sprockets", '~>1.3.0'
21
+ end
@@ -0,0 +1,27 @@
1
+ require "jasmine"
2
+ require "jasmine-sprockets/version"
3
+ require "jasmine-sprockets/jasmine_file"
4
+
5
+ module Jasmine
6
+
7
+ def self.app(config)
8
+ Rack::Builder.app {
9
+ use Rack::Head
10
+
11
+ map('/run.html') { run Jasmine::Redirect.new('/') }
12
+ map('/__suite__') { run Jasmine::FocusedSuite.new(config) }
13
+
14
+ map('/__JASMINE_ROOT__') { run Rack::JasmineFile.new(Jasmine.root) }
15
+ map(config.spec_path) { run Rack::JasmineFile.new(config.spec_dir) }
16
+ map(config.root_path) { run Rack::JasmineFile.new(config.project_root) }
17
+
18
+ map('/') do
19
+ run Rack::Cascade.new([
20
+ Rack::URLMap.new('/' => Rack::JasmineFile.new(config.src_dir)),
21
+ Jasmine::RunAdapter.new(config)
22
+ ])
23
+ end
24
+ }
25
+ end
26
+
27
+ end
@@ -0,0 +1,31 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ Bundler.require :jasmine, :development, :test
5
+
6
+ require 'coffee-script'
7
+ require 'tilt'
8
+
9
+ ::Tilt::CoffeeScriptTemplate.default_bare = true
10
+
11
+ module Rack
12
+
13
+ class JasmineFile < Rack::File
14
+ def sprocket
15
+ @sprocket ||= Sprockets::Environment.new.tap{|s| s.append_path @root}
16
+ end
17
+
18
+ def serving
19
+ body = [sprocket[@path].to_s]
20
+ size = Utils.bytesize(body.first)
21
+
22
+ [200, {
23
+ "Last-Modified" => F.mtime(@path).httpdate,
24
+ "Cache-Control" => "must-revalidate",
25
+ "Content-Type" => Mime.mime_type(F.extname(@path), 'text/plain'),
26
+ "Content-Length" => size.to_s
27
+ }, body]
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ module Jasmine
2
+ module Sprockets
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jasmine-sprockets
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Scott Gonyea
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-02 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jasmine
16
+ requirement: &70194974450340 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.2.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70194974450340
25
+ - !ruby/object:Gem::Dependency
26
+ name: sprockets
27
+ requirement: &70194974449840 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70194974449840
36
+ - !ruby/object:Gem::Dependency
37
+ name: sprockets
38
+ requirement: &70194974449380 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.3.0
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70194974449380
47
+ description:
48
+ email:
49
+ - sgonyea@truecar.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - Rakefile
57
+ - jasmine-sprockets.gemspec
58
+ - lib/jasmine-sprockets.rb
59
+ - lib/jasmine-sprockets/jasmine_file.rb
60
+ - lib/jasmine-sprockets/version.rb
61
+ homepage: ''
62
+ licenses: []
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 1.8.6
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Adds Sprockets to Jasmine's Asset Serving
85
+ test_files: []