webruby 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/webruby/config.rb +3 -3
- data/lib/webruby/rake/files.rake +3 -3
- data/lib/webruby/rake/mruby.rake +1 -1
- data/scripts/gen_require.rb +18 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a820a2ac9abf12cba9386374ef4770f5483ef9ee
|
4
|
+
data.tar.gz: 528292cd94b2d6924caa37314ad6d3106f4815da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fa9b17c31996090696a77d49293978d3a35a09a436ae367f2c85975e7769a3f520d90a547548d611f9a22fc64fee09d2ddbe5c9f40939f67cfea5a88a8696d6
|
7
|
+
data.tar.gz: baff4144d8e107f68c8fcfe5ed5417a95b00628f240bef27a2feb66aa4789203d38022a804ec093e813d519a2fef583f096f5d595d7b8fbf361d2bcc46a2ba6a
|
data/lib/webruby/config.rb
CHANGED
@@ -16,15 +16,15 @@ module Webruby
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def is_release_mode
|
19
|
-
|
19
|
+
compile_mode == 'release'
|
20
20
|
end
|
21
21
|
|
22
22
|
def cflags
|
23
|
-
|
23
|
+
%w(-Wall -Werror-implicit-function-declaration -Wno-warn-absolute-paths) + [optimization_flag]
|
24
24
|
end
|
25
25
|
|
26
26
|
def ldflags
|
27
|
-
optimization_flag
|
27
|
+
[optimization_flag]
|
28
28
|
end
|
29
29
|
|
30
30
|
def optimization_flag
|
data/lib/webruby/rake/files.rake
CHANGED
@@ -28,7 +28,7 @@ end
|
|
28
28
|
|
29
29
|
file "#{Webruby.build_dir}/app.o" => "#{Webruby.build_dir}/app.c" do |t|
|
30
30
|
require_flag = (Webruby::App.config.source_processor == :gen_require) ? ("-DHAS_REQUIRE") : ("")
|
31
|
-
sh "#{EMCC} #{EMCC_CFLAGS} #{require_flag} #{Webruby::App.config.cflags} #{Webruby.build_dir}/app.c -o #{Webruby.build_dir}/app.o"
|
31
|
+
sh "#{EMCC} #{EMCC_CFLAGS} #{require_flag} #{Webruby::App.config.cflags.join(' ')} #{Webruby.build_dir}/app.c -o #{Webruby.build_dir}/app.o"
|
32
32
|
end
|
33
33
|
|
34
34
|
file "#{Webruby.build_dir}/link.js" =>
|
@@ -38,7 +38,7 @@ file "#{Webruby.build_dir}/link.js" =>
|
|
38
38
|
Webruby::App.config.loading_mode,
|
39
39
|
[])
|
40
40
|
|
41
|
-
sh "#{EMLD} #{Webruby.build_dir}/app.o #{Webruby.build_dir}/#{LIBMRUBY} -o #{Webruby.build_dir}/link.js #{Webruby.gem_js_flags} #{func_arg} #{Webruby::App.config.ldflags}"
|
41
|
+
sh "#{EMLD} #{Webruby.build_dir}/app.o #{Webruby.build_dir}/#{LIBMRUBY} -o #{Webruby.build_dir}/link.js #{Webruby.gem_js_flags} #{func_arg} #{Webruby::App.config.ldflags.join(' ')}"
|
42
42
|
end
|
43
43
|
|
44
44
|
append_file_deps = Webruby::App.config.append_file ?
|
@@ -62,5 +62,5 @@ file "#{Webruby.build_dir}/mrbtest.js" =>
|
|
62
62
|
func_arg = Webruby.get_exported_arg("#{Webruby.build_dir}/functions",
|
63
63
|
0, ['main'])
|
64
64
|
|
65
|
-
sh "#{EMLD} #{Webruby.build_dir}/mrbtest.bc -o #{Webruby.build_dir}/mrbtest.js -s TOTAL_MEMORY=33554432 #{Webruby.gem_test_js_flags} #{func_arg} #{Webruby::App.config.ldflags}"
|
65
|
+
sh "#{EMLD} #{Webruby.build_dir}/mrbtest.bc -o #{Webruby.build_dir}/mrbtest.js -s TOTAL_MEMORY=33554432 #{Webruby.gem_test_js_flags} #{func_arg} #{Webruby::App.config.ldflags.join(' ')}"
|
66
66
|
end
|
data/lib/webruby/rake/mruby.rake
CHANGED
data/scripts/gen_require.rb
CHANGED
@@ -72,6 +72,7 @@ RUBY_SOURCE_PATH = "#{OUTPUT_PATH}.tmp"
|
|
72
72
|
File.open(RUBY_SOURCE_PATH, "w") do |f|
|
73
73
|
f.puts <<END
|
74
74
|
module Kernel
|
75
|
+
@@REQUIRED_PATH = ""
|
75
76
|
@@REQUIRED_MODULES = {
|
76
77
|
END
|
77
78
|
|
@@ -84,10 +85,27 @@ END
|
|
84
85
|
|
85
86
|
def require(name)
|
86
87
|
return false unless @@REQUIRED_MODULES.include?(name)
|
88
|
+
@@REQUIRED_PATH = name[0, name.rindex('/') || 0]
|
87
89
|
require_internal(@@REQUIRED_MODULES[name])
|
88
90
|
@@REQUIRED_MODULES.delete(name)
|
89
91
|
true
|
90
92
|
end
|
93
|
+
|
94
|
+
def require_relative(path)
|
95
|
+
current_path = @@REQUIRED_PATH
|
96
|
+
path.split('/').each do |fragment|
|
97
|
+
case fragment
|
98
|
+
when '.'
|
99
|
+
# Doing nothing, current path
|
100
|
+
when '..'
|
101
|
+
current_path = current_path[0, current_path.rindex('/') || 0]
|
102
|
+
else
|
103
|
+
current_path = current_path.empty? ? fragment :
|
104
|
+
"\#{current_path}/\#{fragment}"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
require(current_path)
|
108
|
+
end
|
91
109
|
end
|
92
110
|
END
|
93
111
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xuejie Xiao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: compile your favourite Ruby source code for the browser!
|
14
14
|
email: xxuejie@gmail.com
|
@@ -1537,9 +1537,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1537
1537
|
version: '0'
|
1538
1538
|
requirements: []
|
1539
1539
|
rubyforge_project:
|
1540
|
-
rubygems_version: 2.0.
|
1540
|
+
rubygems_version: 2.0.14
|
1541
1541
|
signing_key:
|
1542
1542
|
specification_version: 4
|
1543
1543
|
summary: webruby
|
1544
1544
|
test_files: []
|
1545
|
-
has_rdoc:
|