esruby 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa89a3c4039892f83c2c7b3ebce054b7a590b504
4
- data.tar.gz: 3f0af5171ea47cf7c2bf5ce443d5992f2202e3d0
3
+ metadata.gz: d89614de5a1ee1efad1386baf4ca5a949f3449e8
4
+ data.tar.gz: 432fc37ab54c1d7506b299183be1a8726f7f5137
5
5
  SHA512:
6
- metadata.gz: 0adb672c9cfab13601617f4868a87074d83523380df97ecdb8d799028f12c19ff7c3ba81f62823084a293dc08d88336cea04f1b47c8eb4e39174fb36471596a6
7
- data.tar.gz: e9654d5efd4d12cdd012b88d3f696b515895117bf67819f0798d12570fbad3d474fb8f8b7ec08b8758480dae75c95fb204f5205020667858c0d525b761c67147
6
+ metadata.gz: 75b010a206ab65ce6b5775d6ac12d93bb75781362e8be7c0befeff49c1059b97b6a15e184b86fd7470528b0852150c6da16a4791a8083fc50a6ea24ae088ca6c
7
+ data.tar.gz: 13ca29a12ce4dc90b028479a152022d2d7da7cb1a088fb512d6581c50d6b444f7649c8a70050a5cba2e468c1de5384999543fe7ead0293a1489a47eb75f11466
data/README.md CHANGED
@@ -3,20 +3,36 @@ This project brings *mruby* to the browser. It uses *emscripten*
3
3
  (https://github.com/kripken/emscripten) to compile the mruby source code into
4
4
  JavaScript (ECMAScript) and runs in the browser. It is heavily based off *webruby* (https://github.com/xxuejie/webruby) but has been adjusted to work with the updates to *emscripten* and *mruby*.
5
5
 
6
- # How to Install
6
+ # Install
7
+ *ESRuby* depends on [emsdk](http://kripken.github.io/emscripten-site/index.html) to provide a tool chain consisting of *emscripten* and *LLVM*. Although the tool chain is available from `apt-get` we will need to build emscripten from source using my branch as I have introduced some new features that have not made it into the release yet.
7
8
 
8
- *ESRuby* depends on [emsdk](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html) to provide emscripten and LLVM infrustructure. To try *ESRuby*, follow these steps:
9
-
10
- TODO: instructions will not work yet
11
-
12
- 1. Install emsdk following instructions at [here](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html)
13
- 2. Install latest incoming version of emscripten sdk(right now webruby still depends on code from incoming branch of emscripten, once this goes into a release version, we will lock the version for better stability)
14
- 3. Activate latest incoming version
15
- 4. Webruby should be able to pick up the correct version of emscripten from emsdk. If not, feel free to create an issue :)
16
- 5. Install gem `gem install esruby`
17
- 6. Create new project with `esruby new <name>`
18
- 7. Build project with `esruby build [config.rb]`
9
+ * we will start with a clean instance of Ubuntu 16.04 with ruby MRI installed
10
+ * `cd` to a directory where you want *emsdk* downloaded
11
+ * `git clone https://github.com/juj/emsdk.git`
12
+ * `cd emsdk`
13
+ * `git reset --hard 313d5ef` # optional, but it may help if you find that `master` is too new for my fork
14
+ * as per the [documentation](http://kripken.github.io/emscripten-site/docs/building_from_source/building_emscripten_from_source_using_the_sdk.html) we will first install from the main repositories then replace *emscripten* with my fork:
15
+ * `./emsdk install sdk-incoming-64bit`
16
+ * `./emsdk activate sdk-incoming-64bit`
17
+ * `cd emscripten/incoming`
18
+ * `git remote add fork https://github.com/robfors/emscripten.git`
19
+ * `git fetch fork esruby`
20
+ * `git checkout -b esruby fork/esruby`
21
+ * `cd ../..`
22
+ * `source ./emsdk_env.sh` # calling this will add necessary paths to bash
23
+ * optional: make the last command persistent by adding\
24
+ `[ -f /path_to_emsdk/emsdk_env.sh ] && source /path_to_emsdk/emsdk_env.sh > /dev/null 2>&1`\
25
+ to your `.bashrc` and `.profile`
26
+ * verify emsdk is working with `emcc -v`
27
+ * install this gem with `gem install esruby`
19
28
 
29
+ # Try
30
+ * create a new esruby project with `esruby new project`
31
+ * `cd project`
32
+ * build the project with `esruby build config.rb`
33
+ * you will now have `www/app.js` and `www/index.html`
34
+ * a simple way to serve these files would be `ruby -run -e httpd www -p 4444`
35
+ * the app with be available at http://localhost:4444
20
36
  # License
21
37
 
22
38
  This project is distributed under the MIT License. See LICENSE for further details.
@@ -14,7 +14,7 @@ module ESRuby
14
14
  end
15
15
 
16
16
  def_delegators :@configuration, :root_directory, :ruby_sources, :build_directory,
17
- :build_mode, :output, :emsdk_directory, :mruby_directory, :gems
17
+ :build_mode, :output, :mruby_directory, :gems
18
18
 
19
19
  def initialize(&block)
20
20
  @configuration = Configuration.new
@@ -58,20 +58,10 @@ module ESRuby
58
58
  js_files
59
59
  end
60
60
 
61
- def emcc
62
- "#{emsdk_directory}/emscripten/incoming/emcc"
63
- end
64
-
65
- def emar
66
- "#{emsdk_directory}/emscripten/incoming/emar"
67
- end
68
-
69
61
  def build_mruby_config
70
62
  template = File.read("#{gem_directory}/resources/build_config.eruby")
71
63
  eruby = Erubis::Eruby.new(template)
72
64
  config = {}
73
- config[:emcc] = emcc
74
- config[:emar] = emar
75
65
  config[:prepended_js_sources] = prepended_js_sources
76
66
  config[:appended_js_sources] = appended_js_sources
77
67
  config[:optimization_argument] = optimization_argument
@@ -124,10 +114,10 @@ module ESRuby
124
114
  js_arguments = prepended_js_sources.map { |path| "--pre-js #{path}" }.join(" ")
125
115
  js_arguments += appended_js_sources.map { |path| "--post-js #{path}" }.join(" ")
126
116
  RakeFileUtils.sh "#{mrbc} -B app -o #{build_directory}/app.c #{ruby_sources.join(" ")}"
127
- RakeFileUtils.sh "#{emcc} --bind -I #{mruby_directory}/include #{build_directory}/app.c -o #{build_directory}/app.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument}"
128
- RakeFileUtils.sh "#{emcc} -std=c++11 --bind -I #{mruby_directory}/include #{gem_directory}/resources/cpp/esruby.cpp -o #{build_directory}/esruby.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument}"
129
- RakeFileUtils.sh "#{emcc} -std=c++11 --bind -I #{mruby_directory}/include #{gem_directory}/resources/cpp/main.cpp -o #{build_directory}/main.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument}"
130
- RakeFileUtils.sh "#{emcc} --bind -I #{mruby_directory}/include -o #{build_directory}/output.js #{build_directory}/app.o #{build_directory}/esruby.o #{build_directory}/main.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument}"
117
+ RakeFileUtils.sh "emcc --bind -I #{mruby_directory}/include #{build_directory}/app.c -o #{build_directory}/app.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument}"
118
+ RakeFileUtils.sh "emcc -std=c++11 --bind -I #{mruby_directory}/include #{gem_directory}/resources/cpp/esruby.cpp -o #{build_directory}/esruby.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument}"
119
+ RakeFileUtils.sh "emcc -std=c++11 --bind -I #{mruby_directory}/include #{gem_directory}/resources/cpp/main.cpp -o #{build_directory}/main.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument}"
120
+ RakeFileUtils.sh "emcc --bind -I #{mruby_directory}/include -o #{build_directory}/output.js #{build_directory}/app.o #{build_directory}/esruby.o #{build_directory}/main.o #{build_directory}/emscripten/lib/libmruby.a -lm #{js_arguments} #{optimization_argument} #{closure_argument} #{debug_argument}"
131
121
  #if build.build_mode == 'production'
132
122
  # sh "java -jar #{PROJECT_DIRECTORY}/emsdk/emscripten/incoming/third_party/closure-compiler/compiler.jar --js #{build.absolute_build_directory}/output.js --js_output_file #{build.absolute_output}"
133
123
  #else
@@ -3,12 +3,11 @@ module ESRuby
3
3
  class Configuration
4
4
 
5
5
  attr_reader :ruby_sources, :prepended_js_sources, :appended_js_sources,
6
- :build_directory, :build_mode, :gems, :emsdk_directory, :mruby_directory,
6
+ :build_directory, :build_mode, :gems, :mruby_directory,
7
7
  :output
8
8
 
9
9
  def initialize
10
10
  @root_directory = nil
11
- @emsdk_directory = 'emsdk'
12
11
  @mruby_directory = "#{ESRuby.gem_directory}/resources/mruby"
13
12
  @output = 'output.js'
14
13
  @ruby_sources = []
@@ -54,12 +53,6 @@ module ESRuby
54
53
  @output = File.expand_path(new_output, root_directory)
55
54
  end
56
55
 
57
- def emsdk_directory=(new_emsdk_directory)
58
- emsdk_directory = File.expand_path(new_emsdk_directory, root_directory)
59
- raise "'emsdk_directory' not found" unless File.directory?(emsdk_directory)
60
- @emsdk_directory = emsdk_directory
61
- end
62
-
63
56
  def mruby_directory=(new_mruby_directory)
64
57
  mruby_directory = File.expand_path(new_mruby_directory, root_directory)
65
58
  raise "'mruby_directory' not found" unless File.directory?(mruby_directory)
@@ -31,10 +31,10 @@ MRuby::Toolchain.new('emscripten') do |conf|
31
31
  c.flags << "<%= debug_argument %>"
32
32
  end
33
33
 
34
- conf.cc.command = "<%= emcc %>"
35
- conf.cxx.command = "<%= emcc %>"
36
- conf.linker.command = "<%= emcc %>"
37
- conf.archiver.command = "<%= emar %>"
34
+ conf.cc.command = "emcc"
35
+ conf.cxx.command = "emcc"
36
+ conf.linker.command = "emcc"
37
+ conf.archiver.command = "emar"
38
38
 
39
39
  end
40
40
 
@@ -18,7 +18,6 @@ ESRuby::Build.new do |conf|
18
18
  # By default the final output file name is "webruby.js"
19
19
  conf.output = "www/app.js"
20
20
 
21
- conf.emsdk_directory = '../emsdk'
22
21
  #conf.mruby_directory = 'mruby'
23
22
 
24
23
  # We found that if memory init file is used, browsers will hang
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Fors
@@ -442,7 +442,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
442
442
  version: '0'
443
443
  requirements: []
444
444
  rubyforge_project:
445
- rubygems_version: 2.6.11
445
+ rubygems_version: 2.4.8
446
446
  signing_key:
447
447
  specification_version: 4
448
448
  summary: Ruby running in the browser