fabrication 2.22.0 → 2.23.0
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 +4 -4
- data/lib/fabrication/config.rb +2 -2
- data/lib/fabrication/generator/active_record.rb +2 -2
- data/lib/fabrication/generator/base.rb +6 -2
- data/lib/fabrication/generator/sequel.rb +1 -1
- data/lib/fabrication/schematic/definition.rb +0 -1
- data/lib/fabrication/support.rb +10 -4
- data/lib/fabrication/version.rb +1 -1
- data/lib/fabrication.rb +1 -2
- metadata +4 -5
- data/lib/fabrication/generator/mongoid.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af00199fb86206bfaecee18e88668f63446301f7bfff776831ad26a18c092187
|
4
|
+
data.tar.gz: b63b7eb25cf5e98f9051befe7ffdb2c994a07c149a32af93e4f48b183f17fdfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfc49c073e8a19855863b5da27ff6c45aa45cd80eea134611b40174fb9c4ac2f9df6ee44e8dd3613001c7662a4e1ece7db0d2df78a8b025d647546d0f0fa137d
|
7
|
+
data.tar.gz: b8802428e05897ec7a0b6dc0a0a01f4d0c33437d5b3d4a895e116664e00fd7f79904143cfd9a6c8db4fb135d6f0c1c4c54754fb7b35fc47d7962209a1fe7eb6a
|
data/lib/fabrication/config.rb
CHANGED
@@ -21,7 +21,7 @@ module Fabrication
|
|
21
21
|
|
22
22
|
def fabricator_dir
|
23
23
|
puts 'DEPRECATION WARNING: Fabrication::Config.fabricator_dir has been ' \
|
24
|
-
|
24
|
+
'replaced by Fabrication::Config.fabricator_path'
|
25
25
|
fabricator_path
|
26
26
|
end
|
27
27
|
|
@@ -31,7 +31,7 @@ module Fabrication
|
|
31
31
|
|
32
32
|
def fabricator_dir=(folders)
|
33
33
|
puts 'DEPRECATION WARNING: Fabrication::Config.fabricator_dir has been ' \
|
34
|
-
|
34
|
+
'replaced by Fabrication::Config.fabricator_path'
|
35
35
|
self.fabricator_path = folders
|
36
36
|
end
|
37
37
|
|
@@ -6,8 +6,8 @@ module Fabrication
|
|
6
6
|
# so we can't assume because we have the ActiveRecord module that we also
|
7
7
|
# have ActiveRecord::Base. Because defined? can return nil we ensure that nil
|
8
8
|
# becomes false.
|
9
|
-
defined?(::ActiveRecord) && defined?(::ActiveRecord::Base) &&
|
10
|
-
klass.ancestors.include?(::ActiveRecord::Base) || false
|
9
|
+
(defined?(::ActiveRecord) && defined?(::ActiveRecord::Base) &&
|
10
|
+
klass.ancestors.include?(::ActiveRecord::Base)) || false
|
11
11
|
end
|
12
12
|
|
13
13
|
def build_instance
|
@@ -69,8 +69,12 @@ module Fabrication
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def set_attributes
|
72
|
-
|
73
|
-
_instance.
|
72
|
+
if _instance.respond_to?(:attributes=)
|
73
|
+
_instance.attributes = _attributes
|
74
|
+
else
|
75
|
+
_attributes.each do |k, v|
|
76
|
+
_instance.send("#{k}=", v)
|
77
|
+
end
|
74
78
|
end
|
75
79
|
end
|
76
80
|
|
data/lib/fabrication/support.rb
CHANGED
@@ -40,14 +40,20 @@ module Fabrication
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def variable_name_to_class_name(name)
|
43
|
-
name.to_s
|
44
|
-
|
45
|
-
|
43
|
+
name_string = name.to_s
|
44
|
+
|
45
|
+
if name_string.respond_to?(:camelize)
|
46
|
+
name_string.camelize
|
47
|
+
else
|
48
|
+
name_string.gsub(%r{/(.?)}) do
|
49
|
+
"::#{Regexp.last_match(1).upcase}"
|
50
|
+
end.gsub(/(?:^|_)(.)/) { Regexp.last_match(1).upcase }
|
51
|
+
end
|
46
52
|
end
|
47
53
|
|
48
54
|
def find_definitions
|
49
55
|
puts 'DEPRECATION WARNING: Fabrication::Support.find_definitions has been replaced ' \
|
50
|
-
|
56
|
+
'by Fabrication.manager.load_definitions and will be removed in 3.0.0.'
|
51
57
|
Fabrication.manager.load_definitions
|
52
58
|
end
|
53
59
|
|
data/lib/fabrication/version.rb
CHANGED
data/lib/fabrication.rb
CHANGED
@@ -33,7 +33,6 @@ module Fabrication
|
|
33
33
|
autoload :ActiveRecord, 'fabrication/generator/active_record'
|
34
34
|
autoload :ActiveRecord4, 'fabrication/generator/active_record_4'
|
35
35
|
autoload :DataMapper, 'fabrication/generator/data_mapper'
|
36
|
-
autoload :Mongoid, 'fabrication/generator/mongoid'
|
37
36
|
autoload :Sequel, 'fabrication/generator/sequel'
|
38
37
|
autoload :Base, 'fabrication/generator/base'
|
39
38
|
end
|
@@ -53,7 +52,7 @@ module Fabrication
|
|
53
52
|
|
54
53
|
def self.schematics
|
55
54
|
puts 'DEPRECATION WARNING: Fabrication.schematics has been replaced by '\
|
56
|
-
|
55
|
+
'Fabrication.manager and will be removed in 3.0.0.'
|
57
56
|
manager
|
58
57
|
end
|
59
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fabrication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Elliott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Fabrication is an object generation framework for ActiveRecord, Mongoid,
|
14
14
|
DataMapper, Sequel, or any other Ruby object.
|
@@ -33,7 +33,6 @@ files:
|
|
33
33
|
- lib/fabrication/generator/active_record.rb
|
34
34
|
- lib/fabrication/generator/base.rb
|
35
35
|
- lib/fabrication/generator/data_mapper.rb
|
36
|
-
- lib/fabrication/generator/mongoid.rb
|
37
36
|
- lib/fabrication/generator/sequel.rb
|
38
37
|
- lib/fabrication/railtie.rb
|
39
38
|
- lib/fabrication/schematic/attribute.rb
|
@@ -63,14 +62,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
62
|
requirements:
|
64
63
|
- - ">="
|
65
64
|
- !ruby/object:Gem::Version
|
66
|
-
version: 2.
|
65
|
+
version: 2.6.0
|
67
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
67
|
requirements:
|
69
68
|
- - ">="
|
70
69
|
- !ruby/object:Gem::Version
|
71
70
|
version: '0'
|
72
71
|
requirements: []
|
73
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.2.22
|
74
73
|
signing_key:
|
75
74
|
specification_version: 4
|
76
75
|
summary: Implementing the factory pattern in Ruby so you don't have to.
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Fabrication
|
2
|
-
module Generator
|
3
|
-
class Mongoid < Fabrication::Generator::Base
|
4
|
-
def self.supports?(klass)
|
5
|
-
defined?(::Mongoid) && klass.ancestors.include?(::Mongoid::Document)
|
6
|
-
end
|
7
|
-
|
8
|
-
def build_instance
|
9
|
-
self._instance = if _klass.respond_to?(:protected_attributes)
|
10
|
-
_klass.new(_attributes, without_protection: true)
|
11
|
-
else
|
12
|
-
_klass.new(_attributes)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|