Module: JBundle
- Defined in:
- lib/jbundle.rb,
lib/jbundle/file.rb,
lib/jbundle/bundle.rb,
lib/jbundle/config.rb,
lib/jbundle/server.rb,
lib/jbundle/writer.rb,
lib/jbundle/builder.rb,
lib/jbundle/version.rb,
lib/jbundle/bundle_utils.rb,
lib/jbundle/command_line.rb
Defined Under Namespace
Modules: BundleUtils
Classes: Builder, Bundle, CommandLine, Compiler, Config, File, NoBundleError, NoJFileError, Server, Version, Writer
Constant Summary
collapse
- JFILE =
'Jfile'
- VERSION =
"0.1.4"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
20
21
22
|
# File 'lib/jbundle.rb', line 20
def logger
@logger
end
|
Class Method Details
.build(name) ⇒ Object
52
53
54
|
# File 'lib/jbundle.rb', line 52
def build(name)
Builder.new(config).build_one find(name)
end
|
.clear_current_dist_dir(dist_dir) ⇒ Object
72
73
74
75
76
|
# File 'lib/jbundle.rb', line 72
def clear_current_dist_dir(dist_dir)
config.version.releaseable.each do |version_dir|
FileUtils.rm_rf ::File.join(dist_dir, version_dir)
end
end
|
.config(&block) ⇒ Object
26
27
28
29
30
|
# File 'lib/jbundle.rb', line 26
def config(&block)
@current_config ||= JBundle::Config.new
@current_config.instance_eval(&block) if block_given?
@current_config
end
|
.config_from_file(file) ⇒ Object
62
63
64
65
66
|
# File 'lib/jbundle.rb', line 62
def config_from_file(file)
raise NoJFileError, "You need to define #{file}" unless ::File.exists?(file)
reset!
config.instance_eval( ::File.read(file), file )
end
|
.find(name) ⇒ Object
56
57
58
59
60
|
# File 'lib/jbundle.rb', line 56
def find(name)
found = config.bundles_and_files.detect {|f| f.original_name == name || f.name == name}
raise NoBundleError, "No bundle or file found with name #{name}" unless found
found
end
|
.log(msg) ⇒ Object
22
23
24
|
# File 'lib/jbundle.rb', line 22
def log(msg)
logger.call(msg)
end
|
.output ⇒ Object
32
33
34
|
# File 'lib/jbundle.rb', line 32
def output
@output ||= Builder.new(config).build!
end
|
.reset! ⇒ Object
36
37
38
39
40
|
# File 'lib/jbundle.rb', line 36
def reset!
@current_config = nil
@output = nil
self
end
|
.run_after_write ⇒ Object
68
69
70
|
# File 'lib/jbundle.rb', line 68
def run_after_write
config.after_write_blocks.each {|block| block.call(config)}
end
|
.write! ⇒ Object
42
43
44
45
46
47
48
49
50
|
# File 'lib/jbundle.rb', line 42
def write!
_dist = config.target_dir || './dist'
clear_current_dist_dir(_dist)
out = output.map do |compiler|
Writer.new(compiler, config, _dist).write
end.flatten
run_after_write unless config.after_write_blocks.empty?
out
end
|