Skip to content

Commit

Permalink
revised x-domain strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
collin committed Sep 1, 2008
1 parent cca0904 commit 26e4fc7
Show file tree
Hide file tree
Showing 240 changed files with 101 additions and 33,832 deletions.
2,497 changes: 0 additions & 2,497 deletions Orbited.js

This file was deleted.

71 changes: 56 additions & 15 deletions build
Expand Up @@ -4,6 +4,10 @@ require 'sass'
require 'haml'
require 'continuous_builder'
require 'pathname'
require 'ruby2ruby'

$-w = nil
$-v = nil

class Pathname
alias / +
Expand All @@ -15,6 +19,21 @@ end

$dir = Pathname.new(__FILE__).dirname

class Sexp
def first_of_type t
detected = []
self.each do |elem|
if elem.is_a? Sexp
if elem.first == t
detected = elem
else
detected = elem.first_of_type t
end
end
end
detected
end
end

class GistLiveContinuousBuilder < ContinuousBuilder
watches :jabs,
Expand All @@ -39,29 +58,51 @@ class GistLiveContinuousBuilder < ContinuousBuilder
:files => "./public/edit_area/*.js",
:update => :repack

def repack path
def pack
pack = []
pack << ($dir/'public'/'jquery-1.2.6.min.js').read
pack << ($dir/'public'/'json2.js').read
pack << ($dir/'jquery.center.js').read
pack << ($dir/'jquery.corner.js').read
pack << ($dir/'gradient-1.0'/'jquery.gradient.pack.js').read
pack << ($dir/'diff_match_patch'/'diff_match_patch.js').read
pack << ($dir/'public'/'edit_area'/'edit_area_full.js').read
pack << ($dir/'vendor'/'jquery-1.2.6.min.js').read
pack
end

Pathname.glob($dir/'src'/'*.html').each do |path|
pack << "var #{path.basename.to_s.gsub('.html', '')} = jQuery(\"#{path.read.gsub("\n", '')}\")"
def repack_mod mod, &block
mod_pack = pack

Pathname.glob($dir/'src'/mod/'*.html').each do |path|
script = "var #{path.basename.to_s.gsub('.html', '')}"
script << "= jQuery(\"#{path.read.gsub("\n", '')}\");"
mod_pack << script
end

pack << ($dir/'src'/'gist_live.js').read

path = $dir/'public'/'embedded.js'
specifics = []
specifics.instance_eval &block
specifics.each do |script|
mod_pack << ($dir/script).read
end

path = $dir/'public'/"#{mod}.js"
f= File.open(path, 'w')
f.write(pack.join("\n"))
f.write(mod_pack.join(";\n\n"))
f.close
end

def repack path
repack_mod :embedded do
push 'vendor/jquery.center.js'
push 'vendor/jquery.corner.js'
push 'vendor/gradient-1.0/jquery.gradient.pack.js'
push 'src/embedded/gist_live.js'
end

repack_mod :editor do
push 'vendor/diff_match_patch/diff_match_patch.js'
# Needs to load files as it goes
push 'public/edit_area/edit_area_full.js'
push 'vendor/Orbited.js'
push 'public/legs.js'
end
end
end

builder = GistLiveContinuousBuilder.new
builder.build_all
builder.build_continuously
builder.build_continuously
29 changes: 0 additions & 29 deletions diff_match_patch/README.txt

This file was deleted.

84 changes: 0 additions & 84 deletions diff_match_patch/demo_diff.html

This file was deleted.

87 changes: 0 additions & 87 deletions diff_match_patch/demo_match.html

This file was deleted.

0 comments on commit 26e4fc7

Please sign in to comment.