[ARVADOS] created: 9ed67680465cffab5420c94c3ed3c1dc768c530f

Git user git at public.curoverse.com
Fri Aug 4 17:16:56 EDT 2017


        at  9ed67680465cffab5420c94c3ed3c1dc768c530f (commit)


commit 9ed67680465cffab5420c94c3ed3c1dc768c530f
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Aug 3 15:54:38 2017 -0400

    12033: Add mithril via npm.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curoverse.com>

diff --git a/apps/workbench/.gitignore b/apps/workbench/.gitignore
index a27ac31..66a7adc 100644
--- a/apps/workbench/.gitignore
+++ b/apps/workbench/.gitignore
@@ -39,3 +39,6 @@
 
 # Generated git-commit.version file
 /git-commit.version
+
+# npm-rails
+/node_modules
diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile
index 8e9fcbf..788dcf6 100644
--- a/apps/workbench/Gemfile
+++ b/apps/workbench/Gemfile
@@ -102,3 +102,5 @@ gem 'lograge'
 gem 'logstash-event'
 
 gem 'safe_yaml'
+
+gem 'npm-rails'
diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock
index 0abe868..34db9cd 100644
--- a/apps/workbench/Gemfile.lock
+++ b/apps/workbench/Gemfile.lock
@@ -169,6 +169,8 @@ GEM
       net-ssh (>= 2.6.5)
     nokogiri (1.6.6.4)
       mini_portile (~> 0.6.0)
+    npm-rails (0.2.1)
+      rails (>= 3.2)
     oj (2.11.2)
     os (0.9.6)
     passenger (4.0.57)
@@ -296,6 +298,7 @@ DEPENDENCIES
   mocha
   morrisjs-rails
   multi_json
+  npm-rails
   oj
   passenger
   piwik_analytics
@@ -320,4 +323,4 @@ DEPENDENCIES
   wiselinks
 
 BUNDLED WITH
-   1.13.2
+   1.15.1
diff --git a/apps/workbench/app/assets/javascripts/application.js b/apps/workbench/app/assets/javascripts/application.js
index c55bda0..d4f928b 100644
--- a/apps/workbench/app/assets/javascripts/application.js
+++ b/apps/workbench/app/assets/javascripts/application.js
@@ -31,6 +31,7 @@
 //= require raphael
 //= require morris
 //= require jquery.number.min
