Browse Source

migration to amber 0.14.17

Herbert Vojčík 10 năm trước cách đây
mục cha
commit
9f7ee8c123
11 tập tin đã thay đổi với 107 bổ sung54 xóa
  1. 73 30
      Gruntfile.js
  2. 1 1
      LICENSE-MIT
  3. 5 11
      bower.json
  4. 7 0
      config-node.js
  5. 1 1
      devel.js
  6. 1 1
      index.html
  7. 8 7
      package.json
  8. 1 1
      src/Benchfib.js
  9. 1 1
      src/Examples.js
  10. 1 1
      src/IDE.js
  11. 8 0
      testing.js

+ 73 - 30
Gruntfile.js

@@ -13,14 +13,17 @@ function findAmberPath(options) {
 }
 
 module.exports = function (grunt) {
-    var path = require('path');
+    var helpers = require('amber-dev/lib/helpers');
 
     // These plugins provide necessary tasks.
+    grunt.loadNpmTasks('grunt-contrib-clean');
     grunt.loadNpmTasks('grunt-contrib-requirejs');
+    grunt.loadNpmTasks('grunt-execute');
     grunt.loadNpmTasks('amber-dev');
 
     // Default task.
-    grunt.registerTask('default', ['amberc:all']);
+    grunt.registerTask('default', ['amdconfig:app', 'amberc:all']);
+    grunt.registerTask('test', ['amdconfig:app', 'requirejs:test_runner', 'execute:test_runner', 'clean:test_runner']);
     grunt.registerTask('devel', ['amdconfig:app', 'requirejs:devel']);
     grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy']);
 
@@ -29,16 +32,15 @@ module.exports = function (grunt) {
         // Metadata.
         // pkg: grunt.file.readJSON(''),
         banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
-            '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
-            '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
-            '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
-            ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
+        '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
+        '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
+        '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
+        ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
         // task configuration
         amberc: {
             options: {
                 amber_dir: findAmberPath(['../..', 'bower_components/amber']),
-                library_dirs: ['src'],
-                closure_jar: ''
+                configFile: "config.js"
             },
             all: {
                 src: [
@@ -46,35 +48,76 @@ module.exports = function (grunt) {
                     // list all tests in dependency order
                 ],
                 amd_namespace: 'amber/legacy',
-                libraries: ['Web']
+                libraries: ['amber/web/Web']
             }
         },
 
         amdconfig: {app: {dest: 'config.js'}},
 
         requirejs: {
-            deploy: {options: {
-                mainConfigFile: "config.js",
-                onBuildWrite: function (moduleName, path, contents) {
-                    return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'deploy'}}});" : contents;
-                },
-                pragmas: {
-                    excludeIdeData: true,
-                    excludeDebugContexts: true
-                },
-                include: ['config', 'node_modules/requirejs/require', 'deploy'],
-                out: "the.js"
-            }},
-            devel: {options: {
-                mainConfigFile: "config.js",
-                onBuildWrite: function (moduleName, path, contents) {
-                    return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'devel'}}});" : contents;
-                },
-                include: ['config', 'node_modules/requirejs/require'],
-                out: "the.js"
-            }}
-        }
+            options: {
+                useStrict: true
+            },
+            deploy: {
+                options: {
+                    mainConfigFile: "config.js",
+                    rawText: {
+                        "amber/Platform": '/*stub*/',
+                        "app": 'define(["deploy"],function(x){return x});define("amber/Platform",["amber_core/Platform-Browser"],{});'
+                    },
+                    pragmas: {
+                        excludeIdeData: true,
+                        excludeDebugContexts: true
+                    },
+                    include: ['config', 'node_modules/requirejs/require', 'app'],
+                    out: "the.js"
+                }
+            },
+            devel: {
+                options: {
+                    mainConfigFile: "config.js",
+                    rawText: {
+                        "amber/Platform": '/*stub*/',
+                        "app": 'define(["devel"],function(x){return x});define("amber/Platform",["amber_core/Platform-Browser"],{});'
+                    },
+                    include: ['config', 'node_modules/requirejs/require', 'app'],
+                    exclude: ['devel'],
+                    out: "the.js"
+                }
+            },
+            test_runner: {
+                options: {
+                    mainConfigFile: "config.js",
+                    rawText: {
+                        "app": "(" + function () {
+                            define(["testing", "amber_devkit/NodeTestRunner"], function (amber) {
+                                amber.initialize();
+                                amber.globals.NodeTestRunner._main();
+                            });
+                        } + "());"
+                    },
+                    paths: {"amber_devkit": helpers.libPath},
+                    pragmas: {
+                        excludeIdeData: true
+                    },
+                    include: ['config-node', 'app'],
+                    insertRequire: ['app'],
+                    optimize: "none",
+                    wrap: helpers.nodeWrapperWithShebang,
+                    out: "test_runner.js"
+                }
+            }
+        },
 
