Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 91b66dd20594
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 80c6535072f7
Choose a head ref
  • 7 commits
  • 19 files changed
  • 1 contributor

Commits on Apr 5, 2016

  1. Verified

    This commit was signed with the committer’s verified signature.
    makenowjust Hiroya Fujinami
    Copy the full SHA
    48d4cc1 View commit details
  2. [Truffle] remove extra space

    pitr-ch committed Apr 5, 2016
    Copy the full SHA
    161717b View commit details
  3. Revert "[Truffle] untag passing require spec tests"

    This reverts commit 2c8fe8a.
    The test are failing intermittently
    pitr-ch committed Apr 5, 2016
    Copy the full SHA
    7b0b2a1 View commit details
  4. 4
    Copy the full SHA
    7d4d142 View commit details
  5. Copy the full SHA
    800ce77 View commit details
  6. Copy the full SHA
    1c972ce View commit details
  7. [Truffle] Formatting

    pitr-ch committed Apr 5, 2016
    Copy the full SHA
    80c6535 View commit details
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ env:
- JT='test specs :library'
- JT='test specs :truffle'
- JT='test integration fast'
- JT='test integration long' JAVA_OPTS="$JAVA_OPTS -Xmx512m"
- JT='test integration long' JAVA_OPTS="$JAVA_OPTS -Xmx512m" HAS_REDIS=true

matrix:
include:
@@ -125,3 +125,6 @@ notifications:
# we are on a branch
on_success: always
on_failure: never

services:
- redis-server
Original file line number Diff line number Diff line change
@@ -136,7 +136,6 @@
:test_validates_presence_of_finds_global_default_key_translation_when_blank],
NumericalityValidationTest: [:test_validates_numericality_with_equal_to] }
p ENV
undefine = if ENV['CI']
failures
else
9 changes: 9 additions & 0 deletions spec/ruby/language/fixtures/yield.rb
Original file line number Diff line number Diff line change
@@ -24,5 +24,14 @@ def r(a)
def rs(a, b, c)
yield(a, b, *c)
end

def self.define_deep(&inned_block)
define_method 'deep' do |v|
# should yield to inner_block
yield v
end
end

define_deep { |v| v * 2}
end
end
5 changes: 5 additions & 0 deletions spec/ruby/language/yield_spec.rb
Original file line number Diff line number Diff line change
@@ -141,4 +141,9 @@
@y.rs([1, 2], 3, 4) { |(*a, b), c, d| [a, b, c, d] }.should == [[1], 2, 3, 4]
end
end

it "uses captured block of a block used in define_method" do
@y.deep(2).should == 4
end

end
12 changes: 12 additions & 0 deletions spec/truffle/tags/core/kernel/require_tags.txt
Original file line number Diff line number Diff line change
@@ -32,3 +32,15 @@ fails:Kernel.require ($LOAD_FEATURES) when a non-extensioned file is in $LOADED_
fails:Kernel.require ($LOAD_FEATURES) when a non-extensioned file is in $LOADED_FEATURES returns false when passed a path and the file is not found
fails:Kernel.require (shell expansion) performs tilde expansion on a .rb file before storing paths in $LOADED_FEATURES
fails:Kernel.require (shell expansion) performs tilde expansion on a non-extensioned file before storing paths in $LOADED_FEATURES
fails:Kernel#require stores the missing path in a LoadError object
fails:Kernel.require stores the missing path in a LoadError object
fails:Kernel#require (concurrently) blocks a second thread from returning while the 1st is still requiring
fails:Kernel.require (concurrently) blocks a second thread from returning while the 1st is still requiring
fails:Kernel#require (concurrently) blocks based on the path
fails:Kernel.require (concurrently) blocks based on the path
fails:Kernel#require (concurrently) allows a 2nd require if the 1st raised an exception
fails:Kernel.require (concurrently) allows a 2nd require if the 1st raised an exception
fails:Kernel#require (concurrently) blocks a 3rd require if the 1st raises an exception and the 2nd is still running
fails:Kernel.require (concurrently) blocks a 3rd require if the 1st raises an exception and the 2nd is still running
slow:Kernel#require (concurrently) blocks based on the path
slow:Kernel.require (concurrently) blocks based on the path
45 changes: 28 additions & 17 deletions test/truffle/integration/rails.sh
Original file line number Diff line number Diff line change
@@ -8,27 +8,38 @@ JRUBY_BIN=../../../../bin
JRUBY=$JRUBY_BIN/jruby
JTR=$JRUBY_BIN/jruby+truffle

$JRUBY_BIN/gem install bundler
if [ -n "$CI" -a -z "$HAS_REDIS" ]
then
echo "No Redis. Skipping rails test."

$JTR setup
$JTR run -r rubygems -- bin/rails server &
serverpid=$!
url=http://localhost:3000/people.json
else

