Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 2c97a54

Browse files
authored
Merge pull request #182 from ruby-hyperloop/opal-0.10-support
Opal 0.10 support
2 parents 8a32711 + 531d499 commit 2c97a54

File tree

14 files changed

+83
-14
lines changed

14 files changed

+83
-14
lines changed

.travis.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,29 @@ rvm:
66
- jruby-19mode
77
before_script:
88
- phantomjs --version
9-
script:
10-
- bundle exec rake test_app
11-
- bundle exec rake
9+
env:
10+
- PHANTOMJS_VERSION=1.9.8
1211
gemfile:
1312
- gemfiles/opal_0.8_react_13.gemfile
1413
- gemfiles/opal_0.8_react_14.gemfile
1514
- gemfiles/opal_0.8_react_15.gemfile
1615
- gemfiles/opal_0.9_react_13.gemfile
1716
- gemfiles/opal_0.9_react_14.gemfile
1817
- gemfiles/opal_0.9_react_15.gemfile
19-
18+
cache:
19+
directories:
20+
- "travis_phantomjs"
21+
before_install:
22+
- "phantomjs --version"
23+
- "export PATH=$PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin:$PATH"
24+
- "phantomjs --version"
25+
- "if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then rm -rf $PWD/travis_phantomjs; mkdir -p $PWD/travis_phantomjs; fi"
26+
- "if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then wget https://github.com/Medium/phantomjs/releases/download/v$PHANTOMJS_VERSION/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -O $PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2; fi"
27+
- "if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then tar -xvf $PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs; fi"
28+
- "phantomjs --version"
29+
script:
30+
- bundle exec rake test_app
31+
- bundle exec rake
2032
# These two setup seems to run indefinitely long
2133
# further investigation required.
2234
matrix:
@@ -27,3 +39,13 @@ matrix:
2739
gemfile: gemfiles/opal_0.9_react_14.gemfile
2840
- rvm: jruby-19mode
2941
gemfile: gemfiles/opal_0.9_react_15.gemfile
42+
include:
43+
- rvm: 2.1
44+
env: PHANTOMJS_VERSION=2.1.1
45+
gemfile: gemfiles/opal_0.10_react_13.gemfile
46+
- rvm: 2.1
47+
env: PHANTOMJS_VERSION=2.1.1
48+
gemfile: gemfiles/opal_0.10_react_14.gemfile
49+
- rvm: 2.1
50+
env: PHANTOMJS_VERSION=2.1.1
51+
gemfile: gemfiles/opal_0.10_react_15.gemfile

Appraisals

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
opal_versions = ['0.8', '0.9']
1+
opal_versions = ['0.8', '0.9', '0.10']
22
react_versions_map = {
33
'13' => '~> 1.3.3',
44
'14' => '~> 1.6.2',
@@ -7,6 +7,7 @@ react_versions_map = {
77
opal_rails_versions_map = {
88
'0.8' => '~> 0.8.1',
99
'0.9' => '~> 0.9.0',
10+
'0.10' => '~> 0.9.0',
1011
}
1112

1213
opal_versions.each do |opal_v|

config.ru

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Bundler.require
44
require "opal/rspec"
55
require "opal-jquery"
66

7+
Opal::Config.arity_check_enabled = true
8+
79
if Opal::RSpec.const_defined?("SprocketsEnvironment")
810
sprockets_env = Opal::RSpec::SprocketsEnvironment.new
911
sprockets_env.cache = Sprockets::Cache::FileStore.new("tmp")
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "opal", "~> 0.10.0"
6+
gem "opal-rails", "~> 0.9.0"
7+
gem "react-rails", "~> 1.3.3", :require => false
8+
9+
group :development do
10+
gem "appraisal"
11+
end
12+
13+
gemspec :path => "../"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "opal", "~> 0.10.0"
6+
gem "opal-rails", "~> 0.9.0"
7+
gem "react-rails", "~> 1.6.2", :require => false
8+
9+
group :development do
10+
gem "appraisal"
11+
end
12+
13+
gemspec :path => "../"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "opal", "~> 0.10.0"
6+
gem "opal-rails", "~> 0.9.0"
7+
gem "react-rails", "~> 1.8.2", :require => false
8+
9+
group :development do
10+
gem "appraisal"
11+
end
12+
13+
gemspec :path => "../"

lib/react/api.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def self.eval_native_react_component(name)
3434
component
3535
end
3636

37-
def self.native_react_component?(name)
37+
def self.native_react_component?(name = nil)
38+
return false unless name
3839
eval_native_react_component(name)
3940
rescue
4041
nil

lib/react/component/props_wrapper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ def self.define_param(name, param_type)
3535
define_method("#{name}") do
3636
fetch_from_cache(name) do
3737
if param_type.respond_to? :_react_param_conversion
38-
param_type._react_param_conversion props[name]
38+
param_type._react_param_conversion props[name], nil
3939
elsif param_type.is_a?(Array) &&
4040
param_type[0].respond_to?(:_react_param_conversion)
4141
props[name].collect do |param|
42-
param_type[0]._react_param_conversion param
42+
param_type[0]._react_param_conversion param, nil
4343
end
4444
else
4545
props[name]

lib/react/element.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Element
2525

2626
attr_accessor :waiting_on_resources
2727

28-
def initialize(native_element, type, properties, block)
28+
def initialize(native_element, type = nil, properties = {}, block = nil)
2929
@type = type
3030
@properties = (`typeof #{properties} === 'undefined'` ? nil : properties) || {}
3131
@block = block

lib/react/top_level.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require "native"
2-
require 'active_support'
2+
require 'active_support/core_ext/object/try'
33
require 'react/component/tags'
44
require 'react/component/base'
55

0 commit comments

Comments
 (0)