opal-js_wrap-three 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/pages.yml +21 -0
- data/.gitignore +2 -0
- data/README.md +12 -0
- data/Rakefile +31 -0
- data/examples/clipping_intersection/Gemfile +2 -2
- data/examples/gltf_loader/Gemfile +2 -2
- data/examples/readme/Gemfile +3 -3
- data/lib/opal/js_wrap/three/version.rb +1 -1
- data/lib/opal/js_wrap/three.rb +1 -1
- data/lib-opal/js_wrap/three.rb +2 -0
- data/lib-opal/js_wrap.rb +7 -18
- metadata +4 -4
- data/Gemfile.lock +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cadbc524a8e47cb01c019ca493fe26f39e55830ed8a97b277137e68610521f9
|
4
|
+
data.tar.gz: 25be6fcee99f405bbc92e67b95d135196c8e0f30efd35f89eeab6cb0960d4336
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17b61356a4c8845013ea98affd2efaed63c0fbcf1e470f6f376937731ca3d6bf02c9d65c14a104c9b01187a68b9430e8bd3727ef689ba0b69f0603cbda7785d9
|
7
|
+
data.tar.gz: 8819e91de6386498d111369e92fe3f65242e35a3c46c97eecb557b58939f412f11c7958ac0494752ac048029765cf8ad4874219bb922f6f647ad77286a1818c5
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Build and Deploy
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
build-and-deploy:
|
5
|
+
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
steps:
|
8
|
+
- name: Checkout 🛎️
|
9
|
+
uses: actions/checkout@v2
|
10
|
+
- name: Setup Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: "3.0" # Not needed with a .ruby-version file
|
14
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
15
|
+
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
|
16
|
+
run: bundle exec rake build_gh_pages
|
17
|
+
- name: Deploy 🚀
|
18
|
+
uses: JamesIves/github-pages-deploy-action@v4.2.3
|
19
|
+
with:
|
20
|
+
branch: gh-pages # The branch the action should deploy to.
|
21
|
+
folder: gh-pages # The folder the action should deploy.
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -41,6 +41,18 @@ is now `set_size` and so on.
|
|
41
41
|
|
42
42
|
See examples for more info.
|
43
43
|
|
44
|
+
## Examples
|
45
|
+
|
46
|
+
* Readme - an adapted example from Three.js readme:
|
47
|
+
* https://hmdne.github.io/opal-js_wrap-three/examples/readme/
|
48
|
+
* https://github.com/hmdne/opal-js_wrap-three/blob/master/examples/readme/example.rb
|
49
|
+
* Clipping intersection
|
50
|
+
* https://hmdne.github.io/opal-js_wrap-three/examples/clipping_intersection/
|
51
|
+
* https://github.com/hmdne/opal-js_wrap-three/blob/master/examples/clipping_intersection/example.rb
|
52
|
+
* GLTF loader
|
53
|
+
* https://hmdne.github.io/opal-js_wrap-three/examples/gltf_loader/
|
54
|
+
* https://github.com/hmdne/opal-js_wrap-three/blob/master/examples/gltf_loader/example.rb
|
55
|
+
|
44
56
|
## Development
|
45
57
|
|
46
58
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
@@ -22,3 +22,34 @@ task :build_js_examples do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
task default: %i[build_js build_js_examples]
|
25
|
+
|
26
|
+
task :build_gh_pages do
|
27
|
+
require 'fileutils'
|
28
|
+
|
29
|
+
output_dir = __dir__+"/gh-pages/examples/"
|
30
|
+
FileUtils.mkdir_p output_dir
|
31
|
+
|
32
|
+
Dir['examples/*'].each do |example_path|
|
33
|
+
example = File.basename(example_path)
|
34
|
+
|
35
|
+
output_example_dir = output_dir+"/"+example
|
36
|
+
FileUtils.mkdir_p output_example_dir
|
37
|
+
|
38
|
+
Dir.chdir(example_path) do
|
39
|
+
Bundler.with_unbundled_env do
|
40
|
+
`bundle install`
|
41
|
+
`bundle exec opal -qopal/js_wrap/three -c example.rb > #{output_example_dir}/app.js`
|
42
|
+
end
|
43
|
+
File.write("#{output_example_dir}/index.html", <<~HTML)
|
44
|
+
<!DOCTYPE html>
|
45
|
+
<html>
|
46
|
+
<head>
|
47
|
+
<style> body { margin: 0; } </style>
|
48
|
+
<script src="app.js"></script>
|
49
|
+
</head>
|
50
|
+
<body></body>
|
51
|
+
</html>
|
52
|
+
HTML
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem "opal-js_wrap-three"
|
3
|
+
gem "opal-js_wrap-three"
|
4
4
|
# This gem should work with any recent version of Opal (no guarantees),
|
5
5
|
# but it's strongly recommended to use Opal v1.4 for improved error
|
6
6
|
# reporting.
|
7
|
-
gem "opal"
|
7
|
+
gem "opal"
|
8
8
|
gem "rack"
|
9
9
|
gem "webrick"
|
@@ -1,9 +1,9 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem "opal-js_wrap-three"
|
3
|
+
gem "opal-js_wrap-three"
|
4
4
|
# This gem should work with any recent version of Opal (no guarantees),
|
5
5
|
# but it's strongly recommended to use Opal v1.4 for improved error
|
6
6
|
# reporting.
|
7
|
-
gem "opal"
|
7
|
+
gem "opal"
|
8
8
|
gem "rack"
|
9
9
|
gem "webrick"
|
data/examples/readme/Gemfile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem "opal-js_wrap-three"
|
3
|
+
gem "opal-js_wrap-three"
|
4
4
|
# This gem should work with any recent version of Opal (no guarantees),
|
5
5
|
# but it's strongly recommended to use Opal v1.4 for improved error
|
6
6
|
# reporting.
|
7
|
-
gem "opal"
|
7
|
+
gem "opal"
|
8
8
|
gem "rack"
|
9
|
-
gem "webrick"
|
9
|
+
gem "webrick"
|
data/lib/opal/js_wrap/three.rb
CHANGED
data/lib-opal/js_wrap/three.rb
CHANGED
data/lib-opal/js_wrap.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# helpers: native, defineProperty
|
2
|
+
# backtick_javascript: true
|
2
3
|
|
3
4
|
`var inspect_stack = []`
|
4
5
|
|
@@ -675,24 +676,12 @@ class Hash
|
|
675
676
|
# @return a JavaScript object with the same keys but calling #to_js on
|
676
677
|
# all values.
|
677
678
|
def to_js(parent=nil)
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
key = keys[i];
|
685
|
-
if (key.$$is_string) {
|
686
|
-
value = smap[key];
|
687
|
-
} else {
|
688
|
-
key = key.key;
|
689
|
-
value = key.value;
|
690
|
-
}
|
691
|
-
key = #{parent.js_property_name_rb2js(`key`)}
|
692
|
-
result[key] = #{JSWrap.unwrap(`value`, parent)}
|
693
|
-
}
|
694
|
-
return result;
|
695
|
-
}
|
679
|
+
result = `{}`
|
680
|
+
each do |k,v|
|
681
|
+
key = parent ? parent.js_property_name_rb2js(k) : k
|
682
|
+
`result[key] = #{JSWrap.unwrap(`v`, parent)}`
|
683
|
+
end
|
684
|
+
result
|
696
685
|
end
|
697
686
|
end
|
698
687
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-js_wrap-three
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hmdne
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -31,12 +31,12 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- ".github/workflows/main.yml"
|
34
|
+
- ".github/workflows/pages.yml"
|
34
35
|
- ".gitignore"
|
35
36
|
- ".rspec"
|
36
37
|
- ".rubocop.yml"
|
37
38
|
- CHANGELOG.md
|
38
39
|
- Gemfile
|
39
|
-
- Gemfile.lock
|
40
40
|
- LICENSE.txt
|
41
41
|
- README.md
|
42
42
|
- Rakefile
|
@@ -581,7 +581,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
581
581
|
- !ruby/object:Gem::Version
|
582
582
|
version: '0'
|
583
583
|
requirements: []
|
584
|
-
rubygems_version: 3.
|
584
|
+
rubygems_version: 3.4.10
|
585
585
|
signing_key:
|
586
586
|
specification_version: 4
|
587
587
|
summary: Wrapper for Three.js
|
data/Gemfile.lock
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
opal-js_wrap-three (0.1.3)
|
5
|
-
opal (~> 1.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
ast (2.4.2)
|
11
|
-
concurrent-ruby (1.1.9)
|
12
|
-
diff-lcs (1.4.4)
|
13
|
-
opal (1.3.2)
|
14
|
-
ast (>= 2.3.0)
|
15
|
-
parser (~> 3.0)
|
16
|
-
opal-rspec (0.8.0)
|
17
|
-
opal (>= 1.0.0, < 2.0)
|
18
|
-
opal-sprockets (< 2.0)
|
19
|
-
rake (>= 12.0)
|
20
|
-
opal-sprockets (1.0.2)
|
21
|
-
opal (>= 1.0, < 2.0)
|
22
|
-
sprockets (~> 4.0)
|
23
|
-
tilt (>= 1.4)
|
24
|
-
parallel (1.21.0)
|
25
|
-
parser (3.0.3.2)
|
26
|
-
ast (~> 2.4.1)
|
27
|
-
rack (2.2.3)
|
28
|
-
rainbow (3.0.0)
|
29
|
-
rake (13.0.6)
|
30
|
-
regexp_parser (2.2.0)
|
31
|
-
rexml (3.2.5)
|
32
|
-
rspec (3.10.0)
|
33
|
-
rspec-core (~> 3.10.0)
|
34
|
-
rspec-expectations (~> 3.10.0)
|
35
|
-
rspec-mocks (~> 3.10.0)
|
36
|
-
rspec-core (3.10.1)
|
37
|
-
rspec-support (~> 3.10.0)
|
38
|
-
rspec-expectations (3.10.1)
|
39
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.10.0)
|
41
|
-
rspec-mocks (3.10.2)
|
42
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.10.0)
|
44
|
-
rspec-support (3.10.3)
|
45
|
-
rubocop (1.23.0)
|
46
|
-
parallel (~> 1.10)
|
47
|
-
parser (>= 3.0.0.0)
|
48
|
-
rainbow (>= 2.2.2, < 4.0)
|
49
|
-
regexp_parser (>= 1.8, < 3.0)
|
50
|
-
rexml
|
51
|
-
rubocop-ast (>= 1.12.0, < 2.0)
|
52
|
-
ruby-progressbar (~> 1.7)
|
53
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
54
|
-
rubocop-ast (1.15.0)
|
55
|
-
parser (>= 3.0.1.1)
|
56
|
-
ruby-progressbar (1.11.0)
|
57
|
-
sprockets (4.0.2)
|
58
|
-
concurrent-ruby (~> 1.0)
|
59
|
-
rack (> 1, < 3)
|
60
|
-
tilt (2.0.10)
|
61
|
-
unicode-display_width (2.1.0)
|
62
|
-
|
63
|
-
PLATFORMS
|
64
|
-
x86_64-linux
|
65
|
-
|
66
|
-
DEPENDENCIES
|
67
|
-
opal-js_wrap-three!
|
68
|
-
opal-rspec
|
69
|
-
rake (~> 13.0)
|
70
|
-
rspec (~> 3.0)
|
71
|
-
rubocop (~> 1.7)
|
72
|
-
|
73
|
-
BUNDLED WITH
|
74
|
-
2.2.20
|