PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/Bespin/BespinEmbedded/docs/devguide/index.html

https://bitbucket.org/raffel/node-host
HTML | 183 lines | 129 code | 37 blank | 17 comment | 0 complexity | 45e2a570da759b6e27153a6b62074a34 MD5 | raw file
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8">
  5. <title>Bespin Developer's Guide</title>
  6. <link rel="stylesheet" type="text/css" href="../css/reset.css">
  7. <link rel="stylesheet" type="text/css" href="../css/stylesheet.css" media="screen,projection">
  8. <link rel="stylesheet" type="text/css" href="../css/colorful.css">
  9. </head>
  10. <body>
  11. <!-- MAIN CONTAINER -->
  12. <div id="main-container">
  13. <!-- MENU -->
  14. <ul id="menu">
  15. <li><a href="../index.html" title="Home">Home</a></li>
  16. <li><a href="../userguide/index.html" title="User Guide">Using Bespin</a></li>
  17. <li><a href="../pluginguide/index.html" title="Plugin Guide">Creating Plugins</a></li>
  18. <li><a href="../embedding/index.html" title="Embedding Bespin in your app">Embedding</a></li>
  19. <li class="current"><a href="../devguide/index.html" title="Developer's Guide">Developing Bespin</a></li>
  20. </ul>
  21. <!-- / MENU -->
  22. <h1 id="web-title">Bespin Developer's Guide</h1>
  23. <h2 id="web-subtitle">Getting Started</h2>
  24. <!-- INDEX PAGE -->
  25. <!-- MAIN COLUMN -->
  26. <div id="maincol">
  27. <h2>Installing the Bespin Server</h2>
  28. <p>Important note: The Bespin Server is going to undergo a complete rework.
  29. You can read more about this in the <a href="http://groups.google.com/group/bespin/browse_thread/thread/6de8c718d64232a0">Bespin Server Roadmap</a>
  30. that was posted to the mailing list.</p>
  31. <p>To work on Bespin, you'll need to install the Bespin server on your local computer.</p>
  32. <p>You can easily get Bespin's Python server running on your local Mac or Linux machine (see note about Windows below).</p>
  33. <h2>Prerequisites</h2>
  34. <p>You will need the following installed on your system to get Bespin up and running: </p>
  35. <ul>
  36. <li>Mercurial </li>
  37. <li>Python 2.5 or 2.6 </li>
  38. </ul>
  39. <p>Python 2.6 is preferred.</p>
  40. <p><strong>NOTE FOR LINUX USERS:</strong> <em>If you are running on a Linux system, you will likely need a "python-dev" and "ruby1.8-dev" (on Ubuntu; possibly "python-devel" elsewhere) package installed, if you do not already have it. If you want to build the embedded release, you will want libyaml: the package on Ubuntu is "libyaml-dev".</em> </p>
  41. <p><strong>NOTE FOR MAC USERS:</strong> <em>You will need Xcode installed.</em> </p>
  42. <p><strong>NOTE FOR WINDOWS USERS:</strong> <em>Most Bespin developers are using unix-like platforms. Bespin's server should be able to run on Windows, though. You'll need a C compiler, and you can use Microsoft's free [http://www.microsoft.com/Express/VC/ Visual C++] compiler. As an alternative, you can use [http://www.cygwin.com/ Cygwin] or [http://www.mingw.org/ MinGW] to have a unix-like environment on your Windows system.</em></p>
  43. <h2>Getting Started</h2>
  44. <p>Run:</p>
  45. <div class="codehilite"><pre><span class="n">hg</span> <span class="n">clone</span> <span class="n">http:</span><span class="sr">//</span><span class="n">hg</span><span class="o">.</span><span class="n">mozilla</span><span class="o">.</span><span class="n">org</span><span class="sr">/labs/</span><span class="n">bespinclient</span><span class="o">/</span>
  46. <span class="n">hg</span> <span class="n">clone</span> <span class="n">http:</span><span class="sr">//</span><span class="n">hg</span><span class="o">.</span><span class="n">mozilla</span><span class="o">.</span><span class="n">org</span><span class="sr">/labs/</span><span class="n">bespinserver</span><span class="o">/</span>
  47. <span class="n">cd</span> <span class="n">bespinclient</span>
  48. </pre></div>
  49. <p>This will get the Bespin client and Python Bespin server code checked out. The <code>bespinclient/</code> directory is the "main" directory that you'll use.</p>
  50. <p>To set up Bespin for the first time, run:</p>
  51. <div class="codehilite"><pre><span class="n">python</span> <span class="n">bootstrap</span><span class="o">.</span><span class="n">py</span> <span class="o">--</span><span class="nb">no</span><span class="o">-</span><span class="n">site</span><span class="o">-</span><span class="n">packages</span>
  52. </pre></div>
  53. <p>to get the environment set up. This is built around <a href="virtualenv">http://pypi.python.org/pypi/virtualenv</a>. Please watch for helpful hints and instructions on screen.</p>
  54. <p>In Unix-like environments, the next step is to activate the virtualenv using this command:</p>
  55. <div class="codehilite"><pre><span class="n">source</span> <span class="n">bin</span><span class="o">/</span><span class="n">activate</span>
  56. </pre></div>
  57. <p>on Windows, the command is Scripts/activate.bat</p>
  58. <p>Once the virtualenv is activate, you need to get the server set up:</p>
  59. <div class="codehilite"><pre><span class="n">paver</span> <span class="n">install_server</span>
  60. </pre></div>
  61. <p>And the first time around, you're also going to want to get a database set up:</p>
  62. <div class="codehilite"><pre><span class="n">paver</span> <span class="n">create_db</span>
  63. </pre></div>
  64. <p>If you have some trouble on macos x like the error message: ImportError: No module named `xxx'
  65. It's probably cause the server side is not completely installed so try:</p>
  66. <div class="codehilite"><pre><span class="n">cd</span> <span class="o">../</span><span class="n">bespinserver</span>
  67. <span class="n">paver</span> <span class="n">develop</span>
  68. <span class="n">paver</span> <span class="n">create_db</span>
  69. </pre></div>
  70. <h2>Starting the development server</h2>
  71. <p>If you are no longer (or not yet) in the virtualenv environment run within the bespinclient directory:</p>
  72. <p>source bin/activate</p>
  73. <p>To start the server execute:</p>
  74. <p>paver start</p>
  75. <p>This will start the Bespin server. You can now access the Bespin editor at http://localhost:8080/ in you browser.</p>
  76. <p>Have fun!</p>
  77. <h2>Coding Conventions</h2>
  78. <p>JavaScript code should follow the <a href="http://javascript.crockford.com/code.html">Crockford Code Conventions</a>. With a few minor modifications:</p>
  79. <ul>
  80. <li>
  81. <p>Namespaces: Crockford does not mention namespaces, probably because owning the global namespace allows you to use as much as you want. Our code is likely to be used in many different places so we should not pollute the global namespace needlessly. Our code is organized in [http://commonjs.org/specs/modules/1.0.html CommonJS] modules, so every variable should either be a "var" or attached to the "exports" object.</p>
  82. </li>
  83. <li>
  84. <p>_private: We agree that prefixing variables with an underscore provides no actual protection, however we think of it as a warning. "Use of this member is unsupported and likely to break without warning in future revisions". In early versions of Bespin where we are experimenting a lot, allowing 3rd parties to join in the experiment is valuable. As Bespin becomes more stable and finalized, we might expect underscored members to be replaced with closure scoped variables.</p>
  85. </li>
  86. <li>
  87. <p>Documentation: Bespin JavaScript is documented with <a href="http://code.google.com/p/jsdoc-toolkit/w/list">JSDoc</a>, which in practice means prefixing functions with a set of comments that use various tags.</p>
  88. </li>
  89. <li>
  90. <p>var first: The standard recommends putting var statements as the first statements in the function body. Crockford doesn't always follow this advice and we reserve the right to follow this lead ;-)</p>
  91. </li>
  92. </ul>
  93. </div>
  94. <!-- / MAIN COLUMN -->
  95. <!-- SIDEBAR -->
  96. <div id="sidebar">
  97. <h2 class="compact">Contents</h2>
  98. <ul class="compact">
  99. <li><a href="index.html">Getting Started</a></li>
  100. <li><a href="tour.html">A Tour of the Code</a></li>
  101. <li><a href="testplan.html">Manual Test Plan</a></li>
  102. </ul>
  103. </div>
  104. <!-- / SIDEBAR -->
  105. <!-- / MAIN CONTAINER -->
  106. </div>
  107. <!-- FOOTER -->
  108. <div id="footer">
  109. <!-- COLUMN ONE -->
  110. <div>
  111. <h2 class="compact">Useful Links</h2>
  112. <ul class="compact">
  113. <li><a href="http://mozillalabs.com/bespin/">Bespin project home page</a></li>
  114. <li><a href="https://wiki.mozilla.org/Labs/Bespin">Wiki</a></li>
  115. </ul>
  116. </div>
  117. <!-- / COLUMN ONE -->
  118. <!-- COLUMN TWO -->
  119. <div>
  120. <h2 class="compact">Developer Resources</h2>
  121. <ul class="compact">
  122. <li><a href="http://hg.mozilla.org/labs/bespinclient/">Main Code Repository</a></li>
  123. <li><a href="http://hg.mozilla.org/labs/bespinserver/">Python server repository</a></li>
  124. <li><a href="http://groups.google.com/group/bespin-core/">bespin-core mailing list for developers</a></li>
  125. <li><a href="http://groups.google.com/group/bespin-commits/">bespin-commits mailing list for repository commit messages</a></li>
  126. <li><a href="https://bugzilla.mozilla.org/buglist.cgi?product=bespin">Bug List</a></li>
  127. </ul>
  128. </div>
  129. <!-- / COLUMN TWO -->
  130. <!-- COLUMN THREE -->
  131. <div>
  132. <h2 class="compact">Get Help</h2>
  133. <ul class="compact">
  134. <li>The <a href="http://groups.google.com/group/bespin/">Bespin mailing list</a></li>
  135. <li>Via IRC: <a href="irc://irc.mozilla.org/bespin">#bespin on irc.mozilla.org</a></li>
  136. </ul>
  137. <h2 class="compact">Documentation Template</h2>
  138. <ul class="compact">
  139. <li>Adapted from a design by <a href="http://www.mgrabovsky.is-game.com/">Matěj Grabovský</a></li>
  140. </ul>
  141. </div>
  142. <!-- / COLUMN THREE -->
  143. </div>
  144. <!-- / FOOTER -->
  145. </body>
  146. </html>