silverstripe-codebank

Code Bank is a code snippet manager with syntax highlighting for multiple languages including C++, ActionScript, Flex, HTML and SQL to name a few. Code Bank also has a simple revision history with a compare viewer so you can see the changes side-by-side between two revisions.

  • 所有者: UndefinedOffset/silverstripe-codebank
  • 平台:
  • 許可證: BSD 3-Clause "New" or "Revised" License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Code Bank (Server)

Latest Stable Version Total Downloads Latest Unstable Version License Build Status

Code Bank is a code snippet manager with syntax highlighting for multiple languages including C++, ActionScript, Flex, HTML and SQL to name a few. Code Bank also has a simple revision history with a compare viewer so you can see the changes side-by-side between two revisions.

Requirements:

Installation (Module)

composer require undefinedoffset/silverstripe-codebank 3.*@stable

Manual Install (Module only)

  1. Download and extract the latest Code Bank module release from here http://programs.edchipman.ca/applications/code-bank/
  2. Extract the module archive to the root of your SilverStripe installation, opening the extracted folder should contain _config.php in the root along with other files/folders
  3. Hit http://{your domain}/{path to root of code bank server folder}/dev/build?flush=all in your browser
  4. You will now see a Code Bank option in the CMS Menu

Installation (Standalone)

  1. Download and extract the latest Code Bank release from here http://programs.edchipman.ca/applications/code-bank/
  2. Extract the Code Bank to a location on your SilverStripe compatible web server, you should now see a Code Bank folder and a framework folder among others
  3. Follow the installation instructions at http://doc.silverstripe.org/framework/en/installation/
  4. If the installer completes successfully you will now be able to use the remote server in Code Bank's desktop client. Just set the server path to be http://{your domain}/{path to root of code bank server folder}
  5. You should make sure that the SilverStripe installer removed the install files install.php, and install-frameworkmissing.html

Upgrading to new versions:

composer update --no-dev undefinedoffset/silverstripe-codebank
Module Only (without composer)
  1. Download the latest Code Bank release here http://programs.edchipman.ca/applications/code-bank/
  2. Extract the archive to into the same folder as your SilverStripe Framework
  3. Hit http://{your domain}/{path to root of code bank server folder}/dev/build?flush=all in your browser
composer update --no-dev
Stand Alone (without composer)
  1. Download and extract the latest Code Bank release from http://programs.edchipman.ca/applications/code-bank/ overwriting the Code Bank and themes folders
  2. Download and extact just the CodeBank, framework and themes folders replacing only those folders and their children
  3. Hit http://{your domain}/{path to root of code bank server folder}/dev/build?flush=all in your browser, then you may use Code Bank normally

Custom Languages with Brushes

Code Bank uses SyntaxHighlighter to highlight code snippets, to provide a language with syntax highlighting you must add to your yml configs the following then run dev/build?flush=all.

CodeBank:
    extra_languages:
        - Name: "Example Language" #Name of the language
          HighlightCode: "example" #Highlighter code
          FileName: "ex" #File extension
          Brush: "mysite/javascript/shBrushEx.js" #Relative Path to the snippet highlighter brush

Switching the search engine

By default Code Bank uses MySQL's fulltext searching and on databases like Postgres it uses a partial match filtering for searching both from the client and in the web interface. Code Bank provides support for switching the engine to Solr if you have the silverstripe/fulltextsearch installed and a Solr server available. You may switch the search engine by adding the following to your mysite/_config/config.yml after add flush=1 to the url to update the config cache.

CodeBank:
    snippet_search_engine: "SolrCodeBankSearchEngine"

Writing your own engine

Code Bank provides an api for you to hook in your own engine, you simply need to implement the ICodeBankSearchEngine interface and define the methods in the interface. The key thing to remember is that the doSnippetSearch() method takes 3 parameters the first $keyword, is the term/keyword the user is searching for (this maybe empty), the second ($langugeID) is the database ID of the language the user is filtering to. The last parameter ($folderID) is the ID of the folder the system is requesting matches for. The method itself should always return a SS_List subclass typically it should be DataList containing or pointing to only snippets. To enable your custom engine follow the steps above.

Attribution:

主要指標

概覽
名稱與所有者UndefinedOffset/silverstripe-codebank
主編程語言PHP
編程語言PHP (語言數: 5)
平台
許可證BSD 3-Clause "New" or "Revised" License
所有者活动
創建於2014-03-01 16:44:59
推送於2017-04-13 21:24:19
最后一次提交2017-04-13 18:24:18
發布數7
最新版本名稱3.1.2 (發布於 )
第一版名稱3.0.0 (發布於 )
用户参与
星數46
關注者數7
派生數14
提交數182
已啟用問題?
問題數25
打開的問題數6
拉請求數4
打開的拉請求數1
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?