friendly 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/.document +5 -0
  2. data/.gitignore +23 -0
  3. data/APACHE-LICENSE +202 -0
  4. data/LICENSE +20 -0
  5. data/README.md +173 -0
  6. data/Rakefile +67 -0
  7. data/VERSION +1 -0
  8. data/examples/friendly.yml +7 -0
  9. data/friendly.gemspec +201 -0
  10. data/lib/friendly/attribute.rb +65 -0
  11. data/lib/friendly/boolean.rb +6 -0
  12. data/lib/friendly/cache/by_id.rb +33 -0
  13. data/lib/friendly/cache.rb +24 -0
  14. data/lib/friendly/config.rb +5 -0
  15. data/lib/friendly/data_store.rb +72 -0
  16. data/lib/friendly/document.rb +165 -0
  17. data/lib/friendly/document_table.rb +56 -0
  18. data/lib/friendly/index.rb +73 -0
  19. data/lib/friendly/memcached.rb +48 -0
  20. data/lib/friendly/newrelic.rb +6 -0
  21. data/lib/friendly/query.rb +42 -0
  22. data/lib/friendly/sequel_monkey_patches.rb +35 -0
  23. data/lib/friendly/storage.rb +31 -0
  24. data/lib/friendly/storage_factory.rb +24 -0
  25. data/lib/friendly/storage_proxy.rb +103 -0
  26. data/lib/friendly/table.rb +15 -0
  27. data/lib/friendly/table_creator.rb +43 -0
  28. data/lib/friendly/time.rb +14 -0
  29. data/lib/friendly/translator.rb +32 -0
  30. data/lib/friendly/uuid.rb +143 -0
  31. data/lib/friendly.rb +49 -0
  32. data/rails/init.rb +3 -0
  33. data/spec/fakes/data_store_fake.rb +29 -0
  34. data/spec/fakes/database_fake.rb +12 -0
  35. data/spec/fakes/dataset_fake.rb +28 -0
  36. data/spec/fakes/document.rb +18 -0
  37. data/spec/fakes/serializer_fake.rb +12 -0
  38. data/spec/fakes/time_fake.rb +12 -0
  39. data/spec/integration/basic_object_lifecycle_spec.rb +114 -0
  40. data/spec/integration/batch_insertion_spec.rb +29 -0
  41. data/spec/integration/convenience_api_spec.rb +25 -0
  42. data/spec/integration/count_spec.rb +12 -0
  43. data/spec/integration/default_value_spec.rb +15 -0
  44. data/spec/integration/find_via_cache_spec.rb +101 -0
  45. data/spec/integration/finder_spec.rb +64 -0
  46. data/spec/integration/index_spec.rb +57 -0
  47. data/spec/integration/pagination_spec.rb +63 -0
  48. data/spec/integration/table_creator_spec.rb +52 -0
  49. data/spec/integration/write_through_cache_spec.rb +53 -0
  50. data/spec/spec.opts +1 -0
  51. data/spec/spec_helper.rb +90 -0
  52. data/spec/unit/attribute_spec.rb +64 -0
  53. data/spec/unit/cache_by_id_spec.rb +102 -0
  54. data/spec/unit/cache_spec.rb +21 -0
  55. data/spec/unit/config_spec.rb +4 -0
  56. data/spec/unit/data_store_spec.rb +188 -0
  57. data/spec/unit/document_spec.rb +311 -0
  58. data/spec/unit/document_table_spec.rb +126 -0
  59. data/spec/unit/friendly_spec.rb +25 -0
  60. data/spec/unit/index_spec.rb +196 -0
  61. data/spec/unit/memcached_spec.rb +114 -0
  62. data/spec/unit/query_spec.rb +104 -0
  63. data/spec/unit/storage_factory_spec.rb +59 -0
  64. data/spec/unit/storage_proxy_spec.rb +218 -0
  65. data/spec/unit/translator_spec.rb +96 -0
  66. data/website/index.html +210 -0
  67. data/website/scripts/clipboard.swf +0 -0
  68. data/website/scripts/shBrushAS3.js +61 -0
  69. data/website/scripts/shBrushBash.js +66 -0
  70. data/website/scripts/shBrushCSharp.js +67 -0
  71. data/website/scripts/shBrushColdFusion.js +102 -0
  72. data/website/scripts/shBrushCpp.js +99 -0
  73. data/website/scripts/shBrushCss.js +93 -0
  74. data/website/scripts/shBrushDelphi.js +57 -0
  75. data/website/scripts/shBrushDiff.js +43 -0
  76. data/website/scripts/shBrushErlang.js +54 -0
  77. data/website/scripts/shBrushGroovy.js +69 -0
  78. data/website/scripts/shBrushJScript.js +52 -0
  79. data/website/scripts/shBrushJava.js +59 -0
  80. data/website/scripts/shBrushJavaFX.js +60 -0
  81. data/website/scripts/shBrushPerl.js +74 -0
  82. data/website/scripts/shBrushPhp.js +91 -0
  83. data/website/scripts/shBrushPlain.js +35 -0
  84. data/website/scripts/shBrushPowerShell.js +76 -0
  85. data/website/scripts/shBrushPython.js +66 -0
  86. data/website/scripts/shBrushRuby.js +57 -0
  87. data/website/scripts/shBrushScala.js +53 -0
  88. data/website/scripts/shBrushSql.js +68 -0
  89. data/website/scripts/shBrushVb.js +58 -0
  90. data/website/scripts/shBrushXml.js +71 -0
  91. data/website/scripts/shCore.js +30 -0
  92. data/website/scripts/shLegacy.js +30 -0
  93. data/website/styles/friendly.css +103 -0
  94. data/website/styles/help.png +0 -0
  95. data/website/styles/ie.css +35 -0
  96. data/website/styles/magnifier.png +0 -0
  97. data/website/styles/page_white_code.png +0 -0
  98. data/website/styles/page_white_copy.png +0 -0
  99. data/website/styles/print.css +29 -0
  100. data/website/styles/printer.png +0 -0
  101. data/website/styles/screen.css +257 -0
  102. data/website/styles/shCore.css +330 -0
  103. data/website/styles/shThemeDefault.css +173 -0
  104. data/website/styles/shThemeDjango.css +176 -0
  105. data/website/styles/shThemeEclipse.css +190 -0
  106. data/website/styles/shThemeEmacs.css +175 -0
  107. data/website/styles/shThemeFadeToGrey.css +177 -0
  108. data/website/styles/shThemeMidnight.css +175 -0
  109. data/website/styles/shThemeRDark.css +175 -0
  110. metadata +264 -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://rdoc.info/jamesgolick/friendly">RDoc.info</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://rdoc.info/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>
Binary file
@@ -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'];
@@ -0,0 +1,99 @@
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.Cpp = function()
31
+ {
32
+ // Copyright 2006 Shin, YoungJin
33
+
34
+ var datatypes = 'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' +
35
+ 'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' +
36
+ 'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' +
37
+ 'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' +
38
+ 'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' +
39
+ 'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' +
40
+ 'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' +
41
+ 'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' +
42
+ 'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' +
43
+ 'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' +
44
+ 'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' +
45
+ 'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' +
46
+ 'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' +
47
+ 'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' +
48
+ 'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' +
49
+ 'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' +
50
+ 'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' +
51
+ 'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' +
52
+ 'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' +
53
+ '__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' +
54
+ 'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' +
55
+ 'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' +
56
+ 'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' +
57
+ 'va_list wchar_t wctrans_t wctype_t wint_t signed';
58
+
59
+ var keywords = 'break case catch class const __finally __exception __try ' +
60
+ 'const_cast continue private public protected __declspec ' +
61
+ 'default delete deprecated dllexport dllimport do dynamic_cast ' +
62
+ 'else enum explicit extern if for friend goto inline ' +
63
+ 'mutable naked namespace new noinline noreturn nothrow ' +
64
+ 'register reinterpret_cast return selectany ' +
65
+ 'sizeof static static_cast struct switch template this ' +
66
+ 'thread throw true false try typedef typeid typename union ' +
67
+ 'using uuid virtual void volatile whcar_t while';
68
+
69
+ var functions = 'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' +
70
+ 'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' +
71
+ 'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' +
72
+ 'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' +
73
+ 'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' +
74
+ 'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' +
75
+ 'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' +
76
+ 'fwrite getc getchar gets perror printf putc putchar puts remove ' +
77
+ 'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' +
78
+ 'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' +
79
+ 'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' +
80
+ 'mbtowc qsort rand realloc srand strtod strtol strtoul system ' +
81
+ 'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' +
82
+ 'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' +
83
+ 'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' +
84
+ 'clock ctime difftime gmtime localtime mktime strftime time';
85
+
86
+ this.regexList = [
87
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
88
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
89
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
90
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
91
+ { regex: /^ *#.*/gm, css: 'preprocessor' },
92
+ { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'color1 bold' },
93
+ { regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions bold' },
94
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' }
95
+ ];
96
+ };
97
+
98
+ SyntaxHighlighter.brushes.Cpp.prototype = new SyntaxHighlighter.Highlighter();
99
+ SyntaxHighlighter.brushes.Cpp.aliases = ['cpp', 'c'];