1// =====================================================================
2// Generate Quark and overview helpfile
3// nescivi, jan 2009
4// =====================================================================
5
6// this is a file to help automate creating Quarks of the plugins.
7
8
9f = File.new( Document.current.dir.dirname +/+"VERSION", "r" );
10~version = f.getLine;
11f.close;
12~version = ~version.asFloat
13
14(
15(Document.current.dir +/+ "build/*").pathMatch.do{ |it|
16var name = PathName( it ).asRelativePath( Document.current.dir.dirname +/+ "build" ).copyFromStart( it.size - 1 );
17	name.postln;
18	f = File.new( (Document.current.dir.dirname +/+ "build/DIRECTORY" +/+ name ++".quark").postln, "w" );
19	f.write( "(\n" );
20	f.write( "\\name:\t\"" ++ name ++ "\",\n");
21	f.write( "\\path:\t\"" ++ name ++ "\",\n");
22	f.write( "\\summary:\t \"sc3-plugins:" ++ name ++ "\",\n");
23	f.write( "\\author:\t \"sc3-plugins\",\n");
24	f.write( "\\helpdoc:\t\"" ++ name ++ ".html\",\n");
25	f.write( "\\url:\t \"http://sc3-plugins.sourceforge.net\",\n");
26	f.write( "\\version:\t" ++ ~version ++ "\n" );
27	f.write( ")\n" );
28	f.close;
29}
30)
31
32
33
34~sc3plugs = Quarks(
35reposPath: "https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build",
36localPath: Platform.userAppSupportDir +/+ "SC3plugins"
37//localPath: "/home/nescivi/svn/sc3-plugins/build"
38);
39
40~sc3plugs.gui;
41
42(
43(Document.current.dir.dirname +/+ "build/*").pathMatch.do{ |it|
44var name = PathName( it ).asRelativePath( Document.current.dir.dirname +/+ "build" ).copyFromStart( it.size - 1 );
45	name.postln;
46//var name = "NCAnalysisUGens";
47q = ~sc3plugs.local.findQuark(name).info;
48
49(
50~header = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> \n
51<html> \n
52  <head> \n
53    <title>"++ q.name ++ "</title> \n
54  </head>\n
55  <body>\n
56  <h1>" ++ q.name ++ "</h1>\n
57  <h2>" ++ q.summary ++ "</h2>\n
58  <h3> by" + q.author ++ "</h3>\n
59";
60);
61
62
63~footer = "</body></html>";
64
65(
66~string = "";
67(~sc3plugs.local.path +/+ q.path +/+ "*.html").pathMatch.collect{ |it|
68PathName( it ).asRelativePath( ~sc3plugs.local.path +/+ q.path  );
69}.do{ |it|
70	~string = ~string + "<A href=\""++it++"\">"++it++"<\A><br>\n";
71};
72(~sc3plugs.local.path +/+ q.path +/+ "help/*.*").pathMatch.collect{ |it|
73PathName( it ).asRelativePath( ~sc3plugs.local.path +/+ q.path  );
74}.do{ |it|
75	~string = ~string + "<A href=\""++it++"\">"++it++"<\A><br>\n";
76};
77(~sc3plugs.local.path +/+ q.path +/+ "Help/*.*").pathMatch.collect{ |it|
78PathName( it ).asRelativePath( ~sc3plugs.local.path +/+ q.path  );
79}.do{ |it|
80	~string = ~string + "<A href=\""++it++"\">"++it++"<\A><br>\n";
81};
82);
83
84
85f = File.new( ~sc3plugs.local.path +/+ q.path +/+ q.name ++".html", "w" );
86f.write( ~header );
87f.write( ~string );
88f.write( ~footer );
89
90f.close;
91
92};
93);
94
95// edit the quark file here to point to the right helpdoc
96(Quarks.local.path +/+ "DIRECTORY" +/+ q.name ++".quark").openDocument;
97
98
99
100
101(
102~header = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> \n
103<html> \n
104  <head> \n
105    <title>"++ q.name ++ "</title> \n
106  </head>\n
107  <body>\n
108  <h1>" ++ q.name ++ "</h1>\n
109  <h2>" ++ q.summary ++ "</h2>\n
110  <h3> by" + q.author ++ "</h3>\n
111";
112);
113
114
115~footer = "</body></html>";
116