summaryrefslogtreecommitdiffhomepage
path: root/bin
diff options
context:
space:
mode:
authorTom Black <[email protected]>2017-02-17 01:04:19 -0500
committerTom Black <[email protected]>2017-02-17 01:04:19 -0500
commitce14713e865d41f0df770d430aaded9fba95bad2 (patch)
treeac41e9626d850e2051fae54b026eee2da5fb5500 /bin
parent664effae7876ac641694ec2247139bdd2373fb6d (diff)
downloadruby2d-ce14713e865d41f0df770d430aaded9fba95bad2.tar.gz
ruby2d-ce14713e865d41f0df770d430aaded9fba95bad2.zip
Strip `require 'ruby2d'` from source files
For MRuby and Opal
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ruby2d18
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/ruby2d b/bin/ruby2d
index 244e958..1d9ef7e 100755
--- a/bin/ruby2d
+++ b/bin/ruby2d
@@ -57,18 +57,22 @@ def make_lib
lib << "
include Ruby2D::DSL
-include Ruby2D
-
-def require(str)
- if str == 'ruby2d'
- true
- end
-end\n"
+include Ruby2D\n"
File.write('build/lib.rb', lib)
end
+# Remove `require 'ruby2d'` from source file
+def strip_require(file)
+ output = ''
+ File.foreach(file) do |line|
+ output << line unless line =~ /require ('|")ruby2d('|")/
+ end
+ return output
+end
+
+
# Build a native version of the provided Ruby application
def build_native(rb_file)