Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Zepto and fix the CI #106

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 10 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
language: ruby
sudo: false

Expand All @@ -6,34 +7,21 @@ script: bundle exec rake $RUN

matrix:
include:
- rvm: 2.4.2
- rvm: 2.6
env: OPAL_VERSION='master'
- rvm: 2.3.4
env: OPAL_VERSION='~> 0.10.5'
- rvm: 2.1.10
env: RACK_VERSION='< 2.0'
- rvm: 2.0.0
env: RACK_VERSION='< 2.0'

# We use 2.1.9 to differentiate the rvm version
# as travis doesn't allow failures by env.
- rvm: 2.1.9
env: RUN=zepto PATH=".:$PATH" RACK_VERSION='< 2.0'
- rvm: 2.5
env: OPAL_VERSION='~> 1.0.1' RUN='jquery3'
- rvm: 2.4
env: OPAL_VERSION='~> 0.11.4'

allow_failures:
- rvm: 2.1.9 # zepto

- rvm: 2.5 # opal 1.0
- rvm: 2.4 # opal 0.11

cache:
bundler: true
directories:
- node_modules

before_install:
- gem update --system
- "export PATH=$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH"
- "if [ $(phantomjs --version) != '2.1.1' ]; then rm -rf $PWD/travis_phantomjs; mkdir -p $PWD/travis_phantomjs; fi"
- "if [ $(phantomjs --version) != '2.1.1' ]; then wget https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2; fi"
- "if [ $(phantomjs --version) != '2.1.1' ]; then tar -xvf $PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs; fi"
- "phantomjs --version"

addons:
chrome: stable
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## [0.5.0](https://github.com/opal/opal-jquery/compare/v0.4.6...HEAD) Unreleased

*see diff*
* Remove support for Zepto.
Zepto hasn't received substantial updates for several and is no longer under active development.
opal-jquery will still accept PRs targeting Zepto as long as they're compatible with jQuery.

## [0.4.6](https://github.com/opal/opal-jquery/compare/v0.4.5...v0.4.6) Unreleased

Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
source 'https://rubygems.org'
gemspec

case (opal_version = ENV['OPAL_VERSION'])
gem 'c_lexer', platform: :mri

case (opal_version = ENV['OPAL_VERSION']) || 'master'
when 'master'
gem 'opal', github: 'opal/opal', branch: 'master'
gem 'opal-sprockets', github: 'opal/opal-sprockets'
Expand Down
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![Build Status](http://img.shields.io/travis/opal/opal-jquery/master.svg)](http://travis-ci.org/opal/opal-jquery)

**opal-jquery** provides DOM access to opal by wrapping jQuery (or zepto)
**opal-jquery** provides DOM access to opal by wrapping jQuery
and providing a nice ruby syntax for dealing with jQuery instances.

<!-- See the Opal website for [documentation](http://opalrb.org/docs/jquery). -->
Expand Down Expand Up @@ -59,13 +59,9 @@ Run the tests inside a phantom.js runner:
$ bundle exec rake


### Zepto

opal-jquery also supports zepto. To run specs for zepto use the rake task:

$ bundle exec rake zepto

### About Zepto support

opal-jquery used to supports [Zepto](https://zeptojs.com), but the project is now semi abandoned and thus is not explicitly supported anymore. That being said, we still accept PRs and fixes targeted support for Zepto, as long as they also work for jQuery.


## Getting Started
Expand All @@ -89,7 +85,7 @@ alert "Hello from jquery + opal"
> You need to bring your own `jquery.js` file as the gem does not include one. If
> you are using the asset pipeline with rails, then this should be available
> already, otherwise download a copy and place it into `app/` or whichever directory
> you are compiling assets from. You can alternatively require a zepto instance.
> you are compiling assets from.

The `#alert` method is provided by `opal-jquery`. If the message displays, then
`jquery` support should be working.
Expand All @@ -102,10 +98,6 @@ bridged instances of jquery objects. Just like ruby arrays are just javascript
arrays, `Element` instances are just jquery objects. This makes interaction
with jquery plugins much easier.

Also, `Element` will try to bridge with Zepto if it cannot find jQuery loaded,
making it ideal for mobile applications as well.




## Interacting with the DOM
Expand Down
7 changes: 1 addition & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require 'bundler'
Bundler.require
Bundler::GemHelper.install_tasks

ENV['RUNNER'] = 'chrome'
ENV['RUNNER'] ||= 'chrome'

require 'opal/rspec/rake_task'
Opal::RSpec::RakeTask.new(:default) do |server, task|
Expand All @@ -15,11 +15,6 @@ Opal::RSpec::RakeTask.new(:jquery3) do |server, task|
task.default_path = 'spec-opal'
end

Opal::RSpec::RakeTask.new(:zepto) do |server, task|
server.index_path = 'spec-opal/zepto/index.html.erb'
task.default_path = 'spec-opal'
end

desc "Build build/opal-jquery.js"
task :dist do
require 'fileutils'
Expand Down
14 changes: 14 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "opal-jquery"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
8 changes: 2 additions & 6 deletions lib/opal/jquery/constants.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
require 'native'

unless defined?(JQUERY_CLASS)
case
when `!!Opal.global.jQuery`
if `!!Opal.global.jQuery`
JQUERY_CLASS = JQUERY_SELECTOR = `Opal.global.jQuery`
when `!!Opal.global.Zepto`
JQUERY_SELECTOR = `Opal.global.Zepto`
JQUERY_CLASS = `Opal.global.Zepto.zepto.Z`
else
raise NameError, "Can't find jQuery or Zepto. jQuery must be included before opal-jquery"
raise NameError, "Can't find jQuery. jQuery must be included before opal-jquery."
end
end
7 changes: 4 additions & 3 deletions opal-jquery.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ['lib']

s.add_runtime_dependency 'opal', ['>= 0.10.0', '< 2.0']
s.add_development_dependency 'opal-rspec', ['>= 0.7', '< 2.0']
s.add_development_dependency 'opal-sprockets', ['>= 0.4.1', '< 2.0']
s.add_runtime_dependency 'opal', '>= 0.11.4', '< 1.1'
s.add_development_dependency 'opal-rspec', '~> 0.8.0.alpha2'
s.add_development_dependency 'opal-sprockets', '~> 0.4.1'
s.add_development_dependency 'yard'
s.add_development_dependency 'rake'
s.add_development_dependency 'puma'
end
4 changes: 3 additions & 1 deletion spec-opal/element/expose_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
end

it 'does not call method_missing after the method is exposed' do
pending "broken on opal < 0.11" if RUBY_ENGINE_VERSION.to_f < 0.11
unless RUBY_ENGINE_VERSION.start_with? '0.11.'
pending "broken on opal < 0.11 and = 1.0"
end

expect(element).to receive(:method_missing).once.with(:exposableMethod)
def element.method_missing(name)
Expand Down
1 change: 1 addition & 0 deletions spec-opal/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ def async(*args, &block)
config.extend SkipAsync
config.formatter = :doc
config.color = true
config.tty = true
end
10 changes: 0 additions & 10 deletions spec-opal/zepto/index.html.erb

This file was deleted.

2 changes: 0 additions & 2 deletions spec-opal/zepto/zepto.js

This file was deleted.