Class: Webruby::Config
- Inherits:
-
Object
- Object
- Webruby::Config
- Defined in:
- lib/webruby/config.rb
Instance Attribute Summary collapse
-
#build_dir ⇒ Object
Returns the value of attribute build_dir.
-
#compile_mode ⇒ Object
Returns the value of attribute compile_mode.
-
#entrypoint ⇒ Object
Returns the value of attribute entrypoint.
-
#executable_output_name ⇒ Object
Returns the value of attribute executable_output_name.
-
#loading_mode ⇒ Object
Returns the value of attribute loading_mode.
-
#output_name ⇒ Object
Returns the value of attribute output_name.
-
#selected_gemboxes ⇒ Object
Returns the value of attribute selected_gemboxes.
-
#selected_gems ⇒ Object
Returns the value of attribute selected_gems.
Instance Method Summary collapse
- #cflags ⇒ Object
- #gem(g) ⇒ Object
- #gem_lines ⇒ Object
- #gembox(gb) ⇒ Object
- #gembox_lines ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #is_release_mode ⇒ Object
- #ldflags ⇒ Object
- #optimization_flag ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/webruby/config.rb', line 7 def initialize @entrypoint = 'app/app.rb' @build_dir = 'build' @selected_gemboxes = ['default'] @selected_gems = [] @compile_mode = 'debug' # debug or release @loading_mode = 2 @output_name = 'webruby.js' @executable_output_name = 'webruby_bin.js' end |
Instance Attribute Details
#build_dir ⇒ Object
Returns the value of attribute build_dir.
3 4 5 |
# File 'lib/webruby/config.rb', line 3 def build_dir @build_dir end |
#compile_mode ⇒ Object
Returns the value of attribute compile_mode.
3 4 5 |
# File 'lib/webruby/config.rb', line 3 def compile_mode @compile_mode end |
#entrypoint ⇒ Object
Returns the value of attribute entrypoint.
3 4 5 |
# File 'lib/webruby/config.rb', line 3 def entrypoint @entrypoint end |
#executable_output_name ⇒ Object
Returns the value of attribute executable_output_name.
3 4 5 |
# File 'lib/webruby/config.rb', line 3 def executable_output_name @executable_output_name end |
#loading_mode ⇒ Object
Returns the value of attribute loading_mode.
3 4 5 |
# File 'lib/webruby/config.rb', line 3 def loading_mode @loading_mode end |
#output_name ⇒ Object
Returns the value of attribute output_name.
3 4 5 |
# File 'lib/webruby/config.rb', line 3 def output_name @output_name end |
#selected_gemboxes ⇒ Object
Returns the value of attribute selected_gemboxes.
3 4 5 |
# File 'lib/webruby/config.rb', line 3 def selected_gemboxes @selected_gemboxes end |
#selected_gems ⇒ Object
Returns the value of attribute selected_gems.
3 4 5 |
# File 'lib/webruby/config.rb', line 3 def selected_gems @selected_gems end |
Instance Method Details
#cflags ⇒ Object
22 23 24 |
# File 'lib/webruby/config.rb', line 22 def cflags "-Wall -Werror-implicit-function-declaration #{optimization_flag}" end |
#gem(g) ⇒ Object
34 35 36 |
# File 'lib/webruby/config.rb', line 34 def gem(g) selected_gems << g end |
#gem_lines ⇒ Object
46 47 48 |
# File 'lib/webruby/config.rb', line 46 def gem_lines generate_conf_lines(selected_gems, 'gem') end |
#gembox(gb) ⇒ Object
38 39 40 |
# File 'lib/webruby/config.rb', line 38 def gembox(gb) selected_gemboxes << gb end |
#gembox_lines ⇒ Object
42 43 44 |
# File 'lib/webruby/config.rb', line 42 def gembox_lines generate_conf_lines(selected_gemboxes, 'gembox') end |
#is_release_mode ⇒ Object
18 19 20 |
# File 'lib/webruby/config.rb', line 18 def is_release_mode @compile_mode == 'release' end |
#ldflags ⇒ Object
26 27 28 |
# File 'lib/webruby/config.rb', line 26 def ldflags optimization_flag end |
#optimization_flag ⇒ Object
30 31 32 |
# File 'lib/webruby/config.rb', line 30 def optimization_flag is_release_mode ? "-O2" : "-O0" end |