Эх сурвалжийг харах

Ruby runtime and framework updates (#3058)

* Ruby runtime updates

* Ruby framework updates

* Sinatra 2 (final)
* Roda 3
* ActiveRecord 5.1
* Sequel 5
* and other goodies
Mike Pastore 7 жил өмнө
parent
commit
5cfe61a57c

+ 2 - 2
frameworks/Ruby/rack-sequel/Gemfile

@@ -2,8 +2,8 @@ source 'https://rubygems.org'
 
 gem 'json', '~> 2.0'
 gem 'passenger', '~> 5.1', :platforms=>[:ruby, :mswin], :require=>false
-gem 'puma', '~> 3.9.1', :require=>false
-gem 'sequel', '~> 4.44'
+gem 'puma', '~> 3.9', :require=>false
+gem 'sequel', '~> 5.0'
 gem 'rack', '~> 2.0'
 gem 'torquebox-web', '>= 4.0.0.beta3', '< 5', :platforms=>:jruby, :require=>false
 gem 'unicorn', '~> 5.2', :platforms=>[:ruby, :mswin], :require=>false

+ 5 - 5
frameworks/Ruby/rack-sequel/README.md

@@ -15,12 +15,12 @@ The tests will be run with:
 * [Ruby 2.4](http://www.ruby-lang.org)
 * [JRuby 9.1](http://jruby.org)
 * [Rubinius 3](https://rubinius.com)\*
-* [Puma 3.9](http://puma.io)
-* [Passenger 5.1](https://www.phusionpassenger.com)
-* [Unicorn 5.2](https://bogomips.org/unicorn/)
+* [Puma 3](http://puma.io)
+* [Passenger 5](https://www.phusionpassenger.com)
+* [Unicorn 5](https://bogomips.org/unicorn/)
 * [TorqueBox 4.0](http://torquebox.org)
-* [Rack 2.0](http://rack.rubyforge.org)
-* [Sequel 4.43](http://sequel.jeremyevans.net)
+* [Rack 2](http://rack.rubyforge.org)
+* [Sequel 5](http://sequel.jeremyevans.net)
 * [MySQL 5.5](https://www.mysql.com)
 * [Postgres 9.3](https://www.postgresql.org)
 

+ 1 - 4
frameworks/Ruby/rack-sequel/boot.rb

@@ -52,10 +52,7 @@ def connect(dbtype)
     }, opts
 end
 
-DB = connect(ENV.fetch('DBTYPE').to_sym).tap do |db|
-  db.extension(:freeze_datasets)
-  db.optimize_model_load = true if db.respond_to?(:optimize_model_load=)
-end
+DB = connect ENV.fetch('DBTYPE').to_sym
 
 # Define ORM models
 class World < Sequel::Model(:World)

+ 6 - 4
frameworks/Ruby/rack-sequel/hello_world.rb

@@ -4,7 +4,9 @@
 class HelloWorld
   DEFAULT_HEADERS = {}.tap do |h|
     h['Server'] = SERVER_STRING if SERVER_STRING
-  end.freeze
+
+    h.freeze
+  end
 
   def bounded_queries(env)
     params = Rack::Utils.parse_query(env['QUERY_STRING'])
@@ -43,7 +45,7 @@ class HelloWorld
     )
     fortunes.sort_by!(&:message)
 
-    html = <<~'HTML'
+    html = String.new(<<~'HTML')
       <!DOCTYPE html>
       <html>
       <head>
@@ -60,7 +62,7 @@ class HelloWorld
     HTML
 
     fortunes.each do |fortune|
-      html += <<~"HTML"
+      html << <<~"HTML"
       <tr>
         <td>#{fortune.id}</td>
         <td>#{Rack::Utils.escape_html(fortune.message)}</td>
@@ -68,7 +70,7 @@ class HelloWorld
       HTML
     end
 
-    html += <<~'HTML'
+    html << <<~'HTML'
       </table>
 
       </body>

+ 3 - 3
frameworks/Ruby/roda-sequel/Gemfile

@@ -3,9 +3,9 @@ source 'https://rubygems.org'
 gem 'erubi', '~> 1.4'
 gem 'json', '~> 2.0'
 gem 'passenger', '~> 5.1', :platforms=>[:ruby, :mswin], :require=>false
-gem 'puma', '~> 3.9.1', :require=>false
-gem 'sequel', '~> 4.44'
-gem 'roda', '~> 2.24'
+gem 'puma', '~> 3.9', :require=>false
+gem 'sequel', '~> 5.0'
+gem 'roda', '~> 3.0'
 gem 'tilt', '~> 2.0', :require=>'tilt/erb'
 gem 'torquebox-web', '>= 4.0.0.beta3', '< 5', :platforms=>:jruby, :require=>false
 gem 'unicorn', '~> 5.2', :platforms=>[:ruby, :mswin], :require=>false

+ 6 - 6
frameworks/Ruby/roda-sequel/README.md

@@ -15,13 +15,13 @@ The tests will be run with:
 * [Ruby 2.4](http://www.ruby-lang.org)
 * [JRuby 9.1](http://jruby.org)
 * [Rubinius 3](https://rubinius.com)\*
-* [Puma 3.9](http://puma.io)
-* [Passenger 5.1](https://www.phusionpassenger.com)
-* [Unicorn 5.2](https://bogomips.org/unicorn/)
+* [Puma 3](http://puma.io)
+* [Passenger 5](https://www.phusionpassenger.com)
+* [Unicorn 5](https://bogomips.org/unicorn/)
 * [TorqueBox 4.0](http://torquebox.org)
-* [Roda 2.22](http://roda.jeremyevans.net)
-* [Sequel 4.43](http://sequel.jeremyevans.net)
-* [Erubi 1.2](https://github.com/jeremyevans/erubi)
+* [Roda 3](http://roda.jeremyevans.net)
+* [Sequel 5](http://sequel.jeremyevans.net)
+* [Erubi 1](https://github.com/jeremyevans/erubi)
 * [MySQL 5.5](https://www.mysql.com)
 * [Postgres 9.3](https://www.postgresql.org)
 

+ 1 - 4
frameworks/Ruby/roda-sequel/boot.rb

@@ -52,10 +52,7 @@ def connect(dbtype)
     }, opts
 end
 
-DB = connect(ENV.fetch('DBTYPE').to_sym).tap do |db|
-  db.extension(:freeze_datasets)
-  db.optimize_model_load = true if db.respond_to?(:optimize_model_load=)
-end
+DB = connect ENV.fetch('DBTYPE').to_sym
 
 # Define ORM models
 class World < Sequel::Model(:World)

+ 1 - 1
frameworks/Ruby/roda-sequel/hello_world.rb

@@ -6,7 +6,7 @@ class HelloWorld < Roda
   plugin :default_headers, 'Server'=>SERVER_STRING if SERVER_STRING
   plugin :hooks
   plugin :json
-  plugin :render, :escape=>:erubi, :layout_opts=>{ :cache_key=>'default_layout' }
+  plugin :render, :escape=>true, :layout_opts=>{ :cache_key=>'default_layout' }
   plugin :static_routing
 
   def bounded_queries

+ 3 - 3
frameworks/Ruby/sinatra-sequel/Gemfile

@@ -2,9 +2,9 @@ source 'https://rubygems.org'
 
 gem 'json', '~> 2.0'
 gem 'passenger', '~> 5.1', :platforms=>[:ruby, :mswin], :require=>false
-gem 'puma', '~> 3.9.1', :require=>false
-gem 'sequel', '~> 4.44'
-gem 'sinatra', '>= 2.0.0.rc1', '< 3.0', :require=>'sinatra/base'
+gem 'puma', '~> 3.9', :require=>false
+gem 'sequel', '~> 5.0'
+gem 'sinatra', '~> 2.0', :require=>'sinatra/base'
 gem 'slim', '~> 3.0'
 gem 'torquebox-web', '>= 4.0.0.beta3', '< 5', :platforms=>:jruby, :require=>false
 gem 'unicorn', '~> 5.2', :platforms=>[:ruby, :mswin], :require=>false

+ 6 - 6
frameworks/Ruby/sinatra-sequel/README.md

@@ -15,13 +15,13 @@ The tests will be run with:
 * [Ruby 2.4](http://www.ruby-lang.org)
 * [JRuby 9.1](http://jruby.org)
 * [Rubinius 3](https://rubinius.com)\*
-* [Puma 3.6](http://puma.io)
-* [Passenger 5.1](https://www.phusionpassenger.com)
-* [Unicorn 5.2](https://bogomips.org/unicorn/)
+* [Puma 3](http://puma.io)
+* [Passenger 5](https://www.phusionpassenger.com)
+* [Unicorn 5](https://bogomips.org/unicorn/)
 * [TorqueBox 4.0](http://torquebox.org)
-* [Sinatra 2.0](http://www.sinatrarb.com)
-* [Sequel 4.43](http://sequel.jeremyevans.net)
-* [Slim 3.0](http://slim-lang.com)
+* [Sinatra 2](http://www.sinatrarb.com)
+* [Sequel 5](http://sequel.jeremyevans.net)
+* [Slim 3](http://slim-lang.com)
 * [MySQL 5.5](https://www.mysql.com)
 * [Postgres 9.3](https://www.postgresql.org)
 

+ 1 - 4
frameworks/Ruby/sinatra-sequel/boot.rb

@@ -52,10 +52,7 @@ def connect(dbtype)
     }, opts
 end
 
-DB = connect(ENV.fetch('DBTYPE').to_sym).tap do |db|
-  db.extension(:freeze_datasets)
-  db.optimize_model_load = true if db.respond_to?(:optimize_model_load=)
-end
+DB = connect ENV.fetch('DBTYPE').to_sym
 
 # Define ORM models
 class World < Sequel::Model(:World)

+ 2 - 2
frameworks/Ruby/sinatra/Gemfile

@@ -4,8 +4,8 @@ gem 'activerecord', '~> 5.0', :require=>'active_record'
 gem 'activerecord-jdbc-adapter', '>= 5.0.pre1', '< 6.0', :platforms=>:jruby
 gem 'json', '~> 2.0'
 gem 'passenger', '~> 5.1', :platforms=>[:ruby, :mswin], :require=>false
-gem 'puma', '~> 3.9.1', :require=>false
-gem 'sinatra', '>= 2.0.0.rc1', '< 3.0', :require=>'sinatra/base'
+gem 'puma', '~> 3.9', :require=>false
+gem 'sinatra', '~> 2.0', :require=>'sinatra/base'
 gem 'torquebox-web', '>= 4.0.0.beta3', '< 5', :platforms=>:jruby, :require=>false
 gem 'unicorn', '~> 5.2', :platforms=>[:ruby, :mswin], :require=>false
 

+ 5 - 5
frameworks/Ruby/sinatra/README.md

@@ -15,12 +15,12 @@ The tests will be run with:
 * [Ruby 2.4](http://www.ruby-lang.org)
 * [JRuby 9.1](http://jruby.org)\*
 * [Rubinius 3](https://rubinius.com)\*
-* [Puma 3.9](http://puma.io)
-* [Passenger 5.1](https://www.phusionpassenger.com)
-* [Unicorn 5.2](https://bogomips.org/unicorn/)
+* [Puma 3](http://puma.io)
+* [Passenger 5](https://www.phusionpassenger.com)
+* [Unicorn 5](https://bogomips.org/unicorn/)
 * [TorqueBox 4.0](http://torquebox.org)\*
-* [Sinatra 2.0](http://www.sinatrarb.com)
-* [ActiveRecord 5.0](https://github.com/rails/rails/tree/master/activerecord)
+* [Sinatra 2](http://www.sinatrarb.com)
+* [ActiveRecord 5](https://github.com/rails/rails/tree/master/activerecord)
 * [MySQL 5.5](https://www.mysql.com)
 * [Postgres 9.3](https://www.postgresql.org)
 

+ 1 - 1
frameworks/Ruby/sinatra/config/auto_tune.rb

@@ -23,7 +23,7 @@ def meminfo(arg)
 end
 
 def auto_tune
-  avail_mem = meminfo('MemFree') * 0.8 - MAX_THREADS * 1_024
+  avail_mem = meminfo('MemAvailable') * 0.8 - MAX_THREADS * 1_024
 
   workers = [
     [(1.0 * avail_mem / KB_PER_WORKER).floor, MIN_WORKERS].max,

+ 2 - 2
toolset/setup/linux/languages/ruby/jruby-1.7.sh

@@ -6,11 +6,11 @@ fw_installed jruby-1.7 && return 0
 
 # rvm stable [typically] only provides one version of jruby-1.7
 # update this when it changes
-JRUBY_VERSION="1.7.26"
+JRUBY_VERSION="1.7.27"
 
 rvm install jruby-$JRUBY_VERSION
 
-rvm jruby-$JRUBY_VERSION do gem install bundler -v 1.14.3
+rvm jruby-$JRUBY_VERSION do gem install bundler -v 1.15.4
 
 echo "export JRUBY_VERSION=${JRUBY_VERSION}" > $IROOT/jruby-1.7.installed
 

+ 2 - 3
toolset/setup/linux/languages/ruby/jruby-9.0.sh

@@ -4,13 +4,12 @@ fw_depends rvm java
 
 fw_installed jruby-9.0 && return 0
 
-# rvm stable [typically] only provides one version of jruby-9.0
-# update this when it changes
+# TODO: JRuby 9.0 is EOL. Remove as soon as possible.
 JRUBY_VERSION="9.0.5.0"
 
 rvm install jruby-$JRUBY_VERSION
 
-rvm jruby-$JRUBY_VERSION do gem install bundler -v 1.14.3
+rvm jruby-$JRUBY_VERSION do gem install bundler -v 1.15.4
 
 echo "export JRUBY_VERSION=${JRUBY_VERSION}" > $IROOT/jruby-9.0.installed
 

+ 2 - 2
toolset/setup/linux/languages/ruby/jruby-9.1.sh

@@ -6,11 +6,11 @@ fw_installed jruby-9.1 && return 0
 
 # rvm stable [typically] only provides one version of jruby-9.0
 # update this when it changes
-JRUBY_VERSION="9.1.8.0"
+JRUBY_VERSION="9.1.14.0"
 
 rvm install jruby-$JRUBY_VERSION
 
-rvm jruby-$JRUBY_VERSION do gem install bundler -v 1.14.3
+rvm jruby-$JRUBY_VERSION do gem install bundler -v 1.15.4
 
 echo "export JRUBY_VERSION=${JRUBY_VERSION}" > $IROOT/jruby-9.1.installed
 

+ 2 - 3
toolset/setup/linux/languages/ruby/ruby-2.0.sh

@@ -4,13 +4,12 @@ fw_depends llvm-dev rvm
 
 fw_installed ruby-2.0 && return 0
 
-# rvm stable [typically] only provides one version of ruby-2.0
-# update this when it changes
+# TODO: Ruby 2.0 is EOL. Remove as soon as possible.
 MRI_VERSION=2.0.0-p648
 
 rvm install $MRI_VERSION
 
-rvm $MRI_VERSION do gem install bundler -v 1.14.3
+rvm $MRI_VERSION do gem install bundler -v 1.15.4
 
 echo "export MRI_VERSION=${MRI_VERSION}" > $IROOT/ruby-2.0.installed
 

+ 2 - 3
toolset/setup/linux/languages/ruby/ruby-2.1.sh

@@ -4,13 +4,12 @@ fw_depends llvm-dev rvm
 
 fw_installed ruby-2.1 && return 0
 
-# rvm stable [typically] only provides one version of ruby-2.1
-# update this when it changes
+# TODO: Ruby 2.1 is EOL. Remove as soon as possible.
 MRI_VERSION=2.1.10
 
 rvm install $MRI_VERSION
 
-rvm $MRI_VERSION do gem install bundler -v 1.14.3
+rvm $MRI_VERSION do gem install bundler -v 1.15.4
 
 echo "export MRI_VERSION=${MRI_VERSION}" > $IROOT/ruby-2.1.installed
 

+ 2 - 2
toolset/setup/linux/languages/ruby/ruby-2.2.sh

@@ -6,11 +6,11 @@ fw_installed ruby-2.2 && return 0
 
 # rvm stable [typically] only provides one version of ruby-2.2
 # update this when it changes
-MRI_VERSION=2.2.6
+MRI_VERSION=2.2.8
 
 rvm install $MRI_VERSION -C --with-jemalloc
 
-rvm $MRI_VERSION do gem install bundler -v 1.14.3
+rvm $MRI_VERSION do gem install bundler -v 1.15.4
 
 echo "export MRI_VERSION=${MRI_VERSION}" > $IROOT/ruby-2.2.installed
 

+ 17 - 0
toolset/setup/linux/languages/ruby/ruby-2.3.sh

@@ -0,0 +1,17 @@
+#!/bin/bash
+
+fw_depends llvm-dev libjemalloc-dev rvm
+
+fw_installed ruby-2.3 && return 0
+
+# rvm stable [typically] only provides one version of ruby-2.3
+# update this when it changes
+MRI_VERSION=2.3.5
+
+rvm install $MRI_VERSION -C --with-jemalloc
+
+rvm $MRI_VERSION do gem install bundler -v 1.15.4
+
+echo "export MRI_VERSION=${MRI_VERSION}" > $IROOT/ruby-2.3.installed
+
+source $IROOT/ruby-2.3.installed

+ 2 - 2
toolset/setup/linux/languages/ruby/ruby-2.4.sh

@@ -6,11 +6,11 @@ fw_installed ruby-2.4 && return 0
 
 # rvm stable [typically] only provides one version of ruby-2.4
 # update this when it changes
-MRI_VERSION=2.4.1
+MRI_VERSION=2.4.2
 
 rvm install $MRI_VERSION -C --with-jemalloc
 
-rvm $MRI_VERSION do gem install bundler -v 1.14.3
+rvm $MRI_VERSION do gem install bundler -v 1.15.4
 
 echo "export MRI_VERSION=${MRI_VERSION}" > $IROOT/ruby-2.4.installed