couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From met...@apache.org
Subject [08/10] git commit: updated refs/heads/master to 88c3171
Date Thu, 04 Apr 2013 13:22:16 GMT
fix broken addon task


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/1fb22598
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/1fb22598
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/1fb22598

Branch: refs/heads/master
Commit: 1fb225985dfd3c83ac4eebfc6aaf2d06ce46800c
Parents: e14abfd
Author: Simon Metson <metson@apache.org>
Authored: Thu Apr 4 13:08:21 2013 +0100
Committer: Simon Metson <metson@apache.org>
Committed: Thu Apr 4 13:09:15 2013 +0100

----------------------------------------------------------------------
 license.skip                                       |    1 +
 src/fauxton/package.json                           |   49 ++--------
 src/fauxton/tasks/addon/rename.json                |    5 +
 src/fauxton/tasks/addon/root/base.js.underscore    |   21 ++++
 .../tasks/addon/root/resources.js.underscore       |   21 ++++
 src/fauxton/tasks/addon/root/route.js.underscore   |   21 ++++
 src/fauxton/tasks/addon/template.js                |   70 +++++++++++++
 src/fauxton/tasks/fauxton.js                       |   78 ---------------
 src/fauxton/tasks/templates/base.js.underscore     |   21 ----
 .../tasks/templates/resources.js.underscore        |   21 ----
 src/fauxton/tasks/templates/route.js.underscore    |   21 ----
 src/fauxton/writing_addons.md                      |   14 ++--
 12 files changed, 154 insertions(+), 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/license.skip
----------------------------------------------------------------------
diff --git a/license.skip b/license.skip
index 7c1f783..291e51d 100644
--- a/license.skip
+++ b/license.skip
@@ -113,6 +113,7 @@
 ^src/fauxton/TODO.md
 ^src/fauxton/settings.json.*
 ^src/fauxton/test/.*
