jasmine-rails 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,4 @@
4
4
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
5
  // the compiled file.
6
6
  //
7
- //= require jquery
8
- //= require jquery_ujs
9
- //= require_tree .
7
+ //= require_jasmine js
@@ -2,6 +2,6 @@
2
2
  * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
3
  * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
4
  * the top of the compiled file, but it's generally better to create a new file per style scope.
5
- *= require_self
6
- *= require_tree .
5
+ *
6
+ *= require_jasmine css
7
7
  */
@@ -1,44 +1,13 @@
1
- <%
2
- #This file is a controlled mess to provide a page you can load with your browser when
3
- # JHW doesn't provide sufficient console feedback.
4
- # at some point the jasmine-gem will support Rails 3.1 / assets / Coffee.
5
- # see this thread on the jasmine group: http://groups.google.com/group/jasmine-js/browse_thread/thread/c9c30854ecfd915d
6
- require 'jasmine-core'
7
- require 'jasmine'
8
-
9
- jasmine_path = Jasmine::Core.path
10
- jasmine_files = Jasmine::Core.js_files.map {|f| "/#{jasmine_path}/#{f}"}
11
- css_files = Jasmine::Core.css_files.map {|f| "/#{jasmine_path}/#{f}"}
12
- %>
13
- <!DOCTYPE html>
14
- <html>
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
+ <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
15
3
  <head>
16
- <!-- jasmine -->
17
- <% css_files.each do |css_file| %>
18
- <style type="text/css" media="screen" data-path="<%=css_file%>">
19
- <%= raw File.read(css_file) %>
20
- </style>
21
- <% end %>
22
-
23
- <% jasmine_files.each do |jasmine_file| %>
24
- <script type="text/javascript" data-path="<%=jasmine_file%>">
25
- <%= raw File.read(jasmine_file) %>
26
- </script>
27
- <% end %>
4
+ <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
5
+ <title>Jasmine suite</title>
28
6
 
29
- <!-- css -->
30
- <%= stylesheet_link_tag "application" %>
7
+ <%= stylesheet_link_tag "jasmine_rails/application" %>
8
+ <%= javascript_include_tag "jasmine_rails/application" %>
31
9
 
32
- <!-- sources -->
33
- <%= javascript_include_tag "application" %>
34
-
35
- <% Jasmine::Config.new.spec_files_full_paths.each do |path| %>
36
- <script type="text/javascript" data-path="<%=path%>">
37
- <%= raw(path.end_with?('.coffee') ? CoffeeScript.compile(File.read(path)) : File.read(path)) %>
38
- </script>
39
- <% end %>
40
-
41
- <!-- executing runner -->
10
+ <!-- executing jasmine's runner -->
42
11
  <script type="text/javascript">
43
12
  var jsApiReporter;
