forgery 0.4.3 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.travis.yml +12 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +35 -0
- data/LICENSE +1 -1
- data/README.markdown +196 -60
- data/Rakefile +10 -54
- data/forgery.gemspec +23 -0
- data/lib/forgery.rb +0 -1
- data/lib/forgery/dictionaries/bics +7 -0
- data/lib/forgery/dictionaries/company_names +0 -1
- data/lib/forgery/dictionaries/currency_descriptions +2 -2
- data/lib/forgery/dictionaries/ibans +61 -0
- data/lib/forgery/dictionaries/job_titles +1 -1
- data/lib/forgery/dictionaries/zones +1 -2
- data/lib/forgery/extend.rb +0 -2
- data/lib/forgery/extensions/range.rb +1 -1
- data/lib/forgery/file_reader.rb +2 -1
- data/lib/forgery/forgery/bank_account.rb +25 -0
- data/lib/forgery/forgery/basic.rb +1 -1
- data/lib/forgery/forgery/credit_card.rb +71 -0
- data/lib/forgery/forgery/geo.rb +54 -0
- data/lib/forgery/forgery/internet.rb +7 -0
- data/lib/forgery/forgery/lorem_ipsum.rb +4 -4
- data/lib/forgery/forgery/russian_tax.rb +57 -0
- data/lib/forgery/forgery_railtie.rb +0 -29
- data/lib/forgery/formats/phone +1 -1
- data/lib/forgery/version.rb +3 -1
- data/spec/data/dictionaries/code_names +6 -0
- data/spec/data/dictionaries/female_first_names +1 -0
- data/spec/data/documents/mock_web_page.html +17 -0
- data/spec/data/documents/mock_xml_doc.xml +5 -0
- data/spec/dictionaries_spec.rb +35 -0
- data/spec/extensions/array_spec.rb +25 -0
- data/spec/extensions/range_spec.rb +33 -0
- data/spec/extensions/string_spec.rb +29 -0
- data/spec/file_reader_spec.rb +32 -0
- data/spec/forgery/address_spec.rb +84 -0
- data/spec/forgery/bank_account_spec.rb +16 -0
- data/spec/forgery/basic_spec.rb +179 -0
- data/spec/forgery/credit_card_spec.rb +68 -0
- data/spec/forgery/currency_spec.rb +15 -0
- data/spec/forgery/date_spec.rb +134 -0
- data/spec/forgery/internet_spec.rb +62 -0
- data/spec/forgery/lorem_ipsum_spec.rb +132 -0
- data/spec/forgery/monetary_spec.rb +14 -0
- data/spec/forgery/name_spec.rb +11 -0
- data/spec/forgery/personal_spec.rb +15 -0
- data/spec/forgery/russian_tax_spec.rb +81 -0
- data/spec/forgery/time_spec.rb +7 -0
- data/spec/forgery_spec.rb +63 -0
- data/spec/formats_spec.rb +35 -0
- data/spec/spec_helper.rb +39 -0
- metadata +89 -38
- data/lib/forgery/file_writer.rb +0 -54
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 76b44d025c21b45dc7df8213246deb73529223357e862efb5278c5ffa3bcc7ef
|
4
|
+
data.tar.gz: 5f905c142572cc921c5c2742cef6ecf192e6cc2570dd1fff234f5313ce658ee9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 68431f47e7370aa37d807779d0253e9dd9b81d49b8e8e02f47a6d6f240f146dd7b986fbcd0b71796c9f397fb6919501fda5afc422f9d9e2dc976f2da4a6833b0
|
7
|
+
data.tar.gz: 01ed166d1e736194f9d67b80870ab3c116bea2764660504e22bf23e37c8cbf08183b86fcc9e797d6ca28de7c222c750fedf90ebe12de57a7f8cf283f1c182864
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
forgery (0.8.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (13.0.1)
|
11
|
+
rspec (3.7.0)
|
12
|
+
rspec-core (~> 3.7.0)
|
13
|
+
rspec-expectations (~> 3.7.0)
|
14
|
+
rspec-mocks (~> 3.7.0)
|
15
|
+
rspec-core (3.7.0)
|
16
|
+
rspec-support (~> 3.7.0)
|
17
|
+
rspec-expectations (3.7.0)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.7.0)
|
20
|
+
rspec-mocks (3.7.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.7.0)
|
23
|
+
rspec-support (3.7.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 2.1.4)
|
30
|
+
forgery!
|
31
|
+
rake
|
32
|
+
rspec
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
2.1.4
|
data/LICENSE
CHANGED
data/README.markdown
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
Forgery
|
2
|
-
|
1
|
+
# Forgery
|
2
|
+
|
3
|
+
[](https://travis-ci.org/sevenwire/forgery)
|
4
|
+
[](https://codeclimate.com/github/sevenwire/forgery)
|
3
5
|
|
4
6
|
**A Problem**:
|
5
|
-
It's harder than
|
7
|
+
It's harder than _absolutely easy_ to make meaningful, simple, data for testing and development.
|
6
8
|
|
7
9
|
**A Solution**:
|
8
10
|
A fake data generator that provides not only a host of basics and a rememberable syntax, but a customizable library to boot.
|
9
11
|
|
10
12
|
Welcome to Forgery, an excellent solution to a problem so hard you didn't know it was there.
|
11
13
|
|
12
|
-
|
13
|
-
Using
|
14
|
-
-----
|
14
|
+
## Using
|
15
15
|
|
16
16
|
You'll want to read individual Forgery categories for more information, but these are the basics:
|
17
17
|
|
18
|
-
|
18
|
+
```ruby
|
19
19
|
Forgery(:basic).password
|
20
20
|
#=> "b6qZTQEH"
|
21
21
|
|
@@ -30,112 +30,248 @@ Forgery(:lorem_ipsum).words(10)
|
|
30
30
|
|
31
31
|
Forgery(:monetary).formatted_money :min => 100, :max => 1000
|
32
32
|
#=> "$923.36"
|
33
|
-
|
33
|
+
```
|
34
34
|
|
35
|
-
And many many
|
35
|
+
And many many more!
|
36
36
|
|
37
|
-
Alternatively you can write it like this:
|
37
|
+
Alternatively you can write it like this:
|
38
38
|
|
39
|
-
|
39
|
+
```ruby
|
40
40
|
Forgery::Basic.hex_color
|
41
41
|
Forgery::Name.full_name
|
42
42
|
Forgery::Personal.shirt_size
|
43
|
-
|
43
|
+
```
|
44
44
|
|
45
45
|
In addition, you can always write your own dictionaries and formats, overriding the ones in the gem.
|
46
|
-
Fully explained
|
46
|
+
Fully explained here.
|
47
47
|
|
48
|
-
|
49
|
-
Installing
|
50
|
-
----------
|
48
|
+
## Installing
|
51
49
|
|
52
50
|
Like any gem, you can install Forgery two ways depending on it's use.
|
53
51
|
|
54
52
|
For normal Ruby development, you need simply use:
|
55
53
|
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
```bash
|
55
|
+
gem install forgery
|
56
|
+
```
|
59
57
|
|
60
58
|
This will add it to your gem library, just like any normal gem.
|
61
59
|
You can then use it like any normal gem library.
|
62
|
-
See
|
63
|
-
|
60
|
+
See examples for more.
|
64
61
|
|
65
|
-
|
62
|
+
### Rails 3.x
|
66
63
|
|
67
64
|
If you're using Rails 3.x you need to do a few extra things (that are probably rote).
|
68
65
|
First step is to add it to your `Rails.root/Gemfile`, we also suggest specifying the latest version (found on rubygems):
|
69
66
|
|
70
|
-
|
71
|
-
gem 'forgery', '0.
|
72
|
-
|
67
|
+
```ruby
|
68
|
+
gem 'forgery', '0.6.0'
|
69
|
+
```
|
73
70
|
|
74
71
|
Then you'll need to run `bundle install` to install and lock in your new gem.
|
75
72
|
Next you'll want to run the special Rails 3 generator:
|
76
73
|
|
77
|
-
|
78
|
-
|
79
|
-
|
74
|
+
```bash
|
75
|
+
bundle exec rails generate forgery
|
76
|
+
```
|
80
77
|
|
81
|
-
|
78
|
+
### Rails 2.x
|
82
79
|
|
83
80
|
For **Rails 2.x** you'll need to do something a little different, by first editing your `Rails.root/config/environment.rb` and adding this to the configuration block:
|
84
81
|
|
85
|
-
|
82
|
+
```ruby
|
86
83
|
config.gem 'forgery'
|
87
|
-
|
84
|
+
```
|
88
85
|
|
89
86
|
Then you'll need to run this in your command line:
|
90
87
|
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
```bash
|
89
|
+
script/generate forgery
|
90
|
+
```
|
94
91
|
|
95
|
-
|
92
|
+
### Generators
|
96
93
|
|
97
94
|
This Rails generators will make these directories in your Rails.root directory:
|
98
95
|
|
99
|
-
~~~ YAML
|
100
96
|
- Rails.root/lib/forgery
|
101
97
|
- Rails.root/lib/forgery/dictionaries
|
102
98
|
- Rails.root/lib/forgery/extensions
|
103
99
|
- Rails.root/lib/forgery/forgeries
|
104
100
|
- Rails.root/lib/forgery/formats
|
105
|
-
~~~
|
106
101
|
|
107
102
|
You can then use these directories to write your own dictionaries, class extensions, forgeries, and formats.
|
108
103
|
|
109
|
-
|
110
|
-
|
111
|
-
|
104
|
+
## Full List of Methods
|
105
|
+
|
106
|
+
| Address | Example Output |
|
107
|
+
| :----------------------------------- | :---------------- |
|
108
|
+
| `Forgery('address').city` | Loomis |
|
109
|
+
| `Forgery('address').continent` | South America |
|
110
|
+
| `Forgery('address').country` | Cameroon |
|
111
|
+
| `Forgery('address').phone` | +1 (693) 901-4549 |
|
112
|
+
| `Forgery('address').province` | Alberta |
|
113
|
+
| `Forgery('address').province_abbrev` | NT |
|
114
|
+
| `Forgery('address').state` | Alabama |
|
115
|
+
| `Forgery('address').state_abbrev` | SC |
|
116
|
+
| `Forgery('address').street_address` | 21 Hayes Park |
|
117
|
+
| `Forgery('address').street_name` | Oneill |
|
118
|
+
| `Forgery('address').street_number` | 222 |
|
119
|
+
| `Forgery('address').street_suffix` | Drive |
|
120
|
+
| `Forgery('address').zip` | 11281-5568 |
|
121
|
+
|
122
|
+
| Basic | Example Output |
|
123
|
+
| :--------------------------------- | :--------------------------------------- |
|
124
|
+
| `Forgery('basic').boolean` | `true` (`TrueClass`) |
|
125
|
+
| `Forgery('basic').color` | Red |
|
126
|
+
| `Forgery('basic').encrypt` | fc0d835dd4e4df144a33a6a346298b0f23dcd14a |
|
127
|
+
| `Forgery('basic').frequency` | Never |
|
128
|
+
| `Forgery('basic').hex_color` | #e1d82a |
|
129
|
+
| `Forgery('basic').number` | 4 |
|
130
|
+
| `Forgery('basic').password` | KcLBHCv6 |
|
131
|
+
| `Forgery('basic').short_hex_color` | #c1d |
|
132
|
+
| `Forgery('basic').text` | G8gECFfvDs2 |
|
133
|
+
|
134
|
+
| Credit Card | Example Output |
|
135
|
+
| :------------------------------------------- | :----------------- |
|
136
|
+
| `Forgery('credit_card').check_digit(number)` | 5 |
|
137
|
+
| `Forgery('credit_card').number` | 343682330855371 |
|
138
|
+
| `Forgery('credit_card').type` | American Express |
|
139
|
+
| `Forgery('currency').code` | XPF |
|
140
|
+
| `Forgery('currency').description` | Austria Schillings |
|
141
|
+
|
142
|
+
| Date | Example Output |
|
143
|
+
| :------------------------------- | :------------------------ |
|
144
|
+
| `Forgery('date').date` | Fri, 20 Mar 2009 (`Date`) |
|
145
|
+
| `Forgery('date').day` | 15 |
|
146
|
+
| `Forgery('date').day_of_week` | Monday |
|
147
|
+
| `Forgery('date').delta(options)` | 3 |
|
148
|
+
| `Forgery('date').month` | January |
|
149
|
+
| `Forgery('date').year` | 1994 |
|
150
|
+
|
151
|
+
| Email | Example Output |
|
152
|
+
| :------------------------- | :------------------------------------------- |
|
153
|
+
| `Forgery('email').address` | gsmith@kamba.org |
|
154
|
+
| `Forgery('email').body` | Lorem ipsum dolor sit amet, consectetuer ... |
|
155
|
+
| `Forgery('email').subject` | Lorem Ipsum Dolor Sit Amet... |
|
156
|
+
|
157
|
+
| Geo | Example Output |
|
158
|
+
| :----------------------------------- | :--------------------------- |
|
159
|
+
| `Forgery('geo').latitude` | -8.095096815540515 (`Float`) |
|
160
|
+
| `Forgery('geo').latitude_degrees` | -49 |
|
161
|
+
| `Forgery('geo').latitude_direction` | N |
|
162
|
+
| `Forgery('geo').latitude_minutes` | 14 |
|
163
|
+
| `Forgery('geo').latitude_seconds` | 45 |
|
164
|
+
| `Forgery('geo').longitude` | -22.56746406884514 (`Float`) |
|
165
|
+
| `Forgery('geo').longitude_degrees` | 100 |
|
166
|
+
| `Forgery('geo').longitude_direction` | W |
|
167
|
+
| `Forgery('geo').longitude_minutes` | 47 |
|
168
|
+
| `Forgery('geo').longitude_seconds` | 41 |
|
169
|
+
|
170
|
+
| Internet | Example Output |
|
171
|
+
| :------------------------------------- | :-------------------------------------- |
|
172
|
+
| `Forgery('internet').cctld` | cf |
|
173
|
+
| `Forgery('internet').domain_name` | bubbletube.net |
|
174
|
+
| `Forgery('internet').email_address` | cwalker@quire.name |
|
175
|
+
| `Forgery('internet').email_subject` | Lorem Ipsum Dolor Sit Amet... |
|
176
|
+
| `Forgery('internet').ip_v4` | 94.120.51.103 |
|
177
|
+
| `Forgery('internet').ip_v6` | c61e:5926:15e6:d225:8eef:fb39:7412:e9d5 |
|
178
|
+
| `Forgery('internet').top_level_domain` | com |
|
179
|
+
| `Forgery('internet').user_name` | sdixon |
|
180
|
+
|
181
|
+
| Lorem Ipsum | Example Output |
|
182
|
+
| :----------------------------------------------------- | :---------------------------------------- |
|
183
|
+
| `Forgery('lorem_ipsum').character` | l |
|
184
|
+
| `Forgery('lorem_ipsum').characters` | lorem ipsu |
|
185
|
+
| `Forgery('lorem_ipsum').lorem_ipsum_characters` | lorem ipsum dolor sit amet... |
|
186
|
+
| `Forgery('lorem_ipsum').lorem_ipsum_words` | ["lorem", "ipsum", "dolor", ...](`Array`) |
|
187
|
+
| `Forgery('lorem_ipsum').paragraph` | Lorem ipsum dolor sit amet... |
|
188
|
+
| `Forgery('lorem_ipsum').paragraphs` | Lorem ipsum dolor sit amet... |
|
189
|
+
| `Forgery('lorem_ipsum').range_from_quantity(quantity)` | 0..4 (`Range`) |
|
190
|
+
| `Forgery('lorem_ipsum').sentence` | Lorem ipsum dolor sit amet... |
|
191
|
+
| `Forgery('lorem_ipsum').sentences` | Lorem ipsum dolor sit amet... |
|
192
|
+
| `Forgery('lorem_ipsum').text` | Lorem ipsum dolor sit amet... |
|
193
|
+
| `Forgery('lorem_ipsum').title` | Lorem Ipsum Dolor Sit Amet... |
|
194
|
+
| `Forgery('lorem_ipsum').word` | lorem |
|
195
|
+
| `Forgery('lorem_ipsum').words` | lorem ipsum dolor sit amet... |
|
196
|
+
|
197
|
+
| Monetary | Example Output |
|
198
|
+
| :------------------------------------ | :-------------- |
|
199
|
+
| `Forgery('monetary').formatted_money` | \$5.49 |
|
200
|
+
| `Forgery('monetary').money` | 9.20 (`String`) |
|
201
|
+
|
202
|
+
| Name | Example Output |
|
203
|
+
| :---------------------------------- | :----------------- |
|
204
|
+
| `Forgery('name').company_name` | Bubbletube |
|
205
|
+
| `Forgery('name').female_first_name` | Judy |
|
206
|
+
| `Forgery('name').first_name` | Albert |
|
207
|
+
| `Forgery('name').full_name` | Evelyn Wallace |
|
208
|
+
| `Forgery('name').industry` | Toy & Hobby Stores |
|
209
|
+
| `Forgery('name').job_title` | Analyst Programmer |
|
210
|
+
| `Forgery('name').job_title_suffix` | III |
|
211
|
+
| `Forgery('name').last_name` | Jackson |
|
212
|
+
| `Forgery('name').location` | Try-N-Save |
|
213
|
+
| `Forgery('name').male_first_name` | Donald |
|
214
|
+
| `Forgery('name').suffix` | Sr |
|
215
|
+
| `Forgery('name').title` | Mr |
|
216
|
+
|
217
|
+
| Personal | Example Output |
|
218
|
+
| :--------------------------------------- | :------------- |
|
219
|
+
| `Forgery('personal').abbreviated_gender` | F |
|
220
|
+
| `Forgery('personal').gender` | Female |
|
221
|
+
| `Forgery('personal').language` | Bislama |
|
222
|
+
| `Forgery('personal').race` | Indonesian |
|
223
|
+
| `Forgery('personal').shirt_size` | 2XL |
|
224
|
+
|
225
|
+
| Bank Account | Example Output |
|
226
|
+
| :----------------------------- | :--------------- |
|
227
|
+
| `Forgery('bank_account').iban` | BE68539007547034 |
|
228
|
+
| `Forgery('bank_account').bic` | VBRSDE33345 |
|
229
|
+
|
230
|
+
| Russian Tax | Example Output |
|
231
|
+
| :-------------------------------------- | :------------------- |
|
232
|
+
| `Forgery('russian_tax').account_number` | 56335652786612121479 |
|
233
|
+
| `Forgery('russian_tax').bik` | 046533860 |
|
234
|
+
| `Forgery('russian_tax').inn` | 7366543467 |
|
235
|
+
| `Forgery('russian_tax').legal_inn` | 7822838630 |
|
236
|
+
| `Forgery('russian_tax').legal_ogrn` | 3483465598635 |
|
237
|
+
| `Forgery('russian_tax').ogrn` | 666325227817763 |
|
238
|
+
| `Forgery('russian_tax').person_inn` | 451559765443 |
|
239
|
+
| `Forgery('russian_tax').person_ogrn` | 195478617554621 |
|
240
|
+
|
241
|
+
| Time | Example Output |
|
242
|
+
| :--------------------- | :------------------- |
|
243
|
+
| `Forgery('time').zone` | Amsterdam (`String`) |
|
244
|
+
|
245
|
+
## Contributing
|
112
246
|
|
113
247
|
This is a work in progress and an open source project, so feel free to contribute.
|
114
248
|
We'll take pull requests via git or suggestions via the issues tab.
|
115
249
|
Any work done on Forgery will get you into the credits list and in our hearts.
|
116
250
|
|
117
|
-
|
118
|
-
Credits
|
119
|
-
-------
|
251
|
+
## Credits
|
120
252
|
|
121
253
|
Thanks to the authors and contributors:
|
122
254
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
255
|
+
- Nate Sutton (nate aka fowlduck)
|
256
|
+
- Brandon Arbini (brandonarbini)
|
257
|
+
- Josh Nichols (technicalpickles)
|
258
|
+
- Jeremy Stephens (viking aka crookshanks)
|
259
|
+
- Darcy Laycock (Sutto)
|
260
|
+
- Lukas Westermann (lwe)
|
261
|
+
- Mike Dungan
|
262
|
+
- Andrew Selder (aselder)
|
263
|
+
- Thomas Sinclair (anathematic)
|
264
|
+
- Stafford Brunk (wingrunr21)
|
265
|
+
- SixArm (SixArm)
|
266
|
+
- Akira Matsuda (amatsuda)
|
267
|
+
- Diego Plentz (plentz)
|
268
|
+
- Gabe Berke-Williams (gabebw)
|
269
|
+
- Todd Mazierski (toddmazierski)
|
270
|
+
- Galen Palmer (palmergs)
|
271
|
+
- Matt Bertino (mbbertino)
|
272
|
+
- Olle Jonsson (olleolleolle)
|
273
|
+
|
274
|
+
## Licensing
|
139
275
|
|
140
276
|
Copyright (c) 2007 Sevenwire LLC
|
141
277
|
|
@@ -158,4 +294,4 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
158
294
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
159
295
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
160
296
|
|
161
|
-
On that note, have fun!
|
297
|
+
On that note, have fun!
|
data/Rakefile
CHANGED
@@ -1,59 +1,15 @@
|
|
1
|
-
require '
|
2
|
-
require 'rake'
|
3
|
-
require 'rspec/core'
|
1
|
+
require 'bundler'
|
4
2
|
require 'rspec/core/rake_task'
|
5
|
-
require 'rdoc/task'
|
6
|
-
require File.expand_path('./lib/forgery/file_writer')
|
7
3
|
|
8
|
-
|
9
|
-
require 'sdoc_helpers'
|
10
|
-
rescue LoadError
|
11
|
-
puts "sdoc support not enabled. Please gem install sdoc-helpers."
|
12
|
-
end
|
13
|
-
|
14
|
-
desc 'Default: run specs with rcov.'
|
15
|
-
task :default => :rcov_spec
|
16
|
-
|
17
|
-
desc 'Run the specs'
|
18
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
19
|
-
t.rspec_opts = ['--colour --format progress']
|
20
|
-
t.pattern = FileList['spec/**/*_spec.rb']
|
21
|
-
end
|
22
|
-
|
23
|
-
desc 'Run the specs with rcov'
|
24
|
-
RSpec::Core::RakeTask.new("rcov_spec") do |t|
|
25
|
-
t.pattern = FileList['spec/**/*_spec.rb']
|
26
|
-
t.rspec_opts = ['--color']
|
27
|
-
t.rcov = true
|
28
|
-
t.rcov_opts = ['--exclude', '^spec,/gems/']
|
29
|
-
end
|
30
|
-
|
31
|
-
Rake::RDocTask.new do |t|
|
32
|
-
t.rdoc_dir = 'doc'
|
33
|
-
t.rdoc_files.include('lib/**/*.rb')
|
34
|
-
t.options << '--inline-source'
|
35
|
-
t.options << '--all'
|
36
|
-
t.options << '--line-numbers'
|
37
|
-
end
|
38
|
-
|
39
|
-
desc %q{
|
40
|
-
Create a dictionary file from web content (xml or html).
|
41
|
-
Writes to the directory specified by Forgery::FileWriter#write_to!
|
42
|
-
'${GEM_HOME}/lib/forgery/dictionaries' by default (standalone)
|
43
|
-
'${Rails.root}/lib/forgery/dictionaries' by default (as a Rails 3 plugin)
|
44
|
-
|
45
|
-
Parameters:
|
46
|
-
:dictionary_name -- the name of your new dictionary file
|
47
|
-
:source_url -- web page containing the data for your dictionary file
|
48
|
-
:css_or_xpath -- css or xpath selector(s) to element(s) containing the desired data
|
4
|
+
task :default => :spec
|
49
5
|
|
50
|
-
|
51
|
-
|
52
|
-
}
|
53
|
-
task :create_dictionary, :dictionary_name, :source_url, :css_or_xpath do |t, args|
|
54
|
-
dictionary_name = args[:dictionary_name].to_s || raise("parameter :dictionary_name is required")
|
55
|
-
source_url = args[:source_url].to_s || raise("parameter :source_url is required")
|
56
|
-
css_or_xpath = args[:css_or_xpath].to_s || raise("parameter :css_or_xpath is required")
|
6
|
+
Bundler::GemHelper.install_tasks
|
7
|
+
RSpec::Core::RakeTask.new
|
57
8
|
|
58
|
-
|
9
|
+
task :console do
|
10
|
+
require 'irb'
|
11
|
+
require 'irb/completion'
|
12
|
+
require 'forgery'
|
13
|
+
ARGV.clear
|
14
|
+
IRB.start
|
59
15
|
end
|