friendly_postgres 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/.document +2 -0
  2. data/.gitignore +26 -0
  3. data/APACHE-LICENSE +202 -0
  4. data/CHANGELOG.md +19 -0
  5. data/CONTRIBUTORS.md +7 -0
  6. data/LICENSE +20 -0
  7. data/README.md +265 -0
  8. data/Rakefile +68 -0
  9. data/TODO.md +5 -0
  10. data/VERSION +1 -0
  11. data/examples/friendly.yml +7 -0
  12. data/friendly.gemspec +232 -0
  13. data/lib/friendly.rb +54 -0
  14. data/lib/friendly/associations.rb +7 -0
  15. data/lib/friendly/associations/association.rb +34 -0
  16. data/lib/friendly/associations/set.rb +37 -0
  17. data/lib/friendly/attribute.rb +91 -0
  18. data/lib/friendly/boolean.rb +10 -0
  19. data/lib/friendly/cache.rb +24 -0
  20. data/lib/friendly/cache/by_id.rb +33 -0
  21. data/lib/friendly/config.rb +5 -0
  22. data/lib/friendly/data_store.rb +72 -0
  23. data/lib/friendly/document.rb +257 -0
  24. data/lib/friendly/document_table.rb +56 -0
  25. data/lib/friendly/index.rb +73 -0
  26. data/lib/friendly/memcached.rb +48 -0
  27. data/lib/friendly/named_scope.rb +17 -0
  28. data/lib/friendly/newrelic.rb +6 -0
  29. data/lib/friendly/query.rb +42 -0
  30. data/lib/friendly/scope.rb +100 -0
  31. data/lib/friendly/scope_proxy.rb +45 -0
  32. data/lib/friendly/sequel_monkey_patches.rb +34 -0
  33. data/lib/friendly/storage.rb +31 -0
  34. data/lib/friendly/storage_factory.rb +24 -0
  35. data/lib/friendly/storage_proxy.rb +103 -0
  36. data/lib/friendly/table.rb +15 -0
  37. data/lib/friendly/table_creator.rb +48 -0
  38. data/lib/friendly/time.rb +14 -0
  39. data/lib/friendly/translator.rb +32 -0
  40. data/lib/friendly/uuid.rb +148 -0
  41. data/rails/init.rb +3 -0
  42. data/spec/config.yml.example +7 -0
  43. data/spec/fakes/data_store_fake.rb +29 -0
  44. data/spec/fakes/database_fake.rb +12 -0
  45. data/spec/fakes/dataset_fake.rb +28 -0
  46. data/spec/fakes/document.rb +18 -0
  47. data/spec/fakes/serializer_fake.rb +12 -0
  48. data/spec/fakes/time_fake.rb +12 -0
  49. data/spec/integration/ad_hoc_scopes_spec.rb +42 -0
  50. data/spec/integration/basic_object_lifecycle_spec.rb +114 -0
  51. data/spec/integration/batch_insertion_spec.rb +29 -0
  52. data/spec/integration/convenience_api_spec.rb +25 -0
  53. data/spec/integration/count_spec.rb +12 -0
  54. data/spec/integration/default_value_spec.rb +15 -0
  55. data/spec/integration/find_via_cache_spec.rb +101 -0
  56. data/spec/integration/finder_spec.rb +64 -0
  57. data/spec/integration/has_many_spec.rb +18 -0
  58. data/spec/integration/index_spec.rb +57 -0
  59. data/spec/integration/named_scope_spec.rb +34 -0
  60. data/spec/integration/pagination_spec.rb +63 -0
  61. data/spec/integration/scope_chaining_spec.rb +22 -0
  62. data/spec/integration/table_creator_spec.rb +64 -0
  63. data/spec/integration/write_through_cache_spec.rb +53 -0
  64. data/spec/spec.opts +1 -0
  65. data/spec/spec_helper.rb +103 -0
  66. data/spec/unit/associations/association_spec.rb +57 -0
  67. data/spec/unit/associations/set_spec.rb +43 -0
  68. data/spec/unit/attribute_spec.rb +105 -0
  69. data/spec/unit/cache_by_id_spec.rb +102 -0
  70. data/spec/unit/cache_spec.rb +21 -0
  71. data/spec/unit/config_spec.rb +4 -0
  72. data/spec/unit/data_store_spec.rb +188 -0
  73. data/spec/unit/document_spec.rb +358 -0
  74. data/spec/unit/document_table_spec.rb +126 -0
  75. data/spec/unit/friendly_spec.rb +25 -0
  76. data/spec/unit/index_spec.rb +196 -0
  77. data/spec/unit/memcached_spec.rb +114 -0
  78. data/spec/unit/named_scope_spec.rb +16 -0
  79. data/spec/unit/query_spec.rb +104 -0
  80. data/spec/unit/scope_proxy_spec.rb +44 -0
  81. data/spec/unit/scope_spec.rb +113 -0
  82. data/spec/unit/storage_factory_spec.rb +59 -0
  83. data/spec/unit/storage_proxy_spec.rb +218 -0
  84. data/spec/unit/translator_spec.rb +96 -0
  85. data/website/index.html +210 -0
  86. data/website/scripts/clipboard.swf +0 -0
  87. data/website/scripts/shBrushAS3.js +61 -0
  88. data/website/scripts/shBrushBash.js +66 -0
  89. data/website/scripts/shBrushCSharp.js +67 -0
  90. data/website/scripts/shBrushColdFusion.js +102 -0
  91. data/website/scripts/shBrushCpp.js +99 -0
  92. data/website/scripts/shBrushCss.js +93 -0
  93. data/website/scripts/shBrushDelphi.js +57 -0
  94. data/website/scripts/shBrushDiff.js +43 -0
  95. data/website/scripts/shBrushErlang.js +54 -0
  96. data/website/scripts/shBrushGroovy.js +69 -0
  97. data/website/scripts/shBrushJScript.js +52 -0
  98. data/website/scripts/shBrushJava.js +59 -0
  99. data/website/scripts/shBrushJavaFX.js +60 -0
  100. data/website/scripts/shBrushPerl.js +74 -0
  101. data/website/scripts/shBrushPhp.js +91 -0
  102. data/website/scripts/shBrushPlain.js +35 -0
  103. data/website/scripts/shBrushPowerShell.js +76 -0
  104. data/website/scripts/shBrushPython.js +66 -0
  105. data/website/scripts/shBrushRuby.js +57 -0
  106. data/website/scripts/shBrushScala.js +53 -0
  107. data/website/scripts/shBrushSql.js +68 -0
  108. data/website/scripts/shBrushVb.js +58 -0
  109. data/website/scripts/shBrushXml.js +71 -0
  110. data/website/scripts/shCore.js +30 -0
  111. data/website/scripts/shLegacy.js +30 -0
  112. data/website/styles/friendly.css +103 -0
  113. data/website/styles/help.png +0 -0
  114. data/website/styles/ie.css +35 -0
  115. data/website/styles/magnifier.png +0 -0
  116. data/website/styles/page_white_code.png +0 -0
  117. data/website/styles/page_white_copy.png +0 -0
  118. data/website/styles/print.css +29 -0
  119. data/website/styles/printer.png +0 -0
  120. data/website/styles/screen.css +257 -0
  121. data/website/styles/shCore.css +330 -0
  122. data/website/styles/shThemeDefault.css +173 -0
  123. data/website/styles/shThemeDjango.css +176 -0
  124. data/website/styles/shThemeEclipse.css +190 -0
  125. data/website/styles/shThemeEmacs.css +175 -0
  126. data/website/styles/shThemeFadeToGrey.css +177 -0
  127. data/website/styles/shThemeMidnight.css +175 -0
  128. data/website/styles/shThemeRDark.css +175 -0
  129. metadata +302 -0
