diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..fbb52ce2f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/.idea/
+/ruby/**/*.gem
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 3da3e22aa..fc3867f3b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,13 @@
-dist: xenial
+dist: focal
+
+env:
+ global:
+ - PGUSER=postgres
+ - PGPORT=5432
+ - PGHOST=localhost
addons:
+ postgresql: '12'
apt:
sources:
- sourceline: 'deb http://dl.yarnpkg.com/debian/ stable main'
@@ -8,12 +15,11 @@ addons:
- sourceline: 'deb http://dl.google.com/linux/chrome/deb/ stable main'
key_url: 'https://dl-ssl.google.com/linux/linux_signing_key.pub'
packages:
- - postgresql-11
- chromium-chromedriver
- google-chrome-stable
- yarn
- redis-server
- postgresql: '11'
+ - postgresql-12
_test_gem_pg: &_test_gem_pg
stage: test
@@ -25,11 +31,9 @@ _test_gem_pg: &_test_gem_pg
- node_modules # NPM packages
before_install:
- - echo 'installing postgresql'
- - sudo sed -i 's/port = 5433/port = 5432/' /etc/postgresql/11/main/postgresql.conf
- - sudo cp /etc/postgresql/{9.6,11}/main/pg_hba.conf
- - sudo service postgresql stop
- - sudo service postgresql start 11
+ - sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/*/main/pg_hba.conf
+ - sudo service postgresql restart
+ - sleep 1
- postgres --version
- sudo rm -f /usr/local/bin/yarn
- nvm install 10
@@ -42,6 +46,8 @@ _test_gem_pg: &_test_gem_pg
- echo before_script $COMPONENT
- echo updating chrome driver
- cd ruby/$COMPONENT
+ - echo creating psql database
+ - psql -c 'create database hyper_mesh_test_db;' -U postgres
- bundle install --jobs=3 --retry=3
- bundle exec ruby -e 'require "webdrivers"; Webdrivers::Chromedriver.update; puts Webdrivers::Chromedriver.current_version'
- ls -la ~/.webdrivers
@@ -50,6 +56,7 @@ _test_gem_pg: &_test_gem_pg
- google-chrome --version
- which google-chrome
- yarn install
+
script:
- echo running script $COMPONENT
- DRIVER=travis bundle exec rake $TASK
@@ -78,12 +85,21 @@ _test_gem: &_test_gem
mariadb: '10.3'
services:
- redis-server
+
before_install:
- echo installing $COMPONENT
+ - sudo apt-get remove --purge mysql-server mysql-client mysql-common
+ - sudo apt-get autoremove
+ - sudo apt-get autoclean
+ - sudo rm -rf /var/lib/mysql
+ - sudo rm -rf /etc/mysql
+ - sudo apt install mariadb-server mariadb-client -y
+ - sudo apt-get install libmysqlclient-dev
+
# yarn is in /usr/local/bin/yarn version 1.3.2 and is not a package
# must remove this zombie for new yarn to work
- sudo rm -f /usr/local/bin/yarn
- - nvm install 10
+ - nvm install 14
- rvm install 2.6.3 # was 2.5.1
- gem install bundler
- echo 'install completed'
@@ -117,106 +133,133 @@ _deploy_gem: &_deploy_gem
jobs:
include:
- - <<: *_test_gem
- env: COMPONENT=rails-hyperstack RUBY_VERSION=2.5.1
- - <<: *_test_gem
- env: COMPONENT=hyper-spec RUBY_VERSION=2.5.1
- - <<: *_test_gem
- env: COMPONENT=hyper-trace RUBY_VERSION=2.5.1
- - <<: *_test_gem
- env: COMPONENT=hyperstack-config RUBY_VERSION=2.5.1
- - <<: *_test_gem
- env: COMPONENT=hyper-state RUBY_VERSION=2.5.1
- - <<: *_test_gem
- env: COMPONENT=hyper-component RUBY_VERSION=2.5.1
- - <<: *_test_gem
- env: COMPONENT=hyper-router RUBY_VERSION=2.5.1
- - <<: *_test_gem
- env: COMPONENT=hyper-store RUBY_VERSION=2.5.1
+ # - <<: *_test_gem
+ # env: COMPONENT=rails-hyperstack RUBY_VERSION=2.5.1
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-spec RUBY_VERSION=2.5.1
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-trace RUBY_VERSION=2.5.1
+ # - <<: *_test_gem
+ # env: COMPONENT=hyperstack-config RUBY_VERSION=2.5.1
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-state RUBY_VERSION=2.5.1
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-component RUBY_VERSION=2.5.1
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-router RUBY_VERSION=2.5.1
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-store RUBY_VERSION=2.5.1
- <<: *_test_gem
env: COMPONENT=hyper-operation RUBY_VERSION=2.5.1
- - <<: *_test_gem_pg
- env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 TASK=part1 DB=hyper_mesh_test_db
- - <<: *_test_gem_pg
- env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 TASK=part2 DB=hyper_mesh_test_db
- - <<: *_test_gem_pg
- env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 TASK=part3 DB=hyper_mesh_test_db
- - <<: *_test_gem
- env: COMPONENT=hyper-i18n RUBY_VERSION=2.5.1
+ # - <<: *_test_gem_pg
+ # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 TASK=part1 DB=hyper_mesh_test_db
+ # - <<: *_test_gem_pg
+ # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 TASK=part2 DB=hyper_mesh_test_db
+ # - <<: *_test_gem_pg
+ # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 TASK=part3 DB=hyper_mesh_test_db
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-i18n RUBY_VERSION=2.5.1
- - <<: *_test_gem
- env: COMPONENT=rails-hyperstack RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-spec RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-trace RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyperstack-config RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-state RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-component RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-router RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-store RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-operation RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
- - <<: *_test_gem_pg
- env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0' TASK=part1 DB=hyper_mesh_test_db
- - <<: *_test_gem_pg
- env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0' TASK=part2 DB=hyper_mesh_test_db
- - <<: *_test_gem_pg
- env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0' TASK=part3 DB=hyper_mesh_test_db
- - <<: *_test_gem
- env: COMPONENT=hyper-i18n RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=rails-hyperstack RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-spec RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-trace RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyperstack-config RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-state RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-component RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-router RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-store RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-operation RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem_pg
+ # # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0' TASK=part1 DB=hyper_mesh_test_db
+ # # - <<: *_test_gem_pg
+ # # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0' TASK=part2 DB=hyper_mesh_test_db
+ # # - <<: *_test_gem_pg
+ # # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0' TASK=part3 DB=hyper_mesh_test_db
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-i18n RUBY_VERSION=2.5.1 OPAL_VERSION='~>0.11' RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=rails-hyperstack RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-spec RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-trace RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyperstack-config RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-state RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-component RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-router RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-store RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
- - <<: *_test_gem
- env: COMPONENT=hyper-operation RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
- - <<: *_test_gem_pg
- env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0' TASK=part1 DB=hyper_mesh_test_db
- - <<: *_test_gem_pg
- env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0' TASK=part2 DB=hyper_mesh_test_db
- - <<: *_test_gem_pg
- env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0' TASK=part3 DB=hyper_mesh_test_db
- - <<: *_test_gem
- env: COMPONENT=hyper-i18n RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
-
- - <<: *_deploy_gem
- env: COMPONENT=hyper-i18n
- - <<: *_deploy_gem
- env: COMPONENT=hyper-trace
- - <<: *_deploy_gem
- env: COMPONENT=hyper-state
- - <<: *_deploy_gem
- env: COMPONENT=hyper-component
- - <<: *_deploy_gem
- env: COMPONENT=hyper-model
- - <<: *_deploy_gem
- env: COMPONENT=hyper-operation
- - <<: *_deploy_gem
- env: COMPONENT=hyper-router
- - <<: *_deploy_gem
- env: COMPONENT=hyper-spec
- - <<: *_deploy_gem
- env: COMPONENT=hyper-store
- - <<: *_deploy_gem
- env: COMPONENT=rails-hyperstack
- - <<: *_deploy_gem
- env: COMPONENT=hyperstack-config
+ # - <<: *_test_gem
+ # env: COMPONENT=rails-hyperstack RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0'
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-spec RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0'
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-trace RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0'
+ # - <<: *_test_gem
+ # env: COMPONENT=hyperstack-config RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0'
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-state RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0'
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-component RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0'
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-router RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0'
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-store RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0'
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-operation RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0'
+ # - <<: *_test_gem_pg
+ # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0' TASK=part1 DB=hyper_mesh_test_db
+ # - <<: *_test_gem_pg
+ # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0' TASK=part2 DB=hyper_mesh_test_db
+ # - <<: *_test_gem_pg
+ # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0' TASK=part3 DB=hyper_mesh_test_db
+ # - <<: *_test_gem
+ # env: COMPONENT=hyper-i18n RUBY_VERSION=2.5.1 RAILS_VERSION='~>6.0.0'
+
+ # # - <<: *_test_gem
+ # # env: COMPONENT=rails-hyperstack RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-spec RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-trace RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyperstack-config RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-state RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-component RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-router RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-store RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-operation RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
+ # # - <<: *_test_gem_pg
+ # # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0' TASK=part1 DB=hyper_mesh_test_db
+ # # - <<: *_test_gem_pg
+ # # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0' TASK=part2 DB=hyper_mesh_test_db
+ # # - <<: *_test_gem_pg
+ # # env: COMPONENT=hyper-model RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0' TASK=part3 DB=hyper_mesh_test_db
+ # # - <<: *_test_gem
+ # # env: COMPONENT=hyper-i18n RUBY_VERSION=2.5.1 RAILS_VERSION='~>5.0'
+
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=hyper-i18n
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=hyper-trace
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=hyper-state
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=hyper-component
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=hyper-model
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=hyper-operation
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=hyper-router
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=hyper-spec
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=hyper-store
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=rails-hyperstack
+ # # - <<: *_deploy_gem
+ # # env: COMPONENT=hyperstack-config
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..975275ee8
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,28 @@
+ARG PRIVATE_REGISTRY=ci.ru.aegean.gr:5000
+FROM ${PRIVATE_REGISTRY}/base20:ruby
+
+RUN apt-get -y update && apt-get -y install mariadb-server mariadb-client libmysqlclient-dev postgresql postgresql-contrib
+
+ARG RUBY_VERSION_TO_INSTALL1=2.7.8
+RUN rbenv install ${RUBY_VERSION_TO_INSTALL1} && rbenv global ${RUBY_VERSION_TO_INSTALL1} \
+&& rbenv rehash && gem install bundler
+
+ARG RUBY_VERSION_TO_INSTALL2=3.0.6
+RUN rbenv install ${RUBY_VERSION_TO_INSTALL2} && rbenv global ${RUBY_VERSION_TO_INSTALL2} \
+&& rbenv rehash && gem install bundler
+
+ARG RUBY_VERSION_TO_INSTALL3=3.1.4
+RUN rbenv install ${RUBY_VERSION_TO_INSTALL3} && rbenv global ${RUBY_VERSION_TO_INSTALL3} \
+&& rbenv rehash && gem install bundler
+
+ARG RUBY_VERSION_TO_INSTALL4=3.2.2
+RUN rbenv install ${RUBY_VERSION_TO_INSTALL4} && rbenv global ${RUBY_VERSION_TO_INSTALL4} \
+&& rbenv rehash && gem install bundler
+
+ENV PGUSER=postgres
+ENV PGPORT=5432
+ENV PGHOST=localhost
+
+RUN sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/*/main/pg_hba.conf
+
+RUN git config --global --add safe.directory /root/hyperstack
\ No newline at end of file
diff --git a/HYPERSTACK_VERSION b/HYPERSTACK_VERSION
index d499b98ff..c969e7ed6 100644
--- a/HYPERSTACK_VERSION
+++ b/HYPERSTACK_VERSION
@@ -1 +1 @@
-1.0.0.alpha1
+'1.0.alpha1.8.0017'
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 000000000..d17dce33b
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,27 @@
+require './ruby/version'
+desc 'Publish hyperstack gems to private dir'
+task :publish do
+ base_path = ENV['PWD']
+ sh "gem", "install", "geminabox"
+ # hyper-console
+ %w{
+ hyper-component
+ hyper-i18n
+ hyper-model
+ hyper-operation
+ hyper-router
+ hyper-spec
+ hyper-state
+ hyper-store
+ hyper-trace
+ hyperstack-config
+ rails-hyperstack
+ }.each do|gem|
+ puts "Publishing #{gem} gem"
+ Dir.chdir("#{base_path}/ruby/#{gem}") do
+ #sh ['bundle', 'update']
+ sh 'gem' ,'build', "#{gem}.gemspec"
+ sh 'gem' ,'inabox' ,"#{gem}-#{Hyperstack::VERSION.tr("'",'')}.gem" ,'-g' ,"https://michail:#{ENV['GEM_SERVER_KEY']}@gems.ru.aegean.gr"
+ end
+ end
+end
diff --git a/create-docker-image b/create-docker-image
new file mode 100755
index 000000000..5ab9c8e74
--- /dev/null
+++ b/create-docker-image
@@ -0,0 +1,5 @@
+#!/bin/bash
+#docker run -it -v .:/root/hyperstack ${PRIVATE_REGISTRY}/base20:hyperstack /bin/bash
+
+docker build -t ${PRIVATE_REGISTRY}/base20:hyperstack .
+docker push ${PRIVATE_REGISTRY}/base20:hyperstack
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100755
index 000000000..2d1b698e9
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,54 @@
+version: '3.5'
+
+volumes:
+ local_gems:
+ external: true
+ name: local_gems
+# rails_cache:
+# node_modules:
+# packs:
+# packs-test:
+
+networks:
+ default:
+ name: development_network
+ driver: bridge
+ ipam:
+ driver: default
+ config:
+ - subnet: ${CONTAINER_SUBNET}
+
+
+services:
+ #############################
+ # Setup the base containers #
+ #############################
+
+ hyperstack:
+ image: ${PRIVATE_REGISTRY}/base20:hyperstack
+ domainname: ${BASE_TEST_DOMAIN}
+ hostname: hyperstack
+ container_name: "hyperstack"
+ entrypoint: ./runone
+ stdin_open: true
+ tty: true
+ working_dir: /root/hyperstack
+ environment:
+ BUNDLE_PATH: "/root/local_gems"
+ DRIVER: "${DRIVER}" # "travis"
+ COMPONENT: "${COMPONENT}"
+ RUBY_VERSION: ${RUBY_VERSION}"
+# RUBY_VERSION: "3.2.2" #"${RUBY_VERSION}"
+# RUBY_VERSION: "3.1.4" #"${RUBY_VERSION}"
+# RUBY_VERSION: "3.0.6" #"${RUBY_VERSION}"
+# RUBY_VERSION: "2.7.8" #"${RUBY_VERSION}"
+# OPAL_VERSION: "1.7.3" #"${OPAL_VERSION}"
+# OPAL_VERSION: "1.6.1" #"${OPAL_VERSION}"
+ OPAL_VERSION: "1.5.1" #"${OPAL_VERSION}"
+ TASK: "${TASK}"
+ DB: "${DB}"
+ volumes:
+ - ${MOUNT_PATH:-..}/hyperstack:/root/hyperstack
+ - local_gems:/root/local_gems
+ networks:
+ default:
diff --git a/docs/specs/Gemfile.lock b/docs/specs/Gemfile.lock
deleted file mode 100644
index 106146aea..000000000
--- a/docs/specs/Gemfile.lock
+++ /dev/null
@@ -1,443 +0,0 @@
-PATH
- remote: ../../ruby/hyper-component
- specs:
- hyper-component (1.0.alpha1.7)
- hyper-state (= 1.0.alpha1.7)
- hyperstack-config (= 1.0.alpha1.7)
- opal-activesupport (~> 0.3.1)
- react-rails (>= 2.4.0, < 2.5.0)
-
-PATH
- remote: ../../ruby/hyper-model
- specs:
- hyper-model (1.0.alpha1.7)
- activemodel
- activerecord (>= 4.0.0)
- hyper-operation (= 1.0.alpha1.7)
-
-PATH
- remote: ../../ruby/hyper-operation
- specs:
- hyper-operation (1.0.alpha1.7)
- activerecord (>= 4.0.0)
- hyper-component (= 1.0.alpha1.7)
- mutations
- opal-activesupport (~> 0.3.1)
- tty-table
-
-PATH
- remote: ../../ruby/hyper-router
- specs:
- hyper-router (1.0.alpha1.7)
- hyper-component (= 1.0.alpha1.7)
- hyper-state (= 1.0.alpha1.7)
- opal-browser (~> 0.2.0)
-
-PATH
- remote: ../../ruby/hyper-spec
- specs:
- hyper-spec (1.0.alpha1.7)
- actionview
- capybara
- chromedriver-helper (= 1.2.0)
- filecache
- method_source
- opal (>= 0.11.0, < 2.0)
- parser
- rspec
- selenium-webdriver
- timecop (~> 0.8.1)
- uglifier
- unparser (>= 0.4.2)
- webdrivers
-
-PATH
- remote: ../../ruby/hyper-state
- specs:
- hyper-state (1.0.alpha1.7)
- hyperstack-config (= 1.0.alpha1.7)
-
-PATH
- remote: ../../ruby/hyperstack-config
- specs:
- hyperstack-config (1.0.alpha1.7)
- listen (~> 3.0)
- opal (>= 0.11.0, < 2.0)
- opal-browser (~> 0.2.0)
- uglifier
- websocket
-
-PATH
- remote: ../../ruby/rails-hyperstack
- specs:
- rails-hyperstack (1.0.alpha1.7)
- hyper-model (= 1.0.alpha1.7)
- hyper-router (= 1.0.alpha1.7)
- hyperstack-config (= 1.0.alpha1.7)
- opal-browser (~> 0.2.0)
- opal-rails
- rails (>= 5.0.0, < 7.0)
- react-rails (>= 2.4.0, < 2.5.0)
-
-GEM
- remote: https://rubygems.org/
- specs:
- abstract_type (0.0.7)
- actioncable (5.2.4.5)
- actionpack (= 5.2.4.5)
- nio4r (~> 2.0)
- websocket-driver (>= 0.6.1)
- actionmailer (5.2.4.5)
- actionpack (= 5.2.4.5)
- actionview (= 5.2.4.5)
- activejob (= 5.2.4.5)
- mail (~> 2.5, >= 2.5.4)
- rails-dom-testing (~> 2.0)
- actionpack (5.2.4.5)
- actionview (= 5.2.4.5)
- activesupport (= 5.2.4.5)
- rack (~> 2.0, >= 2.0.8)
- rack-test (>= 0.6.3)
- rails-dom-testing (~> 2.0)
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
- actionview (5.2.4.5)
- activesupport (= 5.2.4.5)
- builder (~> 3.1)
- erubi (~> 1.4)
- rails-dom-testing (~> 2.0)
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
- activejob (5.2.4.5)
- activesupport (= 5.2.4.5)
- globalid (>= 0.3.6)
- activemodel (5.2.4.5)
- activesupport (= 5.2.4.5)
- activerecord (5.2.4.5)
- activemodel (= 5.2.4.5)
- activesupport (= 5.2.4.5)
- arel (>= 9.0)
- activestorage (5.2.4.5)
- actionpack (= 5.2.4.5)
- activerecord (= 5.2.4.5)
- marcel (~> 0.3.1)
- activesupport (5.2.4.5)
- concurrent-ruby (~> 1.0, >= 1.0.2)
- i18n (>= 0.7, < 2)
- minitest (~> 5.1)
- tzinfo (~> 1.1)
- adamantium (0.2.0)
- ice_nine (~> 0.11.0)
- memoizable (~> 0.4.0)
- addressable (2.7.0)
- public_suffix (>= 2.0.2, < 5.0)
- anima (0.3.2)
- abstract_type (~> 0.0.7)
- adamantium (~> 0.2)
- equalizer (~> 0.0.11)
- archive-zip (0.12.0)
- io-like (~> 0.3.0)
- arel (9.0.0)
- ast (2.4.2)
- babel-source (5.8.35)
- babel-transpiler (0.7.0)
- babel-source (>= 4.0, < 6)
- execjs (~> 2.0)
- bindex (0.8.1)
- bootsnap (1.7.2)
- msgpack (~> 1.0)
- builder (3.2.4)
- byebug (11.1.3)
- capybara (3.35.3)
- addressable
- mini_mime (>= 0.1.3)
- nokogiri (~> 1.8)
- rack (>= 1.6.0)
- rack-test (>= 0.6.3)
- regexp_parser (>= 1.5, < 3.0)
- xpath (~> 3.2)
- childprocess (3.0.0)
- chromedriver-helper (1.2.0)
- archive-zip (~> 0.10)
- nokogiri (~> 1.8)
- coderay (1.1.3)
- coffee-rails (4.2.2)
- coffee-script (>= 2.2.0)
- railties (>= 4.0.0)
- coffee-script (2.4.1)
- coffee-script-source
- execjs
- coffee-script-source (1.12.2)
- concord (0.1.6)
- adamantium (~> 0.2.0)
- equalizer (~> 0.0.9)
- concurrent-ruby (1.1.8)
- connection_pool (2.2.3)
- crass (1.0.6)
- diff-lcs (1.4.4)
- equalizer (0.0.11)
- erubi (1.10.0)
- execjs (2.7.0)
- ffi (1.15.0)
- filecache (1.0.2)
- foreman (0.87.2)
- globalid (0.4.2)
- activesupport (>= 4.2.0)
- i18n (1.8.9)
- concurrent-ruby (~> 1.0)
- ice_nine (0.11.2)
- io-like (0.3.1)
- jbuilder (2.11.2)
- activesupport (>= 5.0.0)
- jquery-rails (4.4.0)
- rails-dom-testing (>= 1, < 3)
- railties (>= 4.2.0)
- thor (>= 0.14, < 2.0)
- listen (3.1.5)
- rb-fsevent (~> 0.9, >= 0.9.4)
- rb-inotify (~> 0.9, >= 0.9.7)
- ruby_dep (~> 1.2)
- loofah (2.9.0)
- crass (~> 1.0.2)
- nokogiri (>= 1.5.9)
- mail (2.7.1)
- mini_mime (>= 0.1.1)
- marcel (0.3.3)
- mimemagic (~> 0.3.2)
- memoizable (0.4.2)
- thread_safe (~> 0.3, >= 0.3.1)
- method_source (1.0.0)
- mimemagic (0.3.5)
- mini_mime (1.0.2)
- mini_portile2 (2.5.0)
- minitest (5.14.4)
- mprelude (0.1.0)
- abstract_type (~> 0.0.7)
- adamantium (~> 0.2.0)
- concord (~> 0.1.5)
- equalizer (~> 0.0.9)
- ice_nine (~> 0.11.1)
- procto (~> 0.0.2)
- msgpack (1.4.2)
- mutations (0.9.1)
- activesupport
- nio4r (2.5.7)
- nokogiri (1.11.2)
- mini_portile2 (~> 2.5.0)
- racc (~> 1.4)
- opal (1.0.5)
- ast (>= 2.3.0)
- parser (~> 2.6)
- opal-activesupport (0.3.3)
- opal (>= 0.5.0, < 2)
- opal-browser (0.2.0)
- opal
- paggio
- opal-jquery (0.4.4)
- opal (>= 0.10.0, < 1.1)
- opal-rails (1.1.2)
- jquery-rails
- opal (~> 1.0.0)
- opal-activesupport (>= 0.0.5)
- opal-jquery (~> 0.4.4)
- opal-sprockets (~> 0.4.6)
- rails (>= 5.1, < 6.1)
- sprockets-rails (>= 2.3.3, < 4.0)
- opal-sprockets (0.4.9.1.0.3.7)
- opal (~> 1.0.0)
- sprockets (~> 3.7)
- tilt (>= 1.4)
- paggio (0.2.6)
- parser (2.7.2.0)
- ast (~> 2.4.1)
- pastel (0.8.0)
- tty-color (~> 0.5)
- procto (0.0.3)
- pry (0.14.0)
- coderay (~> 1.1)
- method_source (~> 1.0)
- public_suffix (4.0.6)
- puma (3.12.6)
- racc (1.5.2)
- rack (2.2.3)
- rack-proxy (0.6.5)
- rack
- rack-test (1.1.0)
- rack (>= 1.0, < 3)
- rails (5.2.4.5)
- actioncable (= 5.2.4.5)
- actionmailer (= 5.2.4.5)
- actionpack (= 5.2.4.5)
- actionview (= 5.2.4.5)
- activejob (= 5.2.4.5)
- activemodel (= 5.2.4.5)
- activerecord (= 5.2.4.5)
- activestorage (= 5.2.4.5)
- activesupport (= 5.2.4.5)
- bundler (>= 1.3.0)
- railties (= 5.2.4.5)
- sprockets-rails (>= 2.0.0)
- rails-dom-testing (2.0.3)
- activesupport (>= 4.2.0)
- nokogiri (>= 1.6)
- rails-html-sanitizer (1.3.0)
- loofah (~> 2.3)
- railties (5.2.4.5)
- actionpack (= 5.2.4.5)
- activesupport (= 5.2.4.5)
- method_source
- rake (>= 0.8.7)
- thor (>= 0.19.0, < 2.0)
- rake (13.0.3)
- rb-fsevent (0.10.4)
- rb-inotify (0.10.1)
- ffi (~> 1.0)
- react-rails (2.4.7)
- babel-transpiler (>= 0.7.0)
- connection_pool
- execjs
- railties (>= 3.2)
- tilt
- regexp_parser (2.1.1)
- rspec (3.10.0)
- rspec-core (~> 3.10.0)
- rspec-expectations (~> 3.10.0)
- rspec-mocks (~> 3.10.0)
- rspec-core (3.10.1)
- rspec-support (~> 3.10.0)
- rspec-expectations (3.10.1)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.10.0)
- rspec-mocks (3.10.2)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.10.0)
- rspec-rails (5.0.1)
- actionpack (>= 5.2)
- activesupport (>= 5.2)
- railties (>= 5.2)
- rspec-core (~> 3.10)
- rspec-expectations (~> 3.10)
- rspec-mocks (~> 3.10)
- rspec-support (~> 3.10)
- rspec-support (3.10.2)
- ruby_dep (1.5.0)
- rubyzip (2.3.0)
- sass (3.7.4)
- sass-listen (~> 4.0.0)
- sass-listen (4.0.0)
- rb-fsevent (~> 0.9, >= 0.9.4)
- rb-inotify (~> 0.9, >= 0.9.7)
- sass-rails (5.1.0)
- railties (>= 5.2.0)
- sass (~> 3.1)
- sprockets (>= 2.8, < 4.0)
- sprockets-rails (>= 2.0, < 4.0)
- tilt (>= 1.1, < 3)
- selenium-webdriver (3.142.7)
- childprocess (>= 0.5, < 4.0)
- rubyzip (>= 1.2.2)
- semantic_range (3.0.0)
- spring (2.1.1)
- spring-watcher-listen (2.0.1)
- listen (>= 2.7, < 4.0)
- spring (>= 1.2, < 3.0)
- sprockets (3.7.2)
- concurrent-ruby (~> 1.0)
- rack (> 1, < 3)
- sprockets-rails (3.2.2)
- actionpack (>= 4.0)
- activesupport (>= 4.0)
- sprockets (>= 3.0.0)
- sqlite3 (1.4.2)
- strings (0.2.1)
- strings-ansi (~> 0.2)
- unicode-display_width (>= 1.5, < 3.0)
- unicode_utils (~> 1.4)
- strings-ansi (0.2.0)
- thor (1.1.0)
- thread_safe (0.3.6)
- tilt (2.0.10)
- timecop (0.8.1)
- tty-color (0.6.0)
- tty-screen (0.8.1)
- tty-table (0.12.0)
- pastel (~> 0.8)
- strings (~> 0.2.0)
- tty-screen (~> 0.8)
- turbolinks (5.2.1)
- turbolinks-source (~> 5.2)
- turbolinks-source (5.2.0)
- tzinfo (1.2.9)
- thread_safe (~> 0.1)
- uglifier (4.2.0)
- execjs (>= 0.3.0, < 3)
- unicode-display_width (2.0.0)
- unicode_utils (1.4.0)
- unparser (0.5.5)
- abstract_type (~> 0.0.7)
- adamantium (~> 0.2.0)
- anima (~> 0.3.1)
- concord (~> 0.1.5)
- diff-lcs (~> 1.3)
- equalizer (~> 0.0.9)
- mprelude (~> 0.1.0)
- parser (>= 2.6.5)
- procto (~> 0.0.2)
- web-console (3.7.0)
- actionview (>= 5.0)
- activemodel (>= 5.0)
- bindex (>= 0.4.0)
- railties (>= 5.0)
- webdrivers (4.6.0)
- nokogiri (~> 1.6)
- rubyzip (>= 1.3.0)
- selenium-webdriver (>= 3.0, < 4.0)
- webpacker (5.2.1)
- activesupport (>= 5.2)
- rack-proxy (>= 0.6.1)
- railties (>= 5.2)
- semantic_range (>= 2.3.0)
- websocket (1.2.9)
- websocket-driver (0.7.3)
- websocket-extensions (>= 0.1.0)
- websocket-extensions (0.1.5)
- xpath (3.2.0)
- nokogiri (~> 1.8)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- bootsnap (>= 1.1.0)
- byebug
- coffee-rails (~> 4.2)
- foreman
- hyper-component!
- hyper-model!
- hyper-operation!
- hyper-router!
- hyper-spec!
- hyper-state!
- hyperstack-config!
- jbuilder (~> 2.5)
- listen (>= 3.0.5, < 3.2)
- opal (= 1.0.5)
- opal-jquery
- pry
- puma (~> 3.11)
- rails (~> 5.2.4, >= 5.2.4.5)
- rails-hyperstack!
- rspec-rails
- sass-rails (~> 5.0)
- spring
- spring-watcher-listen (~> 2.0.0)
- sqlite3
- turbolinks (~> 5)
- tzinfo-data
- uglifier (>= 1.3.0)
- web-console (>= 3.3.0)
- webpacker
-
-RUBY VERSION
- ruby 2.7.2p137
-
-BUNDLED WITH
- 2.1.4
diff --git a/hyperstack.gocd.yaml b/hyperstack.gocd.yaml
new file mode 100644
index 000000000..af8e51ed1
--- /dev/null
+++ b/hyperstack.gocd.yaml
@@ -0,0 +1,281 @@
+format_version: 10
+common:
+ on_cancel: &cancel
+ exec: &exec_cancel
+ arguments:
+ - compose
+ - run
+ - --rm
+ - --entrypoint
+ - "/bin/bash -c 'chown -R 1000:1001 /root/hyperstack'"
+ - hyperstack
+ command: docker
+ run_if: any
+ test_jobs: &test_jobs
+ rails-hyperstack:
+ environment_variables:
+ COMPONENT: rails-hyperstack
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-spec:
+ environment_variables:
+ COMPONENT: hyper-spec
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-trace:
+ environment_variables:
+ COMPONENT: hyper-trace
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyperstack-config:
+ environment_variables:
+ COMPONENT: hyperstack-config
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-state:
+ environment_variables:
+ COMPONENT: hyper-state
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-component:
+ environment_variables:
+ COMPONENT: hyper-component
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-router:
+ environment_variables:
+ COMPONENT: hyper-router
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-store:
+ environment_variables:
+ COMPONENT: hyper-store
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-operation:
+ environment_variables:
+ COMPONENT: hyper-operation
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-model-part1:
+ environment_variables:
+ COMPONENT: hyper-model
+ TASK: part1
+ DB: hyper_mesh_test_db
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-model-part2:
+ environment_variables:
+ COMPONENT: hyper-model
+ TASK: part2
+ DB: hyper_mesh_test_db
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-model-part3:
+ environment_variables:
+ COMPONENT: hyper-model
+ TASK: part3
+ DB: hyper_mesh_test_db
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+ hyper-i18n:
+ environment_variables:
+ COMPONENT: hyper-i18n
+ timeout: 0
+ tasks:
+ - exec:
+ arguments:
+ - compose
+ - run
+ - --rm
+ - hyperstack
+ command: docker
+ run_if: passed
+ on_cancel: *cancel
+ - exec: *exec_cancel
+environments:
+ test:
+ pipelines:
+ - hyperstack
+ - hyperstack-build
+pipelines:
+ hyperstack-build:
+ group: hyperstack
+ label_template: ${COUNT}
+ lock_behavior: none
+ display_order: -1
+ materials:
+ hyperstack:
+ git: https://github.com/mpantel/hyperstack.git
+ shallow_clone: false
+ auto_update: true
+ branch: edge
+ stages:
+ - build:
+ fetch_materials: true
+ keep_artifacts: false
+ clean_workspace: false
+ approval:
+ type: manual
+ allow_only_on_success: false
+ jobs:
+ cleanup:
+ timeout: 0
+ tasks:
+ - exec:
+ command: ./create-docker-image
+ run_if: passed
+ hyperstack:
+ group: hyperstack
+ label_template: ${COUNT}
+ lock_behavior: none
+ display_order: -1
+ environment_variables:
+ DRIVER: travis
+ materials:
+ hyperstack:
+ git: https://github.com/mpantel/hyperstack.git
+ shallow_clone: false
+ auto_update: true
+ branch: edge
+ stages:
+ - ruby-version-2-7-8:
+ environment_variables:
+ RUBY_VERSION: 2.7.8
+ fetch_materials: true
+ keep_artifacts: false
+ clean_workspace: false
+ approval:
+ type: success
+ allow_only_on_success: false
+ jobs: *test_jobs
+ - ruby-version-3-0-6:
+ environment_variables:
+ RUBY_VERSION: 3.0.6
+ fetch_materials: true
+ keep_artifacts: false
+ clean_workspace: false
+ approval:
+ type: success
+ allow_only_on_success: false
+ jobs: *test_jobs
\ No newline at end of file
diff --git a/login_to_registry.sh b/login_to_registry.sh
new file mode 100755
index 000000000..4febf320c
--- /dev/null
+++ b/login_to_registry.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+docker login -u $LOGNAME -p $GEM_SERVER_KEY ${PRIVATE_REGISTRY}
\ No newline at end of file
diff --git a/ruby/examples/misc/sinatra_app/Gemfile.lock b/ruby/examples/misc/sinatra_app/Gemfile.lock
deleted file mode 100644
index 72b796b6e..000000000
--- a/ruby/examples/misc/sinatra_app/Gemfile.lock
+++ /dev/null
@@ -1,159 +0,0 @@
-PATH
- remote: ../../../hyper-spec
- specs:
- hyper-spec (1.0.alpha1.5)
- actionview
- capybara
- chromedriver-helper (= 1.2.0)
- filecache
- method_source
- opal (>= 0.11.0, < 2.0)
- parser (>= 2.3.3.1)
- rspec
- selenium-webdriver
- timecop (~> 0.8.1)
- uglifier
- unparser (>= 0.4.2)
- webdrivers
-
-GEM
- remote: https://rubygems.org/
- specs:
- actionview (6.1.3)
- activesupport (= 6.1.3)
- builder (~> 3.1)
- erubi (~> 1.4)
- rails-dom-testing (~> 2.0)
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
- activesupport (6.1.3)
- concurrent-ruby (~> 1.0, >= 1.0.2)
- i18n (>= 1.6, < 2)
- minitest (>= 5.1)
- tzinfo (~> 2.0)
- zeitwerk (~> 2.3)
- addressable (2.7.0)
- public_suffix (>= 2.0.2, < 5.0)
- archive-zip (0.12.0)
- io-like (~> 0.3.0)
- ast (2.4.2)
- builder (3.2.4)
- capybara (3.35.3)
- addressable
- mini_mime (>= 0.1.3)
- nokogiri (~> 1.8)
- rack (>= 1.6.0)
- rack-test (>= 0.6.3)
- regexp_parser (>= 1.5, < 3.0)
- xpath (~> 3.2)
- childprocess (3.0.0)
- chromedriver-helper (1.2.0)
- archive-zip (~> 0.10)
- nokogiri (~> 1.8)
- coderay (1.1.3)
- concurrent-ruby (1.1.8)
- crass (1.0.6)
- diff-lcs (1.4.4)
- erubi (1.10.0)
- execjs (2.7.0)
- filecache (1.0.2)
- i18n (1.8.9)
- concurrent-ruby (~> 1.0)
- io-like (0.3.1)
- loofah (2.9.0)
- crass (~> 1.0.2)
- nokogiri (>= 1.5.9)
- method_source (1.0.0)
- mini_mime (1.0.2)
- mini_portile2 (2.5.0)
- minitest (5.14.4)
- mustermann (1.1.1)
- ruby2_keywords (~> 0.0.1)
- nio4r (2.5.7)
- nokogiri (1.11.2)
- mini_portile2 (~> 2.5.0)
- racc (~> 1.4)
- opal (1.1.1)
- ast (>= 2.3.0)
- parser (~> 3.0)
- opal-sprockets (1.0.0)
- opal (>= 1.0, < 1.2)
- sprockets (~> 4.0)
- tilt (>= 1.4)
- parser (3.0.0.0)
- ast (~> 2.4.1)
- pry (0.14.0)
- coderay (~> 1.1)
- method_source (~> 1.0)
- public_suffix (4.0.6)
- puma (5.2.2)
- nio4r (~> 2.0)
- racc (1.5.2)
- rack (2.2.3)
- rack-protection (2.1.0)
- rack
- rack-test (1.1.0)
- rack (>= 1.0, < 3)
- rails-dom-testing (2.0.3)
- activesupport (>= 4.2.0)
- nokogiri (>= 1.6)
- rails-html-sanitizer (1.3.0)
- loofah (~> 2.3)
- regexp_parser (2.1.1)
- rspec (3.10.0)
- rspec-core (~> 3.10.0)
- rspec-expectations (~> 3.10.0)
- rspec-mocks (~> 3.10.0)
- rspec-core (3.10.1)
- rspec-support (~> 3.10.0)
- rspec-expectations (3.10.1)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.10.0)
- rspec-mocks (3.10.2)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.10.0)
- rspec-support (3.10.2)
- ruby2_keywords (0.0.4)
- rubyzip (2.3.0)
- selenium-webdriver (3.142.7)
- childprocess (>= 0.5, < 4.0)
- rubyzip (>= 1.2.2)
- sinatra (2.1.0)
- mustermann (~> 1.0)
- rack (~> 2.2)
- rack-protection (= 2.1.0)
- tilt (~> 2.0)
- sprockets (4.0.2)
- concurrent-ruby (~> 1.0)
- rack (> 1, < 3)
- tilt (2.0.10)
- timecop (0.8.1)
- tzinfo (2.0.4)
- concurrent-ruby (~> 1.0)
- uglifier (4.2.0)
- execjs (>= 0.3.0, < 3)
- unparser (0.6.0)
- diff-lcs (~> 1.3)
- parser (>= 3.0.0)
- webdrivers (4.6.0)
- nokogiri (~> 1.6)
- rubyzip (>= 1.3.0)
- selenium-webdriver (>= 3.0, < 4.0)
- xpath (3.2.0)
- nokogiri (~> 1.8)
- zeitwerk (2.4.2)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- hyper-spec!
- opal
- opal-sprockets
- pry
- puma
- rack
- rspec
- sinatra
-
-BUNDLED WITH
- 2.1.4
diff --git a/ruby/hyper-component/Gemfile b/ruby/hyper-component/Gemfile
index 7bb59f443..052aad50c 100644
--- a/ruby/hyper-component/Gemfile
+++ b/ruby/hyper-component/Gemfile
@@ -4,9 +4,9 @@ gem 'hyper-spec', path: '../hyper-spec'
gem 'hyperstack-config', path: '../hyperstack-config'
gem 'hyper-store', path: '../hyper-store'
gem 'hyper-state', path: '../hyper-state'
-unless ENV['OPAL_VERSION']&.match("0.11")
- gem 'opal-browser', git: 'https://github.com/opal/opal-browser'
-end
+# unless ENV['OPAL_VERSION']&.match("0.11")
+# gem 'opal-browser', git: 'https://github.com/opal/opal-browser'
+# end
gem 'hyper-trace', path: '../hyper-trace'
#gem 'puma', '~> 3.11.0' # As of adding, version 3.12.0 isn't working so we are locking
diff --git a/ruby/hyper-component/hyper-component.gemspec b/ruby/hyper-component/hyper-component.gemspec
index 8239235dc..b27b23be7 100644
--- a/ruby/hyper-component/hyper-component.gemspec
+++ b/ruby/hyper-component/hyper-component.gemspec
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'hyper-state', Hyperstack::Component::VERSION
spec.add_dependency 'hyperstack-config', Hyperstack::Component::VERSION
spec.add_dependency 'opal-activesupport', '~> 0.3.1'
- spec.add_dependency 'react-rails', '>= 2.4.0', '< 2.5.0'
+ spec.add_dependency 'react-rails', '>= 2.4.0', '< 2.7.0'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'chromedriver-helper'
@@ -28,18 +28,18 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'jquery-rails'
spec.add_development_dependency 'listen'
spec.add_development_dependency 'mime-types'
- spec.add_development_dependency 'mini_racer', '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency
+ spec.add_development_dependency 'mini_racer'#, '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency
spec.add_development_dependency 'nokogiri'
spec.add_development_dependency 'opal-jquery'
- spec.add_development_dependency 'opal-rails', '>= 0.9.4', '< 2.0'
+ spec.add_development_dependency 'opal-rails'
spec.add_development_dependency 'pry-rescue'
spec.add_development_dependency 'pry-stack_explorer'
- spec.add_development_dependency 'puma'
+ spec.add_development_dependency 'puma', '<= 5.4.0'
spec.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '>= 5.0.0', '< 7.0'
spec.add_development_dependency 'rails-controller-testing'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'rubocop' #, '~> 0.51.0'
spec.add_development_dependency 'sqlite3', '~> 1.4.2'
- spec.add_development_dependency 'timecop', '~> 0.8.1'
+ spec.add_development_dependency 'timecop' #, '~> 0.8.1'
end
diff --git a/ruby/hyper-component/lib/hyper-component.rb b/ruby/hyper-component/lib/hyper-component.rb
index b68d23cdf..546718252 100644
--- a/ruby/hyper-component/lib/hyper-component.rb
+++ b/ruby/hyper-component/lib/hyper-component.rb
@@ -47,6 +47,6 @@
require 'hyperstack/component/isomorphic_helpers'
require 'hyperstack/ext/component/serializers'
- Opal.append_path File.expand_path('../', __FILE__).untaint
+ Opal.append_path File.expand_path('../', __FILE__)
require 'react/react-source'
end
diff --git a/ruby/hyper-component/lib/hyperstack/component/version.rb b/ruby/hyper-component/lib/hyperstack/component/version.rb
index de5a13179..5b06d3183 100644
--- a/ruby/hyper-component/lib/hyperstack/component/version.rb
+++ b/ruby/hyper-component/lib/hyperstack/component/version.rb
@@ -1,5 +1,5 @@
module Hyperstack
module Component
- VERSION = '1.0.alpha1.8' # '1.0.alpha1.5'
+ VERSION = '1.0.alpha1.8.0017' # '1.0.alpha1.5'
end
end
diff --git a/ruby/hyper-component/lib/hyperstack/internal/component/react_wrapper.rb b/ruby/hyper-component/lib/hyperstack/internal/component/react_wrapper.rb
index bc0db975c..19c4f5ade 100644
--- a/ruby/hyper-component/lib/hyperstack/internal/component/react_wrapper.rb
+++ b/ruby/hyper-component/lib/hyperstack/internal/component/react_wrapper.rb
@@ -27,16 +27,19 @@ def self.import_native_component(opal_class, native_class)
@@component_classes[opal_class] = native_class
end
+ # patched
+ # https://github.com/hyperstack-org/hyperstack/issues/305
def self.eval_native_react_component(name)
component = `eval(name)`
raise "#{name} is not defined" if `#{component} === undefined`
- component = `component.default` if `component.__esModule`
+ component = `component.default` if `component.__esModule && component.default`
is_component_class = `#{component}.prototype !== undefined` &&
(`!!#{component}.prototype.isReactComponent` ||
`!!#{component}.prototype.render`)
+ is_memo = `#{component}.type != undefined` && `typeof #{component}.type.render === "function"`
has_render_method = `typeof #{component}.render === "function"`
- unless is_component_class || stateless?(component) || has_render_method
+ unless is_component_class || stateless?(component) || has_render_method || is_memo
raise 'does not appear to be a native react component'
end
component
diff --git a/ruby/hyper-component/lib/react/react-source.rb b/ruby/hyper-component/lib/react/react-source.rb
index cbe9b9f07..9db06b632 100644
--- a/ruby/hyper-component/lib/react/react-source.rb
+++ b/ruby/hyper-component/lib/react/react-source.rb
@@ -13,5 +13,5 @@
require "react/rails/asset_variant"
variant = Hyperstack.env.production? ? :production : :development
react_directory = React::Rails::AssetVariant.new({ variant: variant }).react_directory
- Opal.append_path react_directory.untaint
+ Opal.append_path react_directory
end
diff --git a/ruby/hyper-component/spec/active_support_spec.rb b/ruby/hyper-component/spec/active_support_spec.rb
index 8d0546730..a7614ba5f 100644
--- a/ruby/hyper-component/spec/active_support_spec.rb
+++ b/ruby/hyper-component/spec/active_support_spec.rb
@@ -18,6 +18,7 @@ def payments
GenericEnumerable.new([ Payment.new(5), Payment.new(15), Payment.new(10) ])
end
end
+
expect_evaluate_ruby do
{ Payment.new(5) => 5, Payment.new(15) => 15, Payment.new(10) => 10 } == payments.index_with(&:price)
end.to be_truthy
diff --git a/ruby/hyper-component/spec/client_features/component_spec.rb b/ruby/hyper-component/spec/client_features/component_spec.rb
index 8f469c40f..11093b475 100644
--- a/ruby/hyper-component/spec/client_features/component_spec.rb
+++ b/ruby/hyper-component/spec/client_features/component_spec.rb
@@ -542,7 +542,7 @@ class Lorem; end
end
Hyperstack::Component::ReactTestUtils.render_component_into_document(Foo, bar: 10, lorem: Lorem.new)
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo`\nRequired prop `foo` was not specified\nProvided prop `bar` could not be converted to String/)
end
@@ -560,7 +560,7 @@ class Lorem; end
end
Hyperstack::Component::ReactTestUtils.render_component_into_document(Foo, foo: 10, bar: '10', lorem: Lorem.new)
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n")).to_not match(/prop/)
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n")).to_not match(/prop/)
end
end
@@ -597,7 +597,7 @@ class Foo
Hyperstack::Component::ReactTestUtils.render_component_into_document(foo)
end
- expect(page.driver.browser.manage.logs.get(:browser)
+ expect(page.driver.browser.logs.get(:browser)
.reject { |entry| entry.to_s.include?('Deprecated feature') }
.reject { |entry| entry.to_s.include?('Object freezing is not supported by Opal')}
.map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n").size)
@@ -612,7 +612,7 @@ class Foo < Hyperloop::Component
render { Foo }
end
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/did you mean to say Foo()/)
end
end
diff --git a/ruby/hyper-component/spec/client_features/dsl_spec.rb b/ruby/hyper-component/spec/client_features/dsl_spec.rb
index 81aa0a60a..68daab280 100644
--- a/ruby/hyper-component/spec/client_features/dsl_spec.rb
+++ b/ruby/hyper-component/spec/client_features/dsl_spec.rb
@@ -182,7 +182,7 @@ class NestedComp < Hyperloop::Component
class Comp; end
end
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Comp does not appear to be a react component./)
end
diff --git a/ruby/hyper-component/spec/client_features/native_library_spec.rb b/ruby/hyper-component/spec/client_features/native_library_spec.rb
index 2b1f17f3c..1d54d80ba 100644
--- a/ruby/hyper-component/spec/client_features/native_library_spec.rb
+++ b/ruby/hyper-component/spec/client_features/native_library_spec.rb
@@ -171,7 +171,7 @@ class Foo < Hyperstack::Component::NativeLibrary
rename "MispelledComponent" => "Bar"
end
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/NativeLibrary.MispelledComponent is undefined/)
# TODO was testing for cannot import, but that message gets trunkated
end
diff --git a/ruby/hyper-component/spec/client_features/opal_jquery_extensions_spec.rb b/ruby/hyper-component/spec/client_features/opal_jquery_extensions_spec.rb
index 62d7637ed..089333340 100644
--- a/ruby/hyper-component/spec/client_features/opal_jquery_extensions_spec.rb
+++ b/ruby/hyper-component/spec/client_features/opal_jquery_extensions_spec.rb
@@ -90,7 +90,7 @@ class Foo < Hyperloop::Component
Element[JS.call(:eval, "(function () { return window; })();")]
true
end.to be_truthy
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.not_to match(/Exception|Error/)
end
diff --git a/ruby/hyper-component/spec/client_features/param_declaration_spec.rb b/ruby/hyper-component/spec/client_features/param_declaration_spec.rb
index 40befc90b..7d159fb2a 100644
--- a/ruby/hyper-component/spec/client_features/param_declaration_spec.rb
+++ b/ruby/hyper-component/spec/client_features/param_declaration_spec.rb
@@ -125,7 +125,7 @@ class Foo < Hyperloop::Component
end
end
expect(page.body[-60..-19]).to include('
12-string
')
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo1` could not be converted to String/)
end
@@ -155,7 +155,7 @@ class Foo2 < Hyperloop::Component
Hyperstack::Component::ReactTestUtils.render_component_into_document(Foo2, bar: 10, lorem: Lorem.new)
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo2`\nRequired prop `foo` was not specified\nProvided prop `bar` could not be converted to String/)
end
@@ -171,7 +171,7 @@ class Foo < Hyperloop::Component
end
Hyperstack::Component::ReactTestUtils.render_component_into_document(Foo, foo: 10, bar: '10', lorem: Lorem.new)
end
- expect(page.driver.browser.manage.logs.get(:browser).reject { |m| m.message =~ /(D|d)eprecated/ }.map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).reject { |m| m.message =~ /(D|d)eprecated/ }.map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.not_to match(/Warning|Error/)
end
@@ -191,7 +191,7 @@ class Foo < Hyperloop::Component
param :bar, type: []
end
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo` could not be converted to Array/)
end
@@ -202,7 +202,7 @@ class Foo < Hyperloop::Component
param :bar, type: [String]
end
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo`\[0\] could not be converted to String/)
end
@@ -227,7 +227,7 @@ def self._react_param_conversion(json, validate_only)
end
end
expect(page.body[-60..-19]).to include('1, 2')
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo` could not be converted to BazWoggle/)
end
diff --git a/ruby/hyper-component/spec/client_features/state_spec.rb b/ruby/hyper-component/spec/client_features/state_spec.rb
index e3dacde8f..29d0b9b40 100644
--- a/ruby/hyper-component/spec/client_features/state_spec.rb
+++ b/ruby/hyper-component/spec/client_features/state_spec.rb
@@ -40,7 +40,7 @@ class << self
end
expect_evaluate_ruby("MARKUP").to eq('Boom')
expect_evaluate_ruby("StateTest.boom").to be_falsy
- expect(page.driver.browser.manage.logs.get(:browser).reject { |entry|
+ expect(page.driver.browser.logs.get(:browser).reject { |entry|
entry_s = entry.to_s
entry_s.include?("Deprecated feature") ||
entry_s.include?("Mount() on the server. This is a no-op.") ||
diff --git a/ruby/hyper-component/spec/deprecated_features/param_declaration_legacy_spec.rb b/ruby/hyper-component/spec/deprecated_features/param_declaration_legacy_spec.rb
index a7156e80b..d767b7b1b 100644
--- a/ruby/hyper-component/spec/deprecated_features/param_declaration_legacy_spec.rb
+++ b/ruby/hyper-component/spec/deprecated_features/param_declaration_legacy_spec.rb
@@ -49,7 +49,7 @@ def setup
element = Hyperstack::Component::ReactAPI.create_element(Foo).on(:foo_submit) { 'bar' }
Hyperstack::Component::ReactTestUtils.render_into_document(element)
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to_not match(/Exception raised/)
end
@@ -73,7 +73,7 @@ def setup
element = Hyperstack::Component::ReactAPI.create_element(Foo).on(:foo_invoked) { return [1,2,3], 'bar' }
Hyperstack::Component::ReactTestUtils.render_into_document(element)
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to_not match(/Exception raised/)
end
end
@@ -199,7 +199,7 @@ class Foo < Hyperloop::Component
end
end
expect(page.body[-60..-19]).to include('12-string
')
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo1` could not be converted to String/)
end
@@ -216,7 +216,7 @@ class Foo2 < Hyperloop::Component
Hyperstack::Component::ReactTestUtils.render_component_into_document(Foo2, bar: 10, lorem: Lorem.new)
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo2`\nRequired prop `foo` was not specified\nProvided prop `bar` could not be converted to String/)
end
@@ -233,7 +233,7 @@ class Foo < Hyperloop::Component
end
Hyperstack::Component::ReactTestUtils.render_component_into_document(Foo, foo: 10, bar: '10', lorem: Lorem.new)
end
- expect(page.driver.browser.manage.logs.get(:browser).reject { |m| m.message =~ /(D|d)eprecated/ }.map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).reject { |m| m.message =~ /(D|d)eprecated/ }.map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.not_to match(/Warning|Error/)
end
@@ -254,7 +254,7 @@ class Foo < Hyperloop::Component
param :bar, type: []
end
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo` could not be converted to Array/)
end
@@ -265,7 +265,7 @@ class Foo < Hyperloop::Component
param :bar, type: [String]
end
end
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo`\[0\] could not be converted to String/)
end
@@ -290,7 +290,7 @@ def self._react_param_conversion(json, validate_only)
end
end
expect(page.body[-60..-19]).to include('1, 2')
- expect(page.driver.browser.manage.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
+ expect(page.driver.browser.logs.get(:browser).map { |m| m.message.gsub(/\\n/, "\n") }.to_a.join("\n"))
.to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo` could not be converted to BazWoggle/)
end
diff --git a/ruby/hyper-component/spec/spec_helper.rb b/ruby/hyper-component/spec/spec_helper.rb
index 47c233658..2c3f55c5c 100644
--- a/ruby/hyper-component/spec/spec_helper.rb
+++ b/ruby/hyper-component/spec/spec_helper.rb
@@ -1,7 +1,6 @@
ENV["RAILS_ENV"] ||= 'test'
require 'opal'
-#require 'opal-rspec'
require 'opal-jquery'
begin
@@ -12,10 +11,8 @@
require 'rspec/rails'
require 'hyper-spec'
require 'pry'
-require 'opal-browser'
require 'timecop'
-
RSpec.configure do |config|
config.color = true
config.fail_fast = ENV['FAIL_FAST'] || false
@@ -51,13 +48,13 @@
# Fail tests on JavaScript errors in Chrome Headless
class JavaScriptError < StandardError; end
- config.after(:each, js: true) do |spec|
- logs = page.driver.browser.manage.logs.get(:browser)
+ config.after(:each, js: true) do
+ logs = page.driver.browser.logs.get(:browser)
errors = logs.select { |e| e.level == "SEVERE" && e.message.present? }
- .map { |m| m.message.gsub(/\\n/, "\n") }.to_a
+ .map { |m| m.message.gsub(/\\n/, "\n") }.to_a
if client_options[:deprecation_warnings] == :on
warnings = logs.select { |e| e.level == "WARNING" && e.message.present? }
- .map { |m| m.message.gsub(/\\n/, "\n") }.to_a
+ .map { |m| m.message.gsub(/\\n/, "\n") }.to_a
puts "\033[0;33;1m\nJavascript client console warnings:\n\n" + warnings.join("\n\n") + "\033[0;30;21m" if warnings.present?
end
unless client_options[:raise_on_js_errors] == :off
diff --git a/ruby/hyper-component/spec/test_app/app/assets/config/manifest.js b/ruby/hyper-component/spec/test_app/app/assets/config/manifest.js
index b16e53d6d..27de0df30 100644
--- a/ruby/hyper-component/spec/test_app/app/assets/config/manifest.js
+++ b/ruby/hyper-component/spec/test_app/app/assets/config/manifest.js
@@ -1,3 +1,4 @@
//= link_tree ../images
//= link_directory ../javascripts .js
+//= link application.css
//= link_directory ../stylesheets .css
diff --git a/ruby/hyper-component/spec/test_app/app/hyperstack/components/components.rb b/ruby/hyper-component/spec/test_app/app/hyperstack/components/components.rb
index 87bfdc23a..edac28d18 100644
--- a/ruby/hyper-component/spec/test_app/app/hyperstack/components/components.rb
+++ b/ruby/hyper-component/spec/test_app/app/hyperstack/components/components.rb
@@ -1,14 +1,4 @@
-# require 'hyper-component'
-# if Hyperstack::Component::IsomorphicHelpers.on_opal_client?
-# require 'browser'
-# require 'browser/delay'
-# #require 'react/ext/opal-jquery/element'
-# require 'hyperstack/component/jquery'
-# end
-# require 'hyperstack/component/server'
-# require 'hyperstack/component/auto-import'
require 'js'
-# require 'hyper-store'
require 'hyperstack/internal/component/haml'
# these mechanisms are deprecated in favor of using the features of hyper-spec. However
diff --git a/ruby/hyper-component/spec/test_app/app/xxxjavascript/packs/client_only.js b/ruby/hyper-component/spec/test_app/app/xxxjavascript/packs/client_only.js
new file mode 100644
index 000000000..52f446dd4
--- /dev/null
+++ b/ruby/hyper-component/spec/test_app/app/xxxjavascript/packs/client_only.js
@@ -0,0 +1,7 @@
+//app/javascript/packs/client_only.js
+// add any requires for packages that will run client side only
+ReactDOM = require('react-dom'); // react-js client side code
+jQuery = require('jquery'); // remove if you don't need jQuery
+// to add additional NPM packages call run yarn add package-name@version
+// then add the require here.
+
diff --git a/ruby/hyper-component/spec/test_app/config/application.rb b/ruby/hyper-component/spec/test_app/config/application.rb
index 383ddfaec..1b198059e 100644
--- a/ruby/hyper-component/spec/test_app/config/application.rb
+++ b/ruby/hyper-component/spec/test_app/config/application.rb
@@ -5,7 +5,7 @@
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups(assets: %w(development test)))
-# require 'jquery-rails'
+require 'jquery-rails'
# require 'opal'
# require 'opal-jquery'
# require 'opal-browser'
diff --git a/ruby/hyper-component/spec/test_app/yarn.lock b/ruby/hyper-component/spec/test_app/yarn.lock
new file mode 100644
index 000000000..fb57ccd13
--- /dev/null
+++ b/ruby/hyper-component/spec/test_app/yarn.lock
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
diff --git a/ruby/hyper-component/yarn.lock b/ruby/hyper-component/yarn.lock
new file mode 100644
index 000000000..fb57ccd13
--- /dev/null
+++ b/ruby/hyper-component/yarn.lock
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
diff --git a/ruby/hyper-console/lib/hyper-console.rb b/ruby/hyper-console/lib/hyper-console.rb
index cc94d7bcc..083ea7414 100644
--- a/ruby/hyper-console/lib/hyper-console.rb
+++ b/ruby/hyper-console/lib/hyper-console.rb
@@ -9,5 +9,5 @@
require 'securerandom'
else
require 'hyperloop/console/engine'
- Opal.append_path File.expand_path('../', __FILE__).untaint
+ Opal.append_path File.expand_path('../', __FILE__)
end
diff --git a/ruby/hyper-console/lib/hyperloop/console/version.rb b/ruby/hyper-console/lib/hyperloop/console/version.rb
index 7d7cbeb0f..2a5a9f062 100644
--- a/ruby/hyper-console/lib/hyperloop/console/version.rb
+++ b/ruby/hyper-console/lib/hyperloop/console/version.rb
@@ -1,5 +1,5 @@
module Hyperloop
module Console
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
end
diff --git a/ruby/hyper-i18n/hyper-i18n.gemspec b/ruby/hyper-i18n/hyper-i18n.gemspec
index 492638eed..e633da327 100644
--- a/ruby/hyper-i18n/hyper-i18n.gemspec
+++ b/ruby/hyper-i18n/hyper-i18n.gemspec
@@ -27,10 +27,10 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'chromedriver-helper'
spec.add_development_dependency 'hyper-model', Hyperstack::I18n::VERSION
spec.add_development_dependency 'hyper-spec', Hyperstack::I18n::VERSION
- spec.add_development_dependency 'mini_racer', '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency
- spec.add_development_dependency 'opal-rails', '>= 0.9.4', '< 2.0.0'
+ spec.add_development_dependency 'mini_racer' # , '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency
+ spec.add_development_dependency 'opal-rails'
spec.add_development_dependency 'pry'
- spec.add_development_dependency 'puma'
+ spec.add_development_dependency 'puma', '<= 5.4.0'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rspec-rails'
diff --git a/ruby/hyper-i18n/lib/hyper-i18n.rb b/ruby/hyper-i18n/lib/hyper-i18n.rb
index d3db3ddab..77e35b2f9 100644
--- a/ruby/hyper-i18n/lib/hyper-i18n.rb
+++ b/ruby/hyper-i18n/lib/hyper-i18n.rb
@@ -19,5 +19,5 @@
else
require 'opal'
- Opal.append_path File.expand_path('../', __FILE__).untaint
+ Opal.append_path File.expand_path('../', __FILE__)
end
diff --git a/ruby/hyper-i18n/lib/hyper-i18n/version.rb b/ruby/hyper-i18n/lib/hyper-i18n/version.rb
index 23b0d5f44..14f3b1592 100644
--- a/ruby/hyper-i18n/lib/hyper-i18n/version.rb
+++ b/ruby/hyper-i18n/lib/hyper-i18n/version.rb
@@ -1,3 +1,3 @@
module HyperI18n
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
diff --git a/ruby/hyper-i18n/lib/hyperstack/i18n/version.rb b/ruby/hyper-i18n/lib/hyperstack/i18n/version.rb
index 414e46f90..64eaa6f73 100644
--- a/ruby/hyper-i18n/lib/hyperstack/i18n/version.rb
+++ b/ruby/hyper-i18n/lib/hyperstack/i18n/version.rb
@@ -1,5 +1,5 @@
module Hyperstack
module I18n
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
end
diff --git a/ruby/hyper-model/hyper-model.gemspec b/ruby/hyper-model/hyper-model.gemspec
index 1cb213c15..0f921f6c1 100644
--- a/ruby/hyper-model/hyper-model.gemspec
+++ b/ruby/hyper-model/hyper-model.gemspec
@@ -30,17 +30,17 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'factory_bot_rails'
spec.add_development_dependency 'hyper-spec', HyperModel::VERSION
spec.add_development_dependency 'hyper-trace', HyperModel::VERSION
- spec.add_development_dependency 'mini_racer', '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency
+ spec.add_development_dependency 'mini_racer'#, '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency
spec.add_development_dependency 'pg'
- spec.add_development_dependency 'opal-rails', '>= 0.9.4', '< 2.0'
+ spec.add_development_dependency 'opal-rails'
spec.add_development_dependency 'pry-rescue'
spec.add_development_dependency 'pry-stack_explorer'
- spec.add_development_dependency 'puma'
+ spec.add_development_dependency 'puma', '<= 5.4.0'
spec.add_development_dependency 'pusher'
spec.add_development_dependency 'pusher-fake'
spec.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '>= 5.0.0', '< 7.0'
spec.add_development_dependency 'rake'
- spec.add_development_dependency 'react-rails', '>= 2.4.0', '< 2.5.0'
+ spec.add_development_dependency 'react-rails', '>= 2.4.0', '< 2.7.0'
spec.add_development_dependency 'rspec-collection_matchers'
spec.add_development_dependency 'rspec-expectations'
spec.add_development_dependency 'rspec-its'
@@ -53,5 +53,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'shoulda-matchers'
spec.add_development_dependency 'spring-commands-rspec', '~> 1.0.4'
spec.add_development_dependency 'sqlite3', '~> 1.4.2' # see https://github.com/rails/rails/issues/35153, '~> 1.3.6'
- spec.add_development_dependency 'timecop', '~> 0.8.1'
+ spec.add_development_dependency 'timecop'#, '~> 0.8.1'
end
diff --git a/ruby/hyper-model/lib/active_record_base.rb b/ruby/hyper-model/lib/active_record_base.rb
index def9de439..464aeda45 100644
--- a/ruby/hyper-model/lib/active_record_base.rb
+++ b/ruby/hyper-model/lib/active_record_base.rb
@@ -129,20 +129,32 @@ def finder_method(name, &block)
end
end
- def server_method(name, _opts = {}, &block)
- # callable from the server internally
- define_method(name, &block)
- # callable remotely from the client
+ def allow_remote_access_to(*methods, &block)
+ methods = methods.collect { |meth| meth.is_a?(Hash) ? meth.keys : meth }.flatten
+ methods.each do |name|
define_method("__secure_remote_access_to_#{name}") do |_self, acting_user, *args|
begin
old = self.acting_user
self.acting_user = acting_user
- send(name, *args)
+ allowed = !block || instance_eval(&block) rescue nil
+ return send(name, *args) if allowed
+
+ Hyperstack::InternalPolicy.raise_operation_access_violation(
+ :illegal_remote_access, "Access denied to #{name}"
+ )
ensure
self.acting_user = old
end
end
end
+ end
+
+ def server_method(name, _opts = {}, &block)
+ # callable from the server internally
+ define_method(name, &block)
+ # callable remotely from the client
+ allow_remote_access_to(name)
+ end
# relationships (and scopes) are regulated using a tri-state system. Each
# remote access method will return the relationship as normal but will also set
diff --git a/ruby/hyper-model/lib/hyper-model.rb b/ruby/hyper-model/lib/hyper-model.rb
index 93b5e51d0..e7324c702 100644
--- a/ruby/hyper-model/lib/hyper-model.rb
+++ b/ruby/hyper-model/lib/hyper-model.rb
@@ -62,8 +62,8 @@
require_relative 'active_record_base'
require 'hyper_model/version'
- Opal.append_path File.expand_path('../sources/', __FILE__).untaint
- Opal.append_path File.expand_path('../', __FILE__).untaint
- Opal.append_path File.expand_path('../../vendor', __FILE__).untaint
+ Opal.append_path File.expand_path('../sources/', __FILE__)
+ Opal.append_path File.expand_path('../', __FILE__)
+ Opal.append_path File.expand_path('../../vendor', __FILE__)
end
require 'enumerable/pluck'
diff --git a/ruby/hyper-model/lib/hyper_model/version.rb b/ruby/hyper-model/lib/hyper_model/version.rb
index a5881f945..ae4f0f09c 100644
--- a/ruby/hyper-model/lib/hyper_model/version.rb
+++ b/ruby/hyper-model/lib/hyper_model/version.rb
@@ -1,3 +1,3 @@
module HyperModel
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
diff --git a/ruby/hyper-model/lib/reactive_record/active_record/class_methods.rb b/ruby/hyper-model/lib/reactive_record/active_record/class_methods.rb
index e4977b83e..03c15673b 100644
--- a/ruby/hyper-model/lib/reactive_record/active_record/class_methods.rb
+++ b/ruby/hyper-model/lib/reactive_record/active_record/class_methods.rb
@@ -368,6 +368,18 @@ def server_method(name, default: nil)
end
end
+ def allow_remote_access_to(*methods)
+ methods.each do |meth|
+ if meth.is_a? Hash
+ puts "defining these guys: #{meth}"
+ meth.each { |name, default| server_method(name, default: default) }
+ else
+ puts "defining this guy: #{meth}"
+ server_method(meth)
+ end
+ end
+ end
+
# define all the methods for each column. To allow overriding the methods they will NOT
# be defined if already defined (i.e. by the model) See the instance_methods module for how
# super calls are handled in this case. The _hyperstack_internal_setter_... methods
diff --git a/ruby/hyper-model/spec/batch1/policies/send_access_xspec.rb b/ruby/hyper-model/spec/batch1/policies/send_access_xspec.rb
index dc1887651..3f8ececf3 100644
--- a/ruby/hyper-model/spec/batch1/policies/send_access_xspec.rb
+++ b/ruby/hyper-model/spec/batch1/policies/send_access_xspec.rb
@@ -42,7 +42,7 @@ def saved_changes
it "will allow sending a relationship to a relationship or scope"
it "will allow sending a server method to a model"
it "will allow sending count to model"
- it "will allow sending count to relationship"
+ it "will allow sending count to relationship" do
stub_const "TestModel1Policy", Class.new
TestModel1Policy.class_eval do
regulate_broadcast do | policy |
diff --git a/ruby/hyper-model/spec/batch6/server_method_spec.rb b/ruby/hyper-model/spec/batch6/server_method_spec.rb
index 04bdba059..2889318a9 100644
--- a/ruby/hyper-model/spec/batch6/server_method_spec.rb
+++ b/ruby/hyper-model/spec/batch6/server_method_spec.rb
@@ -88,4 +88,42 @@ class ServerMethodTester < HyperComponent
expect(TestModel.count).to be_zero
expect(ChildModel.count).to be_zero
end
+
+ it "will allow remote access to methods" do
+ TodoItem.class_eval do
+ def foo
+ "foo"
+ end
+
+ def bar
+ "bar"
+ end
+
+ def broken
+ "broken"
+ end
+
+ def defaulted
+ "defaulted"
+ end
+ end
+ isomorphic do
+ TodoItem.class_eval do
+ allow_remote_access_to(:foo, :bar) { acting_user.nil? }
+ allow_remote_access_to(:broken) { acting_user.admin? }
+ allow_remote_access_to(:dontcallme, defaulted: "loading") { true }
+ end
+ end
+ client_option raise_on_js_errors: :off
+ expect { TodoItem.last.foo }.on_client_to be_nil
+ expect { Hyperstack::Model.load { TodoItem.last.foo } }.on_client_to eq("foo")
+ expect { TodoItem.last.bar }.on_client_to be_nil
+ expect { Hyperstack::Model.load { TodoItem.last.bar } }.on_client_to eq("bar")
+ expect { Hyperstack::Model.load { TodoItem.last.broken } }.on_client_to be_nil
+ expect { TodoItem.last.defaulted }.on_client_to eq "loading"
+ expect { Hyperstack::Model.load { TodoItem.last.defaulted } }.on_client_to eq("defaulted")
+ errors = page.driver.browser.manage.logs.get(:browser).select { |m| m.level == "SEVERE" }
+ expect(errors.count).to eq(2)
+ expect(errors.first.message).to match(/the server responded with a status of 403 \(Forbidden\)/)
+ end
end
diff --git a/ruby/hyper-model/spec/spec_helper.rb b/ruby/hyper-model/spec/spec_helper.rb
index b860162e1..28c895a47 100644
--- a/ruby/hyper-model/spec/spec_helper.rb
+++ b/ruby/hyper-model/spec/spec_helper.rb
@@ -176,7 +176,7 @@ def finished_all_ajax_requests?
module CheckErrors
def check_errors
- logs = page.driver.browser.manage.logs.get(:browser)
+ logs = page.driver.browser.logs.get(:browser)
errors = logs.select { |e| e.level == "SEVERE" && e.message.present? }
.map { |m| m.message.gsub(/\\n/, "\n") }.to_a
puts "WARNING - FOUND UNEXPECTED ERRORS #{errors}" if errors.present?
@@ -308,7 +308,7 @@ class << self
class JavaScriptError < StandardError; end
config.after(:each, js: true) do |spec|
- logs = page.driver.browser.manage.logs.get(:browser)
+ logs = page.driver.browser.logs.get(:browser)
if spec.exception
all_messages = logs.select { |e| e.message.present? }
.map { |m| m.message.gsub(/\\n/, "\n") }.to_a
@@ -336,7 +336,7 @@ class JavaScriptError < StandardError; end
# Capybara.register_driver :chrome do |app|
# #caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"excludeSwitches" => [ "ignore-certificate-errors" ]})
# caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => [ "--window-size=200,200" ]})
- # Capybara::Selenium::Driver.new(app, :browser => :chrome, :desired_capabilities => caps)
+ # Capybara::Selenium::Driver.new(app, :browser => :chrome, :capabilities => caps)
# end
# Use legacy hyper-spec on_client behavior
diff --git a/ruby/hyper-model/spec/test_app/app/assets/config/manifest.js b/ruby/hyper-model/spec/test_app/app/assets/config/manifest.js
new file mode 100644
index 000000000..9c361e667
--- /dev/null
+++ b/ruby/hyper-model/spec/test_app/app/assets/config/manifest.js
@@ -0,0 +1,2 @@
+ //= link_directory ../javascripts .js
+ //= link_directory ../stylesheets .css
\ No newline at end of file
diff --git a/ruby/hyper-model/spec/test_app/db/schema.rb b/ruby/hyper-model/spec/test_app/db/schema.rb
index 82639473f..2d052daf1 100644
--- a/ruby/hyper-model/spec/test_app/db/schema.rb
+++ b/ruby/hyper-model/spec/test_app/db/schema.rb
@@ -2,8 +2,8 @@
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
-# This file is the source Rails uses to define your schema when running `rails
-# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
+# This file is the source Rails uses to define your schema when running `bin/rails
+# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
diff --git a/ruby/hyper-model/yarn.lock b/ruby/hyper-model/yarn.lock
new file mode 100644
index 000000000..fb57ccd13
--- /dev/null
+++ b/ruby/hyper-model/yarn.lock
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
diff --git a/ruby/hyper-operation/hyper-operation.gemspec b/ruby/hyper-operation/hyper-operation.gemspec
index 1f8b4bdab..b1f246ef7 100644
--- a/ruby/hyper-operation/hyper-operation.gemspec
+++ b/ruby/hyper-operation/hyper-operation.gemspec
@@ -30,20 +30,20 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'database_cleaner'
spec.add_development_dependency 'hyper-spec', Hyperstack::Operation::VERSION
spec.add_development_dependency 'mysql2'
- spec.add_development_dependency 'opal-browser', '~> 0.2.0'
- spec.add_development_dependency 'opal-rails', '>= 0.9.4', '< 2.0'
+ # spec.add_development_dependency 'opal-browser', '~> 0.2.0'
+ spec.add_development_dependency 'opal-rails'
spec.add_development_dependency 'pry-rescue'
spec.add_development_dependency 'pry-stack_explorer'
- spec.add_development_dependency 'puma'
+ spec.add_development_dependency 'puma', '<= 5.4.0'
spec.add_development_dependency 'pusher'
spec.add_development_dependency 'pusher-fake'
spec.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '>= 5.0.0', '< 7.0'
spec.add_development_dependency 'rake'
- spec.add_development_dependency 'react-rails', '>= 2.4.0', '< 2.5.0'
+ spec.add_development_dependency 'react-rails', '>= 2.4.0', '< 2.7.0'
spec.add_development_dependency 'redis'
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'rspec-steps', '~> 2.1.1'
spec.add_development_dependency 'rspec-wait'
spec.add_development_dependency 'sqlite3', '~> 1.4.2' # see https://github.com/rails/rails/issues/35153
- spec.add_development_dependency 'timecop', '~> 0.8.1'
+ spec.add_development_dependency 'timecop'#, '~> 0.8.1'
end
diff --git a/ruby/hyper-operation/lib/hyper-operation.rb b/ruby/hyper-operation/lib/hyper-operation.rb
index da470051f..c98d07adc 100644
--- a/ruby/hyper-operation/lib/hyper-operation.rb
+++ b/ruby/hyper-operation/lib/hyper-operation.rb
@@ -59,7 +59,7 @@ def titleize
require 'hyper-operation/server_op'
require 'hyper-operation/boot'
Opal.use_gem 'mutations', false
- Opal.append_path File.expand_path('../sources/', __FILE__).untaint
- Opal.append_path File.expand_path('../', __FILE__).untaint
- Opal.append_path File.expand_path('../../vendor', __FILE__).untaint
+ Opal.append_path File.expand_path('../sources/', __FILE__)
+ Opal.append_path File.expand_path('../', __FILE__)
+ Opal.append_path File.expand_path('../../vendor', __FILE__)
end
diff --git a/ruby/hyper-operation/lib/hyper-operation/transport/connection_adapter/active_record.rb b/ruby/hyper-operation/lib/hyper-operation/transport/connection_adapter/active_record.rb
index f503b0c24..c1c44da2f 100644
--- a/ruby/hyper-operation/lib/hyper-operation/transport/connection_adapter/active_record.rb
+++ b/ruby/hyper-operation/lib/hyper-operation/transport/connection_adapter/active_record.rb
@@ -81,7 +81,7 @@ def connect_to_transport(channel, session, root_path)
end
def disconnect(channel)
- Connection.find_by(channel: channel, session: nil).destroy
+ Connection.find_by(channel: channel, session: nil)&.destroy
end
def root_path=(path)
diff --git a/ruby/hyper-operation/lib/hyper-operation/transport/connection_adapter/redis.rb b/ruby/hyper-operation/lib/hyper-operation/transport/connection_adapter/redis.rb
index 766e0c389..cc1435171 100644
--- a/ruby/hyper-operation/lib/hyper-operation/transport/connection_adapter/redis.rb
+++ b/ruby/hyper-operation/lib/hyper-operation/transport/connection_adapter/redis.rb
@@ -63,7 +63,7 @@ def connect_to_transport(channel, session, root_path)
end
def disconnect(channel)
- Connection.find_by(channel: channel, session: nil).destroy
+ Connection.find_by(channel: channel, session: nil)&.destroy
end
def root_path=(path)
diff --git a/ruby/hyper-operation/lib/hyper-operation/transport/hyperstack.rb b/ruby/hyper-operation/lib/hyper-operation/transport/hyperstack.rb
index 1d78cc26b..31de6917e 100644
--- a/ruby/hyper-operation/lib/hyper-operation/transport/hyperstack.rb
+++ b/ruby/hyper-operation/lib/hyper-operation/transport/hyperstack.rb
@@ -70,7 +70,7 @@ def self.reset_operations
if connection[:adapter] == :redis
require 'redis'
- connection[:redis_url] ||= 'redis://127.0.0.1:6379/hyperstack'
+ connection[:redis_url] ||= 'redis://127.0.0.1:6379/0'
end
end
diff --git a/ruby/hyper-operation/lib/hyper-operation/version.rb b/ruby/hyper-operation/lib/hyper-operation/version.rb
index 2a0e07d81..3b698a728 100644
--- a/ruby/hyper-operation/lib/hyper-operation/version.rb
+++ b/ruby/hyper-operation/lib/hyper-operation/version.rb
@@ -1,5 +1,5 @@
module Hyperstack
class Operation
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
end
diff --git a/ruby/hyper-operation/spec/spec_helper.rb b/ruby/hyper-operation/spec/spec_helper.rb
index c773c3b06..c6d3924da 100644
--- a/ruby/hyper-operation/spec/spec_helper.rb
+++ b/ruby/hyper-operation/spec/spec_helper.rb
@@ -125,7 +125,7 @@ def self.on_server?
# class JavaScriptError < StandardError; end
# config.after(:each, js: true) do |spec|
- # errors = page.driver.browser.manage.logs.get(:browser)
+ # errors = page.driver.browser.logs.get(:browser)
# .select { |e| e.level == "SEVERE" && e.message.present? }
# #.map { |m| m.message.gsub(/\\n/, "\n") }.to_a
# #.reject { |e| e =~ /Unexpected response code: 200/ }
diff --git a/ruby/hyper-operation/spec/test_app/app/assets/config/manifest.js b/ruby/hyper-operation/spec/test_app/app/assets/config/manifest.js
new file mode 100644
index 000000000..9c361e667
--- /dev/null
+++ b/ruby/hyper-operation/spec/test_app/app/assets/config/manifest.js
@@ -0,0 +1,2 @@
+ //= link_directory ../javascripts .js
+ //= link_directory ../stylesheets .css
\ No newline at end of file
diff --git a/ruby/hyper-operation/spec/test_app/config/application.rb b/ruby/hyper-operation/spec/test_app/config/application.rb
index 424c42ada..b763a19e4 100644
--- a/ruby/hyper-operation/spec/test_app/config/application.rb
+++ b/ruby/hyper-operation/spec/test_app/config/application.rb
@@ -23,6 +23,7 @@ class Application < Rails::Application
config.opal.enable_specs = true
config.opal.spec_location = 'spec-opal'
config.hyperstack.auto_config = false
+ config.active_record.yaml_column_permitted_classes = [Symbol, ActiveSupport::HashWithIndifferentAccess]
config.assets.cache_store = :null_store
# Settings in config/environments/* take precedence over those specified here.
diff --git a/ruby/hyper-operation/yarn.lock b/ruby/hyper-operation/yarn.lock
new file mode 100644
index 000000000..fb57ccd13
--- /dev/null
+++ b/ruby/hyper-operation/yarn.lock
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
diff --git a/ruby/hyper-router/hyper-router.gemspec b/ruby/hyper-router/hyper-router.gemspec
index 6332a7485..7e62eea23 100644
--- a/ruby/hyper-router/hyper-router.gemspec
+++ b/ruby/hyper-router/hyper-router.gemspec
@@ -17,18 +17,18 @@ Gem::Specification.new do |spec|
spec.add_dependency 'hyper-component', HyperRouter::VERSION
spec.add_dependency 'hyper-state', HyperRouter::VERSION
- spec.add_dependency 'opal-browser', '~> 0.2.0'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'chromedriver-helper'
spec.add_development_dependency 'hyper-spec', HyperRouter::VERSION
spec.add_development_dependency 'hyper-store', HyperRouter::VERSION
spec.add_development_dependency 'listen'
- spec.add_development_dependency 'mini_racer', '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency
- spec.add_development_dependency 'opal-rails', '>= 0.9.4', '< 2.0.0'
+ spec.add_development_dependency 'mini_racer' # , '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency
+ spec.add_development_dependency 'opal-rails'
+ spec.add_development_dependency 'opal-jquery'
spec.add_development_dependency 'pry-rescue'
spec.add_development_dependency 'pry-stack_explorer'
- spec.add_development_dependency 'puma'
+ spec.add_development_dependency 'puma', '<= 5.4.0'
spec.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '>= 5.0.0', '< 7.0'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec-collection_matchers'
@@ -40,5 +40,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'shoulda'
spec.add_development_dependency 'shoulda-matchers'
spec.add_development_dependency 'sqlite3', '~> 1.4.2' # see https://github.com/rails/rails/issues/35153
- spec.add_development_dependency 'timecop', '~> 0.8.1'
+ spec.add_development_dependency 'timecop'#, '~> 0.8.1'
end
diff --git a/ruby/hyper-router/lib/hyper-router.rb b/ruby/hyper-router/lib/hyper-router.rb
index c334dddd1..1770ec9ba 100644
--- a/ruby/hyper-router/lib/hyper-router.rb
+++ b/ruby/hyper-router/lib/hyper-router.rb
@@ -25,5 +25,5 @@
require 'hyperstack/internal/router/isomorphic_methods'
require 'hyperstack/router/version'
- Opal.append_path File.expand_path('../', __FILE__).untaint
+ Opal.append_path File.expand_path('../', __FILE__)
end
diff --git a/ruby/hyper-router/lib/hyperstack/router/version.rb b/ruby/hyper-router/lib/hyperstack/router/version.rb
index b386e5e32..7f3e84336 100644
--- a/ruby/hyper-router/lib/hyperstack/router/version.rb
+++ b/ruby/hyper-router/lib/hyperstack/router/version.rb
@@ -1,3 +1,3 @@
module HyperRouter
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
diff --git a/ruby/hyper-router/spec/test_app/app/assets/config/manifest.js b/ruby/hyper-router/spec/test_app/app/assets/config/manifest.js
new file mode 100644
index 000000000..92bfa3059
--- /dev/null
+++ b/ruby/hyper-router/spec/test_app/app/assets/config/manifest.js
@@ -0,0 +1,3 @@
+ //= link_tree ../images
+ //= link_directory ../javascripts .js
+ //= link_directory ../stylesheets .css
\ No newline at end of file
diff --git a/ruby/hyper-spec/Gemfile b/ruby/hyper-spec/Gemfile
index c0e97c691..3bde0e514 100644
--- a/ruby/hyper-spec/Gemfile
+++ b/ruby/hyper-spec/Gemfile
@@ -4,4 +4,5 @@ gem 'hyper-store', path: '../hyper-store'
gem 'hyper-state', path: '../hyper-state'
gem 'hyperstack-config', path: '../hyperstack-config'
#gem 'unparser', path: '../../../unparser'
+gem 'opal' #, '1.0.5'
gemspec
diff --git a/ruby/hyper-spec/hyper-spec.gemspec b/ruby/hyper-spec/hyper-spec.gemspec
index f2f82ea2a..d27e9d9c0 100644
--- a/ruby/hyper-spec/hyper-spec.gemspec
+++ b/ruby/hyper-spec/hyper-spec.gemspec
@@ -29,22 +29,21 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
spec.add_dependency 'parser'
spec.add_dependency 'rspec'
spec.add_dependency 'selenium-webdriver'
- spec.add_dependency 'timecop', '~> 0.8.1'
+ spec.add_dependency 'timecop'#, '~> 0.8.1'
spec.add_dependency 'uglifier'
spec.add_dependency 'unparser', '>= 0.4.2'
spec.add_dependency 'webdrivers'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'hyper-component', HyperSpec::VERSION
- spec.add_development_dependency 'mini_racer', '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency
- spec.add_development_dependency 'opal-browser', '~> 0.2.0'
+ spec.add_development_dependency 'mini_racer'#, '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency
spec.add_development_dependency 'opal-rails', '>= 0.9.4'
spec.add_development_dependency 'pry-rescue'
spec.add_development_dependency 'pry-stack_explorer'
- spec.add_development_dependency 'puma'
+ spec.add_development_dependency 'puma', '<= 5.4.0'
spec.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '>= 5.0.0', '< 7.0'
spec.add_development_dependency 'rake'
- spec.add_development_dependency 'react-rails', '>= 2.3.0', '< 2.5.0'
+ spec.add_development_dependency 'react-rails', '>= 2.3.0', '< 2.7.0'
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'rspec-collection_matchers'
spec.add_development_dependency 'rspec-expectations'
diff --git a/ruby/hyper-spec/lib/hyper-spec.rb b/ruby/hyper-spec/lib/hyper-spec.rb
index ba89a70e5..13d57e7fa 100644
--- a/ruby/hyper-spec/lib/hyper-spec.rb
+++ b/ruby/hyper-spec/lib/hyper-spec.rb
@@ -4,6 +4,8 @@
require 'unparser'
require 'method_source'
require 'filecache'
+require 'webdrivers'
+
require 'capybara/rspec'
require 'hyper-spec/internal/client_execution'
@@ -84,9 +86,11 @@ module Selenium
module WebDriver
module Chrome
module Bridge
- COMMANDS = remove_const(:COMMANDS).dup
- COMMANDS[:get_log] = [:post, 'session/:session_id/log']
- COMMANDS.freeze
+ if const_defined?(:COMMANDS)
+ COMMANDS = remove_const(:COMMANDS).dup
+ COMMANDS[:get_log] = [:post, 'session/:session_id/log']
+ COMMANDS.freeze
+ end
def log(type)
data = execute :get_log, {}, type: type.to_s
@@ -191,17 +195,42 @@ def self.on_server?
Capybara.default_max_wait_time = 10
- Capybara.register_driver :chrome do |app|
- options = {}
- options.merge!(
- w3c: false,
- args: %w[auto-open-devtools-for-tabs]
+ Capybara.register_driver :chrome_undocked do |app|
+ opts = Selenium::WebDriver::Chrome::Options.new(args: %w[auto-open-devtools-for-tabs])
+ opts.add_preference(
+ 'devtools',
+ 'preferences' => {
+ 'currentDockState' => '"undocked"', # Or '"bottom"', '"right"', etc.
+ 'panel-selectedTab' => '"console"'
+ }
)
- options['mobileEmulation'] = { 'deviceName' => ENV['DEVICE'].tr('-', ' ') } if ENV['DEVICE']
- capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
- chromeOptions: options, 'goog:loggingPrefs' => { browser: 'ALL' }
+ caps = Selenium::WebDriver::Remote::Capabilities.chrome
+ caps["goog:loggingPrefs"] = { browser: 'ALL' }
+
+ Capybara::Selenium::Driver.new(app, browser: :chrome, options: opts, desired_capabilities: caps)
+ end
+
+ Capybara.register_driver :chrome_docked do |app|
+ opts = Selenium::WebDriver::Chrome::Options.new(args: %w[auto-open-devtools-for-tabs])
+ opts.add_preference(
+ 'devtools',
+ 'preferences' => {
+ 'currentDockState' => '"right"', # Or '"bottom"', '"undocked"', etc.
+ 'panel-selectedTab' => '"console"'
+ }
)
- Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
+ caps = Selenium::WebDriver::Remote::Capabilities.chrome
+ caps["goog:loggingPrefs"] = { browser: 'ALL' }
+
+ Capybara::Selenium::Driver.new(app, browser: :chrome, options: opts, desired_capabilities: caps)
+ end
+
+ Capybara.register_driver :chrome do |app|
+ caps = Selenium::WebDriver::Remote::Capabilities.chrome
+
+ caps["goog:loggingPrefs"] = { browser: 'ALL' } # if ENV['LOG_JS']
+
+ Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: caps)
end
Capybara.register_driver :firefox do |app|
@@ -238,6 +267,8 @@ def self.on_server?
Capybara.javascript_driver =
case ENV['DRIVER']
when 'beheaded' then :firefox_headless
+ when 'chrome_undocked' then :chrome_undocked
+ when 'chrome_docked' then :chrome_docked
when 'chrome' then :chrome
when 'ff' then :selenium_with_firebug
when 'firefox' then :firefox
diff --git a/ruby/hyper-spec/lib/hyper-spec/component_test_helpers working.rbx b/ruby/hyper-spec/lib/hyper-spec/component_test_helpers working.rbx
new file mode 100644
index 000000000..f41fbe740
--- /dev/null
+++ b/ruby/hyper-spec/lib/hyper-spec/component_test_helpers working.rbx
@@ -0,0 +1,365 @@
+# see component_test_helpers_spec.rb for examples
+require 'parser/current'
+require 'unparser'
+require 'hyper-spec/unparser_patch'
+require 'method_source'
+require_relative '../../lib/hyper-spec/time_cop.rb'
+
+Parser::Builders::Default.emit_procarg0 = true
+
+module HyperSpec
+ module ComponentTestHelpers
+ TOP_LEVEL_COMPONENT_PATCH =
+ Opal.compile(File.read(File.expand_path('../../sources/top_level_rails_component.rb', __FILE__)))
+ TIME_COP_CLIENT_PATCH =
+ Opal.compile(File.read(File.expand_path('../../hyper-spec/time_cop.rb', __FILE__))) +
+ "\n#{File.read(File.expand_path('../../sources/lolex.js', __FILE__))}"
+
+ class << self
+ attr_accessor :current_example
+ attr_accessor :description_displayed
+
+ def display_example_description
+ ""
+ end
+ end
+
+ def build_test_url_for(controller)
+ unless controller
+ unless defined?(::HyperstackTestController)
+ Object.const_set('HyperstackTestController', Class.new(::ActionController::Base))
+ end
+
+ controller = ::HyperstackTestController
+ end
+
+ route_root = controller.name.gsub(/Controller$/, '').underscore
+
+ unless controller.method_defined?(:test)
+ controller.class_eval do
+ define_method(:test) do
+ route_root = self.class.name.gsub(/Controller$/, '').underscore
+ test_params = ::Rails.cache.read("/#{route_root}/#{params[:id]}")
+ @component_name = test_params[0]
+ @component_params = test_params[1]
+ render_params = test_params[2]
+ render_on = render_params.delete(:render_on) || :client_only
+ _mock_time = render_params.delete(:mock_time)
+ style_sheet = render_params.delete(:style_sheet)
+ javascript = render_params.delete(:javascript)
+ code = render_params.delete(:code)
+
+ page = '<%= react_component @component_name, @component_params, '\
+ "{ prerender: #{render_on != :client_only} } %>"
+ unless render_on == :server_only
+ page = "\n#{page}"
+ page = "\n#{page}" if code
+ end
+
+ if render_on != :server_only || Lolex.initialized?
+ page = "\n#{page}"
+ end
+
+ if (render_on != :server_only && !render_params[:layout]) || javascript
+ page = "<%= javascript_include_tag '#{javascript || 'application'}' %>\n#{page}"
+ end
+
+ if !render_params[:layout] || style_sheet
+ page = "<%= stylesheet_link_tag '#{style_sheet || 'application'}' %>\n#{page}"
+ end
+ page = "\n#{page}"
+
+ title = view_context.escape_javascript(ComponentTestHelpers.current_example.description)
+ title = "#{title}...continued." if ComponentTestHelpers.description_displayed
+
+ page = "\n#{page}"
+
+ ComponentTestHelpers.description_displayed = true
+ render_params[:inline] = page
+ render render_params
+ end
+ end
+
+ begin
+ routes = ::Rails.application.routes
+ routes.disable_clear_and_finalize = true
+ routes.clear!
+ routes.draw do
+ get "/#{route_root}/:id", to: "#{route_root}#test"
+ end
+ ::Rails.application.routes_reloader.paths.each { |path| load(path) }
+ routes.finalize!
+ ActiveSupport.on_load(:action_controller) { routes.finalize! }
+ ensure
+ routes.disable_clear_and_finalize = false
+ end
+ end
+
+ "/#{route_root}/#{@test_id = (@test_id || 0) + 1}"
+ end
+
+ def isomorphic(&block)
+ yield
+ on_client(&block)
+ end
+
+ def evaluate_ruby(str = '', opts = {}, &block)
+ insure_mount
+ if block
+ str = "#{str}\n#{Unparser.unparse Parser::CurrentRuby.parse(block.source).children.last}"
+ end
+ js = Opal.compile(str).gsub("// Prepare super implicit arguments\n", "")
+ .delete("\n").gsub('(Opal);', '(Opal)')
+ # workaround for firefox 58 and geckodriver 0.19.1, because firefox is unable to find .$to_json:
+ # JSON.parse(evaluate_script("(function(){var a=Opal.Array.$new(); a[0]=#{js}; return a.$to_json();})();"), opts).first
+ JSON.parse(evaluate_script("[#{js}].$to_json()"), opts).first
+ end
+
+ def expect_evaluate_ruby(str = '', opts = {}, &block)
+ insure_mount
+ expect(evaluate_ruby(add_opal_block(str, block), opts))
+ end
+
+ def add_opal_block(str, block)
+ # big assumption here is that we are going to follow this with a .to
+ # hence .children.first followed by .children.last
+ # probably should do some kind of "search" to make this work nicely
+ return str unless block
+ "#{str}\n"\
+ "#{Unparser.unparse Parser::CurrentRuby.parse(block.source).children.first.children.last}"
+ end
+
+ def evaluate_promise(str = '', opts = {}, &block)
+ insure_mount
+ str = "#{str}\n#{Unparser.unparse Parser::CurrentRuby.parse(block.source).children.last}" if block
+ str = "#{str}.then { |args| args = [args]; `window.hyper_spec_promise_result = args` }"
+ js = Opal.compile(str).gsub("\n","").gsub("(Opal);","(Opal)")
+ page.evaluate_script("window.hyper_spec_promise_result = false")
+ page.execute_script(js)
+ Timeout.timeout(Capybara.default_max_wait_time) do
+ loop do
+ sleep 0.25
+ break if page.evaluate_script("!!window.hyper_spec_promise_result")
+ end
+ end
+ JSON.parse(page.evaluate_script("window.hyper_spec_promise_result.$to_json()"), opts).first
+ end
+
+ def expect_promise(str = '', opts = {}, &block)
+ insure_mount
+ expect(evaluate_promise(add_opal_block(str, block), opts))
+ end
+
+ def ppr(str)
+ js = Opal.compile(str).delete("\n").gsub('(Opal);', '(Opal)')
+ execute_script("console.log(#{js})")
+ end
+
+ def on_client(&block)
+ @client_code =
+ "#{@client_code}#{Unparser.unparse Parser::CurrentRuby.parse(block.source).children.last}\n"
+ end
+
+ def debugger
+ `debugger`
+ nil
+ end
+
+ def insure_mount
+ # rescue in case page is not defined...
+ mount unless page.instance_variable_get('@hyper_spec_mounted')
+ end
+
+ def client_option(opts = {})
+ @client_options ||= {}
+ @client_options.merge! opts
+ end
+
+ alias client_options client_option
+
+ def mount(component_name = nil, params = nil, opts = {}, &block)
+ unless params
+ params = opts
+ opts = {}
+ end
+
+ opts = client_options opts
+ test_url = build_test_url_for(opts.delete(:controller))
+
+ if block || @client_code || component_name.nil?
+ block_with_helpers = <<-code
+ module ComponentHelpers
+ def self.js_eval(s)
+ `eval(s)`
+ end
+ def self.dasherize(s)
+ res = %x{
+ s.replace(/[-_\\s]+/g, '-')
+ .replace(/([A-Z\\d]+)([A-Z][a-z])/g, '$1-$2')
+ .replace(/([a-z\\d])([A-Z])/g, '$1-$2')
+ .toLowerCase()
+ }
+ res
+ end
+ def self.add_class(class_name, styles={})
+ style = styles.collect { |attr, value| "\#{dasherize(attr)}:\#{value}" }.join("; ")
+ cs = class_name.to_s
+ %x{
+ var style_el = document.createElement("style");
+ var css = "." + cs + " { " + style + " }";
+ style_el.type = "text/css";
+ if (style_el.styleSheet){
+ style_el.styleSheet.cssText = css;
+ } else {
+ style_el.appendChild(document.createTextNode(css));
+ }
+ document.head.appendChild(style_el);
+ }
+ end
+ end
+ class Hyperstack::Internal::Component::TestDummy
+ include Hyperstack::Component
+ render {}
+ end
+ #{@client_code}
+ #{Unparser.unparse(Parser::CurrentRuby.parse(block.source).children.last) if block}
+ code
+ opts[:code] = Opal.compile(block_with_helpers)
+ end
+
+ component_name ||= 'Hyperstack::Internal::Component::TestDummy'
+ ::Rails.cache.write(test_url, [component_name, params, opts])
+ test_code_key = "hyper_spec_prerender_test_code.js"
+ @@original_server_render_files ||= ::Rails.configuration.react.server_renderer_options[:files]
+ if opts[:render_on] == :both || opts[:render_on] == :server_only
+ unless opts[:code].blank?
+ ::Rails.cache.write(test_code_key, opts[:code])
+ ::Rails.configuration.react.server_renderer_options[:files] = @@original_server_render_files + [test_code_key]
+ ::React::ServerRendering.reset_pool # make sure contexts are reloaded so they dont use code from cache, as the rails filewatcher doesnt look for cache changes
+ else
+ ::Rails.cache.delete(test_code_key)
+ ::Rails.configuration.react.server_renderer_options[:files] = @@original_server_render_files
+ ::React::ServerRendering.reset_pool # make sure contexts are reloaded so they dont use code from cache, as the rails filewatcher doesnt look for cache changes
+ end
+ end
+ visit test_url
+ wait_for_ajax unless opts[:no_wait]
+ page.instance_variable_set('@hyper_spec_mounted', true)
+ Lolex.init(self, client_options[:time_zone], client_options[:clock_resolution])
+ end
+
+ [:callback_history_for, :last_callback_for, :clear_callback_history_for,
+ :event_history_for, :last_event_for, :clear_event_history_for].each do |method|
+ define_method(method) do |event_name|
+ evaluate_ruby("Hyperstack::Internal::Component::TopLevelRailsComponent.#{method}('#{event_name}')")
+ end
+ end
+
+ def run_on_client(&block)
+ script = Opal.compile(Unparser.unparse(Parser::CurrentRuby.parse(block.source).children.last))
+ execute_script(script)
+ end
+
+ def add_class(class_name, style)
+ @client_code = "#{@client_code}ComponentHelpers.add_class('#{class_name}', #{style})\n"
+ end
+
+ def open_in_chrome
+ if false && ['linux', 'freebsd'].include?(`uname`.downcase)
+ `google-chrome http://#{page.server.host}:#{page.server.port}#{page.current_path}`
+ else
+ `open http://#{page.server.host}:#{page.server.port}#{page.current_path}`
+ end
+
+ while true
+ sleep 1.hour
+ end
+ end
+
+ def pause(message = nil)
+ if message
+ puts message
+ page.evaluate_script "console.log('#{message} (type go() to continue)')"
+ end
+
+ page.evaluate_script('window.hyper_spec_waiting_for_go = true')
+ page.evaluate_script('go = function() {window.hyper_spec_waiting_for_go = false}')
+ loop do
+ sleep 0.25
+ break unless page.evaluate_script('window.hyper_spec_waiting_for_go')
+ end
+ end
+
+ def wait_for_size(width, height)
+ start_time = Capybara::Helpers.monotonic_time
+ stable_count_w = 0
+ stable_count_h = 0
+ prev_size = [0, 0]
+ begin
+ sleep 0.05
+ curr_size = Capybara.current_session.current_window.size
+ return if [width, height] == curr_size
+ # some maximum or minimum is reached and size doesnt change anymore
+ stable_count_w += 1 if prev_size[0] == curr_size[0]
+ stable_count_h += 1 if prev_size[1] == curr_size[1]
+ return if stable_count_w > 2 || stable_count_h > 2
+ prev_size = curr_size
+ end while (Capybara::Helpers.monotonic_time - start_time) < Capybara.current_session.config.default_max_wait_time
+ raise Capybara::WindowError, "Window size not stable within #{Capybara.current_session.config.default_max_wait_time} seconds."
+ end
+
+ def size_window(width = nil, height = nil)
+ # return if @window_cannot_be_resized
+ # original_width = evaluate_script('window.innerWidth')
+ # original_height = evaluate_script('window.innerHeight')
+ width, height = [height, width] if width == :portrait
+ width, height = width if width.is_a? Array
+ portrait = true if height == :portrait
+
+ case width
+ when :small
+ width, height = [480, 320]
+ when :mobile
+ width, height = [640, 480]
+ when :tablet
+ width, height = [960, 640]
+ when :large
+ width, height = [1920, 6000]
+ when :default, nil
+ width, height = [1024, 768]
+ end
+
+ width, height = [height, width] if portrait
+
+ unless RSpec.configuration.debugger_width
+ Capybara.current_session.current_window.resize_to(1000, 500)
+ wait_for_size(1000, 500)
+ inner_width = evaluate_script('window.innerWidth')
+ RSpec.configuration.debugger_width = 1000 - inner_width
+ end
+ Capybara.current_session.current_window
+ .resize_to(width + RSpec.configuration.debugger_width, height)
+ wait_for_size(width + RSpec.configuration.debugger_width, height)
+ end
+ end
+
+ RSpec.configure do |config|
+ config.before(:each) do |example|
+ ComponentTestHelpers.current_example = example
+ ComponentTestHelpers.description_displayed = false
+ end
+
+ if defined?(ActiveRecord)
+ config.before(:all) do
+ ActiveRecord::Base.class_eval do
+ def attributes_on_client(page)
+ page.evaluate_ruby("#{self.class.name}.find(#{id}).attributes", symbolize_names: true)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/ruby/hyper-spec/lib/hyper-spec/version.rb b/ruby/hyper-spec/lib/hyper-spec/version.rb
index 59df37dbd..181672ec0 100644
--- a/ruby/hyper-spec/lib/hyper-spec/version.rb
+++ b/ruby/hyper-spec/lib/hyper-spec/version.rb
@@ -1,3 +1,3 @@
module HyperSpec
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
diff --git a/ruby/hyper-spec/spec/spec_helper.rb b/ruby/hyper-spec/spec/spec_helper.rb
index 2ed740a54..deee6f270 100644
--- a/ruby/hyper-spec/spec/spec_helper.rb
+++ b/ruby/hyper-spec/spec/spec_helper.rb
@@ -1,6 +1,5 @@
require 'hyper-spec'
require 'pry'
-require 'opal-browser'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path('../test_app/config/environment', __FILE__)
diff --git a/ruby/hyper-spec/yarn.lock b/ruby/hyper-spec/yarn.lock
new file mode 100644
index 000000000..fb57ccd13
--- /dev/null
+++ b/ruby/hyper-spec/yarn.lock
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
diff --git a/ruby/hyper-state/hyper-state.gemspec b/ruby/hyper-state/hyper-state.gemspec
index 000d0046e..7994915d1 100644
--- a/ruby/hyper-state/hyper-state.gemspec
+++ b/ruby/hyper-state/hyper-state.gemspec
@@ -24,19 +24,19 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'hyper-component', Hyperstack::State::VERSION
spec.add_development_dependency 'hyper-spec', Hyperstack::State::VERSION
spec.add_development_dependency 'listen'
- # spec.add_development_dependency 'mini_racer', '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency, '~> 0.2.4'
- spec.add_development_dependency 'opal-browser', '~> 0.2.0'
- spec.add_development_dependency 'opal-rails', '>= 0.9.4', '< 2.0'
+ # spec.add_development_dependency 'mini_racer'#, '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency, '~> 0.2.4'
+ # spec.add_development_dependency 'opal-browser', '~> 0.2.0'
+ spec.add_development_dependency 'opal-rails'
spec.add_development_dependency 'pry-rescue'
spec.add_development_dependency 'pry-stack_explorer'
- spec.add_development_dependency 'puma'
+ spec.add_development_dependency 'puma', '<= 5.4.0'
spec.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '>= 5.0.0', '< 7.0'
spec.add_development_dependency 'rake'
- spec.add_development_dependency 'react-rails', '>= 2.4.0', '< 2.5.0'
+ spec.add_development_dependency 'react-rails', '>= 2.4.0', '< 2.7.0'
spec.add_development_dependency 'rspec', '~> 3.7.0'
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'rspec-steps', '~> 2.1.1'
spec.add_development_dependency 'rubocop' #, '~> 0.51.0'
spec.add_development_dependency 'sqlite3', '~> 1.4.2' # see https://github.com/rails/rails/issues/35153
- spec.add_development_dependency 'timecop', '~> 0.8.1'
+ spec.add_development_dependency 'timecop'#, '~> 0.8.1'
end
diff --git a/ruby/hyper-state/lib/hyper-state.rb b/ruby/hyper-state/lib/hyper-state.rb
index c5f3e3224..ec44a44af 100644
--- a/ruby/hyper-state/lib/hyper-state.rb
+++ b/ruby/hyper-state/lib/hyper-state.rb
@@ -16,5 +16,5 @@
require 'ext/object_space'
else
require 'opal'
- Opal.append_path(File.expand_path('../', __FILE__).untaint)
+ Opal.append_path(File.expand_path('../', __FILE__))
end
diff --git a/ruby/hyper-state/lib/hyperstack/state/version.rb b/ruby/hyper-state/lib/hyperstack/state/version.rb
index b16fd1ced..a45043e15 100644
--- a/ruby/hyper-state/lib/hyperstack/state/version.rb
+++ b/ruby/hyper-state/lib/hyperstack/state/version.rb
@@ -1,5 +1,5 @@
module Hyperstack
module State
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
end
diff --git a/ruby/hyper-state/yarn.lock b/ruby/hyper-state/yarn.lock
new file mode 100644
index 000000000..fb57ccd13
--- /dev/null
+++ b/ruby/hyper-state/yarn.lock
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
diff --git a/ruby/hyper-store/hyper-store.gemspec b/ruby/hyper-store/hyper-store.gemspec
index 922292445..126b57be1 100644
--- a/ruby/hyper-store/hyper-store.gemspec
+++ b/ruby/hyper-store/hyper-store.gemspec
@@ -25,20 +25,20 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'hyper-component', Hyperstack::Legacy::Store::VERSION
spec.add_development_dependency 'hyper-spec', Hyperstack::Legacy::Store::VERSION
spec.add_development_dependency 'listen'
- # spec.add_development_dependency 'mini_racer', '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency, '~> 0.2.6'
+ #spec.add_development_dependency 'mini_racer'#, '< 0.4.0' # something is busted with 0.4.0 and its libv8-node dependency, '~> 0.2.6'
spec.add_development_dependency 'opal-browser', '~> 0.2.0'
- spec.add_development_dependency 'opal-rails', '>= 0.9.4', '< 2.0'
+ spec.add_development_dependency 'opal-rails'
spec.add_development_dependency 'pry-rescue'
spec.add_development_dependency 'pry-stack_explorer'
- spec.add_development_dependency 'puma'
+ spec.add_development_dependency 'puma', '<= 5.4.0'
spec.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '>= 5.0.0', '< 7.0'
spec.add_development_dependency 'rake'
- spec.add_development_dependency 'react-rails', '>= 2.4.0', '< 2.5.0'
+ spec.add_development_dependency 'react-rails', '>= 2.4.0', '< 2.7.0'
spec.add_development_dependency 'rspec', '~> 3.7.0'
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'rspec-steps', '~> 2.1.1'
spec.add_development_dependency 'rubocop' #, '~> 0.51.0'
spec.add_development_dependency 'sqlite3', '~> 1.4.2'
- spec.add_development_dependency 'timecop', '~> 0.8.1'
+ spec.add_development_dependency 'timecop'#, '~> 0.8.1'
end
diff --git a/ruby/hyper-store/lib/hyper-store.rb b/ruby/hyper-store/lib/hyper-store.rb
index 3e6a072b0..1d95db07b 100644
--- a/ruby/hyper-store/lib/hyper-store.rb
+++ b/ruby/hyper-store/lib/hyper-store.rb
@@ -25,5 +25,5 @@ class BaseStoreClass < BasicObject
if RUBY_ENGINE != 'opal'
require 'opal'
- Opal.append_path(File.expand_path('../', __FILE__).untaint)
+ Opal.append_path(File.expand_path('../', __FILE__))
end
diff --git a/ruby/hyper-store/lib/hyperstack/legacy/store/version.rb b/ruby/hyper-store/lib/hyperstack/legacy/store/version.rb
index b6ba5bb77..6543efb2e 100644
--- a/ruby/hyper-store/lib/hyperstack/legacy/store/version.rb
+++ b/ruby/hyper-store/lib/hyperstack/legacy/store/version.rb
@@ -1,7 +1,7 @@
module Hyperstack
module Legacy
module Store
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
end
end
diff --git a/ruby/hyper-store/yarn.lock b/ruby/hyper-store/yarn.lock
new file mode 100644
index 000000000..fb57ccd13
--- /dev/null
+++ b/ruby/hyper-store/yarn.lock
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
diff --git a/ruby/hyper-trace/lib/hyper-trace.rb b/ruby/hyper-trace/lib/hyper-trace.rb
index a291bd4ec..30d438d8d 100644
--- a/ruby/hyper-trace/lib/hyper-trace.rb
+++ b/ruby/hyper-trace/lib/hyper-trace.rb
@@ -4,5 +4,5 @@
require 'hyper_trace/react_trace.rb'
else
require 'opal'
- Opal.append_path File.expand_path('../', __FILE__).untaint
+ Opal.append_path File.expand_path('../', __FILE__)
end
diff --git a/ruby/hyper-trace/lib/hyper_trace/version.rb b/ruby/hyper-trace/lib/hyper_trace/version.rb
index dff9a4eee..cd8bee9ec 100644
--- a/ruby/hyper-trace/lib/hyper_trace/version.rb
+++ b/ruby/hyper-trace/lib/hyper_trace/version.rb
@@ -1,3 +1,3 @@
module HyperTrace
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
diff --git a/ruby/hyperstack-config/hyperstack-config.gemspec b/ruby/hyperstack-config/hyperstack-config.gemspec
index c6955534b..794c74e51 100644
--- a/ruby/hyperstack-config/hyperstack-config.gemspec
+++ b/ruby/hyperstack-config/hyperstack-config.gemspec
@@ -24,21 +24,21 @@ Gem::Specification.new do |spec|
spec.add_dependency 'listen', '~> 3.0' # for hot loader
# spec.add_dependency 'mini_racer', '~> 0.2.6'
spec.add_dependency 'opal', ENV['OPAL_VERSION'] || '>= 0.11.0', '< 2.0'
- spec.add_dependency 'opal-browser', '~> 0.2.0'
+ spec.add_dependency 'opal-browser' # this is needed everywhere else so its loaded here
spec.add_dependency 'uglifier'
spec.add_dependency 'websocket' # for hot loader
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'chromedriver-helper'
- spec.add_development_dependency 'opal-rails', '>= 0.9.4', '< 2.0'
+ spec.add_development_dependency 'opal-rails' #, '>= 0.9.4', '< 2.0'
spec.add_development_dependency 'pry-rescue'
spec.add_development_dependency 'pry-stack_explorer'
- spec.add_development_dependency 'puma'
+ spec.add_development_dependency 'puma', '<= 5.4.0'
spec.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '>= 5.0.0', '< 7.0'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.7.0'
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'rubocop' #, '~> 0.51.0'
spec.add_development_dependency 'sqlite3', '~> 1.4.2' # see https://github.com/rails/rails/issues/35153
- spec.add_development_dependency 'timecop', '~> 0.8.1'
+ spec.add_development_dependency 'timecop'#, '~> 0.8.1'
end
diff --git a/ruby/hyperstack-config/lib/hyperstack-config.rb b/ruby/hyperstack-config/lib/hyperstack-config.rb
index a10902fe6..d14bbe46f 100644
--- a/ruby/hyperstack-config/lib/hyperstack-config.rb
+++ b/ruby/hyperstack-config/lib/hyperstack-config.rb
@@ -15,9 +15,14 @@ def self.naming_convention
require 'hyperstack/active_support_string_inquirer.rb'
require 'hyperstack_env'
require 'hyperstack/hotloader/stub'
+ require 'promise'
+ # uncommenting these lines breaks prerendering
+ # require 'opal-browser'
else
require 'opal'
+ # because promises and features in opal-browsers are used everywhere we load them here
require 'opal-browser'
+
# We need opal-rails to be loaded for Gem code to be properly included by sprockets.
begin
require 'opal-rails' if defined? Rails
@@ -41,12 +46,18 @@ def self.naming_convention
Hyperstack.define_setting :hotloader_ping, nil
Hyperstack.define_setting :hotloader_ignore_callback_mapping, false
Hyperstack.import 'opal', gem: true
+
+ # because promises and features in opal-browsers are used everywhere we load them here
+ Hyperstack.import 'promise', client_only: true
Hyperstack.import 'browser', client_only: true
+ Hyperstack.import 'browser/delay', client_only: true
+ Hyperstack.import 'browser/interval', client_only: true
+
Hyperstack.import 'hyperstack-config', gem: true
Hyperstack.import 'hyperstack/autoloader'
Hyperstack.import 'hyperstack/autoloader_starter'
# based on the environment pick the directory containing the file with the matching
# value for the client. This avoids use of ERB for builds outside of sprockets environment
- Opal.append_path(File.expand_path("../hyperstack/environment/#{Hyperstack.env}/", __FILE__).untaint)
- Opal.append_path(File.expand_path('../', __FILE__).untaint)
+ Opal.append_path(File.expand_path("../hyperstack/environment/#{Hyperstack.env}/", __FILE__))
+ Opal.append_path(File.expand_path('../', __FILE__))
end
diff --git a/ruby/hyperstack-config/lib/hyperstack/config/version.rb b/ruby/hyperstack-config/lib/hyperstack/config/version.rb
index 923640f12..7247f252e 100644
--- a/ruby/hyperstack-config/lib/hyperstack/config/version.rb
+++ b/ruby/hyperstack-config/lib/hyperstack/config/version.rb
@@ -1,5 +1,5 @@
module Hyperstack
module Config
- VERSION = '1.0.alpha1.8'
+ VERSION = '1.0.alpha1.8.0017'
end
end
diff --git a/ruby/hyperstack-config/lib/hyperstack/hotloader/server.rb b/ruby/hyperstack-config/lib/hyperstack/hotloader/server.rb
index bd97822df..f9eab7dfd 100644
--- a/ruby/hyperstack-config/lib/hyperstack/hotloader/server.rb
+++ b/ruby/hyperstack-config/lib/hyperstack/hotloader/server.rb
@@ -37,7 +37,7 @@ def setup_directories(options)
'app/assets/stylesheets',
'app/views/components'
].each { |known_dir|
- if !@directories.include?(known_dir) && File.exists?(known_dir)
+ if !@directories.include?(known_dir) && File.exist?(known_dir)
@directories << known_dir
end
}
diff --git a/ruby/hyperstack-config/lib/hyperstack/js_imports.rb b/ruby/hyperstack-config/lib/hyperstack/js_imports.rb
index b11427504..75879da49 100644
--- a/ruby/hyperstack-config/lib/hyperstack/js_imports.rb
+++ b/ruby/hyperstack-config/lib/hyperstack/js_imports.rb
@@ -8,7 +8,7 @@ def js_import(value, client_only: nil, server_only: nil, defines:)
on_server = `typeof Opal.global.document === 'undefined'`
return if (server_only && !on_server) || (client_only && on_server)
defines.each do |name|
- next unless `Opal.global[#{name}] === undefined`
+ next unless `Opal.global['#{name}'] === undefined`
raise "The package #{name} was not found. Add it to the webpack "\
"#{client_only ? 'client_only.js' : 'client_and_server.js'} manifest."
end
diff --git a/ruby/hyperstack-config/lib/hyperstack/native_wrapper_compatibility.rb b/ruby/hyperstack-config/lib/hyperstack/native_wrapper_compatibility.rb
index fbb775f19..b8dc25507 100644
--- a/ruby/hyperstack-config/lib/hyperstack/native_wrapper_compatibility.rb
+++ b/ruby/hyperstack-config/lib/hyperstack/native_wrapper_compatibility.rb
@@ -1,7 +1,7 @@
# allows hyperstack to include Native::Wrapper even if running Opal 0.11
module Native
module Wrapper
- def self.included(klass)
+ def self.includedx(klass)
if Native.instance_methods.include? :to_n
klass.include Native
else
diff --git a/ruby/hyperstack-config/spec/test_app/app/assets/config/manifest.js b/ruby/hyperstack-config/spec/test_app/app/assets/config/manifest.js
new file mode 100644
index 000000000..6f71952ea
--- /dev/null
+++ b/ruby/hyperstack-config/spec/test_app/app/assets/config/manifest.js
@@ -0,0 +1 @@
+ //= link_directory ../javascripts .js
diff --git a/ruby/hyperstack-config/yarn.lock b/ruby/hyperstack-config/yarn.lock
new file mode 100644
index 000000000..fb57ccd13
--- /dev/null
+++ b/ruby/hyperstack-config/yarn.lock
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
diff --git a/ruby/rails-hyperstack/.ruby-version b/ruby/rails-hyperstack/.ruby-version
deleted file mode 100644
index 37c2961c2..000000000
--- a/ruby/rails-hyperstack/.ruby-version
+++ /dev/null
@@ -1 +0,0 @@
-2.7.2
diff --git a/ruby/rails-hyperstack/Gemfile b/ruby/rails-hyperstack/Gemfile
index cbc05abe0..70876008e 100644
--- a/ruby/rails-hyperstack/Gemfile
+++ b/ruby/rails-hyperstack/Gemfile
@@ -8,4 +8,5 @@ gem 'hyper-router', path: '../hyper-router'
gem 'hyper-spec', path: '../hyper-spec'
gem 'webpacker' # TODO: figure out why these two are necessary!
gem 'turbolinks'
+gem "selenium-webdriver" #, '3.142.7'
gemspec
diff --git a/ruby/rails-hyperstack/Rakefile b/ruby/rails-hyperstack/Rakefile
index 70271475f..9e31d53fd 100644
--- a/ruby/rails-hyperstack/Rakefile
+++ b/ruby/rails-hyperstack/Rakefile
@@ -21,11 +21,15 @@ namespace :spec do
sh('spring stop')
sh('bundle exec rails g hyperstack:install')
sh('bundle exec rails generate model Sample name:string description:text')
+ sleep 1
+ sh('pwd')
+ sh('ls app/models')
sh('mv app/models/sample.rb app/hyperstack/models/sample.rb')
sh("cat ../server_side_sample.rb >> app/models/sample.rb")
sh('bundle exec rake db:migrate')
sh('RAILS_ENV=test bundle exec rake db:setup')
# sh('bundle exec rails dev:cache') # not tested yet...
+ sh('RAILS_ENV=test bundle exec rails webpacker:compile')
end
end
end
diff --git a/ruby/rails-hyperstack/lib/generators/install/hyperstack_generator.rb b/ruby/rails-hyperstack/lib/generators/install/hyperstack_generator.rb
index 8a1d30a4c..381b43fe1 100644
--- a/ruby/rails-hyperstack/lib/generators/install/hyperstack_generator.rb
+++ b/ruby/rails-hyperstack/lib/generators/install/hyperstack_generator.rb
@@ -40,7 +40,7 @@ class HyperComponent
end
def move_and_update_application_record
- unless File.exists? 'app/hyperstack/models/application_record.rb'
+ unless File.exist? 'app/hyperstack/models/application_record.rb'
`mv app/models/application_record.rb app/hyperstack/models/application_record.rb`
create_file 'app/models/application_record.rb', <<-RUBY
# app/models/application_record.rb
diff --git a/ruby/rails-hyperstack/lib/generators/install/hyperstack_generator_base.rb b/ruby/rails-hyperstack/lib/generators/install/hyperstack_generator_base.rb
index d55bc6088..77b05999e 100644
--- a/ruby/rails-hyperstack/lib/generators/install/hyperstack_generator_base.rb
+++ b/ruby/rails-hyperstack/lib/generators/install/hyperstack_generator_base.rb
@@ -11,7 +11,7 @@ def warnings
end
def clear_cache
- run 'rm -rf tmp/cache' unless Dir.exists?(Rails.root.join('app', 'hyperstack'))
+ run 'rm -rf tmp/cache' unless Dir.exist?(Rails.root.join('app', 'hyperstack'))
end
def insure_hyperstack_loader_installed
@@ -66,11 +66,11 @@ def insure_base_component_class_exists
file_name = Rails.root.join(
'app', 'hyperstack', 'components', "#{@component_base_class.underscore}.rb"
)
- template 'hyper_component_template.rb', file_name unless File.exists? file_name
+ template 'hyper_component_template.rb', file_name unless File.exist? file_name
end
def add_to_manifest(manifest, &block)
- if File.exists? "app/javascript/packs/#{manifest}"
+ if File.exist? "app/javascript/packs/#{manifest}"
append_file "app/javascript/packs/#{manifest}", &block
else
create_file "app/javascript/packs/#{manifest}", &block
diff --git a/ruby/rails-hyperstack/lib/hyperstack/server_side_auto_require.rb b/ruby/rails-hyperstack/lib/hyperstack/server_side_auto_require.rb
index a3388d127..ee500361c 100644
--- a/ruby/rails-hyperstack/lib/hyperstack/server_side_auto_require.rb
+++ b/ruby/rails-hyperstack/lib/hyperstack/server_side_auto_require.rb
@@ -1,4 +1,17 @@
-Rails.configuration.autoloader = :classic
+# require "hyperstack/server_side_auto_require.rb" in your hyperstack initializer
+# to autoload shadowed server side files that match files
+# in the hyperstack directory
+
+if Rails.configuration.try(:autoloader) == :zeitwerk
+ Rails.autoloaders.each do |loader|
+ loader.on_load do |_cpath, _value, abspath|
+ ActiveSupport::Dependencies.add_server_side_dependency(abspath) do |load_path|
+ loader.send(:log, "Hyperstack loading server side shadowed file: #{load_path}") if loader&.logger
+ require("#{load_path}.rb")
+ end
+ end
+ end
+end
module ActiveSupport
module Dependencies
@@ -11,7 +24,7 @@ class << self
# and add that as a dependency
def require_or_load(file_name, const_path = nil)
- add_server_side_dependency(file_name)
+ add_server_side_dependency(file_name) { |load_path| require_dependency load_path }
original_require_or_load(file_name, const_path)
end
@@ -20,7 +33,7 @@ def require_or_load(file_name, const_path = nil)
# the filename, and if a ruby file exists at that location then
# add it as a dependency
- def add_server_side_dependency(file_name)
+ def add_server_side_dependency(file_name, loader = nil)
path = File.expand_path(file_name.chomp(".rb"))
.split(File::SEPARATOR).reverse
hs_index = path.find_index(HYPERSTACK_DIR)
@@ -32,7 +45,7 @@ def add_server_side_dependency(file_name)
return unless File.exist? "#{load_path}.rb"
- require_dependency load_path
+ yield load_path
end
end
end
diff --git a/ruby/rails-hyperstack/lib/hyperstack/version.rb b/ruby/rails-hyperstack/lib/hyperstack/version.rb
index 4c001ab78..f3ab25793 100644
--- a/ruby/rails-hyperstack/lib/hyperstack/version.rb
+++ b/ruby/rails-hyperstack/lib/hyperstack/version.rb
@@ -1,3 +1,3 @@
module Hyperstack
- ROUTERVERSION = VERSION = '1.0.alpha1.8'
+ ROUTERVERSION = VERSION = '1.0.alpha1.8.0017'
end
diff --git a/ruby/rails-hyperstack/rails-hyperstack.gemspec b/ruby/rails-hyperstack/rails-hyperstack.gemspec
index f42541c2d..75a674a76 100644
--- a/ruby/rails-hyperstack/rails-hyperstack.gemspec
+++ b/ruby/rails-hyperstack/rails-hyperstack.gemspec
@@ -58,10 +58,9 @@ You can control how much of the stack gets installed as well:
spec.add_dependency 'hyper-model', Hyperstack::VERSION
spec.add_dependency 'hyper-router', Hyperstack::ROUTERVERSION
spec.add_dependency 'hyperstack-config', Hyperstack::VERSION
- spec.add_dependency 'opal-rails' #, '~> 2.0'
-
- spec.add_dependency 'opal-browser', '~> 0.2.0'
- spec.add_dependency 'react-rails', '>= 2.4.0', '< 2.5.0'
+ spec.add_dependency 'opal-rails'
+ spec.add_dependency 'opal', ENV['OPAL_VERSION'] || '>= 0.11.0', '< 2.0'
+ spec.add_dependency 'react-rails', '>= 2.4.0', '< 2.7.0'
# spec.add_dependency 'mini_racer', '~> 0.2.6'
# spec.add_dependency 'libv8', '~> 7.3.492.27.1'
spec.add_dependency 'rails', ENV['RAILS_VERSION'] || '>= 5.0.0', '< 7.0'
@@ -70,7 +69,7 @@ You can control how much of the stack gets installed as well:
spec.add_development_dependency 'chromedriver-helper'
spec.add_development_dependency 'hyper-spec', Hyperstack::VERSION
spec.add_development_dependency 'pry'
- spec.add_development_dependency 'puma'
+ spec.add_development_dependency 'puma', '<= 5.4.0'
spec.add_development_dependency 'bootsnap'
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'rubocop' #, '~> 0.51.0'
diff --git a/ruby/version.rb b/ruby/version.rb
index 3de6fcf01..3f17672fc 100644
--- a/ruby/version.rb
+++ b/ruby/version.rb
@@ -1,3 +1,3 @@
-module Hyperloop
+module Hyperstack
VERSION = File.read(File.expand_path("../HYPERSTACK_VERSION", __dir__)).strip
end
diff --git a/runall b/runall
new file mode 100755
index 000000000..e9b78fe15
--- /dev/null
+++ b/runall
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+service postgresql restart
+service mysql restart
+redis-server &
+sleep 1
+psql -c 'create database hyper_mesh_test_db;' -U postgres
+
+#DRIVER=travis COMPONENT=rails-hyperstack RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-spec RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-trace RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyperstack-config RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-state RUBY_VERSION=2.7.8 ./runtests
+DRIVER=travis COMPONENT=hyper-component RUBY_VERSION=2.7.8 ./runtests
+
+#DRIVER=travis COMPONENT=hyper-router RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-store RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-operation RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-model RUBY_VERSION=2.7.8 TASK=part1 DB=hyper_mesh_test_db ./runtests
+#DRIVER=travis COMPONENT=hyper-model RUBY_VERSION=2.7.8 TASK=part2 DB=hyper_mesh_test_db ./runtests
+#DRIVER=travis COMPONENT=hyper-model RUBY_VERSION=2.7.8 TASK=part3 DB=hyper_mesh_test_db ./runtests
+#DRIVER=travis COMPONENT=hyper-i18n RUBY_VERSION=2.7.8 ./runtests
diff --git a/runone b/runone
new file mode 100755
index 000000000..43fbd807e
--- /dev/null
+++ b/runone
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+service postgresql restart
+service mysql restart
+redis-server &
+sleep 1
+rbenv global $RUBY_VERSION
+psql -c 'create database hyper_mesh_test_db;' -U postgres
+mysql -u root -e 'create database test_hyper_operation_db;'
+
+./runtests
+#DRIVER=travis COMPONENT=rails-hyperstack RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-spec RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-trace RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyperstack-config RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-state RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-component RUBY_VERSION=2.7.8 ./runtests
+
+#DRIVER=travis COMPONENT=hyper-router RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-store RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-operation RUBY_VERSION=2.7.8 ./runtests
+#DRIVER=travis COMPONENT=hyper-model RUBY_VERSION=2.7.8 TASK=part1 DB=hyper_mesh_test_db ./runtests
+#DRIVER=travis COMPONENT=hyper-model RUBY_VERSION=2.7.8 TASK=part2 DB=hyper_mesh_test_db ./runtests
+#DRIVER=travis COMPONENT=hyper-model RUBY_VERSION=2.7.8 TASK=part3 DB=hyper_mesh_test_db ./runtests
+#DRIVER=travis COMPONENT=hyper-i18n RUBY_VERSION=2.7.8 ./runtests
diff --git a/runtests b/runtests
new file mode 100755
index 000000000..1ad1f84f0
--- /dev/null
+++ b/runtests
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+cd /root/hyperstack/ruby/$COMPONENT
+
+bundle install
+yarn install
+
+#bundle exec chromedriver-update
+mkdir -p /usr/lib/chromium-browser
+bundle exec ruby -e 'require "webdrivers"; Webdrivers::Chromedriver.update; puts Webdrivers::Chromedriver.current_version'
+cp ~/.webdrivers/chromedriver /usr/lib/chromium-browser/chromedriver
+
+bundle exec rake spec:prepare
+bundle exec rake $TASK
diff --git a/temp-293.rdb b/temp-293.rdb
new file mode 100644
index 000000000..7a7b1c474
Binary files /dev/null and b/temp-293.rdb differ
diff --git a/verify-gocd-yaml b/verify-gocd-yaml
new file mode 100755
index 000000000..5dc659c80
--- /dev/null
+++ b/verify-gocd-yaml
@@ -0,0 +1 @@
+ docker run -it -v .:/dojo/work -e GOCDCLI_SKIP_AUTH=false kudulab/gocd-cli-dojo:yaml "gocd configrepo syntax --yaml hyperstack.gocd.yaml"
diff --git a/yarn.lock b/yarn.lock
new file mode 100644
index 000000000..fb57ccd13
--- /dev/null
+++ b/yarn.lock
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+