Permalink
Browse files

Detect if Sizzle hasn't been loaded via submodule.

  • Loading branch information...
savetheclocktower committed Oct 11, 2009
1 parent 4d042a9 commit c5372d81f3a84554e3a0eb1bd56e5f411375947d
Showing with 17 additions and 4 deletions.
  1. +17 −4 Rakefile
View
@@ -14,9 +14,14 @@ module PrototypeHelper
TEST_UNIT_DIR = File.join(TEST_DIR, 'unit')
TMP_DIR = File.join(TEST_UNIT_DIR, 'tmp')
VERSION = YAML.load(IO.read(File.join(SRC_DIR, 'constants.yml')))['PROTOTYPE_VERSION']
+
+ %w[sprockets pdoc unittest_js caja_builder sizzle].each do |name|
+ $:.unshift File.join(PrototypeHelper::ROOT_DIR, 'vendor', name, 'lib')
+ end
def self.sprocketize(path, source, destination = nil, strip_comments = true)
require_sprockets
+ require_sizzle
secretary = Sprockets::Secretary.new(
:root => File.join(ROOT_DIR, path),
:load_path => [SRC_DIR, SIZZLE_DIR],
@@ -59,6 +64,16 @@ module PrototypeHelper
require_submodule('CajaBuilder', 'caja_builder')
end
+ def self.require_sizzle
@tobie

tobie Oct 11, 2009

Collaborator

That's not very dry.

@savetheclocktower

savetheclocktower Oct 11, 2009

Collaborator

No, it isn't. But Sizzle is loaded differently from other modules. I'll DRY it up at some point.

+ if !File.exists?(File.join(SIZZLE_DIR, 'sizzle.js'))
+ puts "\nIt looks like you're missing Sizzle. Just run:\n\n"
+ puts " $ git submodule init"
+ puts " $ git submodule update"
+ puts "\nand you should be all set.\n\n"
+ exit
+ end
+ end
+
def self.require_submodule(name, path)
begin
require path
@@ -67,7 +82,7 @@ module PrototypeHelper
if missing_file == path
puts "\nIt looks like you're missing #{name}. Just run:\n\n"
puts " $ git submodule init"
- puts " $ git submodule update vendor/#{path}"
@tobie

tobie Oct 11, 2009

Collaborator

Why remove that line? that actually avoided needing to load unnecessary submodules (the Caja one is very heavy).

@savetheclocktower

savetheclocktower Oct 11, 2009

Collaborator

Think of someone who checks out the repo and tries a rake dist. They'll get the message for vendor/sprockets, then they'll run the commands and try again, then get the message for vendor/pdoc, then get the message for vendor/unittest_js...

Maybe we can have a rake task for updating all the submodules except Caja?

+ puts " $ git submodule update"
puts "\nand you should be all set.\n\n"
else
puts "\nIt looks like #{name} is missing the '#{missing_file}' gem. Just run:\n\n"
@@ -79,9 +94,7 @@ module PrototypeHelper
end
end
-%w[sprockets pdoc unittest_js caja_builder].each do |name|
- $:.unshift File.join(PrototypeHelper::ROOT_DIR, 'vendor', name, 'lib')
-end
+
task :default => [:dist, :dist_helper, :package, :clean_package_source]

2 comments on commit c5372d8

Collaborator

tobie replied Oct 11, 2009

Maybe we can have a rake task for updating all the submodules except Caja?

Sounds like a plan.

Collaborator

tobie replied Oct 11, 2009

No, it isn't. But Sizzle is loaded differently from other modules.

Ya, hadn't noticed that when I first commented. My bad.

Please sign in to comment.