Skip to content

Commit ae66a27

Browse files
author
Mikhail Bezoyan
committed
file api refactorings and fixes
1 parent 626abaa commit ae66a27

18 files changed

+651
-364
lines changed

Gruntfile.js

Lines changed: 82 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,24 @@ module.exports = function (grunt){
4444
port: 9001,
4545
base: '.'
4646
}
47-
}
48-
},
47+
},
48+
standalone: {
49+
options: {
50+
hostname: '*',
51+
keepalive: true,
52+
port: 9001,
53+
base: '.'
54+
}
55+
}
56+
},
4957

5058
qunit: {
5159
all: {
5260
options: {
5361
timeout: 5 * 60 * 1000, // 5min
5462
files: {
5563
'1px.gif':['tests/files/1px.gif']
64+
, 'big.jpg':['tests/files/big.jpg']
5665
, 'hello.txt':['tests/files/hello.txt']
5766
, 'image.jpg':['tests/files/image.jpg']
5867
, 'dino.png':['tests/files/dino.png']
@@ -65,7 +74,7 @@ module.exports = function (grunt){
6574

6675
concat: {
6776
options: {
68-
banner: '/*! <%= pkg.name %> <%= pkg.version %> - <%= pkg.license %> | <%= pkg.repository.url %>\n' +
77+
banner: '/*! <%= pkg.exportName %> <%= pkg.version %> - <%= pkg.license %> | <%= pkg.repository.url %>\n' +
6978
' * <%= pkg.description %>\n' +
7079
' */\n\n',
7180

@@ -83,7 +92,7 @@ module.exports = function (grunt){
8392
, 'lib/FileAPI.Camera.js'
8493
, 'lib/FileAPI.Flash.js'
8594
],
86-
dest: 'dist/<%= pkg.name %>.js'
95+
dest: 'dist/<%= pkg.exportName %>.js'
8796
},
8897

8998
html5: {
@@ -96,21 +105,81 @@ module.exports = function (grunt){
96105
, 'lib/FileAPI.XHR.js'
97106
, 'lib/FileAPI.Camera.js'
98107
],
99-
dest: 'dist/<%= pkg.name %>.html5.js'
100-
}
108+
dest: 'dist/<%= pkg.exportName %>.html5.js'
109+
},
110+
111+
ok: {
112+
src: [
113+
'lib/FileAPI.header.js'
114+
, 'lib/canvas-to-blob.js'
115+
, 'lib/FileAPI.core.js'
116+
, 'lib/FileAPI.Image.js'
117+
, 'lib/load-image-ios.js'
118+
, 'lib/FileAPI.Form.js'
119+
, 'lib/FileAPI.XHR.js'
120+
, 'plugins/FileAPI.exif.js'
121+
, 'lib/FileAPI.Flash.js'
122+
],
123+
dest: 'dist/<%= pkg.exportName %>.ok.js'
124+
},
125+
126+
html5ok: {
127+
src: [
128+
'lib/FileAPI.header.js'
129+
, 'lib/canvas-to-blob.js'
130+
, 'lib/FileAPI.core.js'
131+
, 'lib/FileAPI.Image.js'
132+
, 'lib/load-image-ios.js'
133+
, 'lib/FileAPI.Form.js'
134+
, 'lib/FileAPI.XHR.js'
135+
, 'plugins/FileAPI.exif.js'
136+
],
137+
dest: 'dist/<%= pkg.exportName %>.html5ok.js'
138+
}
101139
},
102140

103141
uglify: {
104-
options: { banner: '/*! <%= pkg.name %> <%= pkg.version %> - <%= pkg.license %> | <%= pkg.repository.url %> */\n' },
142+
options: { banner: '/*! <%= pkg.exportName %> <%= pkg.version %> - <%= pkg.license %> | <%= pkg.repository.url %> */\n' },
105143
dist: {
106144
files: {
107-
'dist/<%= pkg.name %>.min.js': ['<%= concat.all.dest %>']
108-
, 'dist/<%= pkg.name %>.html5.min.js': ['<%= concat.html5.dest %>']
145+
'dist/<%= pkg.exportName %>.min.js': ['<%= concat.all.dest %>']
146+
, 'dist/<%= pkg.exportName %>.html5.min.js': ['<%= concat.html5.dest %>']
147+
, 'dist/<%= pkg.exportName %>.ok.min.js': ['<%= concat.ok.dest %>']
148+
, 'dist/<%= pkg.exportName %>.html5ok.min.js': ['<%= concat.html5ok.dest %>']
109149
}
110150
}
111151
},
112152

113-
watch: {
153+
mxmlc: {
154+
core: {
155+
options: {
156+
rawConfig: '-static-link-runtime-shared-libraries=true -compiler.debug=true' +
157+
' -library-path+=flash/core/lib/blooddy_crypto.swc -library-path+=flash/core/lib/EnginesLibrary.swc'
158+
},
159+
files: {
160+
'dist/<%= pkg.exportName %>.flash.swf': ['flash/core/src/FileAPI_flash.as']
161+
}
162+
},
163+
image: {
164+
options: {
165+
rawConfig: '-static-link-runtime-shared-libraries=true -compiler.debug=true' +
166+
' -library-path+=flash/image/lib/blooddy_crypto.swc'
167+
},
168+
files: {
169+
'dist/<%= pkg.exportName %>.flash.image.swf': ['flash/image/src/FileAPI_flash_image.as']
170+
}
171+
},
172+
camera: {
173+
options: {
174+
rawConfig: '-static-link-runtime-shared-libraries=true -compiler.debug=true'
175+
},
176+
files: {
177+
'dist/<%= pkg.exportName %>.flash.camera.swf': ['flash/camera/src/FileAPI_flash_camera.as']
178+
}
179+
}
180+
},
181+
182+
watch: {
114183
scripts: {
115184
files: 'lib/**/*.js',
116185
tasks: ['concat'],
@@ -127,12 +196,12 @@ module.exports = function (grunt){
127196
grunt.loadNpmTasks('grunt-contrib-uglify');
128197
grunt.loadNpmTasks('grunt-contrib-watch');
129198
grunt.loadNpmTasks('grunt-contrib-connect');
130-
199+
grunt.loadNpmTasks('grunt-mxmlc');
131200
// Load custom QUnit task, based on grunt-contrib-qunit, but support "files" option.
132201
grunt.loadTasks('./tests/grunt-task/');
133202

134203
// "npm build" runs these tasks
135-
grunt.registerTask('tests', ['jshint', 'concat', 'connect', 'qunit']);
136-
grunt.registerTask('build', ['version', 'concat', 'uglify']);
204+
grunt.registerTask('tests', ['jshint', 'concat', 'connect:server', 'qunit']);
205+
grunt.registerTask('build', ['version', 'concat', 'uglify', 'mxmlc']);
137206
grunt.registerTask('default', ['tests', 'build']);
138207
};

dist/FileAPI.flash.camera.swf

610 Bytes
Binary file not shown.

dist/FileAPI.flash.image.swf

735 Bytes
Binary file not shown.

dist/FileAPI.flash.swf

31.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)