@@ -0,0 +1,210 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7
+ <link rel="stylesheet" href="styles/screen.css" type="text/css" media="screen, projection" />
8
+ <link rel="stylesheet" href="styles/print.css" type="text/css" media="print" />
9
+ <!--[if lt IE 8]><link rel="stylesheet" href="/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
10
+
11
+ <script type="text/javascript" src="scripts/shCore.js"></script>
12
+ <script type="text/javascript" src="scripts/shBrushRuby.js"></script>
13
+ <script type="text/javascript" src="scripts/shBrushBash.js"></script>
14
+ <link type="text/css" rel="stylesheet" href="styles/shCore.css"/>
15
+ <link type="text/css" rel="stylesheet" href="styles/shThemeDefault.css"/>
16
+ <script type="text/javascript">
17
+ SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
18
+ SyntaxHighlighter.all();
19
+ </script>
20
+
21
+ <link rel="stylesheet" href="styles/friendly.css" type="text/css" media="screen, projection" />
22
+ <title>NoSQL with MySQL in Ruby - Friendly</title>
23
+ </head>
24
+ <body>
25
+ <div id="information">
26
+ <div class="container">
27
+ <h1>Friendly &nbsp;<span>NoSQL with MySQL in Ruby</span></h1>
28
+
29
+ <div id="about" class="clearfix">
30
+ <div class="span-17 append-1">
31
+ <dl>
32
+ <dt>Store schema-less data in MySQL.</dt>
33
+ <dd>Evolve your data model without feeling the pain of migrations.</dd>
34
+
35
+ <dt>Build indexes offline</dt>
36
+ <dd>Building an index can take hours with a lot of data. Stay agile without taking your app offline.</dd>
37
+
38
+ <dt>Write-through and read-through caching baked right in.</dt>
39
+ <dd><a href="http://radar.oreilly.com/2009/10/watching-websites.html">Fast websites make more money.</a> The 99.8% cache hit rate we see in production is a one-liner with Friendly.</dd>
40
+ </dl>
41
+ <p id="created-by">Created by: <a href="http://jamesgolick.com">James Golick</a> and <a href="http://technotales.wordpress.com/">Jonathan Palardy</a> for <a href="http://fetlife.com">FetLife</a> #NSFW. </p>
42
+ <p class="small">Inspired by <a href="http://bret.appspot.com/entry/how-friendfeed-uses-mysql">How FriendFeed uses MySQL to store schema-less data</a>.</p>
43
+ </div>
44
+ <div class="span-6 last">
45
+ <div class="box">
46
+ <ul class="box">
47
+ <li><span class="label small quiet">repo:</span> <a href="http://github.com/jamesgolick/friendly">Github</a></li>
48
+ <li><span class="label small quiet">docs:</span> <a href="http://yardoc.org/docs/jamesgolick-friendly">Yardoc.org</a></li>
49
+ <li><span class="label small quiet">blog:</span> <a href="http://jamesgolick.com/2009/12/16/introducing-friendly-nosql-with-mysql-in-ruby.html">Announcement</a></li>
50
+ <li><span class="label small quiet">list:</span> <a href="mailto: friendly@librelist.com">Librelist</a></li>
51
+ <li><span class="label small quiet">irc:</span> #friendlyorm <span class="small quiet">(freenode)</li>
52
+ </ul>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ <div id="quickinstall">
59
+ <div class="container">
60
+
61
+ <h2 class="bottom">Get Friendly in 5 minutes</h2>
62
+ <h3 class="bottom">Install friendly</h3>
63
+ <p class="quiet bottom">Install the gem.</p>
64
+ <pre class="brush: bash;">sudo gem install friendly</pre>
65
+ <br/>
66
+
67
+ <h3 class="bottom">Setup gem dependency in Rails</h3>
68
+ <p class="bottom quiet">If you're on rails, add this in environment.rb:</p>
69
+ <pre class="brush: ruby;">config.gem "friendly"</pre>
70
+
71
+ <p class="quiet bottom">and create a config/friendly.yml:</p>
72
+ <pre class="brush: ruby;">
73
+ development:
74
+ :adapter: "mysql"
75
+ :host: "localhost"
76
+ :user: "root"
77
+ :password: "swordfish"
78
+ :database: "friendly_development"
79
+ </pre>
80
+
81
+ <p class="quiet">not using Rails:</p>
82
+ <pre class="brush: ruby;">
83
+ Friendly.configure :adapter => "mysql",
84
+ :host => "localhost",
85
+ :user => "root",
86
+ :password => "swordfish",
87
+ :database => "playing_with_friendly"
88
+ </pre>
89
+
90
+ <br/>
91
+ <h3 class="bottom">Create a Model</h3>
92
+ <p class="bottom quiet">Fire up your vim:</p>
93
+ <pre class="brush: ruby;">
94
+ class BlogPost
95
+ include Friendly::Document
96
+
97
+ attribute :author, String
98
+ attribute :title, String
99
+ attribute :body, String
100
+ end
101
+ </pre>
102
+ <br/>
103
+
104
+ <h3 class="bottom">Create the Table</h3>
105
+ <p class="quiet bottom">From irb or script/console:</p>
106
+ <pre class="brush: ruby;">Friendly.create_tables!</pre>
107
+ <br/>
108
+
109
+ <h3 class="bottom">Index</h3>
110
+ <p class="bottom quiet">Just add the indexes you want to your model.</p>
111
+ <pre class="brush: ruby; highlight: [8,9];">
112
+ class BlogPost
113
+ include Friendly::Document
114
+
115
+ attribute :author, String
116
+ attribute :title, String
117
+ attribute :body, String
118
+
119
+ indexes :author
120
+ indexes :created_at
121
+ end
122
+ </pre>
123
+
124
+ <p class="bottom quiet">Run create_tables again and the index tables will be created for you.</p>
125
+ <pre class="brush: ruby;">Friendly.create_tables!</pre>
126
+ <br/>
127
+
128
+ <h3 class="bottom">Create Objects</h3>
129
+ <p class="bottom quiet">With familiar ActiveRecord syntax:</p>
130
+ <pre class="brush: ruby;">
131
+ BlogPost.create :author => "James Golick",
132
+ :title => "Friendly has familiar syntax.",
133
+ :body => "So, there's very little learning curve."
134
+ </pre>
135
+ <br/>
136
+
137
+
138
+ <h3 class="bottom">Query</h3>
139
+ <p class="bottom quiet">All posts by James Golick:</p>
140
+ <pre class="brush: ruby;">BlogPost.all(:author => "James Golick")</pre>
141
+
142
+ <p class="bottom quiet">Most recent posts:</p>
143
+ <pre class="brush: ruby;">BlogPost.all(:order! => :created_at.desc)</pre>
144
+ <br/>
145
+
146
+ <h3 class="bottom">Cache</h3>
147
+ <p class="bottom quiet">Install the memcached gem:</p>
148
+ <pre class="brush: ruby;">sudo gem install memcached</pre>
149
+
150
+ <p class="bottom quiet">Configure Friendly to cache:</p>
151
+ <pre class="brush: ruby;">Friendly.cache = Friendly::Memcached.new(Memcached.new)</pre>
152
+
153
+ <p class="bottom quiet">Configure your model to cache:</p>
154
+ <pre class="brush: ruby; highlight: [11];">
155
+ class BlogPost
156
+ include Friendly::Document
157
+
158
+ attribute :author, String
159
+ attribute :title, String
160
+ attribute :body, String
161
+
162
+ indexes :author
163
+ indexes :created_at
164
+
165
+ caches_by :id
166
+ end
167
+ </pre>
168
+ <p class="friendlier">And now your app is that much <u>friendlier</u>!</p>
169
+ </div>
170
+ </div>
171
+ <div id="footer" class="small">
172
+ <div class="container">
173
+ <div class="span-6">
174
+ <h4>Important links</h4>
175
+ <ul>
176
+ <li><a href="http://github.com/jamesgolick/friendly">GitHub Repository</a></li>
177
+ <li><a href="http://github.com/jamesgolick/friendly#readme">README</a></li>
178
+ <li><a href="mailto: friendly@librelist.com">Mailing List</a></li>
179
+ <li><a href="http://yardoc.org/docs/jamesgolick-friendly">Documentation</a></li>
180
+ <li><a href="http://jamesgolick.com/2009/12/16/introducing-friendly-nosql-with-mysql-in-ruby.html">Release Announcement</a></li>
181
+ </ul>
182
+ </div>
183
+ <div class="span-6">
184
+ <h4>Created by</h4>
185
+ <ul>
186
+ <li><a href="http://jamesgolick.com">James Golick</a></li>
187
+ <li><a href="http://technotales.wordpress.com">Jonathan Palardy</a></li>
188
+ </ul>
189
+ </div>
190
+ <div class="span-6">
191
+ <h4>Inspired by</h4>
192
+ <ul>
193
+ <li><a href="http://bret.appspot.com/entry/how-friendfeed-uses-mysql">FriendFeed</a></li>
194
+ <!-- Special thanks to Jesus Christ our Lord Saviour -->
195
+ </ul>
196
+ </div>
197
+ <div class="span-6 last">
198
+ <h4>Used on</h4>
199
+ <ul>
200
+ <li><a href="http://fetlife.com">FetLife</a> <span class="small">#NSFW</span></li>
201
+ </ul>
202
+ </div>
203
+ </div>
204
+ </div>
205
+
206
+ <script src="http://static.getclicky.com/js" type="text/javascript"></script>
207
+ <script type="text/javascript">clicky.init(164296);</script>
208
+ <noscript><p><img alt="Clicky" width="1" height="1" src="http://static.getclicky.com/164296ns.gif" /></p></noscript>
209
+ </body>
210
+ </html>
@@ -0,0 +1,61 @@
1
+ /**
2
+ * SyntaxHighlighter
3
+ * http://alexgorbatchev.com/
4
+ *
5
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
6
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
7
+ *
8
+ * @version
9
+ * 2.1.364 (October 15 2009)
10
+ *
11
+ * @copyright
12
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
13
+ *
14
+ * @license
15
+ * This file is part of SyntaxHighlighter.
16
+ *
17
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
18
+ * it under the terms of the GNU Lesser General Public License as published by
19
+ * the Free Software Foundation, either version 3 of the License, or
20
+ * (at your option) any later version.
21
+ *
22
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
29
+ */
30
+ SyntaxHighlighter.brushes.AS3 = function()
31
+ {
32
+ // Created by Peter Atoria @ http://iAtoria.com
33
+
34
+ var inits = 'class interface function package';
35
+
36
+ var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' +
37
+ 'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' +
38
+ 'extends false final finally flash_proxy for get if implements import in include Infinity ' +
39
+ 'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' +
40
+ 'Null Number Object object_proxy override parseFloat parseInt private protected public ' +
41
+ 'return set static String super switch this throw true try typeof uint undefined unescape ' +
42
+ 'use void while with'
43
+ ;
44
+
45
+ this.regexList = [
46
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
47
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
48
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
49
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
50
+ { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
51
+ { regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations
52
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
53
+ { regex: new RegExp('var', 'gm'), css: 'variable' }, // variable
54
+ { regex: new RegExp('trace', 'gm'), css: 'color1' } // trace
55
+ ];
56
+
57
+ this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
58
+ };
59
+
60
+ SyntaxHighlighter.brushes.AS3.prototype = new SyntaxHighlighter.Highlighter();
61
+ SyntaxHighlighter.brushes.AS3.aliases = ['actionscript3', 'as3'];
@@ -0,0 +1,66 @@
1
+ /**
2
+ * SyntaxHighlighter
3
+ * http://alexgorbatchev.com/
4
+ *
5
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
6
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
7
+ *
8
+ * @version
9
+ * 2.1.364 (October 15 2009)
10
+ *
11
+ * @copyright
12
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
13
+ *
14
+ * @license
15
+ * This file is part of SyntaxHighlighter.
16
+ *
17
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
18
+ * it under the terms of the GNU Lesser General Public License as published by
19
+ * the Free Software Foundation, either version 3 of the License, or
20
+ * (at your option) any later version.
21
+ *
22
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
29
+ */
30
+ SyntaxHighlighter.brushes.Bash = function()
31
+ {
32
+ var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne gt lt ge le';
33
+ var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' +
34
+ 'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' +
35
+ 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' +
36
+ 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' +
37
+ 'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' +
38
+ 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' +
39
+ 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' +
40
+ 'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' +
41
+ 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' +
42
+ 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' +
43
+ 'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' +
44
+ 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' +
45
+ 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' +
46
+ 'vi watch wc whereis which who whoami Wget xargs yes'
47
+ ;
48
+
49
+ this.findMatches = function(regexList, code)
50
+ {
51
+ code = code.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
52
+ this.code = code;
53
+ return SyntaxHighlighter.Highlighter.prototype.findMatches.apply(this, [regexList, code]);
54
+ };
55
+
56
+ this.regexList = [
57
+ { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
58
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
59
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
60
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
61
+ { regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands
62
+ ];
63
+ }
64
+
65
+ SyntaxHighlighter.brushes.Bash.prototype = new SyntaxHighlighter.Highlighter();
66
+ SyntaxHighlighter.brushes.Bash.aliases = ['bash', 'shell'];
@@ -0,0 +1,67 @@
1
+ /**
2
+ * SyntaxHighlighter
3
+ * http://alexgorbatchev.com/
4
+ *
5
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
6
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
7
+ *
8
+ * @version
9
+ * 2.1.364 (October 15 2009)
10
+ *
11
+ * @copyright
12
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
13
+ *
14
+ * @license
15
+ * This file is part of SyntaxHighlighter.
16
+ *
17
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
18
+ * it under the terms of the GNU Lesser General Public License as published by
19
+ * the Free Software Foundation, either version 3 of the License, or
20
+ * (at your option) any later version.
21
+ *
22
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
29
+ */
30
+ SyntaxHighlighter.brushes.CSharp = function()
31
+ {
32
+ var keywords = 'abstract as base bool break byte case catch char checked class const ' +
33
+ 'continue decimal default delegate do double else enum event explicit ' +
34
+ 'extern false finally fixed float for foreach get goto if implicit in int ' +
35
+ 'interface internal is lock long namespace new null object operator out ' +
36
+ 'override params private protected public readonly ref return sbyte sealed set ' +
37
+ 'short sizeof stackalloc static string struct switch this throw true try ' +
38
+ 'typeof uint ulong unchecked unsafe ushort using virtual void while';
39
+
40
+ function fixComments(match, regexInfo)
41
+ {
42
+ var css = (match[0].indexOf("///") == 0)
43
+ ? 'color1'
44
+ : 'comments'
45
+ ;
46
+
47
+ return [new SyntaxHighlighter.Match(match[0], match.index, css)];
48
+ }
49
+
50
+ this.regexList = [
51
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments
52
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
53
+ { regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings
54
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
55
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
56
+ { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
57
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword
58
+ { regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial'
59
+ { regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield'
60
+ ];
61
+
62
+ this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
63
+ };
64
+
65
+ SyntaxHighlighter.brushes.CSharp.prototype = new SyntaxHighlighter.Highlighter();
66
+ SyntaxHighlighter.brushes.CSharp.aliases = ['c#', 'c-sharp', 'csharp'];
67
+
@@ -0,0 +1,102 @@
1
+ /**
2
+ * SyntaxHighlighter
3
+ * http://alexgorbatchev.com/
4
+ *
5
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
6
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
7
+ *
8
+ * @version
9
+ * 2.1.364 (October 15 2009)
10
+ *
11
+ * @copyright
12
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
13
+ *
14
+ * @license
15
+ * This file is part of SyntaxHighlighter.
16
+ *
17
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
18
+ * it under the terms of the GNU Lesser General Public License as published by
19
+ * the Free Software Foundation, either version 3 of the License, or
20
+ * (at your option) any later version.
21
+ *
22
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
29
+ */
30
+ SyntaxHighlighter.brushes.ColdFusion = function()
31
+ {
32
+ // Contributed by Jen
33
+ // http://www.jensbits.com/2009/05/14/coldfusion-brush-for-syntaxhighlighter-plus
34
+
35
+ var funcs = 'Abs ACos AddSOAPRequestHeader AddSOAPResponseHeader AjaxLink AjaxOnLoad ArrayAppend ArrayAvg ArrayClear ArrayDeleteAt ' +
36
+ 'ArrayInsertAt ArrayIsDefined ArrayIsEmpty ArrayLen ArrayMax ArrayMin ArraySet ArraySort ArraySum ArraySwap ArrayToList ' +
37
+ 'Asc ASin Atn BinaryDecode BinaryEncode BitAnd BitMaskClear BitMaskRead BitMaskSet BitNot BitOr BitSHLN BitSHRN BitXor ' +
38
+ 'Ceiling CharsetDecode CharsetEncode Chr CJustify Compare CompareNoCase Cos CreateDate CreateDateTime CreateObject ' +
39
+ 'CreateODBCDate CreateODBCDateTime CreateODBCTime CreateTime CreateTimeSpan CreateUUID DateAdd DateCompare DateConvert ' +
40
+ 'DateDiff DateFormat DatePart Day DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear DE DecimalFormat DecrementValue ' +
41
+ 'Decrypt DecryptBinary DeleteClientVariable DeserializeJSON DirectoryExists DollarFormat DotNetToCFType Duplicate Encrypt ' +
42
+ 'EncryptBinary Evaluate Exp ExpandPath FileClose FileCopy FileDelete FileExists FileIsEOF FileMove FileOpen FileRead ' +
43
+ 'FileReadBinary FileReadLine FileSetAccessMode FileSetAttribute FileSetLastModified FileWrite Find FindNoCase FindOneOf ' +
44
+ 'FirstDayOfMonth Fix FormatBaseN GenerateSecretKey GetAuthUser GetBaseTagData GetBaseTagList GetBaseTemplatePath ' +
45
+ 'GetClientVariablesList GetComponentMetaData GetContextRoot GetCurrentTemplatePath GetDirectoryFromPath GetEncoding ' +
46
+ 'GetException GetFileFromPath GetFileInfo GetFunctionList GetGatewayHelper GetHttpRequestData GetHttpTimeString ' +
47
+ 'GetK2ServerDocCount GetK2ServerDocCountLimit GetLocale GetLocaleDisplayName GetLocalHostIP GetMetaData GetMetricData ' +
48
+ 'GetPageContext GetPrinterInfo GetProfileSections GetProfileString GetReadableImageFormats GetSOAPRequest GetSOAPRequestHeader ' +
49
+ 'GetSOAPResponse GetSOAPResponseHeader GetTempDirectory GetTempFile GetTemplatePath GetTickCount GetTimeZoneInfo GetToken ' +
50
+ 'GetUserRoles GetWriteableImageFormats Hash Hour HTMLCodeFormat HTMLEditFormat IIf ImageAddBorder ImageBlur ImageClearRect ' +
51
+ 'ImageCopy ImageCrop ImageDrawArc ImageDrawBeveledRect ImageDrawCubicCurve ImageDrawLine ImageDrawLines ImageDrawOval ' +
52
+ 'ImageDrawPoint ImageDrawQuadraticCurve ImageDrawRect ImageDrawRoundRect ImageDrawText ImageFlip ImageGetBlob ImageGetBufferedImage ' +
53
+ 'ImageGetEXIFTag ImageGetHeight ImageGetIPTCTag ImageGetWidth ImageGrayscale ImageInfo ImageNegative ImageNew ImageOverlay ImagePaste ' +
54
+ 'ImageRead ImageReadBase64 ImageResize ImageRotate ImageRotateDrawingAxis ImageScaleToFit ImageSetAntialiasing ImageSetBackgroundColor ' +
55
+ 'ImageSetDrawingColor ImageSetDrawingStroke ImageSetDrawingTransparency ImageSharpen ImageShear ImageShearDrawingAxis ImageTranslate ' +
56
+ 'ImageTranslateDrawingAxis ImageWrite ImageWriteBase64 ImageXORDrawingMode IncrementValue InputBaseN Insert Int IsArray IsBinary ' +
57
+ 'IsBoolean IsCustomFunction IsDate IsDDX IsDebugMode IsDefined IsImage IsImageFile IsInstanceOf IsJSON IsLeapYear IsLocalHost ' +
58
+ 'IsNumeric IsNumericDate IsObject IsPDFFile IsPDFObject IsQuery IsSimpleValue IsSOAPRequest IsStruct IsUserInAnyRole IsUserInRole ' +
59
+ 'IsUserLoggedIn IsValid IsWDDX IsXML IsXmlAttribute IsXmlDoc IsXmlElem IsXmlNode IsXmlRoot JavaCast JSStringFormat LCase Left Len ' +
60
+ 'ListAppend ListChangeDelims ListContains ListContainsNoCase ListDeleteAt ListFind ListFindNoCase ListFirst ListGetAt ListInsertAt ' +
61
+ 'ListLast ListLen ListPrepend ListQualify ListRest ListSetAt ListSort ListToArray ListValueCount ListValueCountNoCase LJustify Log ' +
62
+ 'Log10 LSCurrencyFormat LSDateFormat LSEuroCurrencyFormat LSIsCurrency LSIsDate LSIsNumeric LSNumberFormat LSParseCurrency LSParseDateTime ' +
63
+ 'LSParseEuroCurrency LSParseNumber LSTimeFormat LTrim Max Mid Min Minute Month MonthAsString Now NumberFormat ParagraphFormat ParseDateTime ' +
64
+ 'Pi PrecisionEvaluate PreserveSingleQuotes Quarter QueryAddColumn QueryAddRow QueryConvertForGrid QueryNew QuerySetCell QuotedValueList Rand ' +
65
+ 'Randomize RandRange REFind REFindNoCase ReleaseComObject REMatch REMatchNoCase RemoveChars RepeatString Replace ReplaceList ReplaceNoCase ' +
66
+ 'REReplace REReplaceNoCase Reverse Right RJustify Round RTrim Second SendGatewayMessage SerializeJSON SetEncoding SetLocale SetProfileString ' +
67
+ 'SetVariable Sgn Sin Sleep SpanExcluding SpanIncluding Sqr StripCR StructAppend StructClear StructCopy StructCount StructDelete StructFind ' +
68
+ 'StructFindKey StructFindValue StructGet StructInsert StructIsEmpty StructKeyArray StructKeyExists StructKeyList StructKeyList StructNew ' +
69
+ 'StructSort StructUpdate Tan TimeFormat ToBase64 ToBinary ToScript ToString Trim UCase URLDecode URLEncodedFormat URLSessionFormat Val ' +
70
+ 'ValueList VerifyClient Week Wrap Wrap WriteOutput XmlChildPos XmlElemNew XmlFormat XmlGetNodeType XmlNew XmlParse XmlSearch XmlTransform ' +
71
+ 'XmlValidate Year YesNoFormat';
72
+
73
+ var keywords = 'cfabort cfajaximport cfajaxproxy cfapplet cfapplication cfargument cfassociate cfbreak cfcache cfcalendar ' +
74
+ 'cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection cfcomponent cfcontent cfcookie cfdbinfo ' +
75
+ 'cfdefaultcase cfdirectory cfdiv cfdocument cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror ' +
76
+ 'cfexchangecalendar cfexchangeconnection cfexchangecontact cfexchangefilter cfexchangemail cfexchangetask ' +
77
+ 'cfexecute cfexit cffeed cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid cfgridcolumn ' +
78
+ 'cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif cfimage cfimport cfinclude cfindex ' +
79
+ 'cfinput cfinsert cfinterface cfinvoke cfinvokeargument cflayout cflayoutarea cfldap cflocation cflock cflog ' +
80
+ 'cflogin cfloginuser cflogout cfloop cfmail cfmailparam cfmailpart cfmenu cfmenuitem cfmodule cfNTauthenticate ' +
81
+ 'cfobject cfobjectcache cfoutput cfparam cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod cfpop ' +
82
+ 'cfpresentation cfpresentationslide cfpresenter cfprint cfprocessingdirective cfprocparam cfprocresult ' +
83
+ 'cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow cfreturn cfsavecontent cfschedule ' +
84
+ 'cfscript cfsearch cfselect cfset cfsetting cfsilent cfslider cfsprydataset cfstoredproc cfswitch cftable ' +
85
+ 'cftextarea cfthread cfthrow cftimer cftooltip cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx ' +
86
+ 'cfwindow cfxml cfzip cfzipparam';
87
+
88
+ var operators = 'all and any between cross in join like not null or outer some';
89
+
90
+ this.regexList = [
91
+ { regex: new RegExp('--(.*)$', 'gm'), css: 'comments' }, // one line and multiline comments
92
+ { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // single quoted strings
93
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
94
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
95
+ { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // functions
96
+ { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such
97
+ { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
98
+ ];
99
+ }
100
+
101
+ SyntaxHighlighter.brushes.ColdFusion.prototype = new SyntaxHighlighter.Highlighter();
102
+ SyntaxHighlighter.brushes.ColdFusion.aliases = ['coldfusion','cf'];