Skip to content

Commit

Permalink
Detect if Sizzle hasn't been loaded via submodule.
Browse files Browse the repository at this point in the history
  • Loading branch information
savetheclocktower committed Oct 11, 2009
1 parent 4d042a9 commit c5372d8
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions Rakefile
Expand Up @@ -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],
Expand Down Expand Up @@ -59,6 +64,16 @@ module PrototypeHelper
require_submodule('CajaBuilder', 'caja_builder')
end

def self.require_sizzle

This comment has been minimized.

Copy link
@tobie

tobie Oct 11, 2009

Collaborator

That's not very dry.

This comment has been minimized.

Copy link
@savetheclocktower

savetheclocktower Oct 11, 2009

Author 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
Expand All @@ -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}"

This comment has been minimized.

Copy link
@tobie

tobie Oct 11, 2009

Collaborator

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

This comment has been minimized.

Copy link
@savetheclocktower

savetheclocktower Oct 11, 2009

Author 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"
Expand All @@ -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]

Expand Down

2 comments on commit c5372d8

@tobie
Copy link
Collaborator

@tobie tobie commented on c5372d8 Oct 11, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sounds like a plan.

@tobie
Copy link
Collaborator

@tobie tobie commented on c5372d8 Oct 11, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.