distil 0.10.4 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/assets/distil.js +359 -0
- data/bin/distil +33 -10
- data/distil.gemspec +35 -24
- data/lib/distil/configurable/file-set.rb +86 -0
- data/lib/distil/configurable/interpolated.rb +36 -0
- data/lib/distil/configurable/output-path.rb +25 -0
- data/lib/distil/configurable/project-path.rb +25 -0
- data/lib/distil/configurable.rb +164 -0
- data/lib/distil/error-reporter.rb +63 -0
- data/lib/distil/product/concatenated.rb +85 -0
- data/lib/distil/product/css-product.rb +37 -0
- data/lib/distil/product/debug.rb +34 -0
- data/lib/distil/product/javascript-base-product.rb +35 -0
- data/lib/distil/product/javascript-doc-product.rb +61 -0
- data/lib/distil/product/javascript-product.rb +131 -0
- data/lib/distil/product/minified.rb +32 -0
- data/lib/distil/product.rb +97 -0
- data/lib/distil/project/distil-project.rb +99 -0
- data/lib/distil/project/external-project.rb +53 -0
- data/lib/distil/project.rb +78 -0
- data/lib/distil/source-file/css-file.rb +14 -0
- data/lib/distil/source-file/html-file.rb +14 -0
- data/lib/distil/source-file/javascript-file.rb +17 -0
- data/lib/distil/source-file/json-file.rb +16 -0
- data/lib/distil/source-file.rb +172 -0
- data/lib/distil/target.rb +235 -0
- data/lib/distil/task/css-dependency-task.rb +64 -0
- data/lib/distil/task/jsl-dependency-task.rb +49 -0
- data/lib/distil/task/nib-task.rb +72 -0
- data/lib/distil/task/validate-js-task.rb +75 -0
- data/lib/distil/task.rb +50 -0
- data/lib/distil.rb +72 -0
- data/lib/jsl.conf +4 -0
- data/vendor/jsl-0.3.0/src/Makefile.ref +16 -6
- data/vendor/jsl-0.3.0/src/config.mk +32 -2
- data/vendor/jsl-0.3.0/src/fdlibm/Makefile.ref +1 -2
- data/vendor/jsl-0.3.0/src/jsl.c +124 -13
- data/vendor/jsl-0.3.0/src/rules.mk +2 -1
- metadata +49 -28
- data/lib/bootstrap-template.js +0 -58
- data/lib/configurable.rb +0 -161
- data/lib/file-set.rb +0 -49
- data/lib/file-types/css-file.rb +0 -12
- data/lib/file-types/html-file.rb +0 -11
- data/lib/file-types/javascript-file.rb +0 -24
- data/lib/file-types/json-file.rb +0 -17
- data/lib/filter.rb +0 -41
- data/lib/filters/css-filter.rb +0 -58
- data/lib/filters/file-reference-filter.rb +0 -30
- data/lib/filters/jsl-dependency-filter.rb +0 -44
- data/lib/project.rb +0 -174
- data/lib/source-file.rb +0 -197
- data/lib/target.rb +0 -102
- data/lib/task.rb +0 -212
- data/lib/tasks/copy-task.rb +0 -17
- data/lib/tasks/css-task.rb +0 -12
- data/lib/tasks/javascript-task.rb +0 -206
- data/lib/tasks/multiple-output-task.rb +0 -140
- data/lib/tasks/output-task.rb +0 -76
- data/lib/tasks/single-output-task.rb +0 -104
- data/lib/tasks/test-task.rb +0 -280
@@ -84,6 +84,11 @@ endif
|
|
84
84
|
ifeq ($(OS_ARCH), CYGWIN32_NT)
|
85
85
|
OS_ARCH := WINNT
|
86
86
|
endif
|
87
|
+
ifeq (MINGW32_NT,$(findstring MINGW32_NT,$(OS_ARCH)))
|
88
|
+
OS_RELEASE := $(patsubst MINGW32_NT-%,%,$(OS_ARCH))
|
89
|
+
OS_ARCH_ENVIRONMENT := MINGW32_NT
|
90
|
+
OS_ARCH := WINNT
|
91
|
+
endif
|
87
92
|
|
88
93
|
# Virtually all Linux versions are identical.
|
89
94
|
# Any distinctions are handled in linux.h
|
@@ -96,10 +101,14 @@ else
|
|
96
101
|
ifeq ($(OS_ARCH),Darwin)
|
97
102
|
OS_CONFIG := Darwin
|
98
103
|
else
|
104
|
+
ifeq ($(OS_ARCH_ENVIRONMENT),MINGW32_NT)
|
105
|
+
OS_CONFIG := MinGW$(OS_RELEASE)
|
106
|
+
else
|
99
107
|
OS_CONFIG := $(OS_ARCH)$(OS_OBJTYPE)$(OS_RELEASE)
|
100
108
|
endif
|
101
109
|
endif
|
102
110
|
endif
|
111
|
+
endif
|
103
112
|
|
104
113
|
ASFLAGS =
|
105
114
|
DEFINES =
|
@@ -114,7 +123,7 @@ endif
|
|
114
123
|
|
115
124
|
ifdef BUILD_OPT
|
116
125
|
OPTIMIZER = -O
|
117
|
-
DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(
|
126
|
+
DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(USER)
|
118
127
|
OBJDIR_TAG = _OPT
|
119
128
|
else
|
120
129
|
ifdef USE_MSVC
|
@@ -122,11 +131,16 @@ OPTIMIZER = -Zi
|
|
122
131
|
else
|
123
132
|
OPTIMIZER = -g
|
124
133
|
endif
|
125
|
-
DEFINES += -DDEBUG -DDEBUG_$(
|
134
|
+
DEFINES += -DDEBUG -DDEBUG_$(USER)
|
126
135
|
OBJDIR_TAG = _DBG
|
127
136
|
endif
|
128
137
|
|
138
|
+
ifeq ($(OS_ARCH), WINNT)
|
139
|
+
SO_SUFFIX = dll
|
140
|
+
EXE_DOTSUFFIX = .exe
|
141
|
+
else
|
129
142
|
SO_SUFFIX = so
|
143
|
+
endif
|
130
144
|
|
131
145
|
NS_USE_NATIVE = 1
|
132
146
|
|
@@ -145,6 +159,22 @@ CLASSPATH = $(JDK)/lib/classes.zip$(SEP)$(CLASSDIR)/$(OBJDIR)
|
|
145
159
|
|
146
160
|
include $(DEPTH)/config/$(OS_CONFIG).mk
|
147
161
|
|
162
|
+
ifndef OBJ_SUFFIX
|
163
|
+
ifdef USE_MSVC
|
164
|
+
OBJ_SUFFIX = obj
|
165
|
+
else
|
166
|
+
OBJ_SUFFIX = o
|
167
|
+
endif
|
168
|
+
endif
|
169
|
+
|
170
|
+
ifndef HOST_BIN_SUFFIX
|
171
|
+
ifeq ($(OS_ARCH),WINNT)
|
172
|
+
HOST_BIN_SUFFIX = .exe
|
173
|
+
else
|
174
|
+
HOST_BIN_SUFFIX =
|
175
|
+
endif
|
176
|
+
endif
|
177
|
+
|
148
178
|
# Name of the binary code directories
|
149
179
|
ifdef BUILD_IDG
|
150
180
|
OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG).OBJD
|
@@ -91,8 +91,7 @@ include $(DEPTH)/config.mk
|
|
91
91
|
#
|
92
92
|
# Default IEEE libm
|
93
93
|
#
|
94
|
-
CFLAGS +=
|
95
|
-
-DJSFILE $(XCFLAGS) -D_IEEE_LIBM
|
94
|
+
CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) -DJSFILE $(XCFLAGS) -D_IEEE_LIBM
|
96
95
|
|
97
96
|
# Need for jstypes.h and friends
|
98
97
|
INCLUDES += -I..
|
data/vendor/jsl-0.3.0/src/jsl.c
CHANGED
@@ -63,11 +63,13 @@
|
|
63
63
|
#include "jsscript.h"
|
64
64
|
#include "jsstr.h"
|
65
65
|
|
66
|
-
#
|
66
|
+
#if defined(XP_UNIX) || defined(_MINGW)
|
67
67
|
#include <unistd.h>
|
68
68
|
#include <sys/types.h>
|
69
69
|
#include <dirent.h>
|
70
|
+
#ifndef _MINGW
|
70
71
|
#include <sys/wait.h>
|
72
|
+
#endif
|
71
73
|
#include <sys/stat.h>
|
72
74
|
#endif
|
73
75
|
|
@@ -180,6 +182,12 @@ typedef struct JSLPathList {
|
|
180
182
|
char path[MAXPATHLEN+1];
|
181
183
|
} JSLPathList;
|
182
184
|
|
185
|
+
typedef struct JSLAliasList {
|
186
|
+
JSCList links;
|
187
|
+
char path[MAXPATHLEN+1];
|
188
|
+
char alias[MAXPATHLEN+1];
|
189
|
+
} JSLAliasList;
|
190
|
+
|
183
191
|
typedef struct JSLScriptList {
|
184
192
|
JSCList links;
|
185
193
|
|
@@ -189,6 +197,7 @@ typedef struct JSLScriptList {
|
|
189
197
|
} JSLScriptList;
|
190
198
|
|
191
199
|
JSLScriptList gScriptList;
|
200
|
+
JSLAliasList gScriptAliasList;
|
192
201
|
JSLPathList gIncludePathList;
|
193
202
|
|
194
203
|
|
@@ -305,8 +314,9 @@ IsDir(char *filename)
|
|
305
314
|
|
306
315
|
|
307
316
|
|
308
|
-
#
|
317
|
+
#if defined(WIN32)
|
309
318
|
|
319
|
+
#ifndef _MINGW
|
310
320
|
struct dirent {
|
311
321
|
char d_name[MAXPATHLEN];
|
312
322
|
};
|
@@ -371,6 +381,7 @@ closedir(DIR *dir)
|
|
371
381
|
}
|
372
382
|
return 0;
|
373
383
|
}
|
384
|
+
#endif
|
374
385
|
|
375
386
|
/* caller should allocate MAXPATHLEN; does not set errno; returns null on failure */
|
376
387
|
static char *
|
@@ -603,6 +614,36 @@ OutputErrorMessage(const char *path, int lineno, int colno, const char *errName,
|
|
603
614
|
}
|
604
615
|
}
|
605
616
|
|
617
|
+
static JSLAliasList*
|
618
|
+
AllocAliasListItem(const char *alias, const char *path)
|
619
|
+
{
|
620
|
+
JSLAliasList *aliasItem= malloc(sizeof(JSLAliasList));
|
621
|
+
memset(aliasItem, 0, sizeof(JSLAliasList));
|
622
|
+
|
623
|
+
JS_INIT_CLIST(&aliasItem->links);
|
624
|
+
strncpy(aliasItem->path, path, MAXPATHLEN);
|
625
|
+
strncpy(aliasItem->alias, alias, MAXPATHLEN);
|
626
|
+
|
627
|
+
return aliasItem;
|
628
|
+
}
|
629
|
+
|
630
|
+
static void
|
631
|
+
AddAliasToList(JSLAliasList *aliasList, const char *alias, const char *path)
|
632
|
+
{
|
633
|
+
JSLAliasList *aliasItem= AllocAliasListItem(alias, path);
|
634
|
+
JS_APPEND_LINK(&aliasItem->links, &aliasList->links);
|
635
|
+
}
|
636
|
+
|
637
|
+
static void
|
638
|
+
FreeAliasList(JSContext *cx, JSLAliasList *aliasList)
|
639
|
+
{
|
640
|
+
while (!JS_CLIST_IS_EMPTY(&aliasList->links)) {
|
641
|
+
JSLAliasList *item = (JSLAliasList*)JS_LIST_HEAD(&aliasList->links);
|
642
|
+
JS_REMOVE_LINK(&item->links);
|
643
|
+
JS_free(cx, item);
|
644
|
+
}
|
645
|
+
}
|
646
|
+
|
606
647
|
static JSLPathList*
|
607
648
|
AllocPathListItem(const char *path)
|
608
649
|
{
|
@@ -804,6 +845,7 @@ ResolveScriptPath(const char *relpath, char *path, JSLScriptList *parentScript)
|
|
804
845
|
JSBool result;
|
805
846
|
struct stat _stat;
|
806
847
|
JSLPathList *inc;
|
848
|
+
JSLAliasList *alias;
|
807
849
|
|
808
850
|
char workingDir[MAXPATHLEN+1];
|
809
851
|
workingDir[0] = 0;
|
@@ -832,6 +874,22 @@ ResolveScriptPath(const char *relpath, char *path, JSLScriptList *parentScript)
|
|
832
874
|
if (result && -1!=stat(path, &_stat))
|
833
875
|
return JS_TRUE;
|
834
876
|
|
877
|
+
// Check for an alias match. Aliased files still must exist or the search
|
878
|
+
// will continue.
|
879
|
+
for (alias= (JSLAliasList*)JS_LIST_HEAD(&gScriptAliasList.links);
|
880
|
+
alias!=&gScriptAliasList;
|
881
|
+
alias= (JSLAliasList*)JS_NEXT_LINK(&alias->links))
|
882
|
+
{
|
883
|
+
if (0==strcmp(relpath, alias->alias))
|
884
|
+
{
|
885
|
+
if (-1==stat(alias->path, &_stat))
|
886
|
+
continue;
|
887
|
+
strcpy(path, alias->path);
|
888
|
+
return JS_TRUE;
|
889
|
+
}
|
890
|
+
}
|
891
|
+
|
892
|
+
// Nothing matches, so look in include folders...
|
835
893
|
for (inc= (JSLPathList*)JS_LIST_HEAD(&gIncludePathList.links);
|
836
894
|
inc!=&gIncludePathList;
|
837
895
|
inc= (JSLPathList*)JS_NEXT_LINK(&inc->links))
|
@@ -1800,20 +1858,72 @@ ProcessSettingErr_Garbage:
|
|
1800
1858
|
*linepos = 0;
|
1801
1859
|
|
1802
1860
|
AddPathToList(&gIncludePathList, path);
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
return LintConfError(cx, path, lineno, "invalid include setting: missing or mismatched quote");
|
1811
|
-
ProcessSettingErr_Garbage:
|
1861
|
+
}
|
1862
|
+
else if (strncasecmp(linepos, "alias", strlen("alias")) == 0) {
|
1863
|
+
char delimiter;
|
1864
|
+
char *path;
|
1865
|
+
char *alias;
|
1866
|
+
|
1867
|
+
if (!enable) {
|
1812
1868
|
fclose(file);
|
1813
|
-
return LintConfError(cx, path, lineno, "
|
1869
|
+
return LintConfError(cx, path, lineno, "-alias is an invalid setting");
|
1814
1870
|
}
|
1815
|
-
|
1871
|
+
|
1872
|
+
linepos += strlen("alias");
|
1873
|
+
|
1874
|
+
/* require (but skip) whitespace */
|
1875
|
+
if (!*linepos || !isspace(*linepos)) goto ProcessSettingErr_MissingPath;
|
1876
|
+
while (*linepos && isspace(*linepos))
|
1877
|
+
linepos++;
|
1878
|
+
if (!*linepos) goto ProcessSettingErr_MissingPath;
|
1879
|
+
|
1880
|
+
/* allow quote */
|
1881
|
+
if (*linepos == '\'') {
|
1882
|
+
delimiter = *linepos;
|
1883
|
+
linepos++;
|
1884
|
+
}
|
1885
|
+
else if (*linepos == '"') {
|
1886
|
+
delimiter = *linepos;
|
1887
|
+
linepos++;
|
1888
|
+
}
|
1889
|
+
else
|
1890
|
+
delimiter = 0;
|
1891
|
+
|
1892
|
+
/* read alias */
|
1893
|
+
if (!*linepos) goto ProcessSettingErr_MissingQuote;
|
1894
|
+
alias = linepos;
|
1895
|
+
while (*linepos)
|
1896
|
+
{
|
1897
|
+
if (delimiter && *linepos==delimiter)
|
1898
|
+
break;
|
1899
|
+
if (!delimiter && isspace(*linepos))
|
1900
|
+
break;
|
1901
|
+
linepos++;
|
1816
1902
|
}
|
1903
|
+
if (delimiter && *linepos!=delimiter) goto ProcessSettingErr_MissingQuote;
|
1904
|
+
if (!delimiter && !isspace(*linepos)) goto ProcessSettingErr_MissingPath;
|
1905
|
+
|
1906
|
+
/* terminate path */
|
1907
|
+
*linepos++= 0;
|
1908
|
+
|
1909
|
+
/* require (but skip) whitespace */
|
1910
|
+
while (*linepos && isspace(*linepos))
|
1911
|
+
linepos++;
|
1912
|
+
if (!*linepos) goto ProcessSettingErr_MissingPath;
|
1913
|
+
|
1914
|
+
/* read path */
|
1915
|
+
if (!*linepos) goto ProcessSettingErr_MissingQuote;
|
1916
|
+
path = linepos;
|
1917
|
+
while (*linepos && *linepos != delimiter)
|
1918
|
+
linepos++;
|
1919
|
+
if (delimiter && !*linepos) goto ProcessSettingErr_MissingQuote;
|
1920
|
+
|
1921
|
+
/* yank ending quote */
|
1922
|
+
if (linepos[0] && linepos[1]) goto ProcessSettingErr_Garbage;
|
1923
|
+
*linepos = 0;
|
1924
|
+
|
1925
|
+
AddAliasToList(&gScriptAliasList, alias, path);
|
1926
|
+
}
|
1817
1927
|
else if (strncasecmp(linepos, "output-format", strlen("output-format")) == 0) {
|
1818
1928
|
linepos += strlen("output-format");
|
1819
1929
|
|
@@ -2304,6 +2414,7 @@ main(int argc, char **argv, char **envp)
|
|
2304
2414
|
argv++;
|
2305
2415
|
|
2306
2416
|
JS_INIT_CLIST(&gScriptList.links);
|
2417
|
+
JS_INIT_CLIST(&gScriptAliasList.links);
|
2307
2418
|
JS_INIT_CLIST(&gIncludePathList.links);
|
2308
2419
|
JS_ASSERT(sizeof(placeholders) / sizeof(placeholders[0]) == JSLPlaceholder_Limit);
|
2309
2420
|
|
@@ -58,7 +58,8 @@ ifdef USE_MSVC
|
|
58
58
|
# TARGETS = $(LIBRARY) # $(PROGRAM) not supported for MSVC yet
|
59
59
|
TARGETS += $(SHARED_LIBRARY) $(PROGRAM) # it is now
|
60
60
|
else
|
61
|
-
TARGETS += $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM)
|
61
|
+
# TARGETS += $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM)
|
62
|
+
TARGETS += $(LIBRARY) $(PROGRAM)
|
62
63
|
endif
|
63
64
|
|
64
65
|
all:
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 11
|
8
|
+
- 0
|
9
|
+
version: 0.11.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeff Watkins
|
@@ -14,10 +14,23 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-06 00:00:00 -07:00
|
18
18
|
default_executable: distil
|
19
|
-
dependencies:
|
20
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: json
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 4
|
30
|
+
- 3
|
31
|
+
version: 1.4.3
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
21
34
|
description: A build tool for Javascript and CSS that takes advantage of best-of-breed helper applications Javascript Lint and JSDoc Toolkit
|
22
35
|
email:
|
23
36
|
executables:
|
@@ -29,32 +42,40 @@ extra_rdoc_files: []
|
|
29
42
|
files:
|
30
43
|
- Rakefile
|
31
44
|
- VERSION
|
45
|
+
- assets/distil.js
|
32
46
|
- bin/distil
|
33
47
|
- distil.gemspec
|
34
|
-
- lib/
|
35
|
-
- lib/configurable.rb
|
36
|
-
- lib/file-set.rb
|
37
|
-
- lib/
|
38
|
-
- lib/
|
39
|
-
- lib/
|
40
|
-
- lib/
|
41
|
-
- lib/
|
42
|
-
- lib/
|
43
|
-
- lib/
|
44
|
-
- lib/
|
48
|
+
- lib/distil.rb
|
49
|
+
- lib/distil/configurable.rb
|
50
|
+
- lib/distil/configurable/file-set.rb
|
51
|
+
- lib/distil/configurable/interpolated.rb
|
52
|
+
- lib/distil/configurable/output-path.rb
|
53
|
+
- lib/distil/configurable/project-path.rb
|
54
|
+
- lib/distil/error-reporter.rb
|
55
|
+
- lib/distil/product.rb
|
56
|
+
- lib/distil/product/concatenated.rb
|
57
|
+
- lib/distil/product/css-product.rb
|
58
|
+
- lib/distil/product/debug.rb
|
59
|
+
- lib/distil/product/javascript-base-product.rb
|
60
|
+
- lib/distil/product/javascript-doc-product.rb
|
61
|
+
- lib/distil/product/javascript-product.rb
|
62
|
+
- lib/distil/product/minified.rb
|
63
|
+
- lib/distil/project.rb
|
64
|
+
- lib/distil/project/distil-project.rb
|
65
|
+
- lib/distil/project/external-project.rb
|
66
|
+
- lib/distil/source-file.rb
|
67
|
+
- lib/distil/source-file/css-file.rb
|
68
|
+
- lib/distil/source-file/html-file.rb
|
69
|
+
- lib/distil/source-file/javascript-file.rb
|
70
|
+
- lib/distil/source-file/json-file.rb
|
71
|
+
- lib/distil/target.rb
|
72
|
+
- lib/distil/task.rb
|
73
|
+
- lib/distil/task/css-dependency-task.rb
|
74
|
+
- lib/distil/task/jsl-dependency-task.rb
|
75
|
+
- lib/distil/task/nib-task.rb
|
76
|
+
- lib/distil/task/validate-js-task.rb
|
45
77
|
- lib/jsdoc.conf
|
46
78
|
- lib/jsl.conf
|
47
|
-
- lib/project.rb
|
48
|
-
- lib/source-file.rb
|
49
|
-
- lib/target.rb
|
50
|
-
- lib/task.rb
|
51
|
-
- lib/tasks/copy-task.rb
|
52
|
-
- lib/tasks/css-task.rb
|
53
|
-
- lib/tasks/javascript-task.rb
|
54
|
-
- lib/tasks/multiple-output-task.rb
|
55
|
-
- lib/tasks/output-task.rb
|
56
|
-
- lib/tasks/single-output-task.rb
|
57
|
-
- lib/tasks/test-task.rb
|
58
79
|
- lib/test/HtmlTestReporter.js
|
59
80
|
- lib/test/Test.js
|
60
81
|
- lib/test/TestReporter.js
|
data/lib/bootstrap-template.js
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
/*jsl:ignore*/ /**#nocode+*/
|
2
|
-
(function() {
|
3
|
-
var baseUrl= findScriptBaseName();
|
4
|
-
|
5
|
-
function findScriptBaseName()
|
6
|
-
{
|
7
|
-
var scripts= document.getElementsByTagName("script");
|
8
|
-
if (!scripts || !scripts.length)
|
9
|
-
throw new Error("Could not find script");
|
10
|
-
|
11
|
-
var l= scripts.length;
|
12
|
-
var s;
|
13
|
-
|
14
|
-
for (--l; l>=0; --l)
|
15
|
-
{
|
16
|
-
s= scripts[l];
|
17
|
-
if (s.src)
|
18
|
-
{
|
19
|
-
var src= s.src;
|
20
|
-
var lastSlash= src.lastIndexOf('/');
|
21
|
-
|
22
|
-
if (-1===lastSlash)
|
23
|
-
throw new Error("Couldn't determine path from src: " + src);
|
24
|
-
|
25
|
-
return src.substring(0, lastSlash+1);
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
throw new Error("No script tags with src attribute.");
|
30
|
-
}
|
31
|
-
|
32
|
-
window.__bootstrap_nextScript= function()
|
33
|
-
{
|
34
|
-
if (!scripts.length)
|
35
|
-
window.__filename__= null;
|
36
|
-
else
|
37
|
-
window.__filename__= scripts.shift();
|
38
|
-
}
|
39
|
-
|
40
|
-
var scripts= [];
|
41
|
-
|
42
|
-
function loadScript(script)
|
43
|
-
{
|
44
|
-
script= baseUrl + script;
|
45
|
-
scripts.push(script);
|
46
|
-
|
47
|
-
if (!window.__filename__)
|
48
|
-
window.__bootstrap_nextScript();
|
49
|
-
|
50
|
-
document.write( ['<', 'script type="text/javascript"',
|
51
|
-
' onload="window.__bootstrap_nextScript()"',
|
52
|
-
' src="', script, '"></script>'].join("") );
|
53
|
-
}
|
54
|
-
|
55
|
-
@LOAD_SCRIPTS@
|
56
|
-
|
57
|
-
})();
|
58
|
-
/**#nocode-*/ /*jsl:end*/
|
data/lib/configurable.rb
DELETED
@@ -1,161 +0,0 @@
|
|
1
|
-
module Kernel
|
2
|
-
|
3
|
-
def Boolean(string)
|
4
|
-
return true if string == true || string =~ /^true$/i
|
5
|
-
return false if string == false || string.nil? || string =~ /^false$/i
|
6
|
-
raise ArgumentError.new("invalid value for Boolean: \"#{string}\"")
|
7
|
-
end
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
class Configurable
|
14
|
-
attr_reader :options
|
15
|
-
|
16
|
-
@@options= {}
|
17
|
-
|
18
|
-
def get_options(settings=nil, parent=nil)
|
19
|
-
keys= @@options.keys
|
20
|
-
values= @@options.map { |k,v| v[:value] }
|
21
|
-
|
22
|
-
s= Struct.new(*keys).new(*values)
|
23
|
-
return s if !settings
|
24
|
-
|
25
|
-
setting_keys= settings.keys.map { |key| key.to_s }
|
26
|
-
|
27
|
-
@@options.each { |key, value|
|
28
|
-
|
29
|
-
intersect= value[:aliases] & setting_keys
|
30
|
-
next if !parent && intersect.empty?
|
31
|
-
|
32
|
-
if (intersect.empty?)
|
33
|
-
s[key]= parent[key]
|
34
|
-
next
|
35
|
-
end
|
36
|
-
|
37
|
-
if (intersect.length>1)
|
38
|
-
raise ArgumentError, "Multiple variants for #{key.to_s} defined: #{intersect.join(", ")}"
|
39
|
-
end
|
40
|
-
|
41
|
-
setting_key= intersect[0]
|
42
|
-
setting_value= settings[setting_key]
|
43
|
-
settings.delete(setting_key)
|
44
|
-
|
45
|
-
# decide if any type conversions are needed...
|
46
|
-
type= value[:type]
|
47
|
-
setting_value= case
|
48
|
-
when FalseClass==type || TrueClass==type
|
49
|
-
Boolean(setting_value)
|
50
|
-
when Array==type
|
51
|
-
setting_value.is_a?(String) ? setting_value.split(/\s*,\s*/) : setting_value
|
52
|
-
when Fixnum==type
|
53
|
-
setting_value.to_i
|
54
|
-
when NilClass==type
|
55
|
-
setting_value
|
56
|
-
when String==type
|
57
|
-
setting_value.to_s
|
58
|
-
else
|
59
|
-
type.new(setting_value)
|
60
|
-
end
|
61
|
-
|
62
|
-
s[key]= setting_value
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
s
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.class_attr(name)
|
70
|
-
if (@class_attributes.nil?)
|
71
|
-
@class_attributes=[name]
|
72
|
-
else
|
73
|
-
@class_attributes<<name
|
74
|
-
end
|
75
|
-
|
76
|
-
class_eval %(
|
77
|
-
def self.#{name}(*rest)
|
78
|
-
if (rest.length>0)
|
79
|
-
@#{name}= rest[0]
|
80
|
-
else
|
81
|
-
@#{name}
|
82
|
-
end
|
83
|
-
end
|
84
|
-
def self.#{name}=(value)
|
85
|
-
@#{name}= value
|
86
|
-
end
|
87
|
-
def #{name}
|
88
|
-
@#{name} || self.class.#{name}
|
89
|
-
end
|
90
|
-
def #{name}=(value)
|
91
|
-
@#{name}=value
|
92
|
-
end
|
93
|
-
)
|
94
|
-
|
95
|
-
end
|
96
|
-
|
97
|
-
def self.inherited(subclass)
|
98
|
-
super(subclass)
|
99
|
-
(@class_attributes||[]).each { |a|
|
100
|
-
instance_var = "@#{a}"
|
101
|
-
subclass.instance_variable_set(instance_var, instance_variable_get(instance_var))
|
102
|
-
}
|
103
|
-
end
|
104
|
-
|
105
|
-
# option name, [type], [default], [options]
|
106
|
-
def self.option(name, *rest)
|
107
|
-
|
108
|
-
name_string= name.to_s
|
109
|
-
|
110
|
-
info= {
|
111
|
-
:aliases=>[name_string, name_string.gsub('_', '-'), name_string.gsub('_', ' ')].uniq
|
112
|
-
}
|
113
|
-
|
114
|
-
arg= rest.shift
|
115
|
-
|
116
|
-
if (arg.is_a?(Class))
|
117
|
-
info[:type]= arg
|
118
|
-
info[:value]= nil #arg.new
|
119
|
-
arg= rest.shift
|
120
|
-
end
|
121
|
-
|
122
|
-
if (!arg.is_a?(Hash))
|
123
|
-
info[:value]= arg
|
124
|
-
info[:type]= arg.class if !info.key?(:type)
|
125
|
-
arg= rest.shift
|
126
|
-
end
|
127
|
-
|
128
|
-
# handle named arguments
|
129
|
-
if (arg.is_a?(Hash))
|
130
|
-
info.merge!(arg)
|
131
|
-
end
|
132
|
-
|
133
|
-
@@options[name]= info
|
134
|
-
|
135
|
-
Configurable.send :define_method, name do
|
136
|
-
@options[name]
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
def self.option_alias(name, name_alias)
|
142
|
-
if (!@@options.key?(name))
|
143
|
-
raise ArgumentError, "No such option: #{name}"
|
144
|
-
end
|
145
|
-
|
146
|
-
name_alias= name_alias.to_s
|
147
|
-
|
148
|
-
@@options[name][:aliases].concat([name_alias,
|
149
|
-
name_alias.to_s.gsub('_', '-'),
|
150
|
-
name_alias.to_s.gsub('_', ' ')].uniq)
|
151
|
-
end
|
152
|
-
|
153
|
-
def initialize(options={}, parent=nil)
|
154
|
-
if (parent.is_a?(Configurable))
|
155
|
-
parent_options= parent.options
|
156
|
-
end
|
157
|
-
@options= get_options(options, parent_options)
|
158
|
-
@extras= options
|
159
|
-
end
|
160
|
-
|
161
|
-
end
|
data/lib/file-set.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require "#{$script_dir}/source-file"
|
2
|
-
|
3
|
-
class FileSet
|
4
|
-
include Enumerable
|
5
|
-
attr_reader :files
|
6
|
-
|
7
|
-
def initialize(set)
|
8
|
-
@files= []
|
9
|
-
case
|
10
|
-
when (set.is_a?(String))
|
11
|
-
include_file(set)
|
12
|
-
when (set.is_a?(Array))
|
13
|
-
set.each { |f| include_file(f) }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def include_file(file)
|
18
|
-
full_path= File.expand_path(file)
|
19
|
-
|
20
|
-
if File.directory?(full_path)
|
21
|
-
Dir.foreach(full_path) { |f|
|
22
|
-
next if ('.'==f[/^\./])
|
23
|
-
include_file(File.join(full_path, f))
|
24
|
-
}
|
25
|
-
return
|
26
|
-
end
|
27
|
-
|
28
|
-
files= Dir.glob(full_path)
|
29
|
-
if (files.length>0)
|
30
|
-
files.each { |f|
|
31
|
-
source_file= SourceFile.from_path(f)
|
32
|
-
next if (@files.include?(source_file))
|
33
|
-
@files << source_file
|
34
|
-
}
|
35
|
-
return
|
36
|
-
end
|
37
|
-
|
38
|
-
# file not found by globbing (would also find explicit reference)
|
39
|
-
source_file= Project.current.find_file(file)
|
40
|
-
return if (!source_file)
|
41
|
-
return if (@files.include?(source_file))
|
42
|
-
@files << source_file
|
43
|
-
end
|
44
|
-
|
45
|
-
def each
|
46
|
-
@files.each { |f| yield f }
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
data/lib/file-types/css-file.rb
DELETED