-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild
executable file
·99 lines (82 loc) · 2.14 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#! /usr/bin/ruby
require 'rubygems'
require 'jabs'
require 'sass'
require 'sass/plugin'
require 'haml'
require 'continuous_builder'
require 'pathname'
require 'ruby2ruby'
$-w = nil
$-v = nil
class Pathname
alias / +
alias old_initialize initialize
def initialize path
old_initialize(path.to_s)
end
end
$dir = Pathname.new(__FILE__).dirname
class GistLiveContinuousBuilder < ContinuousBuilder
watches :jabs,
:files => "./src/**/*.js.jabs",
:module => Jabs,
:update => :repack
watches :haml,
:files => "./src/**/*.html.haml",
:module => Haml,
:update => :repack
watches :public_haml,
:files => "./public/**/*.html.haml",
:module => Haml
watches :public_sass,
:files => "./public/**/*.css.sass",
:module => Sass
watches :edit_area_source,
:files => "./public/edit_area/*.js",
:update => :repack
watches :legs,
:files => "./public/legs.js",
:update => :repack
def pack
pack = []
pack << ($dir/'vendor'/'jquery-1.2.6.min.js').read
pack << ($dir/'vendor'/'json2.js').read
pack
end
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
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(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