44
13
  (function() {
@@ -0,0 +1,11 @@
1
+ require 'processes_jasmine_directives'
2
+ require 'jasmine'
3
+ require 'jasmine-core'
4
+
5
+ assets = Rails.application.assets
6
+
7
+ assets.register_preprocessor 'application/javascript', ProcessesJasmineDirectives
8
+ assets.register_preprocessor 'text/css', ProcessesJasmineDirectives
9
+
10
+ assets.append_path Jasmine::Config.new.spec_dir
11
+ assets.append_path Jasmine::Core.path
data/config/routes.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'jasmine-core'
2
+ require 'jasmine'
3
+
1
4
  JasmineRails::Engine.routes.draw do
2
5
  root :to => "spec_runner#index"
3
6
  end
@@ -1,3 +1,3 @@
1
1
  module JasmineRails
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,38 @@
1
+ require 'jasmine-core'
2
+ require 'sprockets/directive_processor'
3
+
4
+ class ProcessesJasmineDirectives < Sprockets::DirectiveProcessor
5
+ ASSET_TYPES = ["css","js"]
6
+
7
+ def process_require_jasmine_directive(asset_type)
8
+ return unless ASSET_TYPES.include?(asset_type)
9
+
10
+ send("require_jasmine_#{asset_type}")
11
+ send("require_user_#{asset_type}")
12
+ end
13
+
14
+ ASSET_TYPES.each do |asset_type|
15
+ define_method "require_jasmine_#{asset_type}" do
16
+ Jasmine::Core.send("#{asset_type}_files").each do |f|
17
+ context.require_asset "/#{Jasmine::Core.path}/#{f}"
18
+ end
19
+ end
20
+
21
+ define_method "require_user_#{asset_type}" do
22
+ config = Jasmine::Config.new
23
+ config.send("#{asset_type}_files").each do |f|
24
+ context.require_asset full_path_for(f,config)
25
+ end
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def full_path_for(partial_path,config)
32
+ if partial_path.include?(config.spec_path)
33
+ partial_path.gsub(/#{config.spec_path}/,config.spec_dir)
34
+ else
35
+ "#{Rails.root}#{partial_path}"
36
+ end
37
+ end
38
+ end
metadata CHANGED
@@ -1,22 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Searls
14
14
  - Mark Van Holstyn
15
+ - Cory Flanigan
15
16
  autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2011-08-27 00:00:00 Z
20
+ date: 2011-09-01 00:00:00 Z
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
23
  name: rails
@@ -26,14 +27,12 @@ dependencies:
26
27
  requirements:
27
28
  - - ~>
28
29
  - !ruby/object:Gem::Version
29
- hash: 15424105
30
+ hash: 3
30
31
  segments:
31
32
  - 3
32
33
  - 1
33
34
  - 0
34
- - rc
35
- - 6
36
- version: 3.1.0.rc6
35
+ version: 3.1.0
37
36
  type: :runtime
38
37
  version_requirements: *id001
39
38
  - !ruby/object:Gem::Dependency
@@ -64,10 +63,39 @@ dependencies:
64
63
  version: "0"
65
64
  type: :runtime
66
65
  version_requirements: *id003
67
- description: Provides a Jasmine Spec Runner that plays nicely with Rails 3.1 assets and jasmine-headless-webkit
66
+ - !ruby/object:Gem::Dependency
67
+ name: rspec
68
+ prerelease: false
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ type: :development
79
+ version_requirements: *id004
80
+ - !ruby/object:Gem::Dependency
81
+ name: gimme
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ hash: 3
89
+ segments:
90
+ - 0
91
+ version: "0"
92
+ type: :development
93
+ version_requirements: *id005
94
+ description: Provides a Jasmine Spec Runner that plays nicely with Rails 3.1 assets and sets up jasmine-headless-webkit
68
95
  email:
69
96
  - searls@gmail.com
70
97
  - mvanholstyn@gmail.com
98
+ - seeflanigan@gmail.com
71
99
  executables: []
72
100
 
73
101
  extensions: []
@@ -81,10 +109,12 @@ files:
81
109
  - app/controllers/jasmine_rails/spec_runner_controller.rb
82
110
  - app/views/jasmine_rails/spec_runner/index.html.erb
83
111
  - app/views/layouts/jasmine_rails/spec_runner.html.erb
112
+ - config/initializers/sprockets.rb
84
113
  - config/routes.rb
85
114
  - lib/jasmine-rails.rb
86
115
  - lib/jasmine_rails/engine.rb
87
116
  - lib/jasmine_rails/version.rb
117
+ - lib/processes_jasmine_directives.rb
88
118
  - MIT-LICENSE
89
119
  - Rakefile
90
120
  - README.rdoc
@@ -120,6 +150,6 @@ rubyforge_project:
120
150
  rubygems_version: 1.8.6
121
151
  signing_key:
122
152
  specification_version: 3
123
- summary: Provides a Jasmine Spec Runner that plays nicely with Rails 3.1 assets and jasmine-headless-webkit
153
+ summary: Makes Jasmine easier on Rails 3.1
124
154
  test_files: []
125
155