Permalink
Browse files

startup script done with documentations

  • Loading branch information...
1 parent 01e42af commit aae0c31c74d3215c17bc1a61c41d6608bea1b3e9 @yssk22 committed May 14, 2011
Showing with 225 additions and 57 deletions.
  1. BIN apps/posts/_attachments/css/images/archive-link.png
  2. BIN apps/posts/_attachments/css/images/draft.png
  3. BIN apps/posts/_attachments/css/images/permalink.png
  4. BIN apps/posts/_attachments/css/images/posts-admin.png
  5. BIN apps/posts/_attachments/css/images/posts-delete.png
  6. BIN apps/posts/_attachments/css/images/posts-edit.png
  7. BIN apps/posts/_attachments/css/images/posts-new.png
  8. BIN apps/posts/_attachments/css/images/tag-link.png
  9. BIN apps/posts/_attachments/css/images/time.png
  10. 0 apps/posts/scripts/generator.js
  11. BIN apps/system/_attachments/css/images/user-undefined.png
  12. +108 −26 bin/create.js
  13. +6 −0 bin/template.js
  14. +1 −1 doc/Makefile
  15. +66 −7 doc/source/getting_started.rst
  16. +4 −21 doc/source/index.rst
  17. +11 −0 doc/source/ref/index.rst
  18. +8 −0 doc/source/tips/index.rst
  19. +18 −0 doc/source/tips/run_in_prodution.rst
  20. +2 −1 package.json
  21. 0 {template → skeletons/site}/_attachments/css/.gitignore
  22. 0 {template → skeletons/site}/_attachments/css/sunrise.less
  23. 0 {template → skeletons/site}/_attachments/templates/index.ejs
  24. 0 {template → skeletons/site}/_attachments/templates/layout.ejs
  25. 0 {template → skeletons/site}/_attachments/vendor/blueprint/AUTHORS.textile
  26. 0 {template → skeletons/site}/_attachments/vendor/blueprint/CHANGELOG
  27. 0 {template → skeletons/site}/_attachments/vendor/blueprint/LICENSE
  28. 0 {template → skeletons/site}/_attachments/vendor/blueprint/README.textile
  29. 0 {template → skeletons/site}/_attachments/vendor/blueprint/TUTORIAL.textile
  30. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/ie.css
  31. BIN {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/buttons/icons/cross.png
  32. BIN {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/buttons/icons/key.png
  33. BIN {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/buttons/icons/tick.png
  34. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/buttons/readme.txt
  35. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/buttons/screen.css
  36. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/fancy-type/readme.txt
  37. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/fancy-type/screen.css
  38. BIN {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/link-icons/icons/doc.png
  39. BIN ...late → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/link-icons/icons/email.png
  40. BIN ...e → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/link-icons/icons/external.png
  41. BIN ...plate → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/link-icons/icons/feed.png
  42. BIN {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/link-icons/icons/im.png
  43. BIN {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/link-icons/icons/pdf.png
  44. BIN ...te → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/link-icons/icons/visited.png
  45. BIN {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/link-icons/icons/xls.png
  46. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/link-icons/readme.txt
  47. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/link-icons/screen.css
  48. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/rtl/readme.txt
  49. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/plugins/rtl/screen.css
  50. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/print.css
  51. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/screen.css
  52. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/src/forms.css
  53. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/src/grid.css
  54. BIN {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/src/grid.png
  55. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/src/ie.css
  56. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/src/print.css
  57. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/src/reset.css
  58. 0 {template → skeletons/site}/_attachments/vendor/blueprint/blueprint/src/typography.css
  59. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/blueprint.rb
  60. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/compressor.rb
  61. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/core_ext.rb
  62. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/css_parser.rb
  63. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/custom_layout.rb
  64. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/grid.css.erb
  65. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/grid_builder.rb
  66. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/namespace.rb
  67. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/semantic_class_names.rb
  68. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/validate/COPYRIGHT.html
  69. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/validate/JIGSAW_COPYRIGHT
  70. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/validate/README.html
  71. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/validate/XERCES_COPYING.txt
  72. BIN ... → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/validate/css-validator-javadoc.jar
  73. BIN {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/validate/css-validator.jar
  74. BIN {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/validate/jigsaw.jar
  75. BIN {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/validate/xerces.jar
  76. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/blueprint/validator.rb
  77. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/compress.rb
  78. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/settings.example.yml
  79. 0 {template → skeletons/site}/_attachments/vendor/blueprint/lib/validate.rb
  80. BIN {template → skeletons/site}/_attachments/vendor/blueprint/templates/psd/fixed-width.psd
  81. 0 {template → skeletons/site}/_attachments/vendor/blueprint/tests/index.html
  82. 0 {template → skeletons/site}/_attachments/vendor/blueprint/tests/parts/elements.html
  83. 0 {template → skeletons/site}/_attachments/vendor/blueprint/tests/parts/forms.html
  84. 0 {template → skeletons/site}/_attachments/vendor/blueprint/tests/parts/grid.html
  85. 0 {template → skeletons/site}/_attachments/vendor/blueprint/tests/parts/sample.html
  86. BIN {template → skeletons/site}/_attachments/vendor/blueprint/tests/parts/test-small.jpg
  87. BIN {template → skeletons/site}/_attachments/vendor/blueprint/tests/parts/test.jpg
  88. BIN {template → skeletons/site}/_attachments/vendor/blueprint/tests/parts/valid.png
  89. 0 {template → skeletons/site}/_attachments/vendor/json2.js
  90. +1 −1 {template → skeletons/site}/app.js
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0 apps/posts/scripts/generator.js 100755 → 100644
No changes.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -2,32 +2,114 @@
var fs = require('fs');
var path = require('path');
-var helper = require(require('sunrise').helper
+var utils = require('sunrise').utils;
var exec = require('child_process').exec;
+var options = utils.merge({}, require('optimist').argv);
+var skeletons = utils.abspath(__dirname + "/../skeletons");
+var config = utils.abspath(__dirname + "/../conf");
-var base = helper.abspath(process.argv[2]);
-var template = helper.abspath(__dirname + "/../template");
-
-path.exists(base, function(exists){
- if( exists ){
- console.error(base + ' already exists');
- process.exit(1);
- }else{
- console.log('Creating a sunrise site directory');
- var command = 'cp -r ' + template + ' ' + base;
- exec(command, function(err, stdout, stderr){
- if( err ){
- console.error('Failed to create a sunrise site directory');
- console.error(stderr);
- process.exit(err.code);
- }else{
- console.log("Your site has been successfully created.");
- console.log("To start up your site: ");
- console.log("");
- console.log(" $ node " + path.join(base, 'boot.js'));
- console.log("");
- }
- });
- }
-});
+var USAGE = ['',
+ 'Usage:',
+ 'sunrise:create [-s dir] [-a dir]',
+ ''].join("\n");
+
+function main(){
+ if( options.s == null && options.a == null ){
+ console.error('-s or -a option must be specified.');
+ console.error(USAGE);
+ process.exit(1);
+ }else if( options.s != null && options.a != null) {
+ console.error('-s or -a option cannot be specified at once.');
+ console.error(USAGE);
+ process.exit(1);
+ }else{
+ var src = options.s ? path.join(skeletons, 'site') : path.join(skeletons, 'app');
+ var dst = utils.abspath(options.s || options.a);
+ copyFromSkeleton(src, dst, function(err){
+ if( err ){
+ console.error(err.toString());
+ process.exit(1);
+ }else{
+ console.log(dst + ' has been created successfully');
+ // site instllation
+ if( options.s ){
+ copyFromSkeleton(config, path.join(dst, 'conf'), function(err){
+ if( err ){
+ console.err(stderr);
+ process.exit(1);
+ }
+ process.chdir(dst);
+ exec('npm link sunrise', function(err, stdout, stderr){
+ if( err ){
+ console.err(stderr);
+ process.exit(1);
+ }else{
+ console.log("Your site has been successfully created.");
+ console.log("To start up your site: ");
+ console.log("");
+ console.log(" $ node " + path.join(dst, 'app.js'));
+ console.log("");
+ }
+ });
+ });
+ }else{
+
+ }
+ }
+ });
+ }
+}
+
+function copyFromSkeleton(src, dst, callback){
+ path.exists(dst, function(exists){
+ if( exists ){
+ callback(new Error(dst + ' already exists!'));
+ }else{
+ var command = 'cp -r ' + src + ' ' + dst;
+ exec(command, function(err, stdout, stderr){
+ if( err ){
+ callback(err);
+ }else{
+ callback();
+ }
+ });
+
+ }
+ });
+}
+
+main();
+
+// path.exists(base, function(exists){
+// if( exists ){
+// console.error(base + ' already exists');
+// process.exit(1);
+// }else{
+// console.log('Creating a sunrise site directory');
+// var command = 'cp -r ' + template + ' ' + base;
+// exec(command, function(err, stdout, stderr){
+// if( err ){
+// console.error('Failed to create a sunrise site directory');
+// console.error(stderr);
+// process.exit(err.code);
+// }else{
+// command = "cd '" + base + "' && npm link sunrise";
+// console.log(command)
+// exec(command, function(err, stdout, stderr){
+// if( err ){
+// console.error('Failed to link sunrise module in your site.');
+// console.error(stderr);
+// process.exit(err.code);
+// }else{
+// console.log("Your site has been successfully created.");
+// console.log("To start up your site: ");
+// console.log("");
+// console.log(" $ node " + path.join(base, 'app.js'));
+// console.log("");
+// }
+// });
+// }
+// });
+// }
+// });
View
@@ -0,0 +1,6 @@
+#!/usr/bin/env node
+
+var path = require('path');
+var abspath = require('sunrise').utils.abspath(__dirname);
+
+require('sunrise').boot(path.join(abspath, '../skeletons/site'));
View
@@ -34,7 +34,7 @@ help:
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
- -rm -rf $(BUILDDIR)/*
+ -rm -rf $(BUILDDIR)/html/* $(BUILDDIR)/doctrees/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@@ -4,26 +4,85 @@ Getting Started
Requirements
================================================================================
-- node.js v0.3.x or later
-- npm
-- couchapp v0.7.x or later
+- node.js v0.4.X or later
+- npm 1.0.X or later
+- Apache CouchDB 1.0.2 or later
+
Install
================================================================================
+Just install by npm.
+
::
- $ npm install sunrise
+ $ npm install -g sunrise
+
+
+Testing a template site
+================================================================================
+
+Configure your CouchDB administrator
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+You must configure the administrator account on your CouchDB located on http://localhost:5984/ before checking the template.
+
+:name: admin
+:password: password
+
+To start up the template site, launch the boot command:
+
+::
+
+ $ sunrise:template
+ ...
+ [2011-05-14 22:09:54.915] [INFO] sunrise - Listening on 8888
+
+And you can visit http://localhost:8888/ to check sunrise is working.
+.. note:: ``login`` function does not work correctly because you have not configure oauth settings.
Craete a new site
================================================================================
+Copy a new site from template
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+The template site cannot be modified. You can copy the template site in your directory to start to build your site.
+
::
- $ sunrise:create my_site
- $ cd my_site
- $ sunrise:start .
+ $ sunrise\:create -s sunrise-site
+ [2011-05-14 22:54:49.445] [INFO] console - /Users/yssk22/tmp/sunrise-site has been created successfully
+ [2011-05-14 22:54:49.630] [INFO] console - Your site has been successfully created.
+ [2011-05-14 22:54:49.631] [INFO] console - To start up your site:
+ [2011-05-14 22:54:49.631] [INFO] console -
+ [2011-05-14 22:54:49.631] [INFO] console - $ node /Users/yssk22/tmp/sunrise-site/app.js
+ [2011-05-14 22:54:49.631] [INFO] console -
+
+After ``sunrise:create`` command is executed, you can modify your site in the newly craeted directory.
+
+Configure settings
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+``${YOUR_SITE_DIR}/conf`` contains default configurations. You can configure settings such as OAuth provides, CouchDB admin account, Cookie settings, ... and so on.
+
+Configuration details are described at :doc:`ref/conf`_
+
+
+Configure bootstrap
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+``${YOUR_SITE_DIR}/app.js`` is a bootstrap script for your site. You can modify applications, URLs, ... on this script.
+
+Boot your site
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+just kick ``app.js`` with ``-c conf`` option to apply your configurations.
+
+::
+ $ cd ${YOUR_SITE_DIR}
+ $ node app.js -c conf/
View
@@ -15,27 +15,10 @@ Application Development Guide
:maxdepth: 2
getting_started
- architecture
-
-Development Tips
------------------------------------
-
-.. toctree::
- :maxdepth: 1
-
- tips/error
-
-Reference
------------------------------------
-
-.. toctree::
- :maxdepth: 2
-
- ref/conf
- ref/i18n
- ref/app
- ref/middleware
- ref/helper
+ architecture
+ tips/index
+ ref/index
+
Indices and tables
==================
View
@@ -0,0 +1,11 @@
+Reference
+-----------------------------------
+
+.. toctree::
+ :maxdepth: 2
+
+ conf
+ i18n
+ app
+ middleware
+ helper
@@ -0,0 +1,8 @@
+Development Tips
+-----------------------------------
+
+.. toctree::
+ :maxdepth: 2
+
+ run_in_prodution
+ error
@@ -0,0 +1,18 @@
+.. highlight:: javascript
+
+Run in production environment
+================================================================================
+
+.. warning:: This section is underconstruction.
+
+Before running your site in the production environment, you should install ``forever`` package using npm.
+
+::
+
+ $ npm install -g forever
+
+And then start ``app.js`` with ``forever`` command to enable auto-restart on failure.
+
+::
+
+ $ NODE_ENV=production forever ./app.js -c conf
View
@@ -6,7 +6,8 @@
"tags": ["cms", "web", "framework", "couchdb"],
"author": "Yohei Sasaki",
"bin": {
- "sunrise:create" : "./bin/create.js"
+ "sunrise:create" : "./bin/create.js",
+ "sunrise:template" : "./bin/template.js"
},
"directories": {
"deps": "./deps"
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
-var couchapp = require('couchapp');
+var couchapp = require('sunrise').couchapp;
var path = require('path');
var ddoc = {
_id: "_design/site" ,

0 comments on commit aae0c31

Please sign in to comment.