+        execute: {
+            test_runner: {
+                src: ['test_runner.js']
+            }
+        },
+
+        clean: {
+            test_runner: ['test_runner.js']
+        }
     });
 
 };

+ 1 - 1
LICENSE-MIT

@@ -1,4 +1,4 @@
-Copyright (c) 2015 Herbert Vojčík
+Copyright (c) 2015
 
 Permission is hereby granted, free of charge, to any person
 obtaining a copy of this software and associated documentation

+ 5 - 11
bower.json

@@ -6,19 +6,12 @@
         "**/.*",
         "node_modules",
         "bower_components",
-        "/test_runner.js",
-        "/config.js",
-        "/the.js",
+        "/*.js",
+        "/*.html",
         "test",
         "tests"
     ],
-    "authors": [
-        {
-            "name": "Herbert Vojčík",
-            "email": "herby@mailbox.sk"
-        }
-    ],
-    "homepage": "",
+    "homepage": "https://github.com/amber-smalltalk/amber-contrib-legacy",
     "keywords": [
         "Amber",
         "Smalltalk"
@@ -35,7 +28,8 @@
         "require-css": "^0.1.2"
     },
     "devDependencies": {
+        "amber": ">=0.14.17",
         "amber-ide-starter-dialog": "^0.1.0",
-        "helios": ">=0.5.0"
+        "helios": ">=0.5.3"
     }
 }

+ 7 - 0
config-node.js

@@ -0,0 +1,7 @@
+// This file is used to make additional changes
+// when building an app to run in node.js.
+// Free to edit. You can break tests (cli test runner uses
+// this to build itself - it is a node executable).
+define("amber/Platform", ["amber_core/Platform-Node"], {});
+define("amber/browser-compatibility", {});
+define("jquery", {});

+ 1 - 1
devel.js

@@ -1,6 +1,6 @@
 define([
+    './testing',
     'amber/devel',
-    './deploy'
     // --- packages used only during development begin here ---
     // --- packages used only during development end here ---
 ], function (amber) {

+ 1 - 1
index.html

@@ -4,7 +4,7 @@
   <head>
     <title>Amber legacy items</title>
     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-    <meta name="author" content="Herbert Vojčík" />
+    <meta name="author" content="" />
     <script type='text/javascript' src='the.js'></script>
   </head>
 

+ 8 - 7
package.json

@@ -3,15 +3,14 @@
   "title": "Amber legacy items",
   "description": "Legacy IDE and a few other old non-core packages",
   "version": "0.2.1",
-  "homepage": "",
-  "author": {
-    "name": "Herbert Vojčík",
-    "email": "herby@mailbox.sk"
-  },
+  "homepage": "https://github.com/amber-smalltalk/amber-contrib-legacy",
   "repository": {
     "type": "git",
     "url": "git://github.com/amber-smalltalk/amber-contrib-legacy.git"
   },
+  "bugs": {
+    "url": "https://github.com/amber-smalltalk/amber-contrib-legacy/issues"
+  },
   "licenses": [
     {
       "type": "MIT",
@@ -19,15 +18,17 @@
     }
   ],
   "engines": {
-    "node": ">=0.10.0"
+    "node": "0.10.x || 0.12.x || >=4.0.0"
   },
   "scripts": {
     "test": "grunt test"
   },
   "devDependencies": {
-    "amber-dev": "^0.5.0",
+    "amber-dev": "^0.8.0",
     "grunt": "^0.4.5",
+    "grunt-contrib-clean": "^0.6.0",
     "grunt-contrib-requirejs": "^0.4.4",
+    "grunt-execute": "^0.2.2",
     "requirejs": "^2.1.15"
   },
   "keywords": [

+ 1 - 1
src/Benchfib.js

@@ -1,4 +1,4 @@
-define("amber/legacy/Benchfib", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
+define("amber/legacy/Benchfib", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('Benchfib');
 $core.packages["Benchfib"].innerEval = function (expr) { return eval(expr); };

+ 1 - 1
src/Examples.js

@@ -1,4 +1,4 @@
-define("amber/legacy/Examples", ["amber/boot", "amber/web/Web"], function($boot){
+define("amber/legacy/Examples", ["amber/boot", "amber/web/Web"], function($boot){"use strict";
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('Examples');
 $core.packages["Examples"].innerEval = function (expr) { return eval(expr); };

+ 1 - 1
src/IDE.js

@@ -6,7 +6,7 @@ define("amber/legacy/IDE", ["amber/boot"
 //>>excludeStart("imports", pragmas.excludeImports);
 
 //>>excludeEnd("imports");
-){
+){"use strict";
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('IDE');
 $core.packages["IDE"].innerEval = function (expr) { return eval(expr); };

+ 8 - 0
testing.js

@@ -0,0 +1,8 @@
+define([
+    './deploy',
+    'amber_core/SUnit',
+    // --- packages used only during automated testing begin here ---
+    // --- packages used only during automated testing end here ---
+], function (amber) {
+    return amber;
+});