Browse Source

Initial commit.

amber init, adding domite dependency, cleaning.
Silk subclass of Domite.
Herbert Vojčík 10 năm trước cách đây
commit
7d97f574b8
14 tập tin đã thay đổi với 312 bổ sung0 xóa
  1. 7 0
      .gitignore
  2. 91 0
      Gruntfile.js
  3. 22 0
      LICENSE-MIT
  4. 36 0
      README.md
  5. 38 0
      bower.json
  6. 8 0
      deploy.js
  7. 12 0
      devel.js
  8. 23 0
      index.html
  9. 5 0
      local.amd.json
  10. 42 0
      package.json
  11. 9 0
      src/Silk-Tests.js
  12. 5 0
      src/Silk-Tests.st
  13. 9 0
      src/Silk.js
  14. 5 0
      src/Silk.st

+ 7 - 0
.gitignore

@@ -0,0 +1,7 @@
+/node_modules/
+/bower_components/
+
+/test_runner.js
+
+/config.js
+/the.js

+ 91 - 0
Gruntfile.js

@@ -0,0 +1,91 @@
+'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', 'bower_components/amber/contrib/src', 'bower_components/domite/src'],
+                closure_jar: ''
+            },
+            all: {
+                src: [
+                    'src/Silk.st', // list all sources in dependency order
+                    'src/Silk-Tests.st' // list all tests in dependency order
+                ],
+                amd_namespace: 'silk',
+                libraries: ['SUnit', 'DOMite']
+            },
+            test_runner: {
+                src: ['node_modules/amber-dev/lib/Test.st'],
+                libraries: [
+                    /* add dependencies packages here */
+                    'Silk', /* add other code-to-test packages here */
+                    'SUnit',
+                    'Silk-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
LICENSE-MIT

@@ -0,0 +1,22 @@
+Copyright (c) 2015 Herbert Vojčík
+
+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.

+ 36 - 0
README.md

@@ -0,0 +1,36 @@
+# Stream-based Seaside-inspired in-page Web framework
+
+Stream-based, Seaside-inspired framework
+for creating and manipulating contents of a page.
+For Amber Smalltalk.
+
+Based on https://github.com/amber-smalltalk/domite,
+created as an alternative to existing Web package
+present in Amber.
+
+## Getting Started
+
+If not already present, create a project
+in an empty directory with `amber init`.
+
+In a project, `bower install silk --save`.
+
+Start development server with `amber serve`
+and go to `http://localhost:4000/` in your browser.
+
+In all packages that uses Silk, add `'silk/Silk'`
+to the package imports.
+
+## Conrtibuting
+
+To bring 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

+ 38 - 0
bower.json

@@ -0,0 +1,38 @@
+{
+  "name": "silk",
+  "description": "Stream-based, Seaside-inspired framework for creating and manipulating contents of a page. For Amber Smalltalk.",
+  "version": "0.1.0",
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "/*.js",
+    "/*.html",
+    "test",
+    "tests"
+  ],
+  "authors": [
+    {
+      "name": "Herbert Vojčík",
+      "email": "herby@mailbox.sk"
+    }
+  ],
+  "homepage": "https://github.com/herby/silk",
+  "keywords": [
+    "Amber",
+    "Smalltalk"
+  ],
+  "license": [
+    "MIT"
+  ],
+  "private": false,
+  "dependencies": {
+    "amber": ">=0.14.12",
+    "domite": "^0.2.2"
+  },
+  "devDependencies": {
+    "amber-ide-starter-dialog": "^0.1.0",
+    "amber-attic": "^0.1.5",
+    "helios": "^0.4.0"
+  }
+}

+ 8 - 0
deploy.js

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

+ 12 - 0
devel.js

@@ -0,0 +1,12 @@
+define([
+    'amber/devel',
+    './deploy',
+    // --- packages used only during development begin here ---
+    'silk/Silk-Tests',
+    'amber-attic/Benchfib',
+    'amber-attic/Examples',
+    'amber-attic/IDE'
+    // --- packages used only during development end here ---
+], function (amber) {
+    return amber;
+});

+ 23 - 0
index.html

@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+
+  <head>
+    <title>Stream-based Seaside-inspired in-page Web framework</title>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <meta name="author" content="Herbert Vojčík" />
+    <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': "silk"
+          });
+          require(["amber-ide-starter-dialog"], function (dlg) { dlg.start(); });
+      });
+  </script>
+  </body>
+
+</html>

+ 5 - 0
local.amd.json

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

+ 42 - 0
package.json

@@ -0,0 +1,42 @@
+{
+  "name": "silk",
+  "title": "Stream-based Seaside-inspired in-page Web framework",
+  "description": "Stream-based, Seaside-inspired framework for creating and manipulating contents of a page. For Amber Smalltalk.",
+  "version": "0.1.0",
+  "homepage": "https://github.com/herby/silk",
+  "author": {
+    "name": "Herbert Vojčík",
+    "email": "herby@mailbox.sk"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/herby/silk"
+  },
+  "bugs": {
+    "url": "https://github.com/herby/silk/issues"
+  },
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "https://github.com/herby/silk/blob/master/LICENSE-MIT"
+    }
+  ],
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "scripts": {
+    "test": "grunt test"
+  },
+  "devDependencies": {
+    "amber-dev": "^0.4.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": [
+    "Amber",
+    "Smalltalk"
+  ]
+}

+ 9 - 0
src/Silk-Tests.js

@@ -0,0 +1,9 @@
+define("silk/Silk-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
+var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
+$core.addPackage('Silk-Tests');
+$core.packages["Silk-Tests"].innerEval = function (expr) { return eval(expr); };
+$core.packages["Silk-Tests"].transport = {"type":"amd","amdNamespace":"silk"};
+
+$core.addClass('SilkTest', $globals.TestCase, [], 'Silk-Tests');
+
+});

+ 5 - 0
src/Silk-Tests.st

@@ -0,0 +1,5 @@
+Smalltalk createPackage: 'Silk-Tests'!
+TestCase subclass: #SilkTest
+	instanceVariableNames: ''
+	package: 'Silk-Tests'!
+

+ 9 - 0
src/Silk.js

@@ -0,0 +1,9 @@
+define("silk/Silk", ["amber/boot", "domite/DOMite"], function($boot){
+var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
+$core.addPackage('Silk');
+$core.packages["Silk"].innerEval = function (expr) { return eval(expr); };
+$core.packages["Silk"].transport = {"type":"amd","amdNamespace":"silk"};
+
+$core.addClass('Silk', $globals.Domite, [], 'Silk');
+
+});

+ 5 - 0
src/Silk.st

@@ -0,0 +1,5 @@
+Smalltalk createPackage: 'Silk'!
+Domite subclass: #Silk
+	instanceVariableNames: ''
+	package: 'Silk'!
+