while ! curl -s $url;
do
echo -n .
sleep 1
done
$JRUBY_BIN/gem install bundler

echo Server is up
$JTR setup
$JTR run -r rubygems -- bin/rails server &
serverpid=$!
url=http://localhost:3000

set -x
while ! curl -s "$url/people.json";
do
echo -n .
sleep 1
done

test "$(curl -s $url)" = '[{"name":"John Doe","email":"jd@example.com"}]'
curl -s --data 'name=Anybody&email=ab@example.com' $url
test "$(curl -s $url)" = '[{"name":"John Doe","email":"jd@example.com"},{"name":"Anybody","email":"ab@example.com"}]'
echo Server is up

kill %1
kill $(cat tmp/pids/server.pid)
set -x
curl -s -X "DELETE" "$url/people/destroy_all.json"
test "$(curl -s "$url/people.json")" = '[]'
curl -s --data 'name=Anybody&email=ab@example.com' "$url/people.json"
echo "$(curl -s "$url/people.json")" | grep '"name":"Anybody","email":"ab@example.com"'
curl -s -X "DELETE" "$url/people/destroy_all.json"

kill %1
kill $(cat tmp/pids/server.pid)

set +x
set +e

fi
5 changes: 5 additions & 0 deletions test/truffle/integration/rails/.jruby+truffle.yaml
Original file line number Diff line number Diff line change
@@ -44,6 +44,11 @@
end
end
end
systemu.rb: |
jruby_version = JRUBY_VERSION
Object.send :remove_const, :JRUBY_VERSION
require_relative '../jruby+truffle/2.2.0/gems/systemu-2.6.5/lib/systemu'
JRUBY_VERSION = jruby_version
rails-html-sanitizer.rb: "puts 'HTML sanitization stubbed'"

:run:
3 changes: 3 additions & 0 deletions test/truffle/integration/rails/Gemfile
Original file line number Diff line number Diff line change
@@ -20,3 +20,6 @@ gem 'sdoc', '~> 0.4.0', group: :doc

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'redis'
gem 'redis_orm'
15 changes: 14 additions & 1 deletion test/truffle/integration/rails/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -49,6 +49,8 @@ GEM
json (1.8.3-java)
loofah (2.0.3)
nokogiri (>= 1.5.9)
macaddr (1.7.1)
systemu (~> 2.6.2)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.99)
@@ -85,6 +87,12 @@ GEM
rake (10.5.0)
rdoc (4.2.2)
json (~> 1.4)
redis (3.2.2)
redis_orm (0.7)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
redis (>= 2.2.0)
uuid (>= 2.3.2)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
@@ -95,21 +103,26 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
systemu (2.6.5)
thor (0.19.1)
thread_safe (0.3.5-java)
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2016.1)
tzinfo (>= 1.0.0)
uuid (2.3.8)
macaddr (~> 1.0)

PLATFORMS
java

DEPENDENCIES
jbuilder (~> 2.0)
rails (= 4.2.5.1)
redis
redis_orm
sdoc (~> 0.4.0)
tzinfo-data

BUNDLED WITH
1.10.6
1.11.2
Original file line number Diff line number Diff line change
@@ -6,31 +6,50 @@ class PeopleController < ApplicationController
:jruby
end

PEOPLE = [
{ name: 'John Doe', email: 'jd@example.com' }
]

# stubbed, will not work
skip_before_filter :verify_authenticity_token

def index
@people = PEOPLE
@people = Person.all
@person = Person.new(name: 'test')

respond_to do |format|
format.json { render :json => @people }
format.json { render json: @people }
format.html
end
end

def create
PEOPLE << person = { name: params[:name], email: params[:email] }
person = Person.create name: params[:name], email: params[:email]

respond_to do |format|
format.json { render json: person }
format.html { redirect_to action: :index }
end
end

def destroy
person = Person.find params[:id]
person.destroy

respond_to do |format|
format.json { render json: person }
format.html { redirect_to action: :index }
end
end

def destroy_all
Person.all.each(&:destroy)

respond_to do |format|
format.json { render :json => person }
format.json { render json: true }
format.html { redirect_to action: :index }
end
end

def platform
respond_to do |format|
format.json { render :json => { platform: PLATFORM } }
format.json { render json: { platform: PLATFORM } }
end
end

Empty file.
21 changes: 21 additions & 0 deletions test/truffle/integration/rails/app/models/person.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Person < RedisOrm::Base
property :name, String
property :email, String
index :email

timestamps

after_create :created

def created
puts format '%s created', self
end

def as_json(options = {})
{ id: id, name: name, email: email }
end

def to_model
self
end
end
85 changes: 44 additions & 41 deletions test/truffle/integration/rails/app/views/people/index.erb
Original file line number Diff line number Diff line change
@@ -3,50 +3,53 @@
<h1>People</h1>

