mini_racer 0.6.4 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +64 -121
- data/README.md +115 -131
- data/ext/mini_racer_extension/mini_racer_extension.cc +3 -3
- data/lib/mini_racer/version.rb +2 -2
- data/lib/mini_racer_extension.so +0 -0
- data/lib/mini_racer_loader.so +0 -0
- metadata +10 -17
- data/.dockerignore +0 -12
- data/.github/workflows/ci.yml +0 -124
- data/.gitignore +0 -13
- data/Dockerfile +0 -21
- data/Gemfile +0 -4
- data/Rakefile +0 -108
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/mini_racer.gemspec +0 -39
data/.github/workflows/ci.yml
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
name: Tests
|
2
|
-
|
3
|
-
on:
|
4
|
-
pull_request:
|
5
|
-
push:
|
6
|
-
branches:
|
7
|
-
- master
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
test-truffleruby:
|
11
|
-
strategy:
|
12
|
-
fail-fast: false
|
13
|
-
matrix:
|
14
|
-
os:
|
15
|
-
- "macos-11"
|
16
|
-
- "macos-12"
|
17
|
-
- "ubuntu-20.04"
|
18
|
-
ruby:
|
19
|
-
- "truffleruby+graalvm-head"
|
20
|
-
|
21
|
-
name: ${{ matrix.os }} - ${{ matrix.ruby }}
|
22
|
-
runs-on: ${{ matrix.os }}
|
23
|
-
|
24
|
-
env:
|
25
|
-
TRUFFLERUBYOPT: "--jvm --polyglot"
|
26
|
-
|
27
|
-
steps:
|
28
|
-
- uses: actions/checkout@v3
|
29
|
-
- uses: ruby/setup-ruby@v1
|
30
|
-
with:
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
32
|
-
bundler-cache: true
|
33
|
-
- name: Install GraalVM JS component
|
34
|
-
run: gu install js
|
35
|
-
- name: Compile
|
36
|
-
run: bundle exec rake compile
|
37
|
-
- name: Test
|
38
|
-
run: bundle exec rake test
|
39
|
-
|
40
|
-
test-darwin:
|
41
|
-
strategy:
|
42
|
-
fail-fast: false
|
43
|
-
matrix:
|
44
|
-
os:
|
45
|
-
- "macos-11"
|
46
|
-
- "macos-12"
|
47
|
-
ruby:
|
48
|
-
- "ruby-2.6"
|
49
|
-
- "ruby-2.7"
|
50
|
-
- "ruby-3.0"
|
51
|
-
- "ruby-3.1"
|
52
|
-
|
53
|
-
name: ${{ matrix.os }} - ${{ matrix.ruby }}
|
54
|
-
runs-on: ${{ matrix.os }}
|
55
|
-
|
56
|
-
steps:
|
57
|
-
- uses: actions/checkout@v3
|
58
|
-
- uses: ruby/setup-ruby@v1
|
59
|
-
with:
|
60
|
-
ruby-version: ${{ matrix.ruby }}
|
61
|
-
bundler-cache: true
|
62
|
-
- name: Compile
|
63
|
-
run: bundle exec rake compile
|
64
|
-
- name: Test
|
65
|
-
run: bundle exec rake test
|
66
|
-
|
67
|
-
test-linux:
|
68
|
-
strategy:
|
69
|
-
fail-fast: false
|
70
|
-
matrix:
|
71
|
-
ruby:
|
72
|
-
- "2.6"
|
73
|
-
- "2.7"
|
74
|
-
- "3.0"
|
75
|
-
- "3.1"
|
76
|
-
platform:
|
77
|
-
- "amd64"
|
78
|
-
- "arm64"
|
79
|
-
libc:
|
80
|
-
- "gnu"
|
81
|
-
- "musl"
|
82
|
-
exclude:
|
83
|
-
# there's no libv8-node (v16) for aarch64-linux-musl at the moment
|
84
|
-
- platform: "arm64"
|
85
|
-
libc: "musl"
|
86
|
-
|
87
|
-
name: linux-${{ matrix.platform }} - ruby-${{ matrix.ruby }} - ${{ matrix.libc }}
|
88
|
-
runs-on: ubuntu-20.04
|
89
|
-
|
90
|
-
steps:
|
91
|
-
- name: Enable ${{ matrix.platform }} platform
|
92
|
-
id: qemu
|
93
|
-
if: ${{ matrix.platform != 'amd64' }}
|
94
|
-
run: |
|
95
|
-
docker run --privileged --rm tonistiigi/binfmt:latest --install ${{ matrix.platform }} | tee platforms.json
|
96
|
-
echo "::set-output name=platforms::$(cat platforms.json)"
|
97
|
-
- name: Start container
|
98
|
-
id: container
|
99
|
-
run: |
|
100
|
-
case ${{ matrix.libc }} in
|
101
|
-
gnu)
|
102
|
-
echo 'ruby:${{ matrix.ruby }}'
|
103
|
-
;;
|
104
|
-
musl)
|
105
|
-
echo 'ruby:${{ matrix.ruby }}-alpine'
|
106
|
-
;;
|
107
|
-
esac > container_image
|
108
|
-
echo "::set-output name=image::$(cat container_image)"
|
109
|
-
docker run --rm -d -v "${PWD}":"${PWD}" -w "${PWD}" --platform linux/${{ matrix.platform }} $(cat container_image) /bin/sleep 64d | tee container_id
|
110
|
-
docker exec -w "${PWD}" $(cat container_id) uname -a
|
111
|
-
echo "::set-output name=id::$(cat container_id)"
|
112
|
-
- name: Install Alpine system dependencies
|
113
|
-
if: ${{ matrix.libc == 'musl' }}
|
114
|
-
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apk add --no-cache build-base bash git
|
115
|
-
- name: Checkout
|
116
|
-
uses: actions/checkout@v3
|
117
|
-
- name: Update Rubygems
|
118
|
-
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} gem update --system
|
119
|
-
- name: Bundle
|
120
|
-
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle install
|
121
|
-
- name: Compile
|
122
|
-
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec rake compile
|
123
|
-
- name: Test
|
124
|
-
run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec rake test
|
data/.gitignore
DELETED
data/Dockerfile
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
ARG RUBY_VERSION=2.7
|
2
|
-
FROM ruby:${RUBY_VERSION}
|
3
|
-
|
4
|
-
RUN test ! -f /etc/alpine-release || apk add --no-cache build-base git
|
5
|
-
|
6
|
-
# without this `COPY .git`, we get the following error:
|
7
|
-
# fatal: not a git repository (or any of the parent directories): .git
|
8
|
-
# but with it we need the full gem just to compile the extension because
|
9
|
-
# of gemspec's `git --ls-files`
|
10
|
-
# COPY .git /code/.git
|
11
|
-
COPY Gemfile mini_racer.gemspec /code/
|
12
|
-
COPY lib/mini_racer/version.rb /code/lib/mini_racer/version.rb
|
13
|
-
WORKDIR /code
|
14
|
-
RUN bundle install
|
15
|
-
|
16
|
-
COPY Rakefile /code/
|
17
|
-
COPY ext /code/ext/
|
18
|
-
RUN bundle exec rake compile
|
19
|
-
|
20
|
-
COPY . /code/
|
21
|
-
CMD bundle exec irb -rmini_racer
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs << "test"
|
6
|
-
t.libs << "lib"
|
7
|
-
t.test_files = FileList['test/**/*_test.rb']
|
8
|
-
end
|
9
|
-
|
10
|
-
task :default => [:compile, :test]
|
11
|
-
|
12
|
-
gem = Gem::Specification.load( File.dirname(__FILE__) + '/mini_racer.gemspec' )
|
13
|
-
|
14
|
-
if RUBY_ENGINE == "truffleruby"
|
15
|
-
task :compile do
|
16
|
-
# noop
|
17
|
-
end
|
18
|
-
|
19
|
-
task :clean do
|
20
|
-
# noop
|
21
|
-
end
|
22
|
-
else
|
23
|
-
require 'rake/extensiontask'
|
24
|
-
Rake::ExtensionTask.new( 'mini_racer_loader', gem )
|
25
|
-
Rake::ExtensionTask.new( 'mini_racer_extension', gem )
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
# via http://blog.flavorjon.es/2009/06/easily-valgrind-gdb-your-ruby-c.html
|
31
|
-
namespace :test do
|
32
|
-
desc "run test suite with Address Sanitizer"
|
33
|
-
task :asan do
|
34
|
-
ENV["CONFIGURE_ARGS"] = [ENV["CONFIGURE_ARGS"], '--enable-asan'].compact.join(' ')
|
35
|
-
Rake::Task['compile'].invoke
|
36
|
-
|
37
|
-
asan_path = `ldconfig -N -p |grep libasan | grep -v 32 | sed 's/.* => \\(.*\\)$/\\1/'`.chomp.split("\n")[-1]
|
38
|
-
|
39
|
-
|
40
|
-
cmdline = "env LD_PRELOAD=\"#{asan_path}\" ruby test/test_leak.rb"
|
41
|
-
puts cmdline
|
42
|
-
system cmdline
|
43
|
-
|
44
|
-
cmdline = "env LD_PRELOAD=\"#{asan_path}\" rake test"
|
45
|
-
puts cmdline
|
46
|
-
system cmdline
|
47
|
-
end
|
48
|
-
# partial-loads-ok and undef-value-errors necessary to ignore
|
49
|
-
# spurious (and eminently ignorable) warnings from the ruby
|
50
|
-
# interpreter
|
51
|
-
VALGRIND_BASIC_OPTS = "--num-callers=50 --error-limit=no \
|
52
|
-
--partial-loads-ok=yes --undef-value-errors=no"
|
53
|
-
|
54
|
-
desc "run test suite under valgrind with basic ruby options"
|
55
|
-
task :valgrind => :compile do
|
56
|
-
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} ruby test/test_leak.rb"
|
57
|
-
puts cmdline
|
58
|
-
system cmdline
|
59
|
-
end
|
60
|
-
|
61
|
-
desc "run test suite under valgrind with leak-check=full"
|
62
|
-
task :valgrind_leak_check => :compile do
|
63
|
-
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} --leak-check=full ruby test/test_leak.rb"
|
64
|
-
puts cmdline
|
65
|
-
require 'open3'
|
66
|
-
_, stderr = Open3.capture3(cmdline)
|
67
|
-
|
68
|
-
section = ""
|
69
|
-
stderr.split("\n").each do |line|
|
70
|
-
|
71
|
-
if line =~ /==.*==\s*$/
|
72
|
-
if (section =~ /mini_racer|SUMMARY/)
|
73
|
-
puts
|
74
|
-
puts section
|
75
|
-
puts
|
76
|
-
end
|
77
|
-
section = ""
|
78
|
-
else
|
79
|
-
section << line << "\n"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
desc 'run clang-tidy linter on mini_racer_extension.cc'
|
86
|
-
task :lint do
|
87
|
-
require 'mkmf'
|
88
|
-
require 'libv8'
|
89
|
-
|
90
|
-
Libv8.configure_makefile
|
91
|
-
|
92
|
-
conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote,
|
93
|
-
'arch_hdrdir' => $arch_hdrdir.quote,
|
94
|
-
'top_srcdir' => $top_srcdir.quote)
|
95
|
-
if $universal and (arch_flag = conf['ARCH_FLAG']) and !arch_flag.empty?
|
96
|
-
conf['ARCH_FLAG'] = arch_flag.gsub(/(?:\G|\s)-arch\s+\S+/, '')
|
97
|
-
end
|
98
|
-
|
99
|
-
checks = %W(bugprone-*
|
100
|
-
cert-*
|
101
|
-
cppcoreguidelines-*
|
102
|
-
clang-analyzer-*
|
103
|
-
performance-*
|
104
|
-
portability-*
|
105
|
-
readability-*).join(',')
|
106
|
-
|
107
|
-
sh RbConfig::expand("clang-tidy -checks='#{checks}' ext/mini_racer_extension/mini_racer_extension.cc -- #$INCFLAGS #$CXXFLAGS", conf)
|
108
|
-
end
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "mini_racer"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/mini_racer.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'mini_racer/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "mini_racer"
|
8
|
-
spec.version = MiniRacer::VERSION
|
9
|
-
spec.authors = ["Sam Saffron"]
|
10
|
-
spec.email = ["sam.saffron@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Minimal embedded v8 for Ruby}
|
13
|
-
spec.description = %q{Minimal embedded v8 engine for Ruby}
|
14
|
-
spec.homepage = "https://github.com/discourse/mini_racer"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.metadata = {
|
18
|
-
"bug_tracker_uri" => "https://github.com/discourse/mini_racer/issues",
|
19
|
-
"changelog_uri" => "https://github.com/discourse/mini_racer/blob/v#{spec.version}/CHANGELOG",
|
20
|
-
"documentation_uri" => "https://www.rubydoc.info/gems/mini_racer/#{spec.version}",
|
21
|
-
"source_code_uri" => "https://github.com/discourse/mini_racer/tree/v#{spec.version}",
|
22
|
-
}
|
23
|
-
|
24
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(benchmark|test|spec|features|examples)/}) }
|
25
|
-
spec.require_paths = ["lib"]
|
26
|
-
|
27
|
-
spec.add_development_dependency "bundler"
|
28
|
-
spec.add_development_dependency "rake", ">= 12.3.3"
|
29
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
30
|
-
spec.add_development_dependency "rake-compiler"
|
31
|
-
spec.add_development_dependency "m"
|
32
|
-
|
33
|
-
spec.add_dependency 'libv8-node', MiniRacer::LIBV8_NODE_VERSION
|
34
|
-
spec.require_paths = ["lib", "ext"]
|
35
|
-
|
36
|
-
spec.extensions = ["ext/mini_racer_loader/extconf.rb", "ext/mini_racer_extension/extconf.rb"]
|
37
|
-
|
38
|
-
spec.required_ruby_version = '>= 2.6'
|
39
|
-
end
|