From e6b22dcabb4de67d2287d1357a459bf814b91988 Mon Sep 17 00:00:00 2001 From: hmdne <54514036+hmdne@users.noreply.github.com> Date: Wed, 10 Nov 2021 11:18:53 +0100 Subject: [PATCH 1/5] Update CI to account for Opal 1.3 release --- .github/workflows/build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d4312e..ffa4fb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,19 +19,19 @@ jobs: browser: chrome os: ubuntu-latest opal: master - - name: Chromium/Linux/Opal-master/PromiseV2 + - name: Chromium/Linux/Opal-1.3/PromiseV2 browser: chrome os: ubuntu-latest - opal: master + opal: 1.3 promise: v2 - - name: Chromium/Linux/Opal-1.2 + - name: Chromium/Linux/Opal-1.3 browser: chrome os: ubuntu-latest - opal: 1.2 - - name: Chromium/Linux/Opal-1.1 + opal: 1.3 + - name: Chromium/Linux/Opal-1.2 browser: chrome os: ubuntu-latest - opal: 1.1 + opal: 1.2 - name: Chromium/Linux/Opal-1.0 browser: chrome os: ubuntu-latest @@ -72,7 +72,7 @@ jobs: - uses: actions/checkout@v2 - name: set environment variables run: | - echo "OPAL_VERSION=${{ matrix.combo.opal || '1.2' }}" >> $GITHUB_ENV + echo "OPAL_VERSION=${{ matrix.combo.opal || '1.3' }}" >> $GITHUB_ENV echo "OPAL_BROWSER_PROMISE=${{ matrix.combo.promise || 'v1' }}" >> $GITHUB_ENV - uses: ruby/setup-ruby@v1 with: From cd54f3e1b9a12e40949ec43e7cc0a1da69cc11bd Mon Sep 17 00:00:00 2001 From: hmdne <54514036+hmdne@users.noreply.github.com> Date: Wed, 17 Nov 2021 12:51:25 +0100 Subject: [PATCH 2/5] Fix error reporting for the runner if body isn't defined --- index.html.erb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.html.erb b/index.html.erb index 0c595b0..28142ab 100644 --- a/index.html.erb +++ b/index.html.erb @@ -2,7 +2,8 @@ Opal Browser - RSpec Runner - + + <%= javascript_include_tag @server.main %> - - From e8fca80b090fa10b20b28ed9d7f2e5815fcac3cd Mon Sep 17 00:00:00 2001 From: hmdne <54514036+hmdne@users.noreply.github.com> Date: Wed, 17 Nov 2021 12:51:43 +0100 Subject: [PATCH 3/5] Correct an Opal 1.3 compatibility issue --- Gemfile | 4 ++-- opal/browser/socket.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 8a185e0..8610bc3 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gem 'rack' gem 'sinatra' gem 'sinatra-websocket' # For opal-rspec, a release is needed -gem 'opal-rspec', github: 'opal/opal-rspec', submodules: true # '>= 0.8.0.alpha1' +gem 'opal-rspec', github: 'hmdne/opal-rspec', branch: 'opal-1.3', submodules: true # '>= 0.8.0.alpha1' gem 'opal-sprockets' # Force build of eventmachine on Windows gem 'eventmachine', github: 'eventmachine/eventmachine' if RUBY_PLATFORM =~ /mingw/ @@ -16,7 +16,7 @@ gem 'eventmachine', github: 'eventmachine/eventmachine' if RUBY_PLATFORM =~ /min # runner gem 'selenium-webdriver', require: false gem 'rest-client', require: false -gem 'webdrivers', github: 'hmdne/webdrivers', require: false +gem 'webdrivers', require: false gem 'rexml', require: false # browser diff --git a/opal/browser/socket.rb b/opal/browser/socket.rb index a169274..1b879d7 100644 --- a/opal/browser/socket.rb +++ b/opal/browser/socket.rb @@ -4,13 +4,13 @@ module Browser # connection. # # @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket -class Socket +class Socket < IO def self.supported? Browser.supports? :WebSocket end include Native::Wrapper - include IO::Writable + include IO::Writable if defined? IO::Writable include Event::Target target {|value| From 02bcb91ba8047e464f1124fb4dfec4161be7e31e Mon Sep 17 00:00:00 2001 From: hmdne <54514036+hmdne@users.noreply.github.com> Date: Wed, 17 Nov 2021 13:45:13 +0100 Subject: [PATCH 4/5] Opal v1.3 compatibility for new super semantics --- examples/component/app/application.rb | 3 ++- opal/browser/dom/node.rb | 5 +++++ spec/dom/element/custom_spec.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/component/app/application.rb b/examples/component/app/application.rb index f18af1c..2d91e47 100644 --- a/examples/component/app/application.rb +++ b/examples/component/app/application.rb @@ -1,5 +1,6 @@ require "opal" require "console" +require "promise" require "browser/setup/full" # Let's test some element before we have been initialized. @@ -15,7 +16,7 @@ class MyCounter < Browser::DOM::Element::Custom self.observed_attributes = %w[value] - def initialize + def initialize(node) super end diff --git a/opal/browser/dom/node.rb b/opal/browser/dom/node.rb index 0b35e60..297c36b 100644 --- a/opal/browser/dom/node.rb +++ b/opal/browser/dom/node.rb @@ -38,6 +38,11 @@ def self.new(value) end end + def initialize(node) + raise ArgumentError, "Please ensure that #initialize of #{self.class} accepts one argument" unless node + super + end + # Return true of the other element is the same underlying DOM node. # # @return [Boolean] diff --git a/spec/dom/element/custom_spec.rb b/spec/dom/element/custom_spec.rb index e6e917e..9396b39 100644 --- a/spec/dom/element/custom_spec.rb +++ b/spec/dom/element/custom_spec.rb @@ -8,7 +8,7 @@ def create_custom_class(name, observed_attrs = []) Class.new(Browser::DOM::Element::Custom) do - def initialize + def initialize(node) super $scratchpad[:initialized] = true end From c5662c9a60df687844b5088e0faa24326797c521 Mon Sep 17 00:00:00 2001 From: hmdne <54514036+hmdne@users.noreply.github.com> Date: Wed, 17 Nov 2021 14:14:21 +0100 Subject: [PATCH 5/5] Release preparations --- Gemfile | 4 +--- README.md | 1 - Rakefile | 1 + opal-browser.gemspec | 2 +- opal/browser/version.rb | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 8610bc3..5a25001 100644 --- a/Gemfile +++ b/Gemfile @@ -27,6 +27,4 @@ when /\./ else gem 'opal', github: 'opal/opal', ref: ENV['OPAL_VERSION'] end -# At this time, we need to use a branch. Please see: -# https://github.com/meh/paggio/issues/7 -gem 'paggio', github: 'hmdne/paggio' + diff --git a/README.md b/README.md index 1ec71c8..cd85f52 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ _Gemfile_ ```ruby source 'https://rubygems.org/' -gem 'paggio', github: 'hmdne/paggio' gem 'opal-browser' ``` diff --git a/Rakefile b/Rakefile index 5f45d7c..372d811 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,6 @@ require 'bundler' Bundler.require +require 'bundler/gem_tasks' require 'webdrivers' load 'webdrivers/Rakefile' diff --git a/opal-browser.gemspec b/opal-browser.gemspec index 4f6fe45..7fde14e 100644 --- a/opal-browser.gemspec +++ b/opal-browser.gemspec @@ -17,5 +17,5 @@ Gem::Specification.new {|s| s.require_paths = ['lib'] s.add_dependency 'opal', ['>= 1.0', '< 2.0'] - s.add_dependency 'paggio' + s.add_dependency 'paggio', '>= 0.3.0' } diff --git a/opal/browser/version.rb b/opal/browser/version.rb index bbe6aba..dfa3555 100644 --- a/opal/browser/version.rb +++ b/opal/browser/version.rb @@ -1,3 +1,3 @@ module Browser - VERSION = '0.2.0' + VERSION = '0.3.0' end