Browse Source

migration to amber 0.14.17

Herbert Vojčík 2 years ago
parent
commit
9f7ee8c123
11 changed files with 107 additions and 54 deletions
  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) {
13 13
 }
14 14
 
15 15
 module.exports = function (grunt) {
16
-    var path = require('path');
16
+    var helpers = require('amber-dev/lib/helpers');
17 17
 
18 18
     // These plugins provide necessary tasks.
19
+    grunt.loadNpmTasks('grunt-contrib-clean');
19 20
     grunt.loadNpmTasks('grunt-contrib-requirejs');
21
+    grunt.loadNpmTasks('grunt-execute');
20 22
     grunt.loadNpmTasks('amber-dev');
21 23
 
22 24
     // Default task.
23
-    grunt.registerTask('default', ['amberc:all']);
25
+    grunt.registerTask('default', ['amdconfig:app', 'amberc:all']);
26
+    grunt.registerTask('test', ['amdconfig:app', 'requirejs:test_runner', 'execute:test_runner', 'clean:test_runner']);
24 27
     grunt.registerTask('devel', ['amdconfig:app', 'requirejs:devel']);
25 28
     grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy']);
26 29
 
@@ -29,16 +32,15 @@ module.exports = function (grunt) {
29 32
         // Metadata.
30 33
         // pkg: grunt.file.readJSON(''),
31 34
         banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
32
-            '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
33
-            '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
34
-            '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
35
-            ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
35
+        '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
36
+        '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
37
+        '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
38
+        ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
36 39
         // task configuration
37 40
         amberc: {
38 41
             options: {
39 42
                 amber_dir: findAmberPath(['../..', 'bower_components/amber']),
40
-                library_dirs: ['src'],
41
-                closure_jar: ''
43
+                configFile: "config.js"
42 44
             },
43 45
             all: {
44 46
                 src: [
@@ -46,35 +48,76 @@ module.exports = function (grunt) {
46 48
                     // list all tests in dependency order
47 49
                 ],
48 50
                 amd_namespace: 'amber/legacy',
49
-                libraries: ['Web']
51
+                libraries: ['amber/web/Web']
50 52
             }
51 53
         },
52 54
 
53 55
         amdconfig: {app: {dest: 'config.js'}},
54 56
 
55 57
         requirejs: {
56
-            deploy: {options: {
57
-                mainConfigFile: "config.js",
58
-                onBuildWrite: function (moduleName, path, contents) {
59
-                    return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'deploy'}}});" : contents;
60
-                },
61
-                pragmas: {
62
-                    excludeIdeData: true,
63
-                    excludeDebugContexts: true
64
-                },
65
-                include: ['config', 'node_modules/requirejs/require', 'deploy'],
66
-                out: "the.js"
67
-            }},
68
-            devel: {options: {
69
-                mainConfigFile: "config.js",
70
-                onBuildWrite: function (moduleName, path, contents) {
71
-                    return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'devel'}}});" : contents;
72
-                },
73
-                include: ['config', 'node_modules/requirejs/require'],
74
-                out: "the.js"
75
-            }}
76
-        }
58
+            options: {
59
+                useStrict: true
60
+            },
61
+            deploy: {
62
+                options: {
63
+                    mainConfigFile: "config.js",
64
+                    rawText: {
65
+                        "amber/Platform": '/*stub*/',
66
+                        "app": 'define(["deploy"],function(x){return x});define("amber/Platform",["amber_core/Platform-Browser"],{});'
67
+                    },
68
+                    pragmas: {
69
+                        excludeIdeData: true,
70
+                        excludeDebugContexts: true
71
+                    },
72
+                    include: ['config', 'node_modules/requirejs/require', 'app'],
73
+                    out: "the.js"
74
+                }
75
+            },
76
+            devel: {
77
+                options: {
78
+                    mainConfigFile: "config.js",
79
+                    rawText: {
80
+                        "amber/Platform": '/*stub*/',
81
+                        "app": 'define(["devel"],function(x){return x});define("amber/Platform",["amber_core/Platform-Browser"],{});'
82
+                    },
83
+                    include: ['config', 'node_modules/requirejs/require', 'app'],
84
+                    exclude: ['devel'],
85
+                    out: "the.js"
86
+                }
87
+            },
88
+            test_runner: {
89
+                options: {
90
+                    mainConfigFile: "config.js",
91
+                    rawText: {
92
+                        "app": "(" + function () {
93
+                            define(["testing", "amber_devkit/NodeTestRunner"], function (amber) {
94
+                                amber.initialize();
95
+                                amber.globals.NodeTestRunner._main();
96
+                            });
97
+                        } + "());"
98
+                    },
99
+                    paths: {"amber_devkit": helpers.libPath},
100
+                    pragmas: {
101
+                        excludeIdeData: true
102
+                    },
103
+                    include: ['config-node', 'app'],
104
+                    insertRequire: ['app'],
105
+                    optimize: "none",
106
+                    wrap: helpers.nodeWrapperWithShebang,
107
+                    out: "test_runner.js"
108
+                }
109
+            }
110
+        },
77 111
 
