stringex 1.5.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +16 -0
  3. data/Gemfile.lock +74 -0
  4. data/README.rdoc +22 -1
  5. data/Rakefile +46 -223
  6. data/VERSION +1 -0
  7. data/init.rb +1 -0
  8. data/lib/stringex.rb +11 -3
  9. data/lib/stringex/acts_as_url.rb +49 -97
  10. data/lib/stringex/acts_as_url/adapter.rb +26 -0
  11. data/lib/stringex/acts_as_url/adapter/active_record.rb +23 -0
  12. data/lib/stringex/acts_as_url/adapter/base.rb +188 -0
  13. data/lib/stringex/acts_as_url/adapter/data_mapper.rb +67 -0
  14. data/lib/stringex/acts_as_url/adapter/mongoid.rb +36 -0
  15. data/lib/stringex/configuration.rb +4 -0
  16. data/lib/stringex/configuration/acts_as_url.rb +44 -0
  17. data/lib/stringex/configuration/base.rb +58 -0
  18. data/lib/stringex/configuration/configurator.rb +25 -0
  19. data/lib/stringex/configuration/string_extensions.rb +19 -0
  20. data/lib/stringex/localization.rb +98 -0
  21. data/lib/stringex/localization/backend/i18n.rb +53 -0
  22. data/lib/stringex/localization/backend/internal.rb +51 -0
  23. data/lib/stringex/localization/conversion_expressions.rb +148 -0
  24. data/lib/stringex/localization/converter.rb +121 -0
  25. data/lib/stringex/localization/default_conversions.rb +88 -0
  26. data/lib/stringex/rails/railtie.rb +10 -0
  27. data/lib/stringex/string_extensions.rb +153 -208
  28. data/lib/stringex/unidecoder.rb +6 -101
  29. data/lib/stringex/unidecoder_data/x00.yml +1 -1
  30. data/lib/stringex/unidecoder_data/x02.yml +5 -5
  31. data/lib/stringex/unidecoder_data/x05.yml +1 -1
  32. data/lib/stringex/unidecoder_data/x06.yml +1 -1
  33. data/lib/stringex/unidecoder_data/x07.yml +3 -3
  34. data/lib/stringex/unidecoder_data/x09.yml +1 -1
  35. data/lib/stringex/unidecoder_data/x0e.yml +2 -2
  36. data/lib/stringex/unidecoder_data/x1f.yml +2 -2
  37. data/lib/stringex/unidecoder_data/x20.yml +1 -1
  38. data/lib/stringex/unidecoder_data/xfb.yml +1 -1
  39. data/lib/stringex/unidecoder_data/xff.yml +1 -1
  40. data/lib/stringex/version.rb +8 -0
  41. data/locales/da.yml +73 -0
  42. data/locales/en.yml +66 -0
  43. data/stringex.gemspec +77 -18
  44. data/test/acts_as_url/adapter/active_record.rb +72 -0
  45. data/test/acts_as_url/adapter/data_mapper.rb +82 -0
  46. data/test/acts_as_url/adapter/mongoid.rb +73 -0
  47. data/test/acts_as_url_configuration_test.rb +51 -0
  48. data/test/acts_as_url_integration_test.rb +271 -0
  49. data/test/localization/da_test.rb +117 -0
  50. data/test/localization/default_test.rb +113 -0
  51. data/test/localization/en_test.rb +117 -0
  52. data/test/localization_test.rb +123 -0
  53. data/test/redcloth_to_html_test.rb +37 -0
  54. data/test/string_extensions_test.rb +59 -91
  55. data/test/test_helper.rb +2 -0
  56. data/test/unicode_point_suite/basic_greek_test.rb +113 -0
  57. data/test/unicode_point_suite/basic_latin_test.rb +142 -0
  58. data/test/unicode_point_suite/codepoint_test_helper.rb +32 -0
  59. data/test/unidecoder/bad_localization.yml +1 -0
  60. data/test/unidecoder/localization.yml +4 -0
  61. data/test/unidecoder_test.rb +3 -5
  62. metadata +145 -37
  63. data/test/acts_as_url_test.rb +0 -272
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OThiMTMzOWIyNTA2MjgyMjBlZjEzZWU0MTZiNGU0ZWM2OGQwMGY2Zg==
5
+ data.tar.gz: !binary |-
6
+ MDk5YTJhMTlmOWNiZjE1YTcwN2Y3YzRhNWU5ZDYzM2RjMTVkNDVhYg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OTI0OGQ1NjQzNThkY2YwZTEzYmEwOTllMGI2Mzk5YzllMDRkNmQxYTgwYmFh
10
+ MGJkMDVkMTFiNzQzMmFjZGM5ZWFiY2M5YTBkMWI1YmM1NzU3Y2FjMTJlYTQx
11
+ OTcwNmUzOGNjOGJiNTFjMzVhZWFmNGE1OTU1ZTZmOTIzYjZiOTM=
12
+ data.tar.gz: !binary |-
13
+ YTc3ZDkyYTA4ZmI4MjQwOTM1YzFkZjM5YTg5ZTA1N2FkODE5YzllMjQwNDVi
14
+ ZWNkZjIyYzcxMmI5NTA2YjBlNmJjNDdmYTBjZWQwMTIwMjZlY2ZmMmYyMDg0
15
+ YjA4MWFjZDNjODllYzE0Yjc5NmI2MWI0NjZjZDQ4N2E2MWFlODE=
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ # A sample Gemfile
2
+ source "https://rubygems.org"
3
+
4
+ group :development do
5
+ gem "activerecord", "3.2.13"
6
+ gem "dm-core", "1.2.0"
7
+ gem "dm-migrations", "1.2.0"
8
+ gem "dm-sqlite-adapter", "1.2.0"
9
+ gem "dm-validations", "1.2.0"
10
+ gem "jeweler", "1.8.4"
11
+ gem "mongoid", "3.1.4"
12
+ gem "RedCloth", "4.2.9" # Can I state that I really dislike camelcased gem names?
13
+ gem "sqlite3", "1.3.7"
14
+ gem "travis-lint", "1.7.0"
15
+ gem "i18n", "0.6.1"
16
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,74 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ RedCloth (4.2.9)
5
+ activemodel (3.2.13)
6
+ activesupport (= 3.2.13)
7
+ builder (~> 3.0.0)
8
+ activerecord (3.2.13)
9
+ activemodel (= 3.2.13)
10
+ activesupport (= 3.2.13)
11
+ arel (~> 3.0.2)
12
+ tzinfo (~> 0.3.29)
13
+ activesupport (3.2.13)
14
+ i18n (= 0.6.1)
15
+ multi_json (~> 1.0)
16
+ addressable (2.2.8)
17
+ arel (3.0.2)
18
+ builder (3.0.4)
19
+ data_objects (0.10.13)
20
+ addressable (~> 2.1)
21
+ dm-core (1.2.0)
22
+ addressable (~> 2.2.6)
23
+ dm-do-adapter (1.2.0)
24
+ data_objects (~> 0.10.6)
25
+ dm-core (~> 1.2.0)
26
+ dm-migrations (1.2.0)
27
+ dm-core (~> 1.2.0)
28
+ dm-sqlite-adapter (1.2.0)
29
+ dm-do-adapter (~> 1.2.0)
30
+ do_sqlite3 (~> 0.10.6)
31
+ dm-validations (1.2.0)
32
+ dm-core (~> 1.2.0)
33
+ do_sqlite3 (0.10.13)
34
+ data_objects (= 0.10.13)
35
+ git (1.2.5)
36
+ hashr (0.0.22)
37
+ i18n (0.6.1)
38
+ jeweler (1.8.4)
39
+ bundler (~> 1.0)
40
+ git (>= 1.2.5)
41
+ rake
42
+ rdoc
43
+ json (1.8.0)
44
+ mongoid (3.1.4)
45
+ activemodel (~> 3.2)
46
+ moped (~> 1.4)
47
+ origin (~> 1.0)
48
+ tzinfo (~> 0.3.22)
49
+ moped (1.5.0)
50
+ multi_json (1.7.5)
51
+ origin (1.1.0)
52
+ rake (10.0.4)
53
+ rdoc (4.0.1)
54
+ json (~> 1.4)
55
+ sqlite3 (1.3.7)
56
+ travis-lint (1.7.0)
57
+ hashr (~> 0.0.22)
58
+ tzinfo (0.3.37)
59
+
60
+ PLATFORMS
61
+ ruby
62
+
63
+ DEPENDENCIES
64
+ RedCloth (= 4.2.9)
65
+ activerecord (= 3.2.13)
66
+ dm-core (= 1.2.0)
67
+ dm-migrations (= 1.2.0)
68
+ dm-sqlite-adapter (= 1.2.0)
69
+ dm-validations (= 1.2.0)
70
+ i18n (= 0.6.1)
71
+ jeweler (= 1.8.4)
72
+ mongoid (= 3.1.4)
73
+ sqlite3 (= 1.3.7)
74
+ travis-lint (= 1.7.0)
data/README.rdoc CHANGED
@@ -1,7 +1,9 @@
1
- = Stringex
1
+ = Stringex {<img src="https://codeclimate.com/github/rsl/stringex.png" />}[https://codeclimate.com/github/rsl/stringex] {<img src="https://travis-ci.org/rsl/stringex.png?branch=master" alt="Build Status" />}[https://travis-ci.org/rsl/stringex]
2
2
 
3
3
  Some [hopefully] useful extensions to Ruby's String class. It is made up of three libraries: ActsAsUrl, Unidecoder, and StringExtensions.
4
4
 
5
+ <em>NOTE: Stringex 2.0 [and beyond] drops support for Rails 2. If you need support for that version, use 1.5.1 instead.</em>
6
+
5
7
  == ActsAsUrl
6
8
 
7
9
  This library is designed to create URI-friendly representations of an attribute, for use in generating urls from your attributes. Basic usage is just calling the method:
@@ -90,6 +92,25 @@ In both the YAML and pure Hash implementation, the end result should be a Hash w
90
92
 
91
93
  A collection of extensions on Ruby's String class. Please see the documentation for StringExtensions module for more information. There's not much to explain about them really.
92
94
 
95
+ == Localization
96
+
97
+ With Stringex version 2.0 and higher, you can localize the different conversions in Stringex. Read more here[https://github.com/rsl/stringex/wiki/Localization-of-Stringex-conversions]
98
+
99
+ == Using with Rails
100
+
101
+ When using Stringex with Ruby on Rails, you automatically get built-in translations for miscellaneous characters, HTML entities, and vulgar fractions.
102
+
103
+ You can see Stringex's standard translations here: TODO: Insert link to the +locales+ folder.
104
+
105
+ Currently, built-in translations are available for the following languages:
106
+ English (en), Danish (da)
107
+
108
+ You can easily add your own or customize the built-in translations - read here[https://github.com/rsl/stringex/wiki/Localization-of-Stringex-conversions]. If you add a new language, please submit a pull request so we can make it available to other users also.
109
+
110
+ If you don't want to use the Stringex built-in translations, you can force Stringex to use English (or another language), regardless what is in your +I18n.locale+. In an initializer, e.g. +config/initializers/stringex.rb+:
111
+
112
+ Stringex::Localization.locale = :en
113
+
93
114
  == Note to users of CanCan
94
115
 
95
116
  You'll need to add a <tt>:find_by => :url</tt> to your <tt>load_and_authorize_resource</tt>. Here's an example:
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # encoding: utf-8
2
2
 
3
3
  require 'rake'
4
4
  require 'rake/testtask'
@@ -7,211 +7,19 @@ require 'rdoc/task'
7
7
  begin
8
8
  require 'jeweler'
9
9
  Jeweler::Tasks.new do |gem|
10
- gem.name = "stringex"
11
- gem.authors = ["Russell Norris"]
12
- gem.email = "rsl@luckysneaks.com"
13
- gem.homepage = "http://github.com/rsl/stringex"
14
- gem.summary = "Some [hopefully] useful extensions to Ruby's String class"
15
- gem.description = "Some [hopefully] useful extensions to Ruby's String class. Stringex is made up of three libraries: ActsAsUrl [permalink solution with better character translation], Unidecoder [Unicode to ASCII transliteration], and StringExtensions [miscellaneous helper methods for the String class]."
16
- gem.has_rdoc = true
17
- gem.files = %w{
18
- init.rb
19
- MIT-LICENSE
20
- Rakefile
21
- README.rdoc
22
- stringex.gemspec
23
- lib/stringex.rb
24
- lib/stringex/acts_as_url.rb
25
- lib/stringex/string_extensions.rb
26
- lib/stringex/unidecoder.rb
27
- lib/stringex/unidecoder_data/x00.yml
28
- lib/stringex/unidecoder_data/x01.yml
29
- lib/stringex/unidecoder_data/x02.yml
30
- lib/stringex/unidecoder_data/x03.yml
31
- lib/stringex/unidecoder_data/x04.yml
32
- lib/stringex/unidecoder_data/x05.yml
33
- lib/stringex/unidecoder_data/x06.yml
34
- lib/stringex/unidecoder_data/x07.yml
35
- lib/stringex/unidecoder_data/x09.yml
36
- lib/stringex/unidecoder_data/x0a.yml
37
- lib/stringex/unidecoder_data/x0b.yml
38
- lib/stringex/unidecoder_data/x0c.yml
39
- lib/stringex/unidecoder_data/x0d.yml
40
- lib/stringex/unidecoder_data/x0e.yml
41
- lib/stringex/unidecoder_data/x0f.yml
42
- lib/stringex/unidecoder_data/x10.yml
43
- lib/stringex/unidecoder_data/x11.yml
44
- lib/stringex/unidecoder_data/x12.yml
45
- lib/stringex/unidecoder_data/x13.yml
46
- lib/stringex/unidecoder_data/x14.yml
47
- lib/stringex/unidecoder_data/x15.yml
48
- lib/stringex/unidecoder_data/x16.yml
49
- lib/stringex/unidecoder_data/x17.yml
50
- lib/stringex/unidecoder_data/x18.yml
51
- lib/stringex/unidecoder_data/x1e.yml
52
- lib/stringex/unidecoder_data/x1f.yml
53
- lib/stringex/unidecoder_data/x20.yml
54
- lib/stringex/unidecoder_data/x21.yml
55
- lib/stringex/unidecoder_data/x22.yml
56
- lib/stringex/unidecoder_data/x23.yml
57
- lib/stringex/unidecoder_data/x24.yml
58
- lib/stringex/unidecoder_data/x25.yml
59
- lib/stringex/unidecoder_data/x26.yml
60
- lib/stringex/unidecoder_data/x27.yml
61
- lib/stringex/unidecoder_data/x28.yml
62
- lib/stringex/unidecoder_data/x2e.yml
63
- lib/stringex/unidecoder_data/x2f.yml
64
- lib/stringex/unidecoder_data/x30.yml
65
- lib/stringex/unidecoder_data/x31.yml
66
- lib/stringex/unidecoder_data/x32.yml
67
- lib/stringex/unidecoder_data/x33.yml
68
- lib/stringex/unidecoder_data/x4d.yml
69
- lib/stringex/unidecoder_data/x4e.yml
70
- lib/stringex/unidecoder_data/x4f.yml
71
- lib/stringex/unidecoder_data/x50.yml
72
- lib/stringex/unidecoder_data/x51.yml
73
- lib/stringex/unidecoder_data/x52.yml
74
- lib/stringex/unidecoder_data/x53.yml
75
- lib/stringex/unidecoder_data/x54.yml
76
- lib/stringex/unidecoder_data/x55.yml
77
- lib/stringex/unidecoder_data/x56.yml
78
- lib/stringex/unidecoder_data/x57.yml
79
- lib/stringex/unidecoder_data/x58.yml
80
- lib/stringex/unidecoder_data/x59.yml
81
- lib/stringex/unidecoder_data/x5a.yml
82
- lib/stringex/unidecoder_data/x5b.yml
83
- lib/stringex/unidecoder_data/x5c.yml
84
- lib/stringex/unidecoder_data/x5d.yml
85
- lib/stringex/unidecoder_data/x5e.yml
86
- lib/stringex/unidecoder_data/x5f.yml
87
- lib/stringex/unidecoder_data/x60.yml
88
- lib/stringex/unidecoder_data/x61.yml
89
- lib/stringex/unidecoder_data/x62.yml
90
- lib/stringex/unidecoder_data/x63.yml
91
- lib/stringex/unidecoder_data/x64.yml
92
- lib/stringex/unidecoder_data/x65.yml
93
- lib/stringex/unidecoder_data/x66.yml
94
- lib/stringex/unidecoder_data/x67.yml
95
- lib/stringex/unidecoder_data/x68.yml
96
- lib/stringex/unidecoder_data/x69.yml
97
- lib/stringex/unidecoder_data/x6a.yml
98
- lib/stringex/unidecoder_data/x6b.yml
99
- lib/stringex/unidecoder_data/x6c.yml
100
- lib/stringex/unidecoder_data/x6d.yml
101
- lib/stringex/unidecoder_data/x6e.yml
102
- lib/stringex/unidecoder_data/x6f.yml
103
- lib/stringex/unidecoder_data/x70.yml
104
- lib/stringex/unidecoder_data/x71.yml
105
- lib/stringex/unidecoder_data/x72.yml
106
- lib/stringex/unidecoder_data/x73.yml
107
- lib/stringex/unidecoder_data/x74.yml
108
- lib/stringex/unidecoder_data/x75.yml
109
- lib/stringex/unidecoder_data/x76.yml
110
- lib/stringex/unidecoder_data/x77.yml
111
- lib/stringex/unidecoder_data/x78.yml
112
- lib/stringex/unidecoder_data/x79.yml
113
- lib/stringex/unidecoder_data/x7a.yml
114
- lib/stringex/unidecoder_data/x7b.yml
115
- lib/stringex/unidecoder_data/x7c.yml
116
- lib/stringex/unidecoder_data/x7d.yml
117
- lib/stringex/unidecoder_data/x7e.yml
118
- lib/stringex/unidecoder_data/x7f.yml
119
- lib/stringex/unidecoder_data/x80.yml
120
- lib/stringex/unidecoder_data/x81.yml
121
- lib/stringex/unidecoder_data/x82.yml
122
- lib/stringex/unidecoder_data/x83.yml
123
- lib/stringex/unidecoder_data/x84.yml
124
- lib/stringex/unidecoder_data/x85.yml
125
- lib/stringex/unidecoder_data/x86.yml
126
- lib/stringex/unidecoder_data/x87.yml
127
- lib/stringex/unidecoder_data/x88.yml
128
- lib/stringex/unidecoder_data/x89.yml
129
- lib/stringex/unidecoder_data/x8a.yml
130
- lib/stringex/unidecoder_data/x8b.yml
131
- lib/stringex/unidecoder_data/x8c.yml
132
- lib/stringex/unidecoder_data/x8d.yml
133
- lib/stringex/unidecoder_data/x8e.yml
134
- lib/stringex/unidecoder_data/x8f.yml
135
- lib/stringex/unidecoder_data/x90.yml
136
- lib/stringex/unidecoder_data/x91.yml
137
- lib/stringex/unidecoder_data/x92.yml
138
- lib/stringex/unidecoder_data/x93.yml
139
- lib/stringex/unidecoder_data/x94.yml
140
- lib/stringex/unidecoder_data/x95.yml
141
- lib/stringex/unidecoder_data/x96.yml
142
- lib/stringex/unidecoder_data/x97.yml
143
- lib/stringex/unidecoder_data/x98.yml
144
- lib/stringex/unidecoder_data/x99.yml
145
- lib/stringex/unidecoder_data/x9a.yml
146
- lib/stringex/unidecoder_data/x9b.yml
147
- lib/stringex/unidecoder_data/x9c.yml
148
- lib/stringex/unidecoder_data/x9d.yml
149
- lib/stringex/unidecoder_data/x9e.yml
150
- lib/stringex/unidecoder_data/x9f.yml
151
- lib/stringex/unidecoder_data/xa0.yml
152
- lib/stringex/unidecoder_data/xa1.yml
153
- lib/stringex/unidecoder_data/xa2.yml
154
- lib/stringex/unidecoder_data/xa3.yml
155
- lib/stringex/unidecoder_data/xa4.yml
156
- lib/stringex/unidecoder_data/xac.yml
157
- lib/stringex/unidecoder_data/xad.yml
158
- lib/stringex/unidecoder_data/xae.yml
159
- lib/stringex/unidecoder_data/xaf.yml
160
- lib/stringex/unidecoder_data/xb0.yml
161
- lib/stringex/unidecoder_data/xb1.yml
162
- lib/stringex/unidecoder_data/xb2.yml
163
- lib/stringex/unidecoder_data/xb3.yml
164
- lib/stringex/unidecoder_data/xb4.yml
165
- lib/stringex/unidecoder_data/xb5.yml
166
- lib/stringex/unidecoder_data/xb6.yml
167
- lib/stringex/unidecoder_data/xb7.yml
168
- lib/stringex/unidecoder_data/xb8.yml
169
- lib/stringex/unidecoder_data/xb9.yml
170
- lib/stringex/unidecoder_data/xba.yml
171
- lib/stringex/unidecoder_data/xbb.yml
172
- lib/stringex/unidecoder_data/xbc.yml
173
- lib/stringex/unidecoder_data/xbd.yml
174
- lib/stringex/unidecoder_data/xbe.yml
175
- lib/stringex/unidecoder_data/xbf.yml
176
- lib/stringex/unidecoder_data/xc0.yml
177
- lib/stringex/unidecoder_data/xc1.yml
178
- lib/stringex/unidecoder_data/xc2.yml
179
- lib/stringex/unidecoder_data/xc3.yml
180
- lib/stringex/unidecoder_data/xc4.yml
181
- lib/stringex/unidecoder_data/xc5.yml
182
- lib/stringex/unidecoder_data/xc6.yml
183
- lib/stringex/unidecoder_data/xc7.yml
184
- lib/stringex/unidecoder_data/xc8.yml
185
- lib/stringex/unidecoder_data/xc9.yml
186
- lib/stringex/unidecoder_data/xca.yml
187
- lib/stringex/unidecoder_data/xcb.yml
188
- lib/stringex/unidecoder_data/xcc.yml
189
- lib/stringex/unidecoder_data/xcd.yml
190
- lib/stringex/unidecoder_data/xce.yml
191
- lib/stringex/unidecoder_data/xcf.yml
192
- lib/stringex/unidecoder_data/xd0.yml
193
- lib/stringex/unidecoder_data/xd1.yml
194
- lib/stringex/unidecoder_data/xd2.yml
195
- lib/stringex/unidecoder_data/xd3.yml
196
- lib/stringex/unidecoder_data/xd4.yml
197
- lib/stringex/unidecoder_data/xd5.yml
198
- lib/stringex/unidecoder_data/xd6.yml
199
- lib/stringex/unidecoder_data/xd7.yml
200
- lib/stringex/unidecoder_data/xf9.yml
201
- lib/stringex/unidecoder_data/xfa.yml
202
- lib/stringex/unidecoder_data/xfb.yml
203
- lib/stringex/unidecoder_data/xfc.yml
204
- lib/stringex/unidecoder_data/xfd.yml
205
- lib/stringex/unidecoder_data/xfe.yml
206
- lib/stringex/unidecoder_data/xff.yml
207
- }
208
- gem.test_files = %w{
209
- test/acts_as_url_test.rb
210
- test/string_extensions_test.rb
211
- test/unidecoder_test.rb
212
- }
10
+ gem.name = "stringex"
11
+ gem.authors = ["Russell Norris"]
12
+ gem.email = "rsl@luckysneaks.com"
13
+ gem.homepage = "http://github.com/rsl/stringex"
14
+ gem.summary = "Some [hopefully] useful extensions to Ruby's String class"
15
+ gem.description = "Some [hopefully] useful extensions to Ruby's String class. Stringex is made up of three libraries: ActsAsUrl [permalink solution with better character translation], Unidecoder [Unicode to ASCII transliteration], and StringExtensions [miscellaneous helper methods for the String class]."
16
+ gem.files.exclude '.travis.yml'
17
+ gem.files.exclude '.ruby-gemset'
18
+ gem.files.exclude '.ruby-version'
19
+ gem.has_rdoc = true
213
20
  gem.rdoc_options = %w{--main README.rdoc --charset utf-8 --line-numbers}
214
21
  gem.extra_rdoc_files = %w{MIT-LICENSE README.rdoc}
22
+ gem.licenses = ['MIT']
215
23
  end
216
24
 
217
25
  Jeweler::RubygemsDotOrgTasks.new
@@ -219,32 +27,47 @@ rescue LoadError
219
27
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
220
28
  end
221
29
 
222
- desc 'Default: run unit tests.'
223
- task :default => [:refresh_db, :test]
30
+ Rake::TestTask.new do |t|
31
+ t.libs << 'lib' << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = true
34
+ end
35
+
36
+ desc 'Default: Run Stringex test suite using ActiveRecord as the ORM'
37
+ task :default => [:setup_active_record_suite, :test]
224
38
 
225
- desc 'Remove old sqlite file.'
226
- task :refresh_db do
227
- `rm -f #{File.dirname(__FILE__)}/test/acts_as_url.sqlite3`
39
+ task :setup_active_record_suite do
40
+ ENV['ADAPTER'] = 'active_record'
228
41
  end
229
42
 
230
- desc 'Test the stringex plugin.'
231
- Rake::TestTask.new(:test) do |t|
232
- t.libs << 'lib'
233
- t.pattern = 'test/**/*_test.rb'
234
- t.verbose = true
43
+ desc 'Run Stringex test suite using ActiveRecord as the ORM'
44
+ namespace :test do
45
+ task :active_record => [:setup_active_record_suite]
235
46
  end
236
47
 
237
- desc 'Generate documentation for the stringex plugin.'
238
- Rake::RDocTask.new(:rdoc) do |rdoc|
239
- if File.exist?('VERSION.yml')
240
- config = YAML.load(File.read('VERSION.yml'))
241
- version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
242
- else
243
- version = ""
244
- end
48
+ task :setup_mongoid_suite do
49
+ ENV['ADAPTER'] = 'mongoid'
50
+ end
51
+
52
+ desc 'Run Stringex test suite using Mongoid as the ORM'
53
+ namespace :test do
54
+ task :mongoid => [:setup_mongoid_suite, :test]
55
+ end
56
+
57
+ task :setup_data_mapper_suite do
58
+ ENV['ADAPTER'] = 'data_mapper'
59
+ end
245
60
 
61
+ desc 'Run Stringex test suite using DataMapper as the ORM'
62
+ namespace :test do
63
+ task :data_mapper => [:setup_data_mapper_suite, :test]
64
+ end
65
+
66
+ desc 'Generate RDoc for Stringex'
67
+ Rake::RDocTask.new(:rdoc) do |rdoc|
68
+ version = File.read('VERSION')
246
69
  rdoc.rdoc_dir = 'rdoc'
247
- rdoc.title = 'Stringex: A String Extension Pack [#{version}]'
70
+ rdoc.title = "Stringex: A String Extension Pack [Version #{version}]"
248
71
  rdoc.options << '--line-numbers' << '--inline-source'
249
72
  rdoc.options << '--charset' << 'utf-8'
250
73
  rdoc.rdoc_files.include('README.rdoc')
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
data/init.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  # encoding: UTF-8
2
+
2
3
  require "stringex"