Skip to content

Commit 90490a7

Browse files
authored
Merge pull request #121 from decosoftware/master
Promote 0.7.1 to staging
2 parents 38382df + 1ac33ec commit 90490a7

File tree

18 files changed

+160
-303
lines changed

18 files changed

+160
-303
lines changed

desktop/Scripts/postinstall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ $USER = "root" ]; then
77
exit 1
88
fi
99

10-
DECO_VERSION=0.7.0
10+
DECO_VERSION=0.7.1
1111

1212
rm -rf ~/Library/Application\ Support/com.decosoftware.Deco/libs
1313
mkdir -p ~/Library/Application\ Support/com.decosoftware.Deco/libs

desktop/deco_unpack_lib/Scripts/deco-tool/default.settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var path = require('path')
1919

2020
module.exports = function(projectName) {
2121
return {
22-
iosTarget: path.join("ios/build/Build/Products/Debug-iphonesimulator/", projectName, ".app"),
22+
iosTarget: path.join("ios/build/Build/Products/Debug-iphonesimulator/", projectName + ".app"),
2323
iosProject: path.join("ios", projectName + ".xcodeproj"),
2424
iosBuildScheme: projectName,
2525
androidManifest: path.join("android/app/src/main/AndroidManifest.xml"),

desktop/deco_unpack_lib/Scripts/deco-tool/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const handleError = (e) => {
3131
errorMessage: `Error in config: ${e.toString()}`,
3232
})
3333
} else {
34-
console.error(`\nLocal config is broken: \n\n[${e}]\n`)
34+
console.error(`\nError in config: \n\n[${e}]\n`)
3535
process.exit(1)
3636
}
3737
}
@@ -210,7 +210,6 @@ try {
210210
fs.statSync(settingsPath)
211211
PROJECT_SETTING = JSON.parse(stripComments(fs.readFileSync(settingsPath).toString()))
212212
} catch (e) {
213-
console.log('Warning: No local .settings file is present at path: ' + settingsPath + ' falling back to defaults.')
214213
try {
215214
const getDefaults = require(path.join(moduleWorkingDir, 'default.settings.js'))
216215
const projectName = path.basename(process.cwd())
@@ -315,6 +314,5 @@ try {
315314
}
316315
})
317316
} catch (e) {
318-
console.error(e)
319317
handleError(e)
320318
}

desktop/gulpfile.js

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ var gulpFail = require('gulp-fail');
44
var path = require('path');
55
var webpack = require("webpack");
66
var webpackProductionConfig = require("./webpack.production.config.js");
7+
var webpackDevConfig = require("./webpack.config.js");
78
var ElectronPackager = require('electron-packager');
89
var child_process = require('child_process');
910
var fs = require('fs');
1011
var plist = require('plist');
1112
var $ = require('gulp-load-plugins')();
13+
var open = require('gulp-open');
1214
var runSequence = require('run-sequence');
1315

14-
var BUILD_VERSION = "0.7.0";
16+
var BUILD_VERSION = "0.7.1";
1517

1618
var SIGN_PACKAGE = process.env['SIGN_DECO_PACKAGE'] == 'true'
1719

1820
var child = null
21+
var debug_child = null
1922
gulp.task('clean-pkg', $.shell.task(["rm -rf " + (path.join(__dirname, '../dist')), "mkdir -p " + (path.join(__dirname, '../dist/osx'))]));
2023

2124
gulp.task('copy-libraries', ['electron-pack'], $.shell.task(["mkdir " + '../app/deco/Deco-darwin-x64/Deco.app/Contents/Resources/app.asar.unpacked', "cp -rf " + (path.join(__dirname, './package/deco_unpack_lib/*')) + " " + (path.join(__dirname, '../app/deco/Deco-darwin-x64/Deco.app/Contents/Resources/app.asar.unpacked/'))]));
@@ -108,6 +111,19 @@ gulp.task("build", function(callback) {
108111
});
109112
});
110113

