Explorar o código

added files from amber-init

hhzl %!s(int64=10) %!d(string=hai) anos
pai
achega
dc215c6381

+ 91 - 23
processing/Gruntfile.js

@@ -1,23 +1,91 @@
-module.exports = function(grunt) {
-  grunt.loadNpmTasks('../../node_modules/amber-dev');
-
-  grunt.registerTask('default', ['amberc:processing']);
-
-  grunt.initConfig({
-    pkg: grunt.file.readJSON('../package.json'),
-
-    amberc: {  
-      options: {
-        amber_dir: '../bower_components/amber',
-        closure_jar: ''
-      },
-      processing: {
-        src: ['st/Processing-Examples.st'],
-        output_dir: 'js',
-        deploy: true,
-        amd_namespace: 'amber_examples_processing'
-      }
-    }
-  });
-
-}
+'use strict';
+
+module.exports = function (grunt) {
+    var path = require('path');
+
+    // 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('test', ['amberc:test_runner', 'execute:test_runner', 'clean:test_runner']);
+    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/ProcessingClock.st', // list all sources in dependency order
+                    'src/ProcessingClock-Tests.st' // list all tests in dependency order
+                ],
+                amd_namespace: 'amber-processingclock',
+                libraries: ['SUnit', 'Web']
+            },
+            test_runner: {
+                src: ['node_modules/amber-dev/lib/Test.st'],
+                libraries: [
+                    /* add dependencies packages here */
+                    'ProcessingClock', /* add other code-to-test packages here */
+                    'SUnit',
+                    'ProcessingClock-Tests' /* add other test packages here */
+                ],
+                main_class: 'NodeTestRunner',
+                output_name: 'test_runner'
+            }
+        },
+
+        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"
+            }}
+        },
+
+        execute: {
+            test_runner: {
+                src: ['test_runner.js']
+            }
+        },
+
+        clean: {
+            test_runner: ['test_runner.js']
+        }
+    });
+
+};

+ 22 - 0
processing/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
processing/README.md

@@ -0,0 +1,17 @@
+# Amber Processing Example
+
+Amber using th
+
+## 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

+ 36 - 0
processing/bower.json

@@ -0,0 +1,36 @@
+{
+  "name": "processingclock",
+  "description": "Amber using th",
+  "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",
+    "processing": "~1.4.8"
+  },
+  "devDependencies": {
+    "amber-ide-starter-dialog": "^0.1.0",
+    "helios": "^0.3.0"
+  }
+}

+ 8 - 0
processing/deploy.js

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

+ 9 - 0
processing/devel.js

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

+ 28 - 46
processing/index.html

@@ -1,48 +1,30 @@
-<!DOCTYPE html> 
-<html> 
-  <head> 
-    <title>using Processing.js with Amber Smalltalk</title> 
-    <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
-    <meta name="author" content="Stefan Krecher" /> 
-    <link rel="stylesheet" type="text/css" href='css/style.css' />
-    <link type="image/x-icon" rel="shortcut icon" href="/favicon.ico"/> 
-    <link href='http://fonts.googleapis.com/css?family=Istok+Web' rel='stylesheet' type='text/css'> 
-	<script type="text/javascript" src="../bower_components/amber/support/requirejs/require.min.js"></script>
-    <script type='text/javascript' src='../bower_components/amber/support/amber.js'></script>
-    <script type='text/javascript' src='showdown/showdown.js'></script>
-	<script type="text/javascript" src="processing-1.4.1.js"></script>
-  </head> 
-  <body> 
-	A Clock made with <a href="http://processingjs.org">Processing.js</a> and <a href="http://amber-lang.net/">Amber</a>
-	<p>Examine the <button onClick="buttonClick()"> ProcessingClock class</button></p> 
-	<p><canvas id="canvas1" width="200" height="200"></canvas></p>
-	<script id="script1" type="text/javascript">
-		var buttonClick;
-		// Simple way to attach js code to the canvas is by using a function
-		function sketchProc(processing) {
-			// Override draw function, by default it will be called 60 times per second
-			processing.draw = function() {};
-		}
+<!DOCTYPE html>
+<html>
 
-		var canvas = document.getElementById("canvas1");
-		// attaching the sketchProc function to the canvas
-		var p = new Processing(canvas, sketchProc);
-		require.config({
-			paths: {
-				'amber_examples_processing': 'js',
-				'amber_examples_processing/_source': 'st'
-			}
-		});
-		require(['amber/devel','amber_examples_processing/Processing-Examples'],function(smalltalk){
+  <head>
+    <title>Amber Processing Example</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>
 
-			smalltalk.defaultAmdNamespace = 'amber_examples_processing';
-			smalltalk.initialize();
-			buttonClick = function() {
-				smalltalk.Browser._openOn_(smalltalk.ProcessingClock);
-			};
-			smalltalk.ProcessingClock._init();
-		});
-	</script>
-	   	
-  </body> 
-</html> 
+  <body>
+  <p>Hi, hhzl! Welcome to Amber project: "Amber Processing Example".</p>
+  <p>This is the place for your application's HTML. After getting familiar with Amber,
+      just remove this welcome contents from index.html and replace it with your own.</p>
+  <button id="amber-with">Hello from TagBrush >> with:</button>
+  <button id="jquery-append">Hello from jQuery append</button>
+  <ol id="output-list"></ol>
+  <script type='text/javascript'>
+      require(['app'], function (amber) {
+          amber.initialize({
+            //used for all new packages in IDE
+            'transport.defaultAmdNamespace': "amber-processingclock"
+          });
+          require(["amber-ide-starter-dialog"], function (dlg) { dlg.start(); });
+          amber.globals.ProcessingClock._start();
+      });
+  </script>
+  </body>
+
+</html>

+ 5 - 0
processing/local.amd.json

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

+ 42 - 0
processing/package.json

@@ -0,0 +1,42 @@
+{
+  "name": "processingclock",
+  "title": "Amber Processing Example",
+  "description": "Amber using th",
+  "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.git"
+  },
+  "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": "grunt test"
+  },
+  "devDependencies": {
+    "amber-dev": "^0.2.3",
+    "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": [
+    "Amber",
+    "Smalltalk"
+  ]
+}