Browse Source

Building/Running/Launching editor from Atom

Josh Engebretson 10 years ago
parent
commit
38c2b3af4b

+ 2 - 0
CLI/atomic-cli-mac-data/index.js

@@ -1,8 +1,10 @@
 
 var ATOMICTOOL_BIN = __dirname  + "/data/editor/AtomicEditor.app/Contents/Applications/CommandLine/AtomicTool";
 var ATOMICEDITOR_DATADIR = __dirname  + "/data/editor/AtomicEditor.app/Contents/Resources";
+var ATOMICEDITOR_APP = __dirname  + "/data/editor/AtomicEditor.app/Contents/MacOS/AtomicEditor";
 
 module.exports = {
   "ATOMICTOOL_BIN" : ATOMICTOOL_BIN,
+  "ATOMICEDITOR_APP" : ATOMICEDITOR_APP,
   "ATOMICEDITOR_DATADIR" : ATOMICEDITOR_DATADIR
 }

+ 2 - 0
CLI/atomic-cli-mac/index.js

@@ -6,5 +6,7 @@ atomic_data = require('atomic-cli-mac-data');
 
 module.exports = {
   "ATOMICTOOL_BIN" : atomic_data.ATOMICTOOL_BIN,
+  "ATOMICEDITOR_APP" : atomic_data.ATOMICEDITOR_APP,
   "ATOMICEDITOR_DATADIR" : atomic_data.ATOMICEDITOR_DATADIR
+
 }

+ 6 - 0
CLI/atomic-cli/bin/atomic-cli.js

@@ -57,6 +57,12 @@ program
 
   });
 
+program
+  .command('edit [path-to-project]')
+  .description('edits the project in the cwd or on at a specified path')
+  .action(function(options){
+    cli.atomiceditor(["-project", process.cwd()], {output:true});
+  });
 
   program.parse(process.argv);
 

+ 19 - 0
CLI/atomic-cli/lib/atomiceditor.js

@@ -0,0 +1,19 @@
+
+var spawn = require("child_process").spawn;
+
+try {
+  var platform_cli = require('atomic-cli-mac');
+}
+catch (e) {
+  console.log(e);
+}
+
+var atomiceditor = function (flags, opts) {
+  opts = opts || {};
+  opts.detached = true;
+  opts.stdio = ["ignore", "ignore", "ignore"];
+  var child = spawn(platform_cli.ATOMICEDITOR_APP, flags, opts);
+  child.unref();
+};
+
+module.exports = atomiceditor;

+ 0 - 2
CLI/atomic-cli/lib/atomictool.js

@@ -5,8 +5,6 @@ var os = require("os");
 var path = require("path");
 var spawn = require("child_process").spawn;
 
-var cli = require ("atomic-cli")
-
 try {
   var platform_cli = require('atomic-cli-mac');
 }

+ 3 - 1
CLI/atomic-cli/lib/main.js

@@ -3,6 +3,7 @@
 var mode = process.env.ATOMIC_GAME_ENGINE_ENV || 'production';
 
 var atomictool = require ("./atomictool.js");
+var atomiceditor = require ("./atomiceditor.js");
 
 module.exports = {
 
@@ -10,6 +11,7 @@ module.exports = {
   "newProject" : atomictool.newProject,
   "addPlatform" : atomictool.addPlatform,
   "build" : atomictool.build,
-  "run" : atomictool.run
+  "run" : atomictool.run,
+  "atomiceditor" : atomiceditor
 
 }

+ 3 - 3
CLI/atomic-game-engine/package.json

@@ -2,11 +2,11 @@
   "name": "atomic-game-engine",
   "main": "./lib/atomic-game-engine",
   "version": "0.0.0",
-  "description": "A short description of your package",
+  "description": "An Atom package for the Atomic Game Engine",
   "activationCommands": {
-    "atom-workspace": ["atomic-game-engine:openEditor", "atomic-game-engine:run"] 
+    "atom-workspace": ["atomic-game-engine:openEditor", "atomic-game-engine:run"]
   },
-  "repository": "https://github.com/atom/atomic-game-engine",
+  "repository": "https://github.com/AtomicGameEngine/AtomicGameEngine",
   "license": "MIT",
   "engines": {
     "atom": ">=0.174.0 <2.0.0"