+^src/fauxton/tasks/rename.json
 ^src/ibrowse/.*
 ^src/mochiweb/.*
 ^src/snappy/.*

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/package.json
----------------------------------------------------------------------
diff --git a/src/fauxton/package.json b/src/fauxton/package.json
index 75d7c63..a6d746c 100644
--- a/src/fauxton/package.json
+++ b/src/fauxton/package.json
@@ -1,42 +1,9 @@
 {
-  "name": "fauxton",
-  "version": "0.1.0",
-  "description": "Fauxton is a modular CouchDB dashboard and Futon replacement.",
-  "main": "grunt.js",
-  "directories": {
-    "test": "test"
-  },
-  "dependencies": {
-    "async": "~0.2.6",
-    "grunt": "~0.4.1",
-    "grunt-cli": "~0.1.6",
-    "couchapp": "~0.9.1",
-    "grunt-contrib": "~0.5.0",
-    "grunt-contrib-cssmin": "~0.5.0",
-    "grunt-contrib-uglify": "~0.2.0",
-    "grunt-couchapp": "~0.1.0",
-    "grunt-exec": "~0.4.0",
-    "grunt-jasmine-task": "~0.2.3",
-    "grunt-requirejs": "~0.3.3",
-    "underscore": "~1.4.2",
-    "url": "~0.7.9",
-    "urls": "~0.0.3",
-    "express": "~3.0.6",
-    "http-proxy": "~0.9.1"
-  },
-  "devDependencies": {},
-  "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://git-wip-us.apache.org/repos/asf/couchdb.git"
-  },
-  "keywords": [
-    "couchdb",
-    "futon",
-    "fauxton"
-  ],
-  "author": "",
-  "license": "Apache V2"
-}
+  "name": "WickedCool",
+  "licenses": [
+    {
+      "type": "Apache",
+      "url": "undefined/blob/master/LICENSE-Apache"
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/tasks/addon/rename.json
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/addon/rename.json b/src/fauxton/tasks/addon/rename.json
new file mode 100644
index 0000000..1f326e9
--- /dev/null
+++ b/src/fauxton/tasks/addon/rename.json
@@ -0,0 +1,5 @@
+{
+  "route.js.underscore": "{%= path %}/{%= name.toLowerCase() %}/route.js",
+  "resources.js.underscore": "{%= path %}/{%= name.toLowerCase() %}/resources.js",
+  "base.js.underscore": "{%= path %}/{%= name.toLowerCase() %}/base.js"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/tasks/addon/root/base.js.underscore
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/addon/root/base.js.underscore b/src/fauxton/tasks/addon/root/base.js.underscore
new file mode 100644
index 0000000..d002cd5
--- /dev/null
+++ b/src/fauxton/tasks/addon/root/base.js.underscore
@@ -0,0 +1,21 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+  "app",
+  "api",
+  "addons/{%= name.toLowerCase() %}/routes"
+],
+
+function(app, FauxtonAPI, {%= name %}) {
+  return {%= name %};
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/tasks/addon/root/resources.js.underscore
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/addon/root/resources.js.underscore b/src/fauxton/tasks/addon/root/resources.js.underscore
new file mode 100644
index 0000000..8d0ef32
--- /dev/null
+++ b/src/fauxton/tasks/addon/root/resources.js.underscore
@@ -0,0 +1,21 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+  "app",
+  "api"
+],
+
+function (app, FauxtonAPI) {
+  var {%= name %} = FauxtonAPI.addon();
+  return {%= name %};
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/tasks/addon/root/route.js.underscore
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/addon/root/route.js.underscore b/src/fauxton/tasks/addon/root/route.js.underscore
new file mode 100644
index 0000000..859e5bb
--- /dev/null
+++ b/src/fauxton/tasks/addon/root/route.js.underscore
@@ -0,0 +1,21 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+  "app",
+  "api",
+  "addons/{%= name.toLowerCase() %}/resources"
+],
+function(app, FauxtonAPI, {%= name %}) {
+  {%= name %}.Routes = {};
+  return {%= name %};
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/tasks/addon/template.js
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/addon/template.js b/src/fauxton/tasks/addon/template.js
new file mode 100644
index 0000000..459ff34
--- /dev/null
+++ b/src/fauxton/tasks/addon/template.js
@@ -0,0 +1,70 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+'use strict';
+
+exports.description = 'Generate a skeleton for an addon.';
+
+exports.notes = '';
+
+exports.after = "Created your addon! Don't forget to update your"+
+                " settings.json for it to be compiled and deployed";
+
+// Any existing file or directory matching this wildcard will cause a warning.
+// exports.warnOn = '*';
+
+// The actual init template.
+exports.template = function(grunt, init, done) {
+
+  // destpath
+  init.process(
+    {},
+    [
+      {
+        name: "name",
+        message: "Add on Name",
+        validator: /^[\w\-\.]+$/,
+        default: "WickedCool"
+      },
+      {
+        name: "path",
+        message: "Location of add ons",
+        default: "app/addons"
+      },
+      {
+        name: "assets",
+        message: "Do you need an assets folder? (for .less)",
+        default: 'y/N'
+      }
+    ],
+    function (err, props) {
+      // Files to copy (and process).
+      var files = init.filesToCopy(props);
+
+      // Actually copy and process (apply the template props) files.
+      init.copyAndProcess(files, props);
+
+      // Make the assets dir if requested
+      if (props.assets == "y"){
+        var asspath = props.path + "/" + props.name.toLowerCase() + "/assets";
+        grunt.file.mkdir(asspath);
+        grunt.log.writeln("Created " + asspath);
+      }
+
+      var tmplpath = props.path + "/" + props.name.toLowerCase() + "/templates";
+      grunt.file.mkdir(tmplpath);
+      grunt.log.writeln("Created " + tmplpath);
+      // All done!
+      done();
+    }
+  )
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/tasks/fauxton.js
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/fauxton.js b/src/fauxton/tasks/fauxton.js
index b718fea..a26f9f8 100644
--- a/src/fauxton/tasks/fauxton.js
+++ b/src/fauxton/tasks/fauxton.js
@@ -10,86 +10,8 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-// var prompt = require('prompt');
-
 module.exports = function(grunt) {
   var _ = grunt.util._;
-  var prompts = [
-    {
-      name: "name",
-      message: "Add on Name",
-      validator: /^[\w\-\.]+$/,
-      default: "WickedCool"
-    },
-    {
-      name: "path",
-      message: "Location of add ons",
-      default: "app/addons"
-    },
-    {
-      name: "assets",
-      message: "Do you need an assets folder? (for .less)",
-      default: 'y/N'
-    }
-  ];
-
-  addonTemplates = [
-    {
-      name: 'base',
-      filename: 'base.js',
-      template: grunt.file.read('./tasks/templates/base.js.underscore')
-    },
-    {
-      name: 'resources',
-      filename: 'resources.js',
-      template: grunt.file.read('./tasks/templates/resources.js.underscore')
-    },
-    {
-      name: 'routes',
-      filename: 'routes.js',
-      template: grunt.file.read('./tasks/templates/route.js.underscore')
-    }
-  ];
-
-  // Create a new task.
-  grunt.registerInitTask('addon', 'Generate a skeleton for an addon"', function() {
-    var done = this.async();
-    grunt.helper('prompt', {}, prompts, function (err, result) {
-      if (err) { return onErr(err); }
-      grunt.log.writeln(result.assets);
-      var module = result.name,
-          assets = result.assets;
-      if (assets == 'y') {
-        //if you need an assets folder
-        filepath = result.path + '/' + module.toLowerCase() + '/assets/less';
-        grunt.file.mkdir(filepath);
-        lessfile = {
-          name: 'less',
-          filename: module.toLowerCase()+'.less',
-          template: '//<%= module %> styles'
-        };
-        lessfile.module = module.charAt(0).toUpperCase() + module.substr(1);
-        var content = grunt.template.process(lessfile.template, lessfile);
-        grunt.file.write(filepath + '/' + lessfile.filename, content);
-      }
-      filepath = result.path + '/' + module.toLowerCase() + '/templates';
-      grunt.file.mkdir(filepath);
-      filepath = result.path + '/' + module.toLowerCase();
-      _.each(addonTemplates, function(file){
-        file.module = module.charAt(0).toUpperCase() + module.substr(1);
-        var content = grunt.template.process(file.template, file);
-        grunt.file.write(filepath + '/' + file.filename, content);
-      });
-      grunt.log.writeln('Created addon ' + result.name + ' in ' + result.path);
-      grunt.log.writeln('\n\nAdd ' + result.name + ' to settings.json for it to be compiled
and deployed');
-      done();
-    });
-    function onErr(err) {
-      grunt.log.writeln(err);
-      done();
-      return 1;
-    }
-  });
 
   grunt.registerMultiTask('template', 'generates an html file from a specified template',
function(){
     var data = this.data;

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/tasks/templates/base.js.underscore
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/templates/base.js.underscore b/src/fauxton/tasks/templates/base.js.underscore
deleted file mode 100644
index cf7afa7..0000000
--- a/src/fauxton/tasks/templates/base.js.underscore
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-define([
-  "app",
-  "api",
-  "addons/<%= module.toLowerCase() %>/routes"
-],
-
-function(app, FauxtonAPI, <%= module %>) {
-  return <%= module %>;
-});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/tasks/templates/resources.js.underscore
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/templates/resources.js.underscore b/src/fauxton/tasks/templates/resources.js.underscore
deleted file mode 100644
index 0aa37f8..0000000
--- a/src/fauxton/tasks/templates/resources.js.underscore
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-define([
-  "app",
-  "api"
-],
-
-function (app, FauxtonAPI) {
-  var <%= module %> = FauxtonAPI.addon();
-  return <%= module %>;
-});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/tasks/templates/route.js.underscore
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/templates/route.js.underscore b/src/fauxton/tasks/templates/route.js.underscore
deleted file mode 100644
index 9256766..0000000
--- a/src/fauxton/tasks/templates/route.js.underscore
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-define([
-  "app",
-  "api", 
-  "addons/<%= module.toLowerCase() %>/resources"
-],
-function(app, FauxtonAPI, <%= module %>) {
-  <%= module %>.Routes = {};
-  return <%= module %>;
-});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1fb22598/src/fauxton/writing_addons.md
----------------------------------------------------------------------
diff --git a/src/fauxton/writing_addons.md b/src/fauxton/writing_addons.md
index ccd09af..e0a85fa 100644
--- a/src/fauxton/writing_addons.md
+++ b/src/fauxton/writing_addons.md
@@ -11,14 +11,14 @@ have the following structure:
 
  [optional]
  * assets/less
-   * my_addon.less 
+   * my_addon.less
 
 ## Generating an addon
-We have a grunt task that lets you create a skeleton addon, including all the
-boiler plate code. Run `bbb addon` and answer the questions it asks to create
-an addon:
+We have a `grunt-init` template that lets you create a skeleton addon,
+including all the boiler plate code. Run `grunt-init tasks/addon` and answer
+the questions it asks to create an addon:
 
-    ± bbb addon
+    ± grunt-init tasks/addon
     path.existsSync is now called `fs.existsSync`.
     Running "addon" task
 
@@ -32,8 +32,8 @@ an addon:
 
     Done, without errors.
 
-Once the addon is created add the name to the settings.json file to get it compiled
-and added on the next install.
+Once the addon is created add the name to the settings.json file to get it
+compiled and added on the next install.
 
 ## Routes and hooks
 An addon can insert itself into fauxton in two ways; via a route or via a hook.


Mime
View raw message