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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20a02618a5107ba5850de6da2bd58ae428d33d8163ab3c71f9233574780998df
4
- data.tar.gz: 33bac0b9d796da2d94adf3a8eb8940ff8766c36c9435429a03a1da0dd1efb8ad
3
+ metadata.gz: 3153c373659350c2969d98f3d21cbc60c92f9aff1f00c51f32c7238357c49195
4
+ data.tar.gz: d69204cacb17bfab516ecbe93d2e05edb60c596052130a1b41340e699dc25412
5
5
  SHA512:
6
- metadata.gz: e0d2aa56f7153981b3be287dde1204a1050b964e5bdba14314d7f7cda4d7af7a4960cb2670bd2c58b7615768fdea84c4dbd15da2d1db95b5b4371e86091b336d
7
- data.tar.gz: a182aecb4c3d38e36cd0e8f282dfd575b7234427a15e7f575cdbc84ca090848f162de9becc0989cef3baaa76c986a946c467b53adb937c5011932af774735b25
6
+ metadata.gz: 99e08637411f94b9df1ff63572c85b9b5fc8016677d043f53b1fb2acf27495b8f1cd1162b63cc6ed6be7579facf5e6dcc9c0929d2374fb6e7b30570308e33184
7
+ data.tar.gz: abffe3aeb00cb0b29589ad12daa9710801bdaecf5898d46b40e7cefa5150a0d00464df300c9edc54e22092097cdd0c712af0af5ae6b9f11f0ccd9965ce9b7582
@@ -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
- _attributes.each do |k, v|
73
- _instance.send("#{k}=", v)
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
 
@@ -7,7 +7,7 @@ module Fabrication
7
7
  end
8
8
 
9
9
  def self.supports?(klass)
10
- defined?(::Sequel) && klass.ancestors.include?(::Sequel::Model)
10
+ defined?(::Sequel) && defined?(::Sequel::Model) && klass.ancestors.include?(::Sequel::Model)
11
11
  end
12
12
 
13
13
  def set_attributes
@@ -4,7 +4,6 @@ module Fabrication
4
4
  GENERATORS = [
5
5
  Fabrication::Generator::ActiveRecord,
6
6
  Fabrication::Generator::Sequel,
7
- Fabrication::Generator::Mongoid,
8
7
  Fabrication::Generator::Base
9
8
  ].freeze
10
9
 
@@ -40,15 +40,15 @@ module Fabrication
40
40
  end
41
41
 
42
42
  def variable_name_to_class_name(name)
43
- name.to_s.gsub(%r{/(.?)}) do
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
- def find_definitions
49
- puts 'DEPRECATION WARNING: Fabrication::Support.find_definitions has been replaced ' \
50
- 'by Fabrication.manager.load_definitions and will be removed in 3.0.0.'
51
- Fabrication.manager.load_definitions
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
@@ -1,3 +1,3 @@
1
1
  module Fabrication
2
- VERSION = '3.0.0.beta.1'.freeze
2
+ VERSION = '3.0.0.beta.1.1'.freeze
3
3
  end
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-04-18 00:00:00.000000000 Z
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.4
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