+//= require npm-dependencies
 //= require_tree .
 
 jQuery(function($){
diff --git a/apps/workbench/app/assets/javascripts/mithril_mount.js b/apps/workbench/app/assets/javascripts/mithril_mount.js
new file mode 100644
index 0000000..e69b80e
--- /dev/null
+++ b/apps/workbench/app/assets/javascripts/mithril_mount.js
@@ -0,0 +1,30 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+// rails_npm does "window.Mithril = require('mithril')" for us.
+var m = window.Mithril
+
+var testComponent = {
+    view: function(vnode) {
+        return m('div.mithril-test-component', [
+            m('p', {
+                onclick: m.withAttr('zzz', function(){}),
+            }, [
+                'mithril is working; rendered at t=',
+                (new Date()).getTime(),
+                'ms',
+            ]),
+        ])
+    },
+}
+
+var mountMithril = {
+    testComponent: testComponent,
+}
+
+$(document).on('ready arv:pane:loaded', function() {
+    $('[data-mount-mithril]').each(function() {
+        m.mount(this, mountMithril[$(this).data('mount-mithril')])
+    })
+})
diff --git a/apps/workbench/app/controllers/tests_controller.rb b/apps/workbench/app/controllers/tests_controller.rb
new file mode 100644
index 0000000..5d2de4e
--- /dev/null
+++ b/apps/workbench/app/controllers/tests_controller.rb
@@ -0,0 +1,9 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class TestsController < ApplicationController
+  skip_before_filter :find_object_by_uuid
+  def mithril
+  end
+end
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index a3644e5..8aec64e 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -128,6 +128,8 @@ ArvadosWorkbench::Application.routes.draw do
 
   match '/_health/ping', to: 'healthcheck#ping', via: [:get]
 
+  get '/tests/mithril', to: 'tests#mithril'
+
   # Send unroutable requests to an arbitrary controller
   # (ends up at ApplicationController#render_not_found)
   match '*a', to: 'links#render_not_found', via: [:get, :post]
diff --git a/build/package-build-dockerfiles/Makefile b/build/package-build-dockerfiles/Makefile
index e35056b..396370d 100644
--- a/build/package-build-dockerfiles/Makefile
+++ b/build/package-build-dockerfiles/Makefile
@@ -29,11 +29,15 @@ ubuntu1604/generated: common-generated-all
 	cp -rlt ubuntu1604/generated common-generated/*
 
 GOTARBALL=go1.8.3.linux-amd64.tar.gz
+NODETARBALL=node-v6.11.2-linux-x64.tar.xz
 
-common-generated-all: common-generated/$(GOTARBALL)
+common-generated-all: common-generated/$(GOTARBALL) common-generated/$(NODETARBALL)
 
 common-generated/$(GOTARBALL): common-generated
 	wget -cqO common-generated/$(GOTARBALL) http://storage.googleapis.com/golang/$(GOTARBALL)
 
+common-generated/$(NODETARBALL): common-generated
+	wget -cqO common-generated/$(NODETARBALL) https://nodejs.org/dist/v6.11.2/$(NODETARBALL)
+
 common-generated:
 	mkdir common-generated
diff --git a/build/package-build-dockerfiles/centos7/Dockerfile b/build/package-build-dockerfiles/centos7/Dockerfile
index 0f084b3..cf120c9 100644
--- a/build/package-build-dockerfiles/centos7/Dockerfile
+++ b/build/package-build-dockerfiles/centos7/Dockerfile
@@ -20,6 +20,10 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys D39DC0E3 && \
 ADD generated/go1.8.3.linux-amd64.tar.gz /usr/local/
 RUN ln -s /usr/local/go/bin/go /usr/local/bin/
 
+# Install nodejs and npm
+ADD generated/node-v6.11.2-linux-x64.tar.xz /usr/local/
+RUN ln -s /usr/local/node-v6.11.2-linux-x64/bin/* /usr/local/bin/
+
 # Need to "touch" RPM database to workaround bug in interaction between
 # overlayfs and yum (https://bugzilla.redhat.com/show_bug.cgi?id=1213602)
 RUN touch /var/lib/rpm/* && yum -q -y install python33
diff --git a/build/package-build-dockerfiles/debian8/Dockerfile b/build/package-build-dockerfiles/debian8/Dockerfile
index f5aced7..b9998c6 100644
--- a/build/package-build-dockerfiles/debian8/Dockerfile
+++ b/build/package-build-dockerfiles/debian8/Dockerfile
@@ -22,6 +22,10 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys D39DC0E3 && \
 ADD generated/go1.8.3.linux-amd64.tar.gz /usr/local/
 RUN ln -s /usr/local/go/bin/go /usr/local/bin/
 
+# Install nodejs and npm
+ADD generated/node-v6.11.2-linux-x64.tar.xz /usr/local/
+RUN ln -s /usr/local/node-v6.11.2-linux-x64/bin/* /usr/local/bin/
+
 # Old versions of setuptools cannot build a schema-salad package.
 RUN pip install --upgrade setuptools
 
diff --git a/build/package-build-dockerfiles/debian9/Dockerfile b/build/package-build-dockerfiles/debian9/Dockerfile
index 0003384..28ba9a3 100644
--- a/build/package-build-dockerfiles/debian9/Dockerfile
+++ b/build/package-build-dockerfiles/debian9/Dockerfile
@@ -21,10 +21,13 @@ RUN gpg --import /tmp/D39DC0E3.asc && \
     /usr/local/rvm/bin/rvm-exec default gem install cure-fpm --version 1.6.0b
 
 # Install golang binary
-COPY generated/go1.8.3.linux-amd64.tar.gz /usr/local/
-RUN cd /usr/local && ls && tar xzvf go1.8.3.linux-amd64.tar.gz
+ADD generated/go1.8.3.linux-amd64.tar.gz /usr/local/
 RUN ln -s /usr/local/go/bin/go /usr/local/bin/
 
+# Install nodejs and npm
+ADD generated/node-v6.11.2-linux-x64.tar.xz /usr/local/
+RUN ln -s /usr/local/node-v6.11.2-linux-x64/bin/* /usr/local/bin/
+
 # Old versions of setuptools cannot build a schema-salad package.
 RUN pip install --upgrade setuptools
 
diff --git a/build/package-build-dockerfiles/ubuntu1204/Dockerfile b/build/package-build-dockerfiles/ubuntu1204/Dockerfile
index bf09089..1d07db7 100644
--- a/build/package-build-dockerfiles/ubuntu1204/Dockerfile
+++ b/build/package-build-dockerfiles/ubuntu1204/Dockerfile
@@ -22,6 +22,10 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys D39DC0E3 && \
 ADD generated/go1.8.3.linux-amd64.tar.gz /usr/local/
 RUN ln -s /usr/local/go/bin/go /usr/local/bin/
 
+# Install nodejs and npm
+ADD generated/node-v6.11.2-linux-x64.tar.xz /usr/local/
+RUN ln -s /usr/local/node-v6.11.2-linux-x64/bin/* /usr/local/bin/
+
 # Old versions of setuptools cannot build a schema-salad package.
 RUN pip install --upgrade setuptools
 
diff --git a/build/package-build-dockerfiles/ubuntu1404/Dockerfile b/build/package-build-dockerfiles/ubuntu1404/Dockerfile
index ecfcefc..9e77ad3 100644
--- a/build/package-build-dockerfiles/ubuntu1404/Dockerfile
+++ b/build/package-build-dockerfiles/ubuntu1404/Dockerfile
@@ -22,6 +22,10 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys D39DC0E3 && \
 ADD generated/go1.8.3.linux-amd64.tar.gz /usr/local/
 RUN ln -s /usr/local/go/bin/go /usr/local/bin/
 
+# Install nodejs and npm
+ADD generated/node-v6.11.2-linux-x64.tar.xz /usr/local/
+RUN ln -s /usr/local/node-v6.11.2-linux-x64/bin/* /usr/local/bin/
+
 # Old versions of setuptools cannot build a schema-salad package.
 RUN pip install --upgrade setuptools
 
diff --git a/build/package-build-dockerfiles/ubuntu1604/Dockerfile b/build/package-build-dockerfiles/ubuntu1604/Dockerfile
index b7c02d7..e4673c8 100644
--- a/build/package-build-dockerfiles/ubuntu1604/Dockerfile
+++ b/build/package-build-dockerfiles/ubuntu1604/Dockerfile
@@ -22,6 +22,10 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys D39DC0E3 && \
 ADD generated/go1.8.3.linux-amd64.tar.gz /usr/local/
 RUN ln -s /usr/local/go/bin/go /usr/local/bin/
 
+# Install nodejs and npm
+ADD generated/node-v6.11.2-linux-x64.tar.xz /usr/local/
+RUN ln -s /usr/local/node-v6.11.2-linux-x64/bin/* /usr/local/bin/
+
 # Old versions of setuptools cannot build a schema-salad package.
 RUN pip install --upgrade setuptools
 
diff --git a/build/run-build-packages.sh b/build/run-build-packages.sh
index a0a6c5f..af90eb6 100755
--- a/build/run-build-packages.sh
+++ b/build/run-build-packages.sh
@@ -621,6 +621,7 @@ if [[ "$?" == "0" ]] ; then
       \cp config/environments/production.rb.example config/environments/production.rb -f
       sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
 
+      RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake npm:install >/dev/null
       RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
 
       # Remove generated configuration files so they don't go in the package.
diff --git a/build/run-tests.sh b/build/run-tests.sh
index 3952b36..15e89fa 100755
--- a/build/run-tests.sh
+++ b/build/run-tests.sh
@@ -204,6 +204,8 @@ sanity_checks() {
     echo -n 'gitolite: '
     which gitolite \
         || fatal "No gitolite. Try: apt-get install gitolite3"
+    which npm \
+          || fatal "No npm. Try: wget -O- https://nodejs.org/dist/v6.11.2/node-v6.11.2-linux-x64.tar.xz | sudo tar -C /usr/local xJf - && sudo ln -s ../node-v6.11.2-linux-x64/bin/{node,npm} /usr/local/bin/"
 }
 
 rotate_logfile() {
@@ -805,7 +807,8 @@ done
 install_workbench() {
     cd "$WORKSPACE/apps/workbench" \
         && mkdir -p tmp/cache \
-        && RAILS_ENV=test bundle_install_trylocal
+        && RAILS_ENV=test bundle_install_trylocal \
+        && RAILS_ENV=test RAILS_GROUPS=assets bundle exec rake npm:install
 }
 do_install apps/workbench workbench
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list