Browse Source

new files from amber init, mod

hhzl 9 years ago
parent
commit
aa3a2fd559

+ 62 - 20
trysmalltalk/Gruntfile.js

@@ -1,24 +1,66 @@
-module.exports = function(grunt) {
-  grunt.loadNpmTasks('../../node_modules/amber-dev');
+'use strict';
 
-  grunt.registerTask('default', ['amberc:trysmalltalk']);
+module.exports = function (grunt) {
+    var path = require('path');
 
-  grunt.initConfig({
-    pkg: grunt.file.readJSON('../package.json'),
+    // These plugins provide necessary tasks.
+    grunt.loadNpmTasks('grunt-contrib-requirejs');
+    grunt.loadNpmTasks('amber-dev');
 
-    amberc: {  
-      options: {
-        amber_dir: '../bower_components/amber',
-        closure_jar: ''
-      },
-      trysmalltalk: {
-        src: ['st/TrySmalltalk.st'],
-        libraries: ['Web'],
-        output_dir: 'js',
-        deploy: true,
-        amd_namespace: 'amber_examples_profstef'
-      }
-    }
-  });
+    // Default task.
+    grunt.registerTask('default', ['amberc:all']);
+    grunt.registerTask('devel', ['amdconfig:app', 'requirejs:devel']);
+    grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy']);
 
-}
+    // Project configuration.
+    grunt.initConfig({
+        // 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',
+        // task configuration
+        amberc: {
+            options: {
+                amber_dir: path.join(__dirname, "bower_components", "amber"),
+                library_dirs: ['src'],
+                closure_jar: ''
+            },
+            all: {
+                src: [
+                    'src/TrySmalltalk.st', // list all sources in dependency order
+                ],
+                amd_namespace: 'amber-trysmalltalk',
+                libraries: ['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"
+            }}
+        }
+    });
+
+};

+ 22 - 0
trysmalltalk/LICENSE-MIT

@@ -0,0 +1,22 @@
+Copyright (c) 2014 hhzl
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.

+ 17 - 0
trysmalltalk/README.md

@@ -0,0 +1,17 @@
+# TrySmalltalk
+
+Tutorial to learn Smalltalk
+
+## Getting Started
+
+Brought project alive (for example after `git clone`):
+
+```sh
+npm install
+bower install
+grunt devel
+```
+
+Developing the project (after brought alive):
+ 
+Start server with `amber serve` and go to `http://localhost:4000/` in your browser and follow the instructions

+ 35 - 0
trysmalltalk/bower.json

@@ -0,0 +1,35 @@
+{
+    "name": "trysmalltalk",
+    "description": "Tutorial to learn Smalltalk",
+    "version": "0.1.0",
+    "ignore": [
+        "**/.*",
+        "node_modules",
+        "bower_components",
+        "/test_runner.js",
+        "test",
+        "tests"
+    ],
+    "authors": [
+        {
+            "name": "hhzl",
+            "email": "hannes.hirzel@gmail.com"
+        }
+    ],
+    "homepage": "https://github.com/amber-smalltalk/amber-examples",
+    "keywords": [
+        "Amber",
+        "Smalltalk"
+    ],
+    "license": [
+        "MIT"
+    ],
+    "private": false,
+    "dependencies": {
+        "amber": "^0.13.2"
+    },
+    "devDependencies": {
+        "amber-ide-starter-dialog": "^0.1.0",
+        "helios": "^0.3.0"
+    }
+}

+ 60 - 0
trysmalltalk/config.js

