Module: Jake

Defined in:
lib/jake.rb,
lib/jake/build.rb,
lib/jake/bundle.rb,
lib/jake/helper.rb,
lib/jake/package.rb,
lib/jake/buildable.rb

Defined Under Namespace

Classes: Build, Buildable, Bundle, Helper, Package

Constant Summary collapse

VERSION =
'1.1.0'
CONFIG_FILE =
'jake.yml'
HELPER_FILE =
'Jakefile'
EXTENSION =
'.js'

Class Method Summary collapse

Class Method Details

.build!(path, options = {}) ⇒ Object



26
27
28
29
# File 'lib/jake.rb', line 26

def self.build!(path, options = {})
  build = Build.new(path, options)
  build.run!
end

.clear_hooks!Object



31
32
33
# File 'lib/jake.rb', line 31

def self.clear_hooks!
  Build.delete_observers
end

.erb(template) ⇒ Object



56
57
58
# File 'lib/jake.rb', line 56

def self.erb(template)
  defined?(Erubis) ? Erubis::Eruby.new(template) : ERB.new(template)
end

.path(*parts) ⇒ Object



35
36
37
38
# File 'lib/jake.rb', line 35

def self.path(*parts)
  parts = parts.compact.map { |p| p.to_s }
  File.expand_path(File.join(*parts))
end

.read(path) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/jake.rb', line 40

def self.read(path)
  path = File.expand_path(path)
  [path, "#{path}#{EXTENSION}"].each do |file|
    return File.read(file) if File.file?(file)
  end
  return nil
end

.symbolize_hash(hash, deep = true) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/jake.rb', line 48

def self.symbolize_hash(hash, deep = true)
  hash.inject({}) do |output, (key, value)|
    value = Jake.symbolize_hash(value) if deep and value.is_a?(Hash)
    output[(key.to_sym rescue key) || key] = value
    output
  end
end