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(<<-EOS, nil, '-')
// This file is automatically generated when you run `jake`. You should
// keep it out of your version control system.

// Maintain your project's dependencies in jake.yml; they will be
// reflected here when you run a build.

JS.Packages(function() { with(this) {
<% files.each do |path, meta| %>
file('./<%= LIB %><%= path %>')
    .provides(<%= list(meta[:provides]) %>)
    .requires(<%= list(meta[:requires]) %>)
    .uses(<%= list(meta[:uses]) %>);
<% end -%>
}});
EOS

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