<table>
<thead>
<tr>
<td>Name:</td>
<td>Email:</td>
</tr>
</thead>

<tbody>
<% @people.each do |person| %>
<tr>
<td><%= person[:name] %></td>
<td><%= person[:email] %></td>
</tr>
<% end %>
</tbody>

<tfoot>
<tr>
<td>Total:</td>
<td><%= @people.size %></td>
</tr>
</tfoot>
<thead>
<tr>
<td>Name:</td>
<td>Email:</td>
<td></td>
</tr>
</thead>

<tbody>
<% @people.each do |person| %>
<tr>
<td><%= person.name %></td>
<td><%= person.email %></td>
<td><%= button_to 'Delete', person_path(id: person.id), method: :delete, class: 'btn', small: true %></td>
</tr>
<% end %>
</tbody>

<tfoot>
<tr>
<td>Total:</td>
<td><%= @people.size %></td>
<td><%= button_to 'Delete all', destroy_all_people_path, method: :delete, class: 'btn', small: true %></td>
</tr>
</tfoot>

</table>


<row>
<column cols="5">

<h2>New person</h2>

<%= form_tag 'people', class: :forms do %>
<section>
<label>Name</label>
<%= text_field_tag :name %>
</section>
<section>
<label>Email</label>
<%= text_field_tag :email %>
</section>
<section>
<button type="primary">Create</button>
</section>
<% end %>

</column>
<column cols="5">

<h2>New person</h2>

<%= form_tag 'people', class: :forms do %>
<section>
<label>Name</label>
<%= text_field_tag :name %>
</section>
<section>
<label>Email</label>
<%= text_field_tag :email %>
</section>
<section>
<button type="primary">Create</button>
</section>
<% end %>

</column>
</row>
7 changes: 7 additions & 0 deletions test/truffle/integration/rails/config/application.rb
Original file line number Diff line number Diff line change
@@ -11,6 +11,9 @@
# require "sprockets/railtie"
# require "rails/test_unit/railtie"

require 'redis'
require 'redis_orm'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
@@ -28,5 +31,9 @@ class Application < Rails::Application
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de

config.after_initialize do
$redis = Redis.new
end
end
end
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@

# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.serve_static_files = true


# Specifies the header that your server uses for sending files.
1 change: 1 addition & 0 deletions test/truffle/integration/rails/config/routes.rb
Original file line number Diff line number Diff line change
@@ -56,5 +56,6 @@

resources :people do
get 'platform', on: :collection
delete 'destroy_all', on: :collection
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
td > form {
margin-bottom: 0;
}
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ public static MethodFilter by(Visibility visibility) {
case PRIVATE:
return PRIVATE;
default:
throw new IllegalArgumentException("unsupported visibility: " + visibility);
throw new IllegalArgumentException("unsupported visibility: " + visibility);
}
}

Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@
* A Ruby method: either a method in a module,
* a literal module/class body
* or some meta-information for eval'd code.
*
* Blocks capture the method in which they are defined.
*/
public class InternalMethod implements ObjectGraphNode {
@@ -42,14 +41,15 @@ public class InternalMethod implements ObjectGraphNode {
private final DynamicObject capturedDefaultDefinee;

public static InternalMethod fromProc(SharedMethodInfo sharedMethodInfo, String name, DynamicObject declaringModule,
Visibility visibility, DynamicObject proc, CallTarget callTarget) {
return new InternalMethod(sharedMethodInfo, name, declaringModule, visibility, false, proc, callTarget, null, null);
Visibility visibility, DynamicObject proc, CallTarget callTarget) {
return new InternalMethod(sharedMethodInfo, name, declaringModule, visibility, false, proc, callTarget, Layouts.PROC.getBlock(proc), null);
}

public InternalMethod(SharedMethodInfo sharedMethodInfo, String name, DynamicObject declaringModule,
Visibility visibility, CallTarget callTarget) {
Visibility visibility, CallTarget callTarget) {
this(sharedMethodInfo, name, declaringModule, visibility, false, null, callTarget, null, null);
}

public InternalMethod(SharedMethodInfo sharedMethodInfo, String name, DynamicObject declaringModule,
Visibility visibility, boolean undefined, DynamicObject proc, CallTarget callTarget) {
this(sharedMethodInfo, name, declaringModule, visibility, undefined, proc, callTarget, null, null);
@@ -89,7 +89,7 @@ public boolean isUndefined() {
return undefined;
}

public CallTarget getCallTarget(){
public CallTarget getCallTarget() {
return callTarget;
}

@@ -158,7 +158,7 @@ public String toString() {
public Set<DynamicObject> getAdjacentObjects() {
final Set<DynamicObject> adjacent = new HashSet<>();

if (declaringModule != null) {
if (declaringModule != null) {
adjacent.add(declaringModule);
}