112
+        execute: {
113
+            test_runner: {
114
+                src: ['test_runner.js']
115
+            }
116
+        },
117
+
118
+        clean: {
119
+            test_runner: ['test_runner.js']
120
+        }
78 121
     });
79 122
 
80 123
 };

+ 1 - 1
LICENSE-MIT

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

+ 5 - 11
bower.json

@@ -6,19 +6,12 @@
6 6
         "**/.*",
7 7
         "node_modules",
8 8
         "bower_components",
9
-        "/test_runner.js",
10
-        "/config.js",
11
-        "/the.js",
9
+        "/*.js",
10
+        "/*.html",
12 11
         "test",
13 12
         "tests"
14 13
     ],
15
-    "authors": [
16
-        {
17
-            "name": "Herbert Vojčík",
18
-            "email": "herby@mailbox.sk"
19
-        }
20
-    ],
21
-    "homepage": "",
14
+    "homepage": "https://github.com/amber-smalltalk/amber-contrib-legacy",
22 15
     "keywords": [
23 16
         "Amber",
24 17
         "Smalltalk"
@@ -35,7 +28,8 @@
35 28
         "require-css": "^0.1.2"
36 29
     },
37 30
     "devDependencies": {
31
+        "amber": ">=0.14.17",
38 32
         "amber-ide-starter-dialog": "^0.1.0",
39
-        "helios": ">=0.5.0"
33
+        "helios": ">=0.5.3"
40 34
     }
41 35
 }

+ 7 - 0
config-node.js

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

+ 1 - 1
devel.js

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

+ 1 - 1
index.html

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

+ 8 - 7
package.json

@@ -3,15 +3,14 @@
3 3
   "title": "Amber legacy items",
4 4
   "description": "Legacy IDE and a few other old non-core packages",
5 5
   "version": "0.2.1",
6
-  "homepage": "",
7
-  "author": {
8
-    "name": "Herbert Vojčík",
9
-    "email": "herby@mailbox.sk"
10
-  },
6
+  "homepage": "https://github.com/amber-smalltalk/amber-contrib-legacy",
11 7
   "repository": {
12 8
     "type": "git",
13 9
     "url": "git://github.com/amber-smalltalk/amber-contrib-legacy.git"
14 10
   },
11
+  "bugs": {
12
+    "url": "https://github.com/amber-smalltalk/amber-contrib-legacy/issues"
13
+  },
15 14
   "licenses": [
16 15
     {
17 16
       "type": "MIT",
@@ -19,15 +18,17 @@
19 18
     }
20 19
   ],
21 20
   "engines": {
22
-    "node": ">=0.10.0"
21
+    "node": "0.10.x || 0.12.x || >=4.0.0"
23 22
   },
24 23
   "scripts": {
25 24
     "test": "grunt test"
26 25
   },
27 26
   "devDependencies": {
28
-    "amber-dev": "^0.5.0",
27
+    "amber-dev": "^0.8.0",
29 28
     "grunt": "^0.4.5",
29
+    "grunt-contrib-clean": "^0.6.0",
30 30
     "grunt-contrib-requirejs": "^0.4.4",
31
+    "grunt-execute": "^0.2.2",
31 32
     "requirejs": "^2.1.15"
32 33
   },
33 34
   "keywords": [

+ 1 - 1
src/Benchfib.js

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

+ 1 - 1
src/Examples.js

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

+ 1 - 1
src/IDE.js

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

+ 8 - 0
testing.js

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