jasmine 1.3.2 → 2.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +3 -37
- data/Gemfile +11 -2
- data/HOW_TO_TEST.markdown +1 -1
- data/README.markdown +10 -10
- data/Rakefile +18 -29
- data/generators/jasmine/templates/jasmine-example/spec/PlayerSpec.js +2 -2
- data/generators/jasmine/templates/jasmine-example/spec/SpecHelper.js +14 -8
- data/generators/jasmine/templates/spec/javascripts/support/jasmine.yml +3 -3
- data/generators/jasmine/templates/spec/javascripts/support/jasmine_helper.rb +1 -0
- data/jasmine.gemspec +11 -41
- data/lib/generators/jasmine/examples/templates/spec/javascripts/helpers/SpecHelper.js +15 -9
- data/lib/generators/jasmine/examples/templates/spec/javascripts/jasmine_examples/PlayerSpec.js +1 -1
- data/lib/jasmine.rb +10 -7
- data/lib/jasmine/asset_bundle.rb +69 -0
- data/lib/jasmine/asset_expander.rb +7 -7
- data/lib/jasmine/command_line_tool.rb +18 -0
- data/lib/jasmine/config.rb +23 -15
- data/lib/jasmine/configuration.rb +14 -8
- data/lib/jasmine/core_configuration.rb +7 -4
- data/lib/jasmine/dependencies.rb +14 -18
- data/lib/jasmine/formatters/base.rb +9 -0
- data/lib/jasmine/formatters/console.rb +45 -0
- data/lib/jasmine/formatters/junit_xml.rb +47 -0
- data/lib/jasmine/path_expander.rb +1 -1
- data/lib/jasmine/railtie.rb +7 -6
- data/lib/jasmine/reporters/api_reporter.rb +38 -0
- data/lib/jasmine/results.rb +28 -9
- data/lib/jasmine/results_processor.rb +1 -1
- data/lib/jasmine/run.html.erb +1 -1
- data/lib/jasmine/run_specs.rb +12 -15
- data/lib/jasmine/runners/http.rb +11 -49
- data/lib/jasmine/selenium_driver.rb +17 -14
- data/lib/jasmine/tasks/jasmine.rake +21 -30
- data/lib/jasmine/tasks/{jasmine_rails3.rake → jasmine_rails.rake} +0 -0
- data/lib/jasmine/version.rb +1 -1
- data/lib/jasmine/yaml_config_parser.rb +9 -0
- data/release_notes/v2.0.0.rc2.md +44 -0
- data/spec/application_spec.rb +33 -38
- data/spec/asset_expander_spec.rb +4 -32
- data/spec/configuration_spec.rb +95 -35
- data/spec/jasmine_command_line_tool_spec.rb +63 -11
- data/spec/jasmine_rails_spec.rb +94 -0
- data/spec/lib/jasmine/formatters/base_spec.rb +9 -0
- data/spec/lib/jasmine/formatters/console_spec.rb +92 -0
- data/spec/lib/jasmine/formatters/junit_xml_spec.rb +55 -0
- data/spec/lib/jasmine/reporters/api_reporter_spec.rb +53 -0
- data/spec/lib/jasmine/runners/http_spec.rb +21 -0
- data/spec/path_expander_spec.rb +25 -0
- data/spec/results_spec.rb +59 -17
- data/spec/spec_helper.rb +36 -18
- data/spec/support/fake_selenium_driver.rb +35 -0
- data/spec/yaml_config_parser_spec.rb +37 -0
- metadata +65 -103
- data/generators/jasmine/templates/jasmine-example/SpecRunner.html +0 -54
- data/lib/jasmine/asset_pipeline_utility.rb +0 -19
- data/lib/jasmine/javascripts/boot.js +0 -28
- data/lib/jasmine/rspec_formatter.rb +0 -92
- data/spec/dependencies_spec.rb +0 -315
- data/spec/jasmine_rails2_spec.rb +0 -89
- data/spec/jasmine_rails3_spec.rb +0 -69
- data/spec/jasmine_self_test_spec.rb +0 -29
- data/spec/rspec_formatter_spec.rb +0 -88
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 829cb8b7df0ab6b49277bd1ff57726df9def1ad5
|
4
|
+
data.tar.gz: 8b35c826f0dce1001cfb2f572139b104f1d0cfa8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c88cd5229bba530394d60d17a6221812e71623b9f44f88ff4d480280a7c0a92ca29942635bbb02b5c89b0eb386bfd79ba01f4a7b053d8f3628be13cab48dd9f1
|
7
|
+
data.tar.gz: ca5e0e70008293b2c96f142df85aa0d7a014a7dfea1a71c93151d13115c81f746210e6698b1da7dacbdab2d2b72bf400546b33822ce700ea4880c137dbff65cc
|
data/.travis.yml
CHANGED
@@ -3,55 +3,21 @@ before_script:
|
|
3
3
|
script: "DISPLAY=:99.0 bundle exec rake"
|
4
4
|
|
5
5
|
rvm:
|
6
|
-
- "1.8.7"
|
7
|
-
- "1.9.2"
|
8
6
|
- "1.9.3"
|
9
|
-
- "
|
7
|
+
- "2.0.0"
|
10
8
|
- "jruby"
|
11
|
-
- "rbx"
|
9
|
+
- "rbx-19mode"
|
12
10
|
|
13
11
|
env:
|
14
|
-
- "RAILS_VERSION=rails2"
|
15
|
-
- "RAILS_VERSION=rails2_3_5"
|
16
12
|
- "RAILS_VERSION=rails3"
|
17
|
-
- "RAILS_VERSION=
|
13
|
+
- "RAILS_VERSION=rails4"
|
18
14
|
- "RAILS_VERSION=pojs-rspec2"
|
19
15
|
|
20
16
|
matrix:
|
21
17
|
exclude:
|
22
|
-
- rvm: rbx
|
23
|
-
env: RAILS_VERSION=rails2
|
24
|
-
- rvm: rbx
|
25
|
-
env: RAILS_VERSION=rails2_3_5
|
26
|
-
- rvm: rbx
|
27
|
-
env: RAILS_VERSION=pojs-rspec1
|
28
18
|
- rvm: rbx
|
29
19
|
env: RAILS_VERSION=pojs-rspec2
|
30
20
|
- rvm: jruby
|
31
|
-
env: RAILS_VERSION=rails2
|
32
|
-
- rvm: jruby
|
33
|
-
env: RAILS_VERSION=rails2_3_5
|
34
|
-
- rvm: jruby
|
35
|
-
env: RAILS_VERSION=pojs-rspec1
|
36
|
-
- rvm: jruby
|
37
|
-
env: RAILS_VERSION=pojs-rspec2
|
38
|
-
- rvm: 1.9.2
|
39
|
-
env: RAILS_VERSION=rails2
|
40
|
-
- rvm: 1.9.2
|
41
|
-
env: RAILS_VERSION=rails2_3_5
|
42
|
-
- rvm: 1.9.2
|
43
|
-
env: RAILS_VERSION=pojs-rspec1
|
44
|
-
- rvm: 1.9.2
|
45
|
-
env: RAILS_VERSION=pojs-rspec2
|
46
|
-
- rvm: ree
|
47
|
-
env: RAILS_VERSION=pojs-rspec2
|
48
|
-
- rvm: 1.8.7
|
49
|
-
env: RAILS_VERSION=rails2
|
50
|
-
- rvm: 1.8.7
|
51
|
-
env: RAILS_VERSION=rails2_3_5
|
52
|
-
- rvm: 1.8.7
|
53
|
-
env: RAILS_VERSION=pojs-rspec1
|
54
|
-
- rvm: 1.8.7
|
55
21
|
env: RAILS_VERSION=pojs-rspec2
|
56
22
|
allow_failures:
|
57
23
|
- rvm: rbx
|
data/Gemfile
CHANGED
@@ -1,8 +1,17 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
2
3
|
gemspec
|
3
4
|
|
4
|
-
unless ENV[
|
5
|
+
unless ENV['TRAVIS']
|
5
6
|
group :debug do
|
6
7
|
gem 'debugger'
|
7
8
|
end
|
8
9
|
end
|
10
|
+
|
11
|
+
|
12
|
+
# during development, do not release
|
13
|
+
if ENV['TRAVIS']
|
14
|
+
gem 'jasmine-core', :git => 'http://github.com/pivotal/jasmine.git'
|
15
|
+
else
|
16
|
+
gem 'jasmine-core', :path => '../jasmine'
|
17
|
+
end
|
data/HOW_TO_TEST.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
To test changes to the jasmine-gem:
|
2
2
|
|
3
|
-
* Export RAILS_VERSION as either "pojs-
|
3
|
+
* Export RAILS_VERSION as either "pojs-rspec2", or "rails3" to test environments other than Rails 4.
|
4
4
|
* Delete `Gemfile.lock`
|
5
5
|
* Clear out your current gemset
|
6
6
|
* exec a `bundle install`
|
data/README.markdown
CHANGED
@@ -7,19 +7,19 @@ This gem contains:
|
|
7
7
|
|
8
8
|
* A small server that builds and executes a Jasmine suite for a project
|
9
9
|
* A script that sets up a project to use the Jasmine gem's server
|
10
|
-
* Generators for Ruby on Rails projects (Rails
|
10
|
+
* Generators for Ruby on Rails projects (Rails 3 and Rails 4)
|
11
11
|
|
12
12
|
You can get all of this by: `gem install jasmine` or by adding Jasmine to your `Gemfile`.
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
```ruby
|
15
|
+
group :development, :test do
|
16
|
+
gem 'jasmine'
|
17
|
+
end
|
18
|
+
```
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
`script/generate jasmine`
|
20
|
+
## Init A Project
|
21
21
|
|
22
|
-
|
22
|
+
To initialize a project for Jasmine
|
23
23
|
|
24
24
|
`rails g jasmine:install`
|
25
25
|
`rails g jasmine:examples`
|
@@ -46,7 +46,7 @@ For Continuous Integration environments, add this task to the project build step
|
|
46
46
|
|
47
47
|
`rake jasmine:ci`
|
48
48
|
|
49
|
-
This uses Selenium to launch a browser and run the Jasmine suite. Then it uses RSpec to extract the results from the Jasmine reporter and write them to your build log. The browser used by selenium can be changed by
|
49
|
+
This uses Selenium to launch a browser and run the Jasmine suite. Then it uses RSpec to extract the results from the Jasmine reporter and write them to your build log. The browser used by selenium can be changed by configuration in spec_helper file (this might require additional webdriver dependencies).
|
50
50
|
|
51
51
|
## Configuration
|
52
52
|
|
@@ -72,4 +72,4 @@ Twitter: [@jasminebdd](http://twitter.com/jasminebdd)
|
|
72
72
|
|
73
73
|
Please file issues here at Github
|
74
74
|
|
75
|
-
Copyright (c) 2008-
|
75
|
+
Copyright (c) 2008-2013 Pivotal Labs. This software is licensed under the MIT License.
|
data/Rakefile
CHANGED
@@ -1,55 +1,44 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/lib")
|
3
|
-
require
|
3
|
+
require 'bundler'
|
4
4
|
Bundler::GemHelper.install_tasks
|
5
5
|
|
6
|
-
require
|
7
|
-
|
8
|
-
|
9
|
-
require 'rspec/core/rake_task'
|
10
|
-
else
|
11
|
-
require 'spec'
|
12
|
-
require 'spec/rake/spectask'
|
13
|
-
end
|
6
|
+
require 'jasmine'
|
7
|
+
require 'rspec'
|
8
|
+
require 'rspec/core/rake_task'
|
14
9
|
|
15
|
-
desc
|
16
|
-
|
17
|
-
|
18
|
-
t.pattern = 'spec/**/*_spec.rb'
|
19
|
-
end
|
20
|
-
else
|
21
|
-
Spec::Rake::SpecTask.new('spec') do |t|
|
22
|
-
t.spec_files = FileList['spec/**/*.rb']
|
23
|
-
end
|
10
|
+
desc 'Run all examples'
|
11
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
12
|
+
t.pattern = 'spec/**/*_spec.rb'
|
24
13
|
end
|
25
14
|
|
26
|
-
task :spec =>
|
15
|
+
task :spec => %w(jasmine:copy_examples_to_gem)
|
27
16
|
|
28
17
|
task :default => :spec
|
29
18
|
|
30
19
|
namespace :jasmine do
|
31
|
-
require
|
20
|
+
require 'jasmine-core'
|
32
21
|
task :server do
|
33
|
-
port = ENV['JASMINE_PORT'] || 8888
|
34
22
|
Jasmine.configure do |config|
|
35
|
-
root = File.expand_path(File.join(File.dirname(__FILE__),
|
23
|
+
root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
36
24
|
config.src_dir = File.join(root, 'src')
|
37
25
|
config.spec_dir = Jasmine::Core.path
|
38
26
|
config.spec_files = lambda { (Jasmine::Core.html_spec_files + Jasmine::Core.core_spec_files).map {|f| File.join(config.spec_dir, f) } }
|
27
|
+
config.jasmine_port = ENV['JASMINE_PORT'] || 8888
|
39
28
|
end
|
40
29
|
|
41
30
|
config = Jasmine.config
|
42
31
|
|
43
|
-
server = Jasmine::Server.new(
|
32
|
+
server = Jasmine::Server.new(config.jasmine_port, Jasmine::Application.app(config))
|
44
33
|
server.start
|
45
34
|
|
46
|
-
puts
|
47
|
-
puts " http://localhost:#{
|
35
|
+
puts 'your tests are here:'
|
36
|
+
puts " http://localhost:#{config.jasmine_port}/"
|
48
37
|
end
|
49
38
|
|
50
|
-
desc
|
39
|
+
desc 'Copy examples from Jasmine JS to the gem'
|
51
40
|
task :copy_examples_to_gem do
|
52
|
-
require
|
41
|
+
require 'fileutils'
|
53
42
|
|
54
43
|
# copy jasmine's example tree into our generator templates dir
|
55
44
|
FileUtils.rm_r('generators/jasmine/templates/jasmine-example', :force => true)
|
@@ -57,6 +46,6 @@ namespace :jasmine do
|
|
57
46
|
end
|
58
47
|
end
|
59
48
|
|
60
|
-
desc
|
61
|
-
task :jasmine =>
|
49
|
+
desc 'Run specs via server'
|
50
|
+
task :jasmine => %w(jasmine:server)
|
62
51
|
|
@@ -1,9 +1,15 @@
|
|
1
|
-
beforeEach(function() {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
beforeEach(function () {
|
2
|
+
jasmine.Expectation.addMatchers({
|
3
|
+
toBePlaying: function () {
|
4
|
+
return {
|
5
|
+
compare: function (actual, expected) {
|
6
|
+
var player = actual;
|
7
|
+
|
8
|
+
return {
|
9
|
+
pass: player.currentlyPlayingSong === expected && player.isPlaying
|
10
|
+
}
|
11
|
+
}
|
12
|
+
};
|
13
|
+
}
|
14
|
+
});
|
9
15
|
});
|
@@ -77,12 +77,12 @@ spec_dir:
|
|
77
77
|
#
|
78
78
|
# Ruby file that Jasmine server will require before starting.
|
79
79
|
# Returned relative to your root path
|
80
|
-
# Default spec/support/jasmine_helper.rb
|
80
|
+
# Default spec/javascripts/support/jasmine_helper.rb
|
81
81
|
#
|
82
82
|
# EXAMPLE:
|
83
83
|
#
|
84
|
-
# spec_helper: spec/support/jasmine_helper.rb
|
84
|
+
# spec_helper: spec/javascripts/support/jasmine_helper.rb
|
85
85
|
#
|
86
|
-
spec_helper: spec/support/jasmine_helper.rb
|
86
|
+
spec_helper: spec/javascripts/support/jasmine_helper.rb
|
87
87
|
|
88
88
|
|
data/jasmine.gemspec
CHANGED
@@ -20,57 +20,27 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
s.rdoc_options = ["--charset=UTF-8"]
|
22
22
|
|
23
|
-
if ENV['RAILS_VERSION'] == 'pojs-
|
24
|
-
|
25
|
-
#1.3.2 buffer overflows
|
26
|
-
s.add_development_dependency 'rspec', '= 1.3.1'
|
27
|
-
s.add_development_dependency 'rack', "1.1"
|
28
|
-
else
|
29
|
-
s.add_development_dependency 'rspec', '>= 1.3.1', '< 2'
|
30
|
-
end
|
31
|
-
s.add_development_dependency 'rake-tasks'
|
32
|
-
elsif ENV['RAILS_VERSION'] == 'pojs-rspec2'
|
33
|
-
if ENV["RUBY_VERSION"] =~ /1\.8\.6/
|
34
|
-
#2.7.0 uses reduce vs inject, non 1.8.6 compatible
|
35
|
-
s.add_development_dependency 'rspec', '2.6.0'
|
36
|
-
else
|
37
|
-
s.add_development_dependency 'rspec', '>= 2.5.0'
|
38
|
-
end
|
23
|
+
if ENV['RAILS_VERSION'] == 'pojs-rspec2'
|
24
|
+
s.add_development_dependency 'rspec', '>= 2.5.0'
|
39
25
|
s.add_development_dependency 'rake-tasks'
|
40
|
-
|
41
|
-
elsif ENV['RAILS_VERSION'] == 'rails2'
|
42
|
-
if ENV["RUBY_VERSION"] =~ /1\.8\.6/
|
43
|
-
#1.3.2 buffer overflows
|
44
|
-
s.add_development_dependency 'rspec', '= 1.3.1'
|
45
|
-
else
|
46
|
-
s.add_development_dependency 'rspec', '>= 1.3.1', '< 2'
|
47
|
-
end
|
48
|
-
# for development & test of Rails 2 Generators
|
49
|
-
s.add_development_dependency 'rails', '2.3.11', "< 3"
|
50
|
-
elsif ENV['RAILS_VERSION'] == 'rails2_3_5'
|
51
|
-
if ENV["RUBY_VERSION"] =~ /1\.8\.6/
|
52
|
-
#1.3.2 buffer overflows
|
53
|
-
s.add_development_dependency 'rspec', '= 1.3.1'
|
54
|
-
else
|
55
|
-
s.add_development_dependency 'rspec', '>= 1.3.1', '< 2'
|
56
|
-
end
|
57
|
-
# for development & test of Rails 2 Generators
|
58
|
-
s.add_development_dependency 'rails', '= 2.3.5'
|
59
|
-
else
|
26
|
+
elsif ENV['RAILS_VERSION'] == 'rails3'
|
60
27
|
# for development & test of Rails 3 Generators
|
61
28
|
s.add_development_dependency 'rspec', '>= 2.5.0'
|
62
|
-
s.add_development_dependency 'rails', '>= 3.0.0'
|
63
|
-
s.add_development_dependency '
|
29
|
+
s.add_development_dependency 'rails', '>= 3.0.0', '< 4.0.0'
|
30
|
+
s.add_development_dependency 'sqlite3'
|
31
|
+
else
|
32
|
+
s.add_development_dependency 'rspec', '>= 2.5.0'
|
33
|
+
s.add_development_dependency 'rails', '>= 4'
|
64
34
|
end
|
65
35
|
|
66
36
|
s.add_development_dependency 'rack-test'
|
67
37
|
s.add_development_dependency 'json_pure'
|
68
|
-
s.add_development_dependency 'nokogiri'
|
69
38
|
|
70
39
|
s.add_development_dependency 'anchorman'
|
71
40
|
|
72
|
-
s.add_dependency 'jasmine-core',
|
73
|
-
s.add_dependency 'rack'
|
41
|
+
s.add_dependency 'jasmine-core', '~> 2.0.0.alpha'
|
42
|
+
s.add_dependency 'rack'
|
74
43
|
s.add_dependency 'rspec', '>= 1.3.1'
|
75
44
|
s.add_dependency 'selenium-webdriver', '>= 0.1.3'
|
45
|
+
s.add_dependency 'nokogiri'
|
76
46
|
end
|
@@ -1,9 +1,15 @@
|
|
1
|
-
beforeEach(function() {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
beforeEach(function () {
|
2
|
+
jasmine.Expectation.addMatchers({
|
3
|
+
toBePlaying: function () {
|
4
|
+
return {
|
5
|
+
compare: function (actual, expected) {
|
6
|
+
var player = actual;
|
7
|
+
|
8
|
+
return {
|
9
|
+
pass: player.currentlyPlayingSong === expected && player.isPlaying
|
10
|
+
}
|
11
|
+
}
|
12
|
+
};
|
13
|
+
}
|
14
|
+
});
|
15
|
+
});
|
data/lib/jasmine.rb
CHANGED
@@ -6,26 +6,29 @@ jasmine_files = ['base',
|
|
6
6
|
'application',
|
7
7
|
'server',
|
8
8
|
'selenium_driver',
|
9
|
-
'rspec_formatter',
|
10
9
|
'command_line_tool',
|
11
10
|
'page',
|
12
11
|
'path_mapper',
|
13
|
-
'
|
12
|
+
'asset_bundle',
|
14
13
|
'asset_pipeline_mapper',
|
15
14
|
'asset_expander',
|
16
15
|
'results_processor',
|
17
16
|
'results',
|
18
17
|
'path_expander',
|
19
18
|
'yaml_config_parser',
|
20
|
-
File.join('
|
19
|
+
File.join('formatters', 'base'),
|
20
|
+
File.join('formatters', 'console'),
|
21
|
+
File.join('formatters', 'junit_xml'),
|
22
|
+
File.join('runners', 'http'),
|
23
|
+
File.join('reporters', 'api_reporter')]
|
24
|
+
|
21
25
|
|
22
26
|
jasmine_files.each do |file|
|
23
27
|
require File.join('jasmine', file)
|
24
28
|
end
|
25
|
-
# jasmine_rack_files.each do |file|
|
26
|
-
# require File.join('rack', 'jasmine', file)
|
27
|
-
# end
|
28
29
|
|
29
|
-
|
30
|
+
if Jasmine::Dependencies.rails?
|
31
|
+
require File.join('jasmine', 'railtie')
|
32
|
+
end
|
30
33
|
|
31
34
|
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Jasmine
|
2
|
+
|
3
|
+
class AssetBundle
|
4
|
+
def self.factory
|
5
|
+
if Jasmine::Dependencies.rails3?
|
6
|
+
return Rails3AssetBundle
|
7
|
+
end
|
8
|
+
if Jasmine::Dependencies.rails4?
|
9
|
+
return Rails4AssetBundle
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class RailsAssetBundle
|
14
|
+
def initialize(pathname)
|
15
|
+
@pathname = pathname
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
attr_reader :pathname
|
21
|
+
end
|
22
|
+
|
23
|
+
class Rails3AssetBundle < RailsAssetBundle
|
24
|
+
|
25
|
+
def assets
|
26
|
+
context = get_asset_context
|
27
|
+
context.asset_paths.asset_for(pathname, 'js').to_a.map do |path|
|
28
|
+
context.asset_path(path)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def get_asset_context
|
34
|
+
context = ::Rails.application.assets.context_class
|
35
|
+
context.extend(::Sprockets::Helpers::IsolatedHelper)
|
36
|
+
context.extend(::Sprockets::Helpers::RailsHelper)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Rails4AssetBundle
|
41
|
+
|
42
|
+
def initialize(pathname)
|
43
|
+
@pathname = pathname
|
44
|
+
end
|
45
|
+
|
46
|
+
def assets
|
47
|
+
context.get_original_assets(pathname)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
attr_reader :pathname
|
52
|
+
|
53
|
+
def context
|
54
|
+
return @context if @context
|
55
|
+
@context = ActionView::Base.new
|
56
|
+
@context.instance_eval do
|
57
|
+
def get_original_assets(pathname)
|
58
|
+
lookup_asset_for_path(pathname, :type => :javascript).to_a.map do |processed_asset|
|
59
|
+
path_to_javascript(processed_asset.logical_path)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
@context
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|