verbose_factory_girl 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/README.rdoc +3 -3
- data/Rakefile +3 -58
- data/lib/verbose_factory_girl.rb +3 -15
- data/lib/verbose_factory_girl/v_factory_girl.rb +23 -0
- data/lib/verbose_factory_girl/version.rb +5 -0
- metadata +49 -68
data/Gemfile
ADDED
data/README.rdoc
CHANGED
@@ -4,10 +4,10 @@ Print out what factory girl is doing to the console in a format that is right at
|
|
4
4
|
home with Rails migrations. For some background read
|
5
5
|
http://pupeno.com/blog/generating-sample-data
|
6
6
|
|
7
|
-
It is used just like factory_girl, but instead of calling
|
8
|
-
|
7
|
+
It is used just like factory_girl, but instead of calling FactoryGirl, you call
|
8
|
+
VFactoryGirl, like:
|
9
9
|
|
10
|
-
|
10
|
+
VFactoryGirl.create :user
|
11
11
|
|
12
12
|
== Note on Patches/Pull Requests
|
13
13
|
|
data/Rakefile
CHANGED
@@ -1,23 +1,7 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "rake"
|
3
3
|
|
4
|
-
|
5
|
-
require "jeweler"
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "verbose_factory_girl"
|
8
|
-
gem.summary = %Q{Like factory girl but much more noisy}
|
9
|
-
gem.description = %Q{Print out what factory girl is doing to the console in a format that is right at home with Rails migrations. For some background read http://pupeno.com/blog/generating-sample-data}
|
10
|
-
gem.email = "pupeno@pupeno.com"
|
11
|
-
gem.homepage = "http://github.com/pupeno/verbose_factory_girl"
|
12
|
-
gem.authors = ["J. Pablo Fernández"]
|
13
|
-
gem.add_development_dependency "yard", ">= 0"
|
14
|
-
gem.add_dependency "factory_girl", ">= 0"
|
15
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
-
end
|
17
|
-
Jeweler::GemcutterTasks.new
|
18
|
-
rescue LoadError
|
19
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
-
end
|
4
|
+
require "bundler/gem_tasks"
|
21
5
|
|
22
6
|
require "rake/testtask"
|
23
7
|
Rake::TestTask.new(:test) do |test|
|
@@ -26,47 +10,8 @@ Rake::TestTask.new(:test) do |test|
|
|
26
10
|
test.verbose = true
|
27
11
|
end
|
28
12
|
|
29
|
-
|
30
|
-
|
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
|
-
begin
|
45
|
-
require "reek/adapters/rake_task"
|
46
|
-
Reek::RakeTask.new do |t|
|
47
|
-
t.fail_on_error = true
|
48
|
-
t.verbose = false
|
49
|
-
t.source_files = "lib/**/*.rb"
|
50
|
-
end
|
51
|
-
rescue LoadError
|
52
|
-
task :reek do
|
53
|
-
abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
begin
|
58
|
-
require "roodi"
|
59
|
-
require "roodi_task"
|
60
|
-
RoodiTask.new do |t|
|
61
|
-
t.verbose = false
|
62
|
-
end
|
63
|
-
rescue LoadError
|
64
|
-
task :roodi do
|
65
|
-
abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi"
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
task :default => :test
|
13
|
+
# task :test => :check_dependencies
|
14
|
+
# task :default => :test
|
70
15
|
|
71
16
|
begin
|
72
17
|
require "yard"
|
data/lib/verbose_factory_girl.rb
CHANGED
@@ -1,17 +1,5 @@
|
|
1
1
|
# Copyright © 2010, José Pablo Fernández
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
human_factory_name = args.first.to_s.gsub("_", " ")
|
7
|
-
if args.size > 1
|
8
|
-
human_arguments = args.second.map { |name, value| "#{name}=>#{value.is_a?(Array) ? value.join(", ") : value}" }.to_sentence
|
9
|
-
puts "-- creating #{human_factory_name} with #{human_arguments}."
|
10
|
-
else
|
11
|
-
puts "-- creating #{human_factory_name}."
|
12
|
-
end
|
13
|
-
Factory.create(*args).tap do |obj|
|
14
|
-
puts " -> done: #{obj}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
3
|
+
require "verbose_factory_girl/version"
|
4
|
+
require "verbose_factory_girl/v_factory_girl"
|
5
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Copyright © 2011, José Pablo Fernández
|
2
|
+
|
3
|
+
|
4
|
+
module VFactoryGirl
|
5
|
+
def self.create *args
|
6
|
+
factory_name = args.first.to_s.gsub("_", " ")
|
7
|
+
arguments = args[1..-1].map do |arg|
|
8
|
+
if arg.is_a? Hash
|
9
|
+
arg.map { |name, value| "#{name}=>#{value.is_a?(Array) ? value.join(", ") : value}" }
|
10
|
+
else
|
11
|
+
arg
|
12
|
+
end
|
13
|
+
end.flatten.to_sentence
|
14
|
+
if arguments.present?
|
15
|
+
puts "-- creating #{factory_name} with #{arguments}."
|
16
|
+
else
|
17
|
+
puts "-- creating #{factory_name}."
|
18
|
+
end
|
19
|
+
FactoryGirl.create(*args).tap do |obj|
|
20
|
+
puts " -> done: #{obj}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,104 +1,85 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: verbose_factory_girl
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
7
|
+
authors:
|
8
|
+
- J. Pablo Fernández
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-12-19 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: yard
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70349354913160 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: factory_girl
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *70349354913160
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: factory_girl
|
27
|
+
requirement: &70349354912640 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
47
33
|
type: :runtime
|
48
|
-
|
49
|
-
|
50
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70349354912640
|
36
|
+
description: Print out what factory girl is doing to the console in a format that
|
37
|
+
is right at home with Rails migrations. For some background read http://pupeno.com/blog/generating-sample-data
|
38
|
+
email:
|
39
|
+
- pupeno@pupeno.com
|
51
40
|
executables: []
|
52
|
-
|
53
41
|
extensions: []
|
54
|
-
|
55
|
-
extra_rdoc_files:
|
42
|
+
extra_rdoc_files:
|
56
43
|
- LICENSE
|
57
44
|
- README.rdoc
|
58
|
-
files:
|
45
|
+
files:
|
59
46
|
- .document
|
60
47
|
- .gitignore
|
48
|
+
- Gemfile
|
61
49
|
- LICENSE
|
62
50
|
- README.rdoc
|
63
51
|
- Rakefile
|
64
52
|
- VERSION
|
65
53
|
- lib/verbose_factory_girl.rb
|
54
|
+
- lib/verbose_factory_girl/v_factory_girl.rb
|
55
|
+
- lib/verbose_factory_girl/version.rb
|
66
56
|
- test/helper.rb
|
67
57
|
- test/test_verbose_factory_girl.rb
|
68
|
-
has_rdoc: true
|
69
58
|
homepage: http://github.com/pupeno/verbose_factory_girl
|
70
59
|
licenses: []
|
71
|
-
|
72
60
|
post_install_message:
|
73
|
-
rdoc_options:
|
61
|
+
rdoc_options:
|
74
62
|
- --charset=UTF-8
|
75
|
-
require_paths:
|
63
|
+
require_paths:
|
76
64
|
- lib
|
77
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
66
|
none: false
|
79
|
-
requirements:
|
80
|
-
- -
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
|
83
|
-
|
84
|
-
- 0
|
85
|
-
version: "0"
|
86
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
72
|
none: false
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
|
92
|
-
segments:
|
93
|
-
- 0
|
94
|
-
version: "0"
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
95
77
|
requirements: []
|
96
|
-
|
97
|
-
|
98
|
-
rubygems_version: 1.3.7
|
78
|
+
rubyforge_project: verbose_factory_girl
|
79
|
+
rubygems_version: 1.8.6
|
99
80
|
signing_key:
|
100
81
|
specification_version: 3
|
101
|
-
summary:
|
102
|
-
test_files:
|
82
|
+
summary: Make the factory girl very noisy
|
83
|
+
test_files:
|
103
84
|
- test/helper.rb
|
104
85
|
- test/test_verbose_factory_girl.rb
|