satisfactory 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06dfe6edd70f452888cfeb3d5379a592a3d88983c5651024cdc634dad1af3ca5
4
- data.tar.gz: f50122a32a4068fd77e3fb6d4639957117ceaf7592af1530bf35e0b4a2b9594f
3
+ metadata.gz: eb0881c675798a625a5af2ba2837a9689191df29051a54c12f3e0f6e38a948d7
4
+ data.tar.gz: cfe749028066a66f517679c6132e6d5a884b673e4bf5f3c329aadc4cb43acaf4
5
5
  SHA512:
6
- metadata.gz: 6fe4c14011c38c9b3116e20b501ce8d65dcc458cd63b9fe44dd1e8291db5ca535d61d63069bc95b118342d17550e5c424aea7217bb5802a51df0cc74e8a0cbf8
7
- data.tar.gz: 522edd69c8e2e31138e7a8cd0fe5521135b5bf42b544c2f9511ef8aa5144635a8cc3a3b953c9578446d041a6144b1e367723c6d7d00f3c679c2bdb0ce0955d17
6
+ metadata.gz: 87e998bfc2817381695b8b16a212fe5d328db770549613dbe962406574446f8017f77d068f5ea447df97b2abe75710662544500fae9728855e167c3915b6b737
7
+ data.tar.gz: 442023301434a224e7b3b71f36762a21432ef681cdf9951672286c6377454649aa4fea7abd8f3e93e5de79f17587f0cc0c8f7e1398c61239dc6f6dc0dedc85ab
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.1] - 2023-01-18
4
+
5
+ - Fix associations bug
6
+
7
+ ## [0.3.0] - 2022-12-22
8
+
9
+ - Fix some API inconsistencies
10
+ - Add a starter acceptance test (with dummy Rails application)
11
+
12
+ ## [0.2.1] - 2022-12-19
13
+
14
+ - Fix a clashing executable name by not packaging any
15
+
16
+ ## [0.2.0] - 2022-12-19
17
+
18
+ - Main functionality implemented
19
+ - Documentation added
20
+ - Licence added
21
+
3
22
  ## [0.1.0] - 2022-12-09
4
23
 
5
24
  - Initial release
@@ -65,6 +65,14 @@ module Satisfactory
65
65
  end
66
66
  end
67
67
 
68
+ # Same as {#with} but always creates a new record.
69
+ #
70
+ # @param (see #and)
71
+ # @return (see #with)
72
+ def with_new(count = nil, downstream_type, **attributes) # rubocop:disable Style/OptionalArguments
73
+ with(count, downstream_type, force: true, **attributes)
74
+ end
75
+
68
76
  # Add a sibling record to the parent record's build plan.
69
77
  # e.g. adding a second user to a project.
70
78
  #
@@ -78,7 +86,7 @@ module Satisfactory
78
86
 
79
87
  # Apply one or more traits to this record's build plan.
80
88
  #
81
- # @param *traits [Symbol, ...] The traits to apply.
89
+ # @param traits [Symbol, ...] The traits to apply.
82
90
  def which_is(*traits)
83
91
  traits.each { |trait| self.traits << trait }
84
92
  self
@@ -91,11 +99,7 @@ module Satisfactory
91
99
  def and_same(upstream_type)
92
100
  Satisfactory::UpstreamRecordFinder.new(upstream:).find(upstream_type)
93
101
  end
94
-
95
- # @api private
96
- def modify
97
- yield(self).upstream
98
- end
102
+ alias return_to and_same
99
103
 
100
104
  # Trigger the creation of this tree's build plan.
101
105
  #
@@ -145,7 +149,7 @@ module Satisfactory
145
149
 
146
150
  # @return [ApplicationRecord]
147
151
  def reify(method)
148
- FactoryBot.public_send(method, factory_name, *traits, attributes.merge(associations.transform_values(&:build)))
152
+ FactoryBot.public_send(method, factory_name, *traits, provided_associations.merge(attributes))
149
153
  end
150
154
 
151
155
  def associations_plan
