opal-rails 0.6.3 → 0.7.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Gemfile +4 -9
- data/README.md +11 -8
- data/Rakefile +1 -0
- data/lib/assets/javascripts/opal-rspec-runner.js.rb +1 -2
- data/lib/assets/javascripts/opal_ujs.js.rb +1 -1
- data/lib/opal/rails/engine.rb +4 -2
- data/lib/opal/rails/slim_filter.rb +12 -0
- data/lib/opal/rails/version.rb +1 -1
- data/lib/rails/generators/opal/assets/assets_generator.rb +20 -0
- data/lib/rails/generators/opal/assets/templates/javascript.js.rb +42 -0
- data/opal-rails.gemspec +8 -8
- data/spec/integration/in_browser_specs_spec.rb +1 -1
- data/spec/integration/source_map_spec.rb +15 -9
- data/spec/spec_helper.rb +81 -10
- data/test_app/app/controllers/application_controller.rb +1 -1
- metadata +21 -34
- data/spec/opal/processor_spec.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93600a56e4e829b286435ad7d9128b4de010ae82
|
4
|
+
data.tar.gz: a1014b6a9bc0dc0e2e67522899fb25d56e57e67f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 581b2e6682dd7ba8c4e46c81ee3336d747729636b49a1859624e765024734c14a9dc9adb40a56fea313bcaee51c81c62f5dd124c4f6a1f74ad351620db110db7
|
7
|
+
data.tar.gz: 3a8f9269c84a84ce358384e903784ddd010b08135bd181ced7de8f08bc54a91cfd62f96fb8fff2b678d29bae3eba2542f4693360bd3e847ae8f814bb4a525dff
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -2,15 +2,10 @@ source 'https://rubygems.org'
|
|
2
2
|
gemspec
|
3
3
|
|
4
4
|
gem 'capybara-webkit'
|
5
|
-
gem '
|
6
|
-
|
7
|
-
# gem 'opal',
|
8
|
-
gem 'opal
|
9
|
-
|
10
|
-
# gem 'opal', :path => '~/Code/opal'
|
11
|
-
# gem 'opal-jquery', :path => '~/Code/opal-jquery'
|
12
|
-
# gem 'opal-rspec', :path => '~/Code/opal-rspec'
|
13
|
-
# gem 'opal-browser', :path => '~/Code/opal-browser'
|
5
|
+
gem 'opal-jquery', github: 'opal/opal-jquery'
|
6
|
+
gem 'opal', github: 'opal'
|
7
|
+
# gem 'opal-jquery', path: '../opal-jquery'
|
8
|
+
# gem 'opal', path: '../opal'
|
14
9
|
|
15
10
|
if RUBY_VERSION.to_f < 1.9
|
16
11
|
gem 'nokogiri', '< 1.6'
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# Opal Rails
|
2
2
|
|
3
|
-
[![Build Status](https://secure.travis-ci.org/elia/opal-rails.
|
4
|
-
[![Code Climate](https://
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/opal-rails.
|
6
|
-
![fun guaranteed](
|
3
|
+
[![Build Status](https://secure.travis-ci.org/elia/opal-rails.svg)](http://travis-ci.org/elia/opal-rails)
|
4
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/elia/opal-rails.svg)](https://codeclimate.com/github/elia/opal-rails)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/opal-rails.svg)](http://badge.fury.io/rb/opal-rails)
|
6
|
+
![fun guaranteed](https://img.shields.io/badge/fun-guaranteed-brightgreen.svg)
|
7
|
+
![web scale](http://img.shields.io/badge/webscale-over%209000-green.svg)
|
7
8
|
|
8
9
|
_Rails (3.2+, 4.0) bindings for [Opal Ruby](http://opalrb.org) engine. ([Changelog](https://github.com/opal/opal-rails/blob/master/CHANGELOG.md))_
|
9
10
|
|
@@ -13,7 +14,7 @@ _Rails (3.2+, 4.0) bindings for [Opal Ruby](http://opalrb.org) engine. ([Changel
|
|
13
14
|
|
14
15
|
In your `Gemfile`
|
15
16
|
|
16
|
-
```
|
17
|
+
```ruby
|
17
18
|
gem 'opal-rails'
|
18
19
|
```
|
19
20
|
|
@@ -73,7 +74,9 @@ puts "G'day world!" # check the console!
|
|
73
74
|
# Dom manipulation
|
74
75
|
require 'opal-jquery'
|
75
76
|
|
76
|
-
|
77
|
+
Document.ready? do
|
78
|
+
Element.find('body > header').html = '<h1>Hi there!</h1>'
|
79
|
+
end
|
77
80
|
```
|
78
81
|
|
79
82
|
|
@@ -148,14 +151,14 @@ describe 'a spec' do
|
|
148
151
|
end
|
149
152
|
```
|
150
153
|
|
151
|
-
Then visit `/opal_spec` from your app and **reload at will
|
154
|
+
Then visit `/opal_spec` from your app and **reload at will** or use the command line with `rake opal:spec`.
|
152
155
|
|
153
156
|
![1 examples, 0 failures](http://f.cl.ly/items/001n0V0g0u0v14160W2G/Schermata%2007-2456110%20alle%201.06.29%20am.png)
|
154
157
|
|
155
158
|
|
156
159
|
## License
|
157
160
|
|
158
|
-
© 2012-
|
161
|
+
© 2012-2014 Elia Schito
|
159
162
|
|
160
163
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
161
164
|
of this software and associated documentation files (the "Software"), to deal
|
data/Rakefile
CHANGED
data/lib/opal/rails/engine.rb
CHANGED
@@ -26,6 +26,7 @@ module Opal
|
|
26
26
|
|
27
27
|
config.after_initialize do |app|
|
28
28
|
require 'opal/rails/haml_filter' if defined?(Haml)
|
29
|
+
require 'opal/rails/slim_filter' if defined?(Slim)
|
29
30
|
|
30
31
|
config = app.config
|
31
32
|
config.opal.each_pair do |key, value|
|
@@ -35,8 +36,9 @@ module Opal
|
|
35
36
|
|
36
37
|
app.routes.prepend do
|
37
38
|
if Opal::Processor.source_map_enabled
|
38
|
-
|
39
|
-
|
39
|
+
prefix = app.config.assets.prefix
|
40
|
+
maps_app = Opal::SourceMapServer.new(app.assets, prefix)
|
41
|
+
mount Rack::Cascade.new([maps_app, app.assets]) => prefix
|
40
42
|
end
|
41
43
|
|
42
44
|
get '/opal_spec' => 'opal_spec#run'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Slim
|
2
|
+
class Embedded
|
3
|
+
class OpalEngine < TiltEngine
|
4
|
+
protected
|
5
|
+
|
6
|
+
def tilt_render(tilt_engine, tilt_options, text)
|
7
|
+
[:static, ::Opal.compile(text)]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
register :opal, JavaScriptEngine, :engine => OpalEngine
|
11
|
+
end
|
12
|
+
end if defined? Slim::Embedded
|
data/lib/opal/rails/version.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails/generators/named_base'
|
2
|
+
require 'rails/generators/resource_helpers'
|
3
|
+
|
4
|
+
module Opal
|
5
|
+
module Generators
|
6
|
+
class AssetsGenerator < ::Rails::Generators::NamedBase
|
7
|
+
include ::Rails::Generators::ResourceHelpers
|
8
|
+
source_root __dir__+'/templates'
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
::Rails::Generators::ModelHelpers.skip_warn = true
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy_opal
|
16
|
+
template 'javascript.js.rb', File.join('app/assets/javascripts', class_path, "#{file_name}_view.js.rb")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Place all the behaviors and hooks related to the matching controller here.
|
2
|
+
# All this logic will automatically be available in application.js.
|
3
|
+
# You can use Opal in this file: http://opalrb.org/
|
4
|
+
#
|
5
|
+
#
|
6
|
+
# Here's an example view class for your controller:
|
7
|
+
#
|
8
|
+
<% if namespaced? -%>
|
9
|
+
#= require opal
|
10
|
+
#= require <%= namespaced_file_path %>
|
11
|
+
|
12
|
+
<% end -%>
|
13
|
+
<% module_namespacing do -%>
|
14
|
+
class <%= controller_class_name %>View
|
15
|
+
def initialize(selector = 'body.controller-<%= controller_class_name.underscore %>', parent = Element)
|
16
|
+
@element = parent.find(selector)
|
17
|
+
setup
|
18
|
+
end
|
19
|
+
attr_reader :element
|
20
|
+
|
21
|
+
def setup
|
22
|
+
# Put here the setup for the view behavior
|
23
|
+
say_hello_when_a_link_is_clicked
|
24
|
+
end
|
25
|
+
|
26
|
+
def say_hello_when_a_link_is_clicked
|
27
|
+
all_links.on :click do |event|
|
28
|
+
# Use prevent_default to stop default behavior (as you would do in jQuery)
|
29
|
+
# event.prevent_default
|
30
|
+
|
31
|
+
puts "Hello! (You just clicked on a link: #{event.current_target.text})"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def all_links
|
39
|
+
@all_links ||= element.find('a')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
<% end -%>
|
data/opal-rails.gemspec
CHANGED
@@ -19,17 +19,17 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ['lib']
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
s.add_dependency '
|
25
|
-
s.add_dependency 'opal
|
22
|
+
required_ruby_version = '>= 1.9.3'
|
23
|
+
|
24
|
+
s.add_dependency 'rails', '>= 3.2', '< 5.0'
|
25
|
+
s.add_dependency 'opal', '~> 0.7.0.beta1'
|
26
|
+
s.add_dependency 'opal-jquery', '~> 0.3.0.beta1'
|
27
|
+
s.add_dependency 'opal-rspec', '~> 0.4.0.beta3'
|
26
28
|
s.add_dependency 'jquery-rails'
|
27
29
|
s.add_dependency 'opal-activesupport', '>= 0.0.5'
|
28
30
|
|
29
31
|
s.add_development_dependency 'execjs'
|
30
32
|
s.add_development_dependency 'launchy'
|
31
|
-
s.add_development_dependency 'capybara'
|
32
|
-
|
33
|
-
s.add_development_dependency 'rspec', '~> 2.13'
|
34
|
-
s.add_development_dependency 'rspec-rails', '~> 2.13'
|
33
|
+
s.add_development_dependency 'capybara', '~> 2.3'
|
34
|
+
s.add_development_dependency 'rspec-rails', '~> 3.0'
|
35
35
|
end
|
@@ -2,34 +2,40 @@ require 'spec_helper'
|
|
2
2
|
require 'opal/source_map'
|
3
3
|
|
4
4
|
describe Opal::SourceMap do
|
5
|
+
let(:js_asset_path) { '/assets/source_map_example.js' }
|
6
|
+
|
5
7
|
before do
|
6
|
-
expect(Rails.application.config.opal.source_map_enabled).to
|
7
|
-
get
|
8
|
+
expect(Rails.application.config.opal.source_map_enabled).to be_truthy
|
9
|
+
get js_asset_path
|
8
10
|
end
|
9
11
|
|
10
|
-
let(:
|
12
|
+
let(:map_path) { extract_map_path(response) }
|
11
13
|
|
12
14
|
let(:map_body) do
|
13
|
-
get
|
14
|
-
|
15
|
+
get map_path
|
16
|
+
expect(response).to be_success, "url: #{map_path}\nstatus: #{response.status}"
|
15
17
|
response.body
|
16
18
|
end
|
17
19
|
|
18
20
|
let(:map) { JSON.parse(map_body) }
|
19
21
|
|
20
22
|
it 'has the source map header or magic comment' do
|
21
|
-
expect(
|
23
|
+
expect(extract_map_path(response)).to be_present
|
22
24
|
end
|
23
25
|
|
24
26
|
it "the map is a valid json" do
|
27
|
+
get map_path
|
25
28
|
%w[sources mappings].each do |key|
|
26
29
|
expect(map_body[key]).to be_present
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
30
|
-
def
|
31
|
-
|
32
|
-
response.
|
33
|
+
def extract_map_path response
|
34
|
+
source_map_regexp = %r{^//[@#] sourceMappingURL=([^\n]+)}
|
35
|
+
map_path = (response.headers['X-SourceMap'] ||
|
36
|
+
response.body.scan(source_map_regexp).
|
37
|
+
flatten.first.to_s.strip)
|
38
|
+
File.join(File.dirname(js_asset_path), map_path) if map_path
|
33
39
|
end
|
34
40
|
|
35
41
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -13,27 +13,98 @@ require 'opal-rails'
|
|
13
13
|
ENV['RAILS_ENV'] = 'test'
|
14
14
|
|
15
15
|
require File.expand_path('test_app/config/environment.rb', root_dir)
|
16
|
+
|
16
17
|
require 'rspec/rails'
|
18
|
+
require 'support/capybara'
|
19
|
+
require 'support/reset_assets_cache'
|
17
20
|
|
18
21
|
Rails.backtrace_cleaner.remove_silencers!
|
19
22
|
|
23
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
24
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
25
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
26
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
27
|
+
#
|
28
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
29
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
30
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
31
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
32
|
+
# a separate helper file that requires the additional dependencies and performs
|
33
|
+
# the additional setup, and require it from the spec files that actually need it.
|
34
|
+
#
|
35
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
36
|
+
# users commonly want.
|
37
|
+
#
|
38
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
39
|
+
RSpec.configure do |config|
|
40
|
+
config.infer_spec_type_from_file_location!
|
20
41
|
|
21
|
-
#
|
22
|
-
|
23
|
-
#
|
24
|
-
|
25
|
-
|
42
|
+
# rspec-expectations config goes here. You can use an alternate
|
43
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
44
|
+
# assertions if you prefer.
|
45
|
+
config.expect_with :rspec do |expectations|
|
46
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
47
|
+
# and `failure_message` of custom matchers include text for helper methods
|
48
|
+
# defined using `chain`, e.g.:
|
49
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
50
|
+
# # => "be bigger than 2 and smaller than 4"
|
51
|
+
# ...rather than:
|
52
|
+
# # => "be bigger than 2"
|
53
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
54
|
+
expectations.syntax = [:expect, :should]
|
55
|
+
end
|
26
56
|
|
27
|
-
|
28
|
-
|
57
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
58
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
59
|
+
config.mock_with :rspec do |mocks|
|
60
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
61
|
+
# a real object. This is generally recommended, and will default to
|
62
|
+
# `true` in RSpec 4.
|
63
|
+
mocks.verify_partial_doubles = true
|
64
|
+
end
|
29
65
|
|
30
|
-
|
31
|
-
|
66
|
+
# These two settings work together to allow you to limit a spec run
|
67
|
+
# to individual examples or groups you care about by tagging them with
|
68
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
69
|
+
# get run.
|
32
70
|
config.filter_run :focus
|
71
|
+
config.run_all_when_everything_filtered = true
|
72
|
+
|
73
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
74
|
+
# For more details, see:
|
75
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
76
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
77
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
78
|
+
# config.disable_monkey_patching!
|
79
|
+
|
80
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
81
|
+
# be too noisy due to issues in dependencies.
|
82
|
+
config.warnings = false
|
83
|
+
|
84
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
85
|
+
# file, and it's useful to allow more verbose output when running an
|
86
|
+
# individual spec file.
|
87
|
+
if config.files_to_run.one?
|
88
|
+
# Use the documentation formatter for detailed output,
|
89
|
+
# unless a formatter has already been configured
|
90
|
+
# (e.g. via a command-line flag).
|
91
|
+
config.default_formatter = 'doc'
|
92
|
+
end
|
93
|
+
|
94
|
+
# Print the 10 slowest examples and example groups at the
|
95
|
+
# end of the spec run, to help surface which specs are running
|
96
|
+
# particularly slow.
|
97
|
+
config.profile_examples = 2
|
33
98
|
|
34
99
|
# Run specs in random order to surface order dependencies. If you find an
|
35
100
|
# order dependency and want to debug it, you can fix the order by providing
|
36
101
|
# the seed, which is printed after each run.
|
37
102
|
# --seed 1234
|
38
|
-
config.order =
|
103
|
+
config.order = :random
|
104
|
+
|
105
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
106
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
107
|
+
# test failures related to randomization by passing the same `--seed` value
|
108
|
+
# as the one that triggered the failure.
|
109
|
+
Kernel.srand config.seed
|
39
110
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia Schito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.2
|
19
|
+
version: '3.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '5.0'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2
|
29
|
+
version: '3.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '5.0'
|
@@ -36,42 +36,42 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
39
|
+
version: 0.7.0.beta1
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
46
|
+
version: 0.7.0.beta1
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: opal-jquery
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 0.3.0.beta1
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.
|
60
|
+
version: 0.3.0.beta1
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: opal-rspec
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.
|
67
|
+
version: 0.4.0.beta3
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
74
|
+
version: 0.4.0.beta3
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: jquery-rails
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,46 +130,32 @@ dependencies:
|
|
130
130
|
version: '0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
name: capybara
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - ">="
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '0'
|
138
|
-
type: :development
|
139
|
-
prerelease: false
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - ">="
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '0'
|
145
|
-
- !ruby/object:Gem::Dependency
|
146
|
-
name: rspec
|
147
133
|
requirement: !ruby/object:Gem::Requirement
|
148
134
|
requirements:
|
149
135
|
- - "~>"
|
150
136
|
- !ruby/object:Gem::Version
|
151
|
-
version: '2.
|
137
|
+
version: '2.3'
|
152
138
|
type: :development
|
153
139
|
prerelease: false
|
154
140
|
version_requirements: !ruby/object:Gem::Requirement
|
155
141
|
requirements:
|
156
142
|
- - "~>"
|
157
143
|
- !ruby/object:Gem::Version
|
158
|
-
version: '2.
|
144
|
+
version: '2.3'
|
159
145
|
- !ruby/object:Gem::Dependency
|
160
146
|
name: rspec-rails
|
161
147
|
requirement: !ruby/object:Gem::Requirement
|
162
148
|
requirements:
|
163
149
|
- - "~>"
|
164
150
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
151
|
+
version: '3.0'
|
166
152
|
type: :development
|
167
153
|
prerelease: false
|
168
154
|
version_requirements: !ruby/object:Gem::Requirement
|
169
155
|
requirements:
|
170
156
|
- - "~>"
|
171
157
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
158
|
+
version: '3.0'
|
173
159
|
description: Rails bindings for opal JS engine
|
174
160
|
email:
|
175
161
|
- elia@schito.me
|
@@ -194,16 +180,18 @@ files:
|
|
194
180
|
- lib/opal/rails.rb
|
195
181
|
- lib/opal/rails/engine.rb
|
196
182
|
- lib/opal/rails/haml_filter.rb
|
183
|
+
- lib/opal/rails/slim_filter.rb
|
197
184
|
- lib/opal/rails/sprockets_cache_key_fix.rb
|
198
185
|
- lib/opal/rails/template_handler.rb
|
199
186
|
- lib/opal/rails/version.rb
|
187
|
+
- lib/rails/generators/opal/assets/assets_generator.rb
|
188
|
+
- lib/rails/generators/opal/assets/templates/javascript.js.rb
|
200
189
|
- lib/tasks/opal-rails_tasks.rake
|
201
190
|
- opal-rails.gemspec
|
202
191
|
- script/rails
|
203
192
|
- spec/integration/assigns_spec.rb
|
204
193
|
- spec/integration/in_browser_specs_spec.rb
|
205
194
|
- spec/integration/source_map_spec.rb
|
206
|
-
- spec/opal/processor_spec.rb
|
207
195
|
- spec/spec_helper.rb
|
208
196
|
- spec/support/capybara.rb
|
209
197
|
- spec/support/reset_assets_cache.rb
|
@@ -259,9 +247,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
259
247
|
version: '0'
|
260
248
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
249
|
requirements:
|
262
|
-
- - "
|
250
|
+
- - ">"
|
263
251
|
- !ruby/object:Gem::Version
|
264
|
-
version:
|
252
|
+
version: 1.3.1
|
265
253
|
requirements: []
|
266
254
|
rubyforge_project: opal-rails
|
267
255
|
rubygems_version: 2.2.2
|
@@ -272,7 +260,6 @@ test_files:
|
|
272
260
|
- spec/integration/assigns_spec.rb
|
273
261
|
- spec/integration/in_browser_specs_spec.rb
|
274
262
|
- spec/integration/source_map_spec.rb
|
275
|
-
- spec/opal/processor_spec.rb
|
276
263
|
- spec/spec_helper.rb
|
277
264
|
- spec/support/capybara.rb
|
278
265
|
- spec/support/reset_assets_cache.rb
|
data/spec/opal/processor_spec.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Opal::Processor do
|
4
|
-
let(:pathname) { Pathname('/Code/app/mylib/opal/asdf.rb') }
|
5
|
-
let(:_context) do
|
6
|
-
double('_context', :logical_path => 'asdf.js.rb', :pathname => pathname)
|
7
|
-
end
|
8
|
-
|
9
|
-
it "is registered for '.opal' files" do
|
10
|
-
Tilt['test.opal'].should eq(Opal::Processor)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "is registered for '.rb' files" do
|
14
|
-
Tilt['test.rb'].should eq(Opal::Processor)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "compiles and evaluates the template on #render" do
|
18
|
-
template = Opal::Processor.new { |t| "puts 'Hello, World!'\n" }
|
19
|
-
template.render(_context).should include('"Hello, World!"')
|
20
|
-
end
|
21
|
-
|
22
|
-
it "can be rendered more than once" do
|
23
|
-
template = Opal::Processor.new(_context) { |t| "puts 'Hello, World!'\n" }
|
24
|
-
3.times { template.render(_context).should include('"Hello, World!"') }
|
25
|
-
end
|
26
|
-
end
|