forgery 0.3.11 → 0.3.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/forgery/extensions/string.rb +2 -2
- data/lib/forgery/forgery/basic.rb +8 -7
- data/lib/forgery/forgery_railtie.rb +2 -1
- data/lib/forgery/version.rb +1 -1
- metadata +5 -5
data/Rakefile
CHANGED
@@ -40,7 +40,7 @@ desc %q{
|
|
40
40
|
Create a dictionary file from web content (xml or html).
|
41
41
|
Writes to the directory specified by Forgery::FileWriter#write_to!
|
42
42
|
'${GEM_HOME}/lib/forgery/dictionaries' by default (standalone)
|
43
|
-
'${
|
43
|
+
'${Rails.root}/lib/forgery/dictionaries' by default (as a Rails 3 plugin)
|
44
44
|
|
45
45
|
Parameters:
|
46
46
|
:dictionary_name -- the name of your new dictionary file
|
@@ -86,20 +86,21 @@ class Forgery::Basic < Forgery
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def self.text(options={})
|
89
|
-
options = {:at_least
|
90
|
-
:at_most
|
91
|
-
:allow_lower
|
92
|
-
:allow_upper
|
89
|
+
options = {:at_least => 10,
|
90
|
+
:at_most => 15,
|
91
|
+
:allow_lower => true,
|
92
|
+
:allow_upper => true,
|
93
93
|
:allow_numeric => true,
|
94
|
-
:allow_special => false
|
94
|
+
:allow_special => false,
|
95
|
+
:exactly => nil}.merge!(options)
|
95
96
|
|
96
97
|
allowed_characters = []
|
97
98
|
allowed_characters += LOWER_ALPHA if options[:allow_lower]
|
98
99
|
allowed_characters += UPPER_ALPHA if options[:allow_upper]
|
99
100
|
allowed_characters += NUMERIC if options[:allow_numeric]
|
100
101
|
allowed_characters += SPECIAL_CHARACTERS if options[:allow_special]
|
101
|
-
|
102
|
-
length = (options[:at_least]..options[:at_most]).random
|
102
|
+
|
103
|
+
length = options[:exactly] || (options[:at_least]..options[:at_most]).random
|
103
104
|
|
104
105
|
allowed_characters.random_subset(length).join
|
105
106
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'forgery'
|
2
2
|
require 'rails'
|
3
|
+
require 'rake'
|
3
4
|
|
4
5
|
class ForgeryRailtie < Rails::Railtie
|
5
6
|
extend Rake::DSL
|
@@ -14,7 +15,7 @@ class ForgeryRailtie < Rails::Railtie
|
|
14
15
|
Create a dictionary file from web content (xml or html).
|
15
16
|
Writes to the directory specified by Forgery::FileWriter#write_to!
|
16
17
|
'${GEM_HOME}/lib/forgery/dictionaries' by default (standalone)
|
17
|
-
'${
|
18
|
+
'${Rails.root}/lib/forgery/dictionaries' by default (as a Rails 3 plugin)
|
18
19
|
|
19
20
|
Parameters:
|
20
21
|
:dictionary_name -- the name of your new dictionary file
|
data/lib/forgery/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forgery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 12
|
10
|
+
version: 0.3.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nathan Sutton
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-07-
|
19
|
+
date: 2011-07-18 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
requirements: []
|
154
154
|
|
155
155
|
rubyforge_project: forgery
|
156
|
-
rubygems_version: 1.
|
156
|
+
rubygems_version: 1.5.0
|
157
157
|
signing_key:
|
158
158
|
specification_version: 3
|
159
159
|
summary: Easy and customizable generation of forged data.
|