Created
February 27, 2012 22:41
-
-
Save bradleypriest/1927641 to your computer and use it in GitHub Desktop.
Using Jammit packages in Jasmine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src_files: | |
- public/javascripts/lib/jquery/jquery.js | |
# jammit_packages | |
# | |
# See jasmine_config.rb | |
jammit_packages: | |
- head | |
- common | |
- checkout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jasmine | |
class Config | |
alias_method :original_src_files, :src_files | |
def src_files | |
files = original_src_files | |
files += pull_from_jammit(jammit_packages) | |
match_files(src_dir, files) | |
end | |
def jammit_packages | |
simple_config['jammit_packages'].map(&:to_sym) | |
end | |
def pull_from_jammit(packages) | |
jammit_js = Jammit.packager.instance_variable_get(:@packages)[:js] | |
packages.map{ |package| jammit_js[package][:urls].map{ |url| "public" + url } }.compact.flatten | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment