monkeysupport 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
6
+ *.bundle
7
+ *.so
8
+ *.dll
9
+ *.o
10
+ Makefile
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Burke Libbey
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,34 @@
1
+ = MonkeySupport
2
+
3
+ MonkeySupport is a collection of monkeypatches to Rails, replacing
4
+ existing methods with (somewhat) optimized C equivalents.
5
+
6
+ If this interests you, you should also check out methodmissing's
7
+ excellent HashWithIndifferentAccess at
8
+ http://github.com/methodmissing/hwia .
9
+
10
+ == Note on Patches/Pull Requests
11
+
12
+ * Fork the project.
13
+ * Make your feature addition or bug fix.
14
+ * Add tests for it. This is important so I don't break it in a
15
+ future version unintentionally.
16
+ * Commit, do not mess with rakefile, version, or history.
17
+ (if you want to have your own version, that is fine but
18
+ bump version in a commit by itself I can ignore when I pull)
19
+ * Send me a pull request. Bonus points for topic branches.
20
+
21
+ == Problems / TODO
22
+
23
+ * I haven't figured out a simple way to get this running with the
24
+ rails test suite. That would be handy.
25
+ * Certain functions are memoized now, that rails doesn't memoize by
26
+ default. I've tried to choose carefully, but with unusual usage
27
+ patterns, this could cause memory issues. Simplest solution that
28
+ comes to my mind would be to use a simple LRU cache instead of a
29
+ plain hash.
30
+ * There's always more to port...
31
+
32
+ == Copyright
33
+
34
+ Copyright (c) 2009 Burke Libbey. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,58 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "monkeysupport"
8
+ gem.summary = %Q{Monkeypatching Rails with C since 2009}
9
+ gem.description = %Q{MonkeySupport provides C implementations for some of the more intensive string manipulation methods in activesupport. ActionView is up next.}
10
+ gem.email = "burke@burkelibbey.org"
11
+ gem.homepage = "http://github.com/burke/monkeysupport"
12
+ gem.authors = ["Burke Libbey"]
13
+ gem.files.include '{test,lib,ext}/**/*'
14
+ gem.extensions = ["ext/monkeysupport_c/extconf.rb"]
15
+ gem.add_development_dependency "thoughtbot-shoulda"
16
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
+ end
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
20
+ end
21
+
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |test|
24
+ test.libs << 'lib' << 'test'
25
+ test.pattern = 'test/**/*_test.rb'
26
+ test.verbose = true
27
+ end
28
+
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/*_test.rb'
34
+ test.verbose = true
35
+ end
36
+ rescue LoadError
37
+ task :rcov do
38
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
+ end
40
+ end
41
+
42
+ task :test => :check_dependencies
43
+
44
+ task :default => :test
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ if File.exist?('VERSION')
49
+ version = File.read('VERSION')
50
+ else
51
+ version = ""
52
+ end
53
+
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "monkeysupport #{version}"
56
+ rdoc.rdoc_files.include('README*')
57
+ rdoc.rdoc_files.include('lib/**/*.rb')
58
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.2
@@ -0,0 +1,4 @@
1
+ require 'mkmf'
2
+ extension_name = 'monkeysupport_c'
3
+ dir_config(extension_name)
4
+ create_makefile(extension_name, 'src')
@@ -0,0 +1,234 @@
1
+ #include <ctype.h>
2
+ #include <stdbool.h>
3
+ #include <stdlib.h>
4
+ #include <string.h>
5
+
6
+ #include "activesupport_inflector.h"
7
+ #include "ruby.h"
8
+
9
+ //TODO: Deal with string encodings in 1.9.
10
+ // if (do_magic_here) {
11
+ // rb_raise(rb_eTypeError, "Non-ASCII String");
12
+ // }
13
+
14
+ VALUE activesupport_inflector_underscore(VALUE self, VALUE rstr)
15
+ {
16
+ Check_Type(rstr, T_STRING);
17
+
18
+ VALUE ret = rb_str_new("", 0);
19
+ char * ip = StringValuePtr(rstr);
20
+ int ilen = RSTRING_LEN(rstr);
21
+ char prev = '\0';
22
+ char temp;
23
+ int i;
24
+
25
+ for (i = 0; i < ilen; i++, prev=*ip++) {
26
+
27
+ // replace :: with /
28
+ if (*ip == ':' && *(ip+1) == ':') {
29
+ rb_str_cat(ret, "/", 1);
30
+ ip++;
31
+ i++; // fastforward one char.
32
+ } else {
33
+ if ((isupper(prev) && isupper(*ip) && islower(*(ip+1)))
34
+ || ((islower(prev)||isdigit(prev)) && isupper(*ip))) {
35
+ rb_str_cat(ret, "_", 1);
36
+ }
37
+ if (*ip == '-') {
38
+ rb_str_cat(ret, "_", 1);
39
+ } else {
40
+ temp = tolower(*ip);
41
+ rb_str_cat(ret, &temp, 1);
42
+ }
43
+ }
44
+ }
45
+ return ret;
46
+ }
47
+
48
+ VALUE activesupport_inflector_parameterize(VALUE self, VALUE str, VALUE sep)
49
+ {
50
+ Check_Type(str, T_STRING);
51
+ Check_Type(sep, T_STRING);
52
+
53
+ VALUE mActiveSupport = rb_define_module("ActiveSupport");
54
+ VALUE mInflector = rb_define_module_under(mActiveSupport, "Inflector");
55
+ VALUE transliterated = rb_funcall(mInflector, rb_intern("transliterate"), 1, str);
56
+
57
+ Check_Type(transliterated, T_STRING); // You never know...
58
+
59
+ VALUE ret = rb_str_new("", 0);
60
+ int sep_len = RSTRING_LEN(sep);
61
+ int ilen = RSTRING_LEN(transliterated);
62
+ char * ip = RSTRING_PTR(transliterated);
63
+ bool separated = true;
64
+ int i;
65
+ char tmp;
66
+
67
+ for (i = 0; i < ilen; i++, ip++) {
68
+ if (isalnum(*ip) || *ip == '-' || *ip == '_' || *ip == '+') { // normal char
69
+ separated = false;
70
+ tmp = tolower(*ip);
71
+ rb_str_cat(ret, &tmp, 1);
72
+ } else { // replace with separator
73
+ if (!separated) {
74
+ separated = true;
75
+ rb_str_cat(ret, RSTRING_PTR(sep), sep_len);
76
+ }
77
+ }
78
+ }
79
+
80
+ // cp points to the end of the return string.
81
+ // Get rid of trailing separators, if any.
82
+ if (RSTRING_LEN(ret) && !memcmp(RSTRING_PTR(sep),
83
+ RSTRING_PTR(ret) + RSTRING_LEN(ret) - sep_len,
84
+ sep_len * sizeof (char)))
85
+ {
86
+ ret = rb_str_new(RSTRING_PTR(ret), RSTRING_LEN(ret) - sep_len);
87
+ }
88
+
89
+ return ret;
90
+ }
91
+
92
+ VALUE activesupport_inflector_dasherize(VALUE self, VALUE str)
93
+ {
94
+ Check_Type(str, T_STRING);
95
+
96
+ char * out = ALLOC_N(char, RSTRING_LEN(str) + 1);
97
+ char * ip = RSTRING_PTR(str);
98
+ char * op = out;
99
+ int len = RSTRING_LEN(str);
100
+ int i;
101
+
102
+ for (i = 0; i < len; i++, ip++) {
103
+ if (*ip == '_') {
104
+ *op++ = '-';
105
+ } else {
106
+ *op++ = *ip;
107
+ }
108
+ }
109
+
110
+ return rb_str_new(out, len);
111
+ }
112
+
113
+ VALUE activesupport_inflector_demodulize(VALUE self, VALUE rstr)
114
+ {
115
+ Check_Type(rstr, T_STRING);
116
+
117
+ char * str = RSTRING_PTR(rstr);
118
+ char * ip = str;
119
+ char * last_part = str;
120
+ int len = RSTRING_LEN(rstr);
121
+ int olen = len;
122
+ int i;
123
+
124
+ for (i = 0; i < len; i++, ip++) {
125
+ if (*ip == ':' && *(ip+1) == ':') {
126
+ olen = len - i - 2;
127
+ last_part = ip + 2;
128
+ }
129
+ }
130
+
131
+ VALUE ret = rb_str_new("", 0);
132
+ rb_str_cat(ret, last_part, olen);
133
+ return ret;
134
+ }
135
+
136
+ VALUE activesupport_inflector_camelize(VALUE self, VALUE str, VALUE first_letter_uppercase)
137
+ {
138
+ Check_Type(str, T_STRING);
139
+
140
+ VALUE ret = rb_str_new("", 0);
141
+ bool cap_next = RTEST(first_letter_uppercase);
142
+ int ilen = RSTRING_LEN(str);
143
+ char * ip = RSTRING_PTR(str);
144
+ int i;
145
+ char tmp;
146
+
147
+ for (i = 0; i < ilen; i++, ip++) {
148
+ if (*ip == '/') {
149
+ cap_next = true;
150
+ rb_str_cat(ret, "::", 2);
151
+ } else if (*ip == '_') {
152
+ cap_next = true;
153
+ // Skip over -- don't print anything.
154
+ } else {
155
+ if (cap_next) {
156
+ tmp = toupper(*ip);
157
+ cap_next = false;
158
+ } else {
159
+ tmp = tolower(*ip);
160
+ }
161
+ rb_str_cat(ret, &tmp, 1);
162
+ }
163
+ }
164
+ return ret;
165
+ }
166
+
167
+ VALUE activesupport_inflector_foreign_key(VALUE self, VALUE str, VALUE use_underscore)
168
+ {
169
+ Check_Type(str, T_STRING);
170
+
171
+ VALUE ret = activesupport_inflector_underscore(self, activesupport_inflector_demodulize(self, str));
172
+
173
+ if (RTEST(use_underscore)) {
174
+ rb_str_cat(ret, "_id", 3);
175
+ } else {
176
+ rb_str_cat(ret, "id", 2);
177
+ }
178
+
179
+ return ret;
180
+ }
181
+
182
+
183
+ static char * itoa(int n)
184
+ {
185
+ char c_tmp;
186
+ int i_tmp;
187
+ char * ret = ALLOC_N(char, 32);
188
+ char * ptr = ret;
189
+ char * ptr1 = ret;
190
+
191
+ do {
192
+ i_tmp = n;
193
+ n /= 10;
194
+ *ptr++ = "9876543210123456789" [9 + (i_tmp - n * 10)];
195
+ } while (n);
196
+
197
+ if (i_tmp < 0) *ptr++ = '-';
198
+ *ptr-- = '\0';
199
+ while (ptr1 < ptr) {
200
+ c_tmp = *ptr;
201
+ *ptr-- = *ptr1;
202
+ *ptr1++ = c_tmp;
203
+ }
204
+
205
+ return ret;
206
+ }
207
+
208
+ VALUE activesupport_inflector_ordinalize(VALUE self, VALUE rn)
209
+ {
210
+ Check_Type(rn, T_FIXNUM);
211
+
212
+ int n = FIX2INT(rn);
213
+ VALUE ret = rb_str_new2(itoa(n));
214
+ int x = n % 100;
215
+
216
+ if ((x > 10) && (x < 14)) {
217
+ rb_str_cat(ret, "th", 2);
218
+ } else {
219
+ switch(n % 10) {
220
+ case 1:
221
+ rb_str_cat(ret, "st", 2);
222
+ break;
223
+ case 2:
224
+ rb_str_cat(ret, "nd", 2);
225
+ break;
226
+ case 3:
227
+ rb_str_cat(ret, "rd", 2);
228
+ break;
229
+ default:
230
+ rb_str_cat(ret, "th", 2);
231
+ }
232
+ }
233
+ return ret;
234
+ }
@@ -0,0 +1,10 @@
1
+ #pragma once
2
+ #include "ruby.h"
3
+
4
+ VALUE activesupport_inflector_underscore(VALUE self, VALUE str);
5
+ VALUE activesupport_inflector_parameterize(VALUE self, VALUE str, VALUE sep);
6
+ VALUE activesupport_inflector_dasherize(VALUE self, VALUE str);
7
+ VALUE activesupport_inflector_demodulize(VALUE self, VALUE str);
8
+ VALUE activesupport_inflector_camelize(VALUE self, VALUE str, VALUE first_letter_uppercase);
9
+ VALUE activesupport_inflector_foreign_key(VALUE self, VALUE str, VALUE use_underscore);
10
+ VALUE activesupport_inflector_ordinalize(VALUE self, VALUE n);
@@ -0,0 +1,19 @@
1
+ #include "activesupport_inflector.h"
2
+
3
+ #include "ruby.h"
4
+
5
+ void
6
+ Init_monkeysupport_c()
7
+ {
8
+ VALUE mMonkeySupport = rb_define_module("MonkeySupport");
9
+ VALUE cMSC = rb_define_class_under(mMonkeySupport, "C", rb_cObject);
10
+
11
+ /* ActiveSupport::ASC.camelize("my_string") */
12
+ rb_define_singleton_method(cMSC, "activesupport_inflector_camelize", activesupport_inflector_camelize, 2);
13
+ rb_define_singleton_method(cMSC, "activesupport_inflector_demodulize", activesupport_inflector_demodulize, 1);
14
+ rb_define_singleton_method(cMSC, "activesupport_inflector_dasherize", activesupport_inflector_dasherize, 1);
15
+ rb_define_singleton_method(cMSC, "activesupport_inflector_foreign_key", activesupport_inflector_foreign_key, 2);
16
+ rb_define_singleton_method(cMSC, "activesupport_inflector_ordinalize", activesupport_inflector_ordinalize, 1);
17
+ rb_define_singleton_method(cMSC, "activesupport_inflector_parameterize", activesupport_inflector_parameterize, 2);
18
+ rb_define_singleton_method(cMSC, "activesupport_inflector_underscore", activesupport_inflector_underscore, 1);
19
+ }
@@ -0,0 +1,6 @@
1
+ require 'monkeysupport_c'
2
+
3
+ require 'monkeysupport/c_proxy'
4
+ require 'monkeysupport/memoizable'
5
+
6
+ require 'monkeysupport/activesupport/inflector'
@@ -0,0 +1,42 @@
1
+ module ActiveSupport
2
+ module Inflector
3
+
4
+ extend MonkeySupport::Memoizable
5
+ extend MonkeySupport::CProxy
6
+
7
+ monkey_memoize :pluralize, :singularize, :humanize
8
+
9
+ monkey_c_proxy(:camelize,
10
+ :activesupport_inflector_camelize,
11
+ [:string, # lower_case_and_underscored_word
12
+ [:bool, true]]) # first_letter_in_uppercase
13
+
14
+ monkey_c_proxy(:underscore,
15
+ :activesupport_inflector_underscore,
16
+ [:string]) # camel_cased_word
17
+
18
+ monkey_c_proxy(:dasherize,
19
+ :activesupport_inflector_dasherize,
20
+ [:string]) # underscored_word
21
+
22
+ monkey_c_proxy(:foreign_key,
23
+ :activesupport_inflector_foreign_key,
24
+ [:string, # class_name
25
+ [:bool, true]]) # separate_class_name_and_id_with_underscore
26
+
27
+ monkey_c_proxy(:demodulize,
28
+ :activesupport_inflector_demodulize,
29
+ [:string]) # class_name_in_module
30
+
31
+ monkey_c_proxy(:ordinalize,
32
+ :activesupport_inflector_ordinalize,
33
+ [:fixnum]) # number
34
+
35
+ monkey_c_proxy(:parameterize,
36
+ :activesupport_inflector_parameterize,
37
+ [:string, # string
38
+ [:string, '-']]) # separator
39
+
40
+ end
41
+ end
42
+
@@ -0,0 +1,61 @@
1
+ module MonkeySupport
2
+ module CProxy
3
+
4
+ # Generates a proxy-to-C method.
5
+ #
6
+ # Parameters:
7
+ # - ruby_name -- the original name of the function to override
8
+ # - c_name -- the name of the C function in MonkeySupport::C to use
9
+ # - args -- list of arguments to funtion, by type.
10
+ #
11
+ # args example: [:string, :fixnum, [:string, '-'], [:bool true]]
12
+ # - takes a string, a fixnum, a string with default value '-', then a boolean
13
+ # with default value true.
14
+ #
15
+ # EXAMPLE:
16
+ #
17
+ # alias_method :__unproxy_demodulize, :demodulize
18
+ # MS_C = MonkeySupport::C unless defined? MS_C
19
+ # def demodulize(arg0)
20
+ # begin
21
+ # MS_C.activesupport_inflector_demodulize(arg0)
22
+ # rescue TypeError
23
+ # __unproxy_demodulize(arg0)
24
+ # end
25
+ # end
26
+ def monkey_c_proxy(ruby_name, c_name, args)
27
+ arglist_with_defaults = Util::arglist(args, true)
28
+ arglist_without_defaults = Util::arglist(args, false)
29
+
30
+ # Note: About MS_C: That little extra lookup to MonkeySupport::C
31
+ # can be a near-15% performance hit on some functions. Brutal.
32
+ function = <<-EOS
33
+ alias_method :__unproxy_#{ruby_name}, :#{ruby_name}
34
+ MS_C = MonkeySupport::C unless defined? MS_C
35
+ def #{ruby_name}(#{arglist_with_defaults})
36
+ begin
37
+ MS_C.#{c_name}(#{arglist_without_defaults})
38
+ rescue TypeError
39
+ __unproxy_#{ruby_name}(#{arglist_without_defaults})
40
+ end
41
+ end
42
+ EOS
43
+
44
+ class_eval(function)
45
+ end
46
+
47
+ module Util
48
+ def self.arglist(args, include_defaults)
49
+ arglist = []
50
+ args.each_with_index do |arg, i|
51
+ if (arg.class == Array && include_defaults)
52
+ arglist << "arg#{i} = #{arg[1].inspect}"
53
+ else
54
+ arglist << "arg#{i}"
55
+ end
56
+ end
57
+ return arglist.join(", ")
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,31 @@
1
+ module MonkeySupport
2
+ module Memoizable
3
+ # This is faster than AS::Memoizeable.
4
+ # Less featureful, however.
5
+ def monkey_memoize(*methods)
6
+ methods.each do |method|
7
+ class_eval <<EOS
8
+
9
+ @__memo_#{method} = {}
10
+ alias_method :__unmemo_#{method}, :#{method}
11
+
12
+ if method(:#{method}).arity == 1
13
+
14
+ def #{method}(arg)
15
+ @__memo_#{method}[arg] ||= __unmemo_#{method}(arg)
16
+ end
17
+
18
+ else
19
+
20
+ def #{method}(*args)
21
+ @__memo_#{method}[args] ||= __unmemo_#{method}(*args)
22
+ end
23
+
24
+ end
25
+
26
+ EOS
27
+
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,71 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{monkeysupport}
8
+ s.version = "0.1.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Burke Libbey"]
12
+ s.date = %q{2009-09-04}
13
+ s.description = %q{MonkeySupport provides C implementations for some of the more intensive string manipulation methods in activesupport. ActionView is up next.}
14
+ s.email = %q{burke@burkelibbey.org}
15
+ s.extensions = ["ext/monkeysupport_c/extconf.rb"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".gitignore",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "ext/monkeysupport_c/extconf.rb",
28
+ "ext/monkeysupport_c/extconf.rb",
29
+ "ext/monkeysupport_c/src/activesupport_inflector.c",
30
+ "ext/monkeysupport_c/src/activesupport_inflector.c",
31
+ "ext/monkeysupport_c/src/activesupport_inflector.h",
32
+ "ext/monkeysupport_c/src/activesupport_inflector.h",
33
+ "ext/monkeysupport_c/src/monkeysupport_c.c",
34
+ "ext/monkeysupport_c/src/monkeysupport_c.c",
35
+ "lib/monkeysupport.rb",
36
+ "lib/monkeysupport.rb",
37
+ "lib/monkeysupport/activesupport/inflector.rb",
38
+ "lib/monkeysupport/activesupport/inflector.rb",
39
+ "lib/monkeysupport/c_proxy.rb",
40
+ "lib/monkeysupport/c_proxy.rb",
41
+ "lib/monkeysupport/memoizable.rb",
42
+ "lib/monkeysupport/memoizable.rb",
43
+ "monkeysupport.gemspec",
44
+ "test/monkeysupport_test.rb",
45
+ "test/monkeysupport_test.rb",
46
+ "test/test_helper.rb",
47
+ "test/test_helper.rb"
48
+ ]
49
+ s.homepage = %q{http://github.com/burke/monkeysupport}
50
+ s.rdoc_options = ["--charset=UTF-8"]
51
+ s.require_paths = ["lib"]
52
+ s.rubygems_version = %q{1.3.4}
53
+ s.summary = %q{Monkeypatching Rails with C since 2009}
54
+ s.test_files = [
55
+ "test/monkeysupport_test.rb",
56
+ "test/test_helper.rb"
57
+ ]
58
+
59
+ if s.respond_to? :specification_version then
60
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
61
+ s.specification_version = 3
62
+
63
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
64
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
65
+ else
66
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
67
+ end
68
+ else
69
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
70
+ end
71
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class MonkeysupportTest < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'monkeysupport'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: monkeysupport
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Burke Libbey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-04 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thoughtbot-shoulda
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: MonkeySupport provides C implementations for some of the more intensive string manipulation methods in activesupport. ActionView is up next.
26
+ email: burke@burkelibbey.org
27
+ executables: []
28
+
29
+ extensions:
30
+ - ext/monkeysupport_c/extconf.rb
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.rdoc
34
+ files:
35
+ - .document
36
+ - .gitignore
37
+ - LICENSE
38
+ - README.rdoc
39
+ - Rakefile
40
+ - VERSION
41
+ - ext/monkeysupport_c/extconf.rb
42
+ - ext/monkeysupport_c/src/activesupport_inflector.c
43
+ - ext/monkeysupport_c/src/activesupport_inflector.h
44
+ - ext/monkeysupport_c/src/monkeysupport_c.c
45
+ - lib/monkeysupport.rb
46
+ - lib/monkeysupport/activesupport/inflector.rb
47
+ - lib/monkeysupport/c_proxy.rb
48
+ - lib/monkeysupport/memoizable.rb
49
+ - monkeysupport.gemspec
50
+ - test/monkeysupport_test.rb
51
+ - test/test_helper.rb
52
+ has_rdoc: true
53
+ homepage: http://github.com/burke/monkeysupport
54
+ licenses: []
55
+
56
+ post_install_message:
57
+ rdoc_options:
58
+ - --charset=UTF-8
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: "0"
66
+ version:
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: "0"
72
+ version:
73
+ requirements: []
74
+
75
+ rubyforge_project:
76
+ rubygems_version: 1.3.5
77
+ signing_key:
78
+ specification_version: 3
79
+ summary: Monkeypatching Rails with C since 2009
80
+ test_files:
81
+ - test/monkeysupport_test.rb
82
+ - test/test_helper.rb