Skip to content

Commit

Permalink
Make main module global when handling more than one file at the same …
Browse files Browse the repository at this point in the history
…time.
  • Loading branch information
tobie committed Oct 31, 2010
1 parent b6757a0 commit ac79ed4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/modulr/sync_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ def add_module_from_path(path)

private
def lib
File.read(PATH_TO_MODULR_SYNC_JS)
output = File.read(PATH_TO_MODULR_SYNC_JS)
if top_level_modules.size > 1
output << "\nvar module = {};\n"
output << "\nrequire.main = module;\n"
end
output
end

def requires
top_level_modules.map { |m| "\n require('#{m.id}');" }.join
end
Expand Down

0 comments on commit ac79ed4

Please sign in to comment.