dummy 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/generators/dummy_generator.rb +7 -0
- metadata +2 -6
@@ -13,6 +13,8 @@ module Dummy
|
|
13
13
|
:desc => "The base amount of records to generate for each model."
|
14
14
|
class_option :growth_ratio, :type => :numeric, :default => 2.0,
|
15
15
|
:desc => "The growth ratio of each model, according to its associations."
|
16
|
+
class_option :manual_amounts, :type => :boolean, :default => false,
|
17
|
+
:desc => "Manually set the amount of records for each model."
|
16
18
|
|
17
19
|
def install_dummy
|
18
20
|
initialize_application
|
@@ -97,6 +99,11 @@ module Dummy
|
|
97
99
|
@models[assoc[:model]][:record_amount]
|
98
100
|
end.max*options.growth_ratio # **info[:associations].size
|
99
101
|
end
|
102
|
+
|
103
|
+
if options.manual_amounts
|
104
|
+
user_defined = ask("Number of records for #{model} (default: #{amount}): ")
|
105
|
+
amount = user_defined unless user_defined.empty?
|
106
|
+
end
|
100
107
|
|
101
108
|
@models[model][:record_amount] = amount.to_i
|
102
109
|
stacked_models.delete(model)
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dummy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 9
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
8
|
+
- 2
|
9
|
+
version: 0.5.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- "Gon\xC3\xA7alo Silva"
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 7712042
|
30
28
|
segments:
|
31
29
|
- 3
|
32
30
|
- 0
|
@@ -72,7 +70,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
70
|
requirements:
|
73
71
|
- - ">="
|
74
72
|
- !ruby/object:Gem::Version
|
75
|
-
hash: 3
|
76
73
|
segments:
|
77
74
|
- 0
|
78
75
|
version: "0"
|
@@ -81,7 +78,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
78
|
requirements:
|
82
79
|
- - ">="
|
83
80
|
- !ruby/object:Gem::Version
|
84
|
-
hash: 21
|
85
81
|
segments:
|
86
82
|
- 1
|
87
83
|
- 3
|