fabrication 3.0.0.beta.1 → 3.0.0.beta.1.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 +4 -4
- data/lib/fabrication/config.rb +0 -12
- 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 +8 -8
- data/lib/fabrication/version.rb +1 -1
- data/lib/fabrication.rb +0 -7
- metadata +3 -4
- 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: 3153c373659350c2969d98f3d21cbc60c92f9aff1f00c51f32c7238357c49195
|
4
|
+
data.tar.gz: d69204cacb17bfab516ecbe93d2e05edb60c596052130a1b41340e699dc25412
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99e08637411f94b9df1ff63572c85b9b5fc8016677d043f53b1fb2acf27495b8f1cd1162b63cc6ed6be7579facf5e6dcc9c0929d2374fb6e7b30570308e33184
|
7
|
+
data.tar.gz: abffe3aeb00cb0b29589ad12daa9710801bdaecf5898d46b40e7cefa5150a0d00464df300c9edc54e22092097cdd0c712af0af5ae6b9f11f0ccd9965ce9b7582
|
data/lib/fabrication/config.rb
CHANGED
@@ -19,22 +19,10 @@ module Fabrication
|
|
19
19
|
end
|
20
20
|
alias fabricator_paths fabricator_path
|
21
21
|
|
22
|
-
def fabricator_dir
|
23
|
-
puts 'DEPRECATION WARNING: Fabrication::Config.fabricator_dir has been ' \
|
24
|
-
'replaced by Fabrication::Config.fabricator_path'
|
25
|
-
fabricator_path
|
26
|
-
end
|
27
|
-
|
28
22
|
def fabricator_path=(folders)
|
29
23
|
@fabricator_path = ([] << folders).flatten
|
30
24
|
end
|
31
25
|
|
32
|
-
def fabricator_dir=(folders)
|
33
|
-
puts 'DEPRECATION WARNING: Fabrication::Config.fabricator_dir has been ' \
|
34
|
-
'replaced by Fabrication::Config.fabricator_path'
|
35
|
-
self.fabricator_path = folders
|
36
|
-
end
|
37
|
-
|
38
26
|
attr_writer :sequence_start, :register_with_steps
|
39
27
|
|
40
28
|
def sequence_start
|
@@ -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,15 +40,15 @@ module Fabrication
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def variable_name_to_class_name(name)
|
43
|
-
name.to_s
|
44
|
-
"::#{Regexp.last_match(1).upcase}"
|
45
|
-
end.gsub(/(?:^|_)(.)/) { Regexp.last_match(1).upcase }
|
46
|
-
end
|
43
|
+
name_string = name.to_s
|
47
44
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
52
52
|
end
|
53
53
|
|
54
54
|
def hash_class
|
data/lib/fabrication/version.rb
CHANGED
data/lib/fabrication.rb
CHANGED
@@ -32,7 +32,6 @@ module Fabrication
|
|
32
32
|
module Generator
|
33
33
|
autoload :ActiveRecord, 'fabrication/generator/active_record'
|
34
34
|
autoload :ActiveRecord4, 'fabrication/generator/active_record_4'
|
35
|
-
autoload :Mongoid, 'fabrication/generator/mongoid'
|
36
35
|
autoload :Sequel, 'fabrication/generator/sequel'
|
37
36
|
autoload :Base, 'fabrication/generator/base'
|
38
37
|
end
|
@@ -49,12 +48,6 @@ module Fabrication
|
|
49
48
|
def self.manager
|
50
49
|
@manager ||= Fabrication::Schematic::Manager.instance
|
51
50
|
end
|
52
|
-
|
53
|
-
def self.schematics
|
54
|
-
puts 'DEPRECATION WARNING: Fabrication.schematics has been replaced by '\
|
55
|
-
'Fabrication.manager and will be removed in 3.0.0.'
|
56
|
-
manager
|
57
|
-
end
|
58
51
|
end
|
59
52
|
|
60
53
|
# rubocop:disable Naming/MethodName
|
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: 3.0.0.beta.1
|
4
|
+
version: 3.0.0.beta.1.1
|
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-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Fabrication is an object generation framework for ActiveRecord, Mongoid,
|
14
14
|
Sequel, or any other Ruby object.
|
@@ -32,7 +32,6 @@ files:
|
|
32
32
|
- lib/fabrication/errors/unknown_fabricator_error.rb
|
33
33
|
- lib/fabrication/generator/active_record.rb
|
34
34
|
- lib/fabrication/generator/base.rb
|
35
|
-
- lib/fabrication/generator/mongoid.rb
|
36
35
|
- lib/fabrication/generator/sequel.rb
|
37
36
|
- lib/fabrication/railtie.rb
|
38
37
|
- lib/fabrication/schematic/attribute.rb
|
@@ -69,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
68
|
- !ruby/object:Gem::Version
|
70
69
|
version: 1.3.1
|
71
70
|
requirements: []
|
72
|
-
rubygems_version: 3.1.
|
71
|
+
rubygems_version: 3.1.6
|
73
72
|
signing_key:
|
74
73
|
specification_version: 4
|
75
74
|
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
|