Module: Helium::JakeBuildHelper

Defined in:
lib/helium/jake.rb

Constant Summary collapse

LIB =
'lib'
TEST_DIR =
File.join(PROJECT_DIR, 'test')
PUBLIC_DIR =
File.join(TEST_DIR, 'public')
TARGET_DIR =

If test/public exists, we generate files there. Otherwise we just put generated files in the test directory.

File.directory?(PUBLIC_DIR) ? PUBLIC_DIR : TEST_DIR
LIB_DIR =
File.join(TARGET_DIR, LIB)
PACKAGES =
ERB.new("// This file is automatically generated when you run `jake`. You should\n// keep it out of your version control system.\n\n// Maintain your project's dependencies in jake.yml; they will be\n// reflected here when you run a build.\n\nJS.Packages(function() { with(this) {\n<% files.each do |path, meta| %>\nfile('./<%= LIB %><%= path %>')\n    .provides(<%= list(meta[:provides]) %>)\n    .requires(<%= list(meta[:requires]) %>)\n    .uses(<%= list(meta[:uses]) %>);\n<% end -%>\n}});\n", nil, '-')

Class Method Summary collapse

Class Method Details

.list(array) ⇒ Object



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

def self.list(array)
  (array || []).map { |s| s.inspect } * ', '
end

.short_path(path) ⇒ Object



40
41
42
# File 'lib/helium/jake.rb', line 40

def self.short_path(path)
  path.sub(PROJECT_DIR, '.')
end