Skip to content

Commit 9cdb2cf

Browse files
committed
Merge pull request #35 from mrjoelkemp/no-cache
Fixes
2 parents 26b8b43 + eb116b2 commit 9cdb2cf

26 files changed

+104
-148
lines changed

.jshintrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"mocha" : true,
99
"globals" : {
1010
"window": false,
11-
"document": false
11+
"document": false,
12+
"$": false,
13+
"moment": false
1214
}
1315
}

Gruntfile.js

+73-107
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,85 @@
11
module.exports = function (grunt) {
2-
var path = require('path'),
3-
fs = require('fs');
2+
var path = require('path'),
3+
fs = require('fs');
44

5-
require('load-grunt-tasks')(grunt);
5+
require('load-grunt-tasks')(grunt);
66

7-
grunt.initConfig({
8-
"sass": {
9-
"dist": {
10-
"files": [
11-
{
12-
"expand": true,
13-
"src": [
14-
"**/*.{scss, sass}",
15-
"!node_modules/**/*.{scss, sass}"
16-
],
17-
"ext": ".css"
18-
}
19-
]
20-
}
7+
grunt.initConfig({
8+
cacheBust: {
9+
options: {
10+
deleteOriginals: true
2111
},
22-
"browserify": {
23-
"dist": {
24-
"files": {
25-
"dist/phpepl.js": ["src/phpepl.js"]
12+
assets: {
13+
files: [{
14+
src: ['index.html']
15+
}]
16+
}
17+
},
18+
sass: {
19+
dist: {
20+
files: [
21+
{
22+
expand: true,
23+
src: [
24+
"**/*.{scss, sass}",
25+
"!node_modules/**/*.{scss, sass}"
26+
],
27+
ext: ".css"
2628
}
27-
}
29+
]
30+
}
31+
},
32+
browserify: {
33+
options: {
34+
exclude: [
35+
'js/vendor/jquery-2.1.3.min.js',
36+
'js/vendor/moment.min.js'
37+
]
2838
},
29-
"uglify": {
30-
"options": {
31-
"sourceMap": true,
32-
"sourceMapIncludeSources": true
33-
},
34-
"dist": {
35-
"files": {
36-
"dist/phpepl.js": ['dist/phpepl.js']
37-
}
39+
dist: {
40+
files: {
41+
"dist/phpepl.js": ["js/phpepl.js"]
3842
}
43+
}
44+
},
45+
uglify: {
46+
options: {
47+
sourceMap: true,
48+
sourceMapIncludeSources: true
3949
},
40-
"watch": {
41-
"sass": {
42-
"files": [
43-
"**/*.scss",
44-
"!node_modules/**/*.scss",
45-
"!.git/**/*.scss",
46-
"!.sass-cache/**/*.scss",
47-
"!bower_components/**/*.scss",
48-
"!vendor/**/*.scss"
49-
],
50-
"tasks": [
51-
"newer:sass"
52-
]
53-
},
54-
"js": {
55-
"files": [
56-
"src/**/*.js"
57-
],
58-
"tasks": [
59-
"browserify",
60-
"uglify"
61-
]
62-
},
63-
"all": {
64-
"files": [
65-
"**/*",
66-
"!node_modules/**/*",
67-
"!.git/**/*",
68-
"!.sass-cache/**/*",
69-
"!bower_components/**/*",
70-
"!vendor/**/*"
71-
],
72-
"tasks": [
73-
"noop"
74-
],
75-
"options": {
76-
"cwd": "./",
77-
"spawn": false,
78-
"event": [
79-
"added"
80-
]
81-
}
50+
dist: {
51+
files: {
52+
"dist/phpepl.js": ['dist/phpepl.js']
8253
}
8354
}
84-
});
85-
86-
grunt.registerTask('default', ['watch']);
87-
88-
// Handle new files with that have a new, supported preprocessor
89-
grunt.event.on('watch', function(action, filepath) {
90-
var ext = path.extname(filepath);
91-
92-
// Ignore directories
93-
if (fs.lstatSync(filepath).isDirectory()) return;
94-
95-
if (action === 'added') {
96-
// This is a special message that's parsed by YA
97-
// to determine if support for an additional preprocessor is necessary
98-
// Note: this allows us to avoid controlling grunt manually within YA
99-
console.log('EXTADDED:' + ext);
100-
101-
// Note: we don't do anything for newly added .js files
102-
// A new js file can't be the root unless it's changed to require
103-
// the current root and saved/changed
104-
} else if (action === 'changed' || action === 'deleted') {
105-
if (ext === '.js') {
106-
// Ignore bundles
107-
if (/.+bundle.js/g.test(filepath)) return;
108-
109-
// Notify YA to recompute the roots and
110-
// generate a configuration
111-
console.log('JSCHANGED:' + filepath);
112-
}
55+
},
56+
watch: {
57+
sass: {
58+
files: [
59+
"**/*.scss",
60+
"!node_modules/**/*.scss",
61+
"!.git/**/*.scss",
62+
"!.sass-cache/**/*.scss",
63+
"!bower_components/**/*.scss",
64+
"!vendor/**/*.scss"
65+
],
66+
tasks: [
67+
"newer:sass"
68+
]
69+
},
70+
js: {
71+
files: [
72+
"js/**/*.js",
73+
"!js/vendor/**/*.js"
74+
],
75+
tasks: [
76+
"browserify",
77+
"uglify",
78+
'cacheBust'
79+
]
11380
}
114-
});
81+
}
82+
});
11583

116-
// For watching entire directories but allowing
117-
// the grunt.event binding to take care of it
118-
grunt.registerTask('noop', function () {});
119-
}
84+
grunt.registerTask('default', ['watch']);
85+
}

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ If you'd like to tinker around with the code, you can do the following:
6969
* `grunt`
7070
* Point your browser to your localhost (assuming you have the app being [served locally](#running-it-locally))
7171

72-
`src/phpepl.js` is the main script for the website. This gets built into `dist/phpepl.js`
73-
which is referenced by `phpepl/index.html`.
72+
`js/phpepl.js` is the main script for the website. This gets built into a hashed `dist/phpepl.js`
73+
which is referenced by `index.html`.
7474

75-
The php evaluation code is in `src/eval/index.php`.
75+
The php evaluation code is in `eval/index.php`.
7676

7777
That endpoint checks for the existence of a `PHPEPL_PROD` environment variable
7878
(which is set on the production hosts) for sandboxing. Locally, you won't
File renamed without changes.

dist/phpepl.6dea5a8de69bec15.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/phpepl.js

-5
This file was deleted.

dist/phpepl.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/eval/index.php eval/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Only production environments will have this set – turning on sandboxing
33
// DEP_VERSION is for cloud control
44
$sandbox_me = isset($_ENV['PHPEPL_PROD']) || isset($_ENV['DEP_VERSION']);
5-
require_once('../../vendor/autoload.php');
5+
require_once('../vendor/autoload.php');
66

77
// Turn off errors since eval will throw them on invalid syntax
88
@ini_set('log_errors', false);

favicon.a7a02ef2032fea1a.ico

1.37 KB
Binary file not shown.

favicon.ico

-1.12 KB
Binary file not shown.

index.html

+17-14
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
<title>PHPepl: The PHP REPL</title>
1010

11-
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
12-
<link rel="icon" href="/favicon.ico" type="image/x-icon">
11+
<link rel="shortcut icon" href="/favicon.a7a02ef2032fea1a.ico" type="image/x-icon">
12+
<link rel="icon" href="/favicon.a7a02ef2032fea1a.ico" type="image/x-icon">
1313

14-
<link href='js/vendor/codemirror/lib/codemirror.css?ver=4.5' rel='stylesheet'>
15-
<link href='css/styles.css?ver=1.10' rel='stylesheet'>
14+
<link href='js/vendor/codemirror/lib/codemirror.69882100f431f700.css' rel='stylesheet'>
15+
<link href='css/styles.8ed83c9a1f6526ce.css' rel='stylesheet'>
1616
<script>
1717
var _gaq = _gaq || [];
1818
_gaq.push(['_setAccount', 'UA-36055599-1']);
@@ -99,15 +99,18 @@
9999
</a>
100100
</div>
101101
</body>
102-
<script src='js/vendor/codemirror/lib/codemirror.js?ver=4.5'></script>
103-
<script src='js/vendor/codemirror/addon/edit/closebrackets.js?ver=4.5'></script>
104-
<script src='js/vendor/codemirror/addon/edit/matchbrackets.js?ver=4.5'></script>
105-
<script src='js/vendor/codemirror/mode/htmlmixed/htmlmixed.js?ver=4.5'></script>
106-
<script src='js/vendor/codemirror/mode/xml/xml.js?ver=4.5'></script>
107-
<script src='js/vendor/codemirror/mode/javascript/javascript.js?ver=4.5'></script>
108-
<script src='js/vendor/codemirror/mode/css/css.js?ver=4.5'></script>
109-
<script src='js/vendor/codemirror/mode/clike/clike.js?ver=4.5'></script>
110-
<script src='js/vendor/codemirror/mode/php/php.js?ver=4.5'></script>
102+
<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
103+
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js'></script>
111104

112-
<script src='dist/phpepl.js?ver=1.11'></script>
105+
<script src='js/vendor/codemirror/lib/codemirror.7a9280b40de09030.js'></script>
106+
<script src='js/vendor/codemirror/addon/edit/closebrackets.99fbd700c4b1dde0.js'></script>
107+
<script src='js/vendor/codemirror/addon/edit/matchbrackets.7c67d671b0ae64eb.js'></script>
108+
<script src='js/vendor/codemirror/mode/htmlmixed/htmlmixed.70e9c6691f93ae5a.js'></script>
109+
<script src='js/vendor/codemirror/mode/xml/xml.b10ab61307626443.js'></script>
110+
<script src='js/vendor/codemirror/mode/javascript/javascript.201d73044f63833b.js'></script>
111+
<script src='js/vendor/codemirror/mode/css/css.623a12754234c2f0.js'></script>
112+
<script src='js/vendor/codemirror/mode/clike/clike.a38e006a81a7baab.js'></script>
113+
<script src='js/vendor/codemirror/mode/php/php.ce287cd834646250.js'></script>
114+
115+
<script src='dist/phpepl.6dea5a8de69bec15.js'></script>
113116
</html>

src/editor.js js/editor.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
var $ = require('jquery');
2-
31
module.exports = window.CodeMirror($('#editor')[0], {
42
lineNumbers: true,
53
matchBrackets: true,

src/helpers/EditorHelpers.js js/helpers/EditorHelpers.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
var moment = require('moment');
2-
var $ = require('jquery');
3-
41
// Set the html of the output div
52
module.exports.setOutput = function(text) {
63
var isError = !!arguments[1];

src/helpers/StorageHelpers.js js/helpers/StorageHelpers.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var editor = require('../editor');
2-
var $ = require('jquery');
32

43
module.exports.saveCode = function() {
54
if (!window.localStorage) { return; }

src/phpepl.js js/phpepl.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22

3-
var $ = window.$ = window.jQuery = require('jquery');
4-
5-
var evalURL = 'src/eval/index.php';
3+
var evalURL = 'eval/index.php';
64

75
var mixpanel = window.mixpanel || {};
86
var editor = require('./editor');

package.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
"description": "The PHP repl",
44
"version": "2.2.1",
55
"author": "Joel Kemp <[email protected]>",
6-
"dependencies": {
7-
"jquery": "1.x",
8-
"moment": "*"
9-
},
6+
"dependencies": {},
107
"repository": {
118
"type": "git",
129
"url": "https://github.com/mrjoelkemp/phpepl"
@@ -21,10 +18,9 @@
2118
"npm": "1.2.x"
2219
},
2320
"devDependencies": {
24-
"browserify": "~3.31.2",
25-
"browserify-shim": "~3.3.0",
2621
"grunt": "^0.4.5",
2722
"grunt-browserify": "~3.2.1",
23+
"grunt-cache-bust": "~0.4.13",
2824
"grunt-cli": "^0.1.13",
2925
"grunt-contrib-sass": "^0.8.1",
3026
"grunt-contrib-uglify": "~0.6.0",
@@ -36,6 +32,6 @@
3632
},
3733
"main": "./src/phpepl.js",
3834
"scripts": {
39-
"test": "jscs -p google src/ && jshint src"
35+
"test": "jscs -p google js/*.js js/helpers && jshint js/*.js js/helpers"
4036
}
4137
}

0 commit comments

Comments
 (0)