Class: Jass::Compiler

Inherits:
Base
  • Object
show all
Defined in:
lib/jass/compiler.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

dependency, function, generate_code, #pid

Constructor Details

#initializeCompiler

Returns a new instance of Compiler.



110
111
112
113
# File 'lib/jass/compiler.rb', line 110

def initialize
  super(Jass.modules_root, 'NODE_PATH' => self.class.node_path)
  init
end

Class Method Details

.append_plugin(package, name, arguments = nil, root = nil) ⇒ Object



96
97
98
99
# File 'lib/jass/compiler.rb', line 96

def append_plugin(package, name, arguments = nil, root = nil)
  plugins.push(Plugin.new(name, arguments, root))
  dependency name => package
end

.node_pathObject



105
106
107
# File 'lib/jass/compiler.rb', line 105

def node_path
  node_paths.join(':')
end

.node_pathsObject



101
102
103
# File 'lib/jass/compiler.rb', line 101

def node_paths
  ([Jass.modules_root, Jass.vendor_modules_root] + plugins.map(&:root)).compact.map { |p| File.absolute_path(File.join(p, 'node_modules')) }
end

.prepend_plugin(package, name, arguments = nil, root = nil) ⇒ Object



91
92
93
94
# File 'lib/jass/compiler.rb', line 91

def prepend_plugin(package, name, arguments = nil, root = nil)
  plugins.unshift(Plugin.new(name, arguments, root))
  dependency name => package
end

Instance Method Details

#bundle(entry, input_options = Jass.input_options, output_options = {}) ⇒ Object



77
78
79
# File 'lib/jass/compiler.rb', line 77

def bundle(entry, input_options = Jass.input_options, output_options = {})
  js_bundle(entry, self.class.node_paths, input_options, output_options)
end