114+
gulp.task("build-dev", function(callback) {
115+
return webpack(webpackDevConfig, function(err, stats) {
116+
if (err) {
117+
throw new gutil.PluginError("webpack:build", err);
118+
}
119+
gutil.log("[webpack:build]", stats.toString({
120+
colors: true
121+
}));
122+
callback();
123+
});
124+
});
125+
126+
111127
gulp.task('build-web', ['build', 'clean-pkg'], function(callback) {
112128
child_process.execSync('npm run build', {
113129
cwd: path.join(__dirname, '../web')
@@ -123,10 +139,41 @@ gulp.task("start", ["build"], function(callback) {
123139
});
124140
});
125141

142+
gulp.task('debug', ['run-debug-processes'], function(callback) {
143+
gulp.src(__filename)
144+
.pipe(open({
145+
uri: 'http://127.0.0.1:3000/?port=5858',
146+
//TODO: needs to change for OS once we support other platforms
147+
app: '/Applications/Google\ Chrome.app',
148+
}))
149+
callback()
150+
});
151+
152+
gulp.task("run-debug-processes", ["build-dev"], function(callback) {
153+
child = child_process.fork("" + (path.join(__dirname, './node_modules/.bin/electron')), ["--debug-brk=5858", __dirname, "--dev-mode"], {
154+
cwd: __dirname,
155+
env: process.env
156+
});
157+
debug_child = child_process.fork("" + (path.join(__dirname, './node_modules/.bin/electron')), [
158+
"node_modules/node-inspector/bin/inspector.js",
159+
"--web-port=3000",
160+
], {
161+
cwd: __dirname,
162+
env: Object.assign({},
163+
process.env, {
164+
ELECTRON_RUN_AS_NODE: true,
165+
})
166+
});
167+
callback()
168+
})
169+
126170
process.on('exit', function() {
127171
if (child != null && !child.killed) {
128172
child.kill();
129173
}
174+
if (debug_child != null && !debug_child.killed) {
175+
debug_child.kill();
176+
}
130177
});
131178

132179
gulp.task('default', function() {

desktop/install-debug-tools.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
3+
./node_modules/.bin/node-pre-gyp --target=1.1.2 --runtime=electron --fallback-to-build --directory node_modules/v8-debug/ --dist-url=https://atom.io/download/atom-shell reinstall
4+
./node_modules/.bin/node-pre-gyp --target=1.1.2 --runtime=electron --fallback-to-build --directory node_modules/v8-profiler/ --dist-url=https://atom.io/download/atom-shell reinstall

desktop/installer/osx/mpkg/Distribution

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<!--+==========================+
1919
| Package References |
2020
+==========================+-->
21-
<pkg-ref id="com.decosoftware.deco" version="0.7.0" auth="Root" installKBytes="0">#Deco.pkg</pkg-ref>
21+
<pkg-ref id="com.decosoftware.deco" version="0.7.1" auth="Root" installKBytes="0">#Deco.pkg</pkg-ref>
2222
<!--+==========================+
2323
| JavaScript Scripts |
2424
+==========================+-->

desktop/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "DecoIDE-Desktop",
3-
"version": "0.7.0",
3+
"version": "0.7.1",
44
"main": "build/app.js",
55
"devDependencies": {
66
"babel-core": "^6.7.2",
@@ -12,15 +12,19 @@
1212
"gulp": "^3.8.11",
1313
"gulp-fail": "^1.0.1",
1414
"gulp-load-plugins": "^0.8.1",
15+
"gulp-open": "^2.0.0",
1516
"gulp-shell": "^0.3.0",
1617
"gulp-util": "^3.0.4",
18+
"node-inspector": "^0.12.8",
19+
"node-pre-gyp": "^0.6.29",
1720
"plist": "^1.2.0",
1821
"run-sequence": "^1.2.1",
1922
"webpack": "^1.12.14"
2023
},
2124
"scripts": {
2225
"start": "./node_modules/.bin/gulp start",
2326
"pack": "./node_modules/.bin/gulp pack",
27+
"debug": "./node_modules/.bin/gulp debug",
2428
"copy-libs": "./node_modules/.bin/gulp dev-unpack-lib",
2529
"upgrade-project-template": "./node_modules/.bin/gulp upgrade-project-template"
2630
},

desktop/src/handlers/projectHandler.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ import Logger from '../log/logger'
5454

5555
let unsavedMap = {}
5656

57-
const PROJECT_SETTINGS_TEMPLATE =`{
57+
const PROJECT_SETTINGS_TEMPLATE = (projectName) => `{
5858
5959
// relative path from project root to the .app binary that is generated after building iOS
60-
"iosTarget": "ios/build/Build/Products/Debug-iphonesimulator/Project.app",
60+
"iosTarget": "ios/build/Build/Products/Debug-iphonesimulator/${projectName}.app",
6161
6262
// relative path from project root to the xcode project or workspace file for iOS build
63-
"iosProject": "ios/Project.xcodeproj",
63+
"iosProject": "ios/${projectName}.xcodeproj",
6464
6565
// scheme name to use when building in Deco
66-
"iosBuildScheme": "Project",
66+
"iosBuildScheme": "${projectName}",
6767
6868
// relative path from project to the AndroidManifest.xml file for your application
6969
"androidManifest": "android/app/src/main/AndroidManifest.xml",
@@ -196,14 +196,15 @@ class ProjectHandler {
196196
return new Promise((resolve, reject) => {
197197
const metadataPath = path.join(rootPath, '.deco')
198198
const settingsFilePath = path.join(metadataPath, '.settings')
199+
const assumedProjectName = path.basename(rootPath)
199200
try {
200201
fs.statSync(settingsFilePath)
201202
resolve(settingsFilePath)
202203
} catch (e) {
203204
if (e && e.code == 'ENOENT') {
204205
mkdirp(metadataPath, () => {
205206
try {
206-
fs.writeFileSync(settingsFilePath, PROJECT_SETTINGS_TEMPLATE, {
207+
fs.writeFileSync(settingsFilePath, PROJECT_SETTINGS_TEMPLATE(assumedProjectName), {
207208
mode: '755'
208209
})
209210
resolve(settingsFilePath)
@@ -249,13 +250,11 @@ class ProjectHandler {
249250
fs.stat(oldMetadataPath, (err, stats) => {
250251
if (err) {
251252
//project is clean
252-
this.createProjectSettingsTemplate(rootPath)
253253
return
254254
}
255255

256256
fs.stat(newMetadataPath, (err, stats) => {
257257
if (!err) {
258-
this.createProjectSettingsTemplate(rootPath)
259258
return //project is current
260259
}
261260
if (err.code == 'ENOENT') {

desktop/src/process/taskLauncher.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,20 @@ class TaskLauncher {
143143
cwd: LIB_FOLDER,
144144
}))
145145

146+
let errors = ''
147+
148+
task.stderr.on('data', (data) => {
149+
try {
150+
var plainTextData = data.toString()
151+
errors += plainTextData
152+
} catch (e) {
153+
Logger.error(e)
154+
}
155+
})
156+
146157
task.once('exit', (code, signal) => {
147158
if (code == 1) {
148-
launchCustomTaskErrorDialog(task.stderr.toString())
159+
launchCustomTaskErrorDialog(errors)
149160
}
150161
})
151162

desktop/webpack.config.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
var path = require('path')
2+
var webpack = require('webpack')
3+
var fs = require('fs')
4+
5+
var nodeModules = {};
6+
fs.readdirSync('node_modules')
7+
.filter(function(x) {
8+
return ['.bin'].indexOf(x) === -1;
9+
})
10+
.forEach(function(mod) {
11+
nodeModules[mod] = 'commonjs ' + mod;
12+
});
13+
14+
15+
module.exports = {
16+
entry: './src/main.js',
17+
target: 'atom',
18+
devtool: 'inline-source-map',
19+
output: {
20+
path: path.join(__dirname, 'build'),
21+
filename: 'app.js'
22+
},
23+
resolve: {
24+
alias: {
25+
'shared': path.join(__dirname, '../shared/src'),
26+
}
27+
},
28+
resolveLoader: {
29+
modulesDirectories: ['..', 'node_modules']
30+
},
31+
node: {
32+
__dirname: false
33+
},
34+
plugins: [
35+
new webpack.optimize.DedupePlugin(),
36+
new webpack.optimize.UglifyJsPlugin(),
37+
new webpack.ExternalsPlugin('commonjs', [
38+
'electron',
39+
]),
40+
],
41+
module: {
42+
loaders: [
43+
{ test: /\.json$/, loader: "json-loader" },
44+
{
45+
loader: 'babel',
46+
test: /\.js$/,
47+
query: {
48+
presets: ['es2015',]
49+
}
50+
}
51+
]
52+
},
53+
externals: nodeModules
54+
}

0 commit comments

Comments
 (0)