@@ -204,5 +208,9 @@ module Satisfactory
204
208
 
205
209
  associations[name].last
206
210
  end
211
+
212
+ def provided_associations
213
+ associations.transform_values(&:build).compact_blank
214
+ end
207
215
  end
208
216
  end
@@ -43,5 +43,8 @@ module Satisfactory
43
43
  def upstream
44
44
  nil
45
45
  end
46
+
47
+ # @api private
48
+ class FactoryNotDefinedError < StandardError; end
46
49
  end
47
50
  end
@@ -7,8 +7,24 @@ module Satisfactory
7
7
  @upstream = upstream
8
8
  end
9
9
 
10
+ # @api private
10
11
  attr_accessor :upstream
11
12
 
13
+ # @!method create
14
+ # Delegates to the upstream record.
15
+ # @return (see Satisfactory::Record#create)
16
+ # @see Satisfactory::Record#create
17
+ # @!method with_new
18
+ # Delegates to the upstream record.
19
+ # @return (see Satisfactory::Record#with_new)
20
+ # @see Satisfactory::Record#with_new
21
+ delegate :create, :with_new, to: :upstream
22
+
23
+ # Find the upstream record of the given type.
24
+ #
25
+ # @api private
26
+ # @param type [Symbol] The type of upstream record to find.
27
+ # @return [Satisfactory::Record, Satisfactory::Collection, Satisfactory::Root]
12
28
  def find(type)
13
29
  raise MissingUpstreamRecordError, type if upstream.nil?
14
30
 
@@ -20,6 +36,7 @@ module Satisfactory
20
36
  end
21
37
  end
22
38
 
39
+ # (see Satisfactory::Record#with)
23
40
  def with(*args, **kwargs)
24
41
  upstream.with(*args, force: true, **kwargs)
25
42
  end
@@ -1,3 +1,3 @@
1
1
  module Satisfactory
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.3.1".freeze
3
3
  end
data/satisfactory.gemspec CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
22
22
  "lib/**/*",
23
23
  "CHANGELOG.md",
24
24
  "LICENCE",
25
- "Rakefile",
26
25
  "README.md",
27
26
  "satisfactory.gemspec",
28
27
  ]
@@ -31,7 +30,4 @@ Gem::Specification.new do |spec|
31
30
  spec.require_paths = ["lib"]
32
31
 
33
32
  spec.add_dependency "factory_bot_rails", "~> 6.2"
34
-
35
- spec.add_development_dependency "rubocop", "~> 1.40"
36
- spec.add_development_dependency "yard", "~> 0.9"
37
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: satisfactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Crosby-McCullough
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2023-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: factory_bot_rails
@@ -24,34 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6.2'
27
- - !ruby/object:Gem::Dependency
28
- name: rubocop
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.40'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.40'
41
- - !ruby/object:Gem::Dependency
42
- name: yard
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.9'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.9'
55
27
  description:
56
28
  email:
57
29
  - elliot.cm@gmail.com
@@ -62,7 +34,6 @@ files:
62
34
  - CHANGELOG.md
63
35
  - LICENCE
64
36
  - README.md
65
- - Rakefile
66
37
  - lib/satisfactory.rb
67
38
  - lib/satisfactory/collection.rb
68
39
  - lib/satisfactory/loader.rb
@@ -75,7 +46,7 @@ homepage: https://github.com/SmartCasual/satisfactory
75
46
  licenses:
76
47
  - CC-BY-NC-SA-4.0
77
48
  metadata:
78
- changelog_uri: https://github.com/SmartCasual/satisfactory/blob/v0.2.1/CHANGELOG.md
49
+ changelog_uri: https://github.com/SmartCasual/satisfactory/blob/v0.3.1/CHANGELOG.md
79
50
  homepage_uri: https://github.com/SmartCasual/satisfactory
80
51
  source_code_uri: https://github.com/SmartCasual/satisfactory
81
52
  rubygems_mfa_required: 'true'
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rubocop/rake_task"
3
-
4
- RuboCop::RakeTask.new
5
-
6
- task default: :rubocop