Skip to content

Commit de899c0

Browse files
committed
Improved Examples 2 Generate script
1 parent 025bfbe commit de899c0

1 file changed

Lines changed: 11 additions & 97 deletions

File tree

generate/examples.php

Lines changed: 11 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,30 @@
44
require('lib/Example.class.php');
55
$benchmark_start = microtime_float();
66

7-
$local = true;
7+
//$local = true;
88

99
// Redefine location on local machine for examples in processing trunk
10-
if ($local) {
10+
//if ($local) {
1111
//define('BASEDIR', '/Users/REAS/Documents/reas@processing.org/trunk/');
12-
define('EXAMPLESOURCEDIR', '/Users/REAS/Documents/reas@processing.org/trunk/processing/java/examples/');
13-
} else {
14-
define('EXAMPLESOURCEDIR', '/Users/REAS/Documents/reas@processing.org/trunk/processing/java/examples/');
15-
}
12+
//define('EXAMPLESOURCEDIR', '/Users/REAS/Documents/reas@processing.org/trunk/processing/java/examples/');
13+
//} else {
14+
define('EXAMPLESOURCEDIR', '../../processing/java/examples/');
15+
//}
1616
//define('CONTENTDIR', BASEDIR.'processing/java/');
1717
//define('EXAMPLESDIR', BASEDIR.'learning/');
1818

19-
20-
// Update the files on the server via SVN
21-
22-
// look for the .subversion folder somewhere else
23-
// otherwise will go looking for /home/root/.subversion or some other user
2419
$where = CONTENTDIR . 'examples';
2520
$there = CONTENTDIR;
2621
putenv('HOME=' . CONTENTDIR);
2722

2823
// do the initial checkout
2924
//`cd /var/www/processing && /usr/local/bin/svn co svn://processing.org/trunk/web/content/`;
3025

31-
if (!$local) {
32-
`cd $there && /usr/local/bin/svn update examples_basics.xml`;
33-
`cd $there && /usr/local/bin/svn update examples_topics.xml`;
34-
`cd $where && /usr/local/bin/svn update`;
35-
}
26+
//if (!$local) {
27+
`cd $there && /usr/local/bin/svn update examples_basics.xml`;
28+
`cd $there && /usr/local/bin/svn update examples_topics.xml`;
29+
`cd $where && /usr/local/bin/svn update`;
30+
//}
3631

3732

3833
# --------------------------------- Basics
@@ -67,7 +62,6 @@
6762
$html = "<div class=\"ref-col\">\n";
6863
foreach ($categories as $cat => $array) {
6964

70-
#$html .= "<h3><img src=\"images/".strtolower(removesymbols($cat)).".gif\" alt=\"$cat\" /></h3>\n<p>";
7165
$html .= "<p><br /><b>$cat</b><br /><br />";
7266
foreach ($array as $file => $name) {
7367
$thisfile = strtolower($file);
@@ -85,16 +79,6 @@
8579
$page->content($html);
8680
writeFile('learning/'.strtolower($subdir).'/index.html', $page->out());
8781

88-
// Copy over a shared core.jar
89-
//if (!copy(CONTENTDIR . 'examples/core.jar',
90-
// EXAMPLESDIR.strtolower($subdir).'/media/core.jar')) {
91-
// echo 'Could not copy core.jar to ' . $subdir . '.';
92-
//}
93-
//if (!copy(CONTENTDIR . 'examples/loading.gif',
94-
// EXAMPLESDIR.strtolower($subdir).'/media/loading.gif')) {
95-
// echo 'Could not copy loading.gif to ' . $subdir . '.';
96-
//}
97-
9882

9983
# --------------------------------- Topics
10084

@@ -126,8 +110,6 @@
126110

127111
$html = "<div class=\"ref-col\">\n";
128112
foreach ($categories as $cat => $array) {
129-
130-
#$html .= "<h3><img src=\"images/".strtolower(removesymbols($cat)).".gif\" alt=\"$cat\" /></h3>\n<p>";
131113
$html .= "<p><br /><b>$cat</b><br /><br />";
132114
foreach ($array as $file => $name) {
133115
$thisfile = strtolower($file);
@@ -145,74 +127,6 @@
145127
$page->content($html);
146128
writeFile('learning/'.strtolower($subdir).'/index.html', $page->out());
147129

148-
/**
149-
if (!copy(CONTENTDIR . 'examples/core.jar',
150-
EXAMPLESDIR.strtolower($subdir).'/media/core.jar')) {
151-
echo 'Could not copy core.jar to ' . $subdir . '.';
152-
}
153-
if (!copy(CONTENTDIR . 'examples/loading.gif',
154-
EXAMPLESDIR.strtolower($subdir).'/media/loading.gif')) {
155-
echo 'Could not copy loading.gif to ' . $subdir . '.';
156-
}
157-
*/
158-
159-
/**
160-
# --------------------------------- 3D
161-
162-
163-
$categories = get_examples_list('examples_3D.xml');
164-
$break_after = array('Transform', 'Lights');
165-
$subdir = '3D';
166-
$dir = CONTENTDIR.'examples/'.$subdir.'/';
167-
168-
$count = 0;
169-
foreach ($categories as $cat => $array) {
170-
if ($dp = opendir($dir.$cat)) {
171-
while ($fp = readdir($dp)) {
172-
if (substr($fp, 0, 1) != '.') {
173-
$ex = new Example($fp, $subdir."/".$cat, $subdir);
174-
//$ex = new Example($fp, $cat);
175-
$ex->output_file($categories);
176-
$count++;
177-
}
178-
}
179-
}
180-
}
181-
182-
$page = new Page('3D', '3D');
183-
$page->subtemplate('template.examples-3d.html');
184-
185-
$html = "<div class=\"ref-col\">\n";
186-
foreach ($categories as $cat => $array) {
187-
188-
#$html .= "<h3><img src=\"images/".strtolower(removesymbols($cat)).".gif\" alt=\"$cat\" /></h3>\n<p>";
189-
$html .= "<p><br /><b>$cat</b><br /><br />";
190-
foreach ($array as $file => $name) {
191-
$thisfile = strtolower($file);
192-
$html .= "\t<a href=\"$thisfile\">$name</a><br />\n";
193-
}
194-
#echo '</p>';
195-
$html .= '</p>';
196-
197-
if (in_array($cat, $break_after)) {
198-
$html .= "</div><div class=\"ref-col\">";
199-
}
200-
}
201-
$html .= "</div>";
202-
203-
$page->content($html);
204-
writeFile('learning/'.strtolower($subdir).'/index.html', $page->out());
205-
if (!copy(CONTENTDIR . 'examples/core.jar',
206-
EXAMPLESDIR.strtolower($subdir).'/media/core.jar')) {
207-
echo 'Could not copy core.jar to ' . $subdir . '.';
208-
}
209-
if (!copy(CONTENTDIR . 'examples/loading.gif',
210-
EXAMPLESDIR.strtolower($subdir).'/media/loading.gif')) {
211-
echo 'Could not copy loading.gif to ' . $subdir . '.';
212-
}
213-
214-
*/
215-
216130

217131
$benchmark_end = microtime_float();
218132
$execution_time = round($benchmark_end - $benchmark_start, 4);

0 commit comments

Comments
 (0)