@@ -0,0 +1,60 @@
+/* DO NOT EDIT! This file is generated. */
+
+var require;
+if (!require) require = {config: function (x) {require = x;}};
+require.config({
+  "paths": {
+    "require-css": "bower_components/require-css",
+    "jquery": "bower_components/jquery/jquery",
+    "jquery-ui": "bower_components/jquery-ui/jquery-ui",
+    "amber_lib/es5-shim": "bower_components/es5-shim",
+    "codemirror": "bower_components/codemirror",
+    "mousetrap": "bower_components/mousetrap/mousetrap",
+    "jquery.blockUI": "bower_components/blockui/jquery.blockUI",
+    "helios/showdown": "bower_components/showdown/src/showdown",
+    "requireJS": "node_modules/requirejs/require",
+    "bootstrap2.3.2": "bower_components/bootstrap2.3.2/bootstrap",
+    "amber": "bower_components/amber/support",
+    "amber_vm": "bower_components/amber/support/deprecated-vm-files",
+    "amber_vm/_st": "bower_components/amber/support/deprecated-vm-files/as-receiver",
+    "amber_css": "bower_components/amber/support/resources",
+    "amber_core": "bower_components/amber/src",
+    "amber-ide-starter-dialog": "bower_components/amber-ide-starter-dialog/lib/idestarter",
+    "helios": "bower_components/helios/src",
+    "helios/resources": "bower_components/helios/resources",
+    "helios/index": "bower_components/helios/index",
+    "amber-trysmalltalk": "src"
+  },
+  "map": {
+    "*": {
+      "css": "require-css/css"
+    }
+  },
+  "shim": {
+    "jquery-ui": {
+      "deps": [
+        "jquery",
+        "jquery"
+      ]
+    },
+    "codemirror/lib/codemirror": {
+      "deps": [
+        "css!codemirror/lib/codemirror",
+        "css!codemirror/lib/codemirror"
+      ]
+    },
+    "bootstrap2.3.2/js/bootstrap": {
+      "deps": [
+        "jquery",
+        "css!bootstrap2.3.2/css/bootstrap"
+      ]
+    },
+    "ensure-console": {
+      "exports": "console"
+    }
+  },
+  "rjs_comment1": "require.min should be removed",
+  "rjs_comment2": "it's backward compatibility hack if config finds",
+  "rjs_comment3": "support/requirejs before node_modules/requirejs;",
+  "rjs_comment4": "the former will go away in 0.14.0"
+});

+ 8 - 0
trysmalltalk/deploy.js

@@ -0,0 +1,8 @@
+define([
+    'amber/deploy',
+    // --- packages to be deployed begin here ---
+    'amber-trysmalltalk/TrySmalltalk'
+    // --- packages to be deployed end here ---
+], function (amber) {
+    return amber;
+});

+ 8 - 0
trysmalltalk/devel.js

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

+ 20 - 21
trysmalltalk/index.html

@@ -1,25 +1,24 @@
+<!DOCTYPE html>
 <html>
-<head>
-<title>TrySmalltalk</title>
-<script src="../bower_components/amber/support/requirejs/require.min.js" type="text/javascript"></script>
-<script src="../bower_components/amber/support/amber.js" type="text/javascript"></script>
-</head>
-<body>
-<script type="text/javascript"> 
-	require.config({
-		paths: {
-			'amber_examples_profstef': 'js',
-			'amber_examples_profstef/_source': 'st'
-		}
-	});
-	require(['amber/devel','amber_examples_profstef/TrySmalltalk'],function(smalltalk) {
-		smalltalk.defaultAmdNamespace = 'amber_examples_profstef';
-		smalltalk.initialize();
-		smalltalk.Browser._openOn_(smalltalk.ProfStef);
-		smalltalk.TrySmalltalkWidget._open();
 
-	});
-</script>
+  <head>
+    <title>TrySmalltalk</title>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <meta name="author" content="hhzl" />
+    <script type='text/javascript' src='the.js'></script>
+  </head>
+
+  <body>
+  <script type='text/javascript'>
+      require(['app'], function (amber) {
+          amber.initialize({
+            //used for all new packages in IDE
+            'transport.defaultAmdNamespace': "amber-trysmalltalk"
+          });
+          require(["amber-ide-starter-dialog"], function (dlg) { dlg.start(); });
+          amber.globals.TrySmalltalkWidget._open();   // Trysmalltalk._start();
+      });
+  </script>
+  </body>
 
-</body>
 </html>

+ 5 - 0
trysmalltalk/local.amd.json

@@ -0,0 +1,5 @@
+{
+    "paths": {
+        "amber-trysmalltalk": "src"
+    }
+}

+ 40 - 0
trysmalltalk/package.json

@@ -0,0 +1,40 @@
+{
+  "name": "trysmalltalk",
+  "title": "TrySmalltalk",
+  "description": "Tutorial to learn Smalltalk",
+  "version": "0.1.0",
+  "homepage": "https://github.com/amber-smalltalk/amber-examples",
+  "author": {
+    "name": "",
+    "email": ""
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/amber-smalltalk/amber-examples"
+  },
+  "bugs": {
+    "url": "https://github.com/amber-smalltalk/amber-examples/issues"
+  },
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "https://github.com/amber-smalltalk/amber-examples/blob/master/LICENSE-MIT"
+    }
+  ],
+  "engines": {
+    "node": ">= 0.8.0"
+  },
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "devDependencies": {
+    "amber-dev": "^0.2.3",
+    "grunt": "^0.4.5",
+    "grunt-contrib-requirejs": "^0.4.4",
+    "requirejs": "^2.1.15"
+  },
+  "keywords": [
+    "Amber",
+    "Smalltalk"
+  ]
+}