stimpack 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stimpack/integrations/factory_bot.rb +2 -0
- data/lib/stimpack/integrations/rails.rb +2 -4
- data/lib/stimpack/integrations/rspec.rb +2 -1
- data/lib/stimpack/version.rb +1 -1
- data/lib/stimpack.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c1c50146a16145446bf9b0bc74d29d19f8cb62fe9194a98d7767163ab5ffe31
|
4
|
+
data.tar.gz: 335d8aaaf0fcd39058d2379d646f4fa1c4ba02c811b70dfc90e316668be35004
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69ab74f37e4eb0980c8ef7c383c54953acc9a80f442b7513f6ce5ba9ca6f328499a6bd1f81f3ef8590d720456cbf453fca24854dbb7704313797ca709aafe7af
|
7
|
+
data.tar.gz: 18bb1001c9d8da9c055202d65ee55e8dbf9c83f3d445999bbf18bc05e7650113d0acd4dc5c1df1d7a742e5e8d11b4683b61c171b5e1b86ab293262f83aee45c6
|
@@ -5,8 +5,10 @@ module Stimpack
|
|
5
5
|
class FactoryBot
|
6
6
|
def initialize(app)
|
7
7
|
return unless app.config.respond_to?(:factory_bot)
|
8
|
+
Stimpack.configure_packs
|
8
9
|
|
9
10
|
Packs.all.each do |pack|
|
11
|
+
next if pack.relative_path.glob('*.gemspec').any?
|
10
12
|
app.config.factory_bot.definition_file_paths << pack.relative_path.join("spec/factories").to_s
|
11
13
|
end
|
12
14
|
end
|
@@ -10,15 +10,13 @@ module Stimpack
|
|
10
10
|
@app = app
|
11
11
|
|
12
12
|
Stimpack.config.paths.freeze
|
13
|
+
Stimpack.configure_packs
|
14
|
+
|
13
15
|
create_engines
|
14
16
|
inject_paths
|
15
17
|
end
|
16
18
|
|
17
19
|
def create_engines
|
18
|
-
# Ideally, the user just does `Packs.configure { |config| config.roots = '...' }`
|
19
|
-
# But that would be a public API change and can come later
|
20
|
-
Packs.configure { |config| config.roots = Array(Stimpack.config.root) }
|
21
|
-
|
22
20
|
Packs.all.each do |pack|
|
23
21
|
next unless pack.metadata['engine']
|
24
22
|
|
@@ -10,11 +10,12 @@ module Stimpack
|
|
10
10
|
to_run = ::RSpec.configuration.instance_variable_get(:@files_or_directories_to_run)
|
11
11
|
default_path = ::RSpec.configuration.default_path
|
12
12
|
|
13
|
+
Stimpack.configure_packs
|
14
|
+
|
13
15
|
if to_run == [default_path]
|
14
16
|
# This is the default case when you run `rspec`. We want to add all the pack's spec paths
|
15
17
|
# to the collection of directories to run.
|
16
18
|
|
17
|
-
Packs.configure { |config| config.roots = Array(Stimpack.config.root) }
|
18
19
|
pack_paths = Packs.all.map do |pack|
|
19
20
|
spec_path = pack.relative_path.join(default_path)
|
20
21
|
spec_path.to_s if spec_path.exist?
|
data/lib/stimpack/version.rb
CHANGED
data/lib/stimpack.rb
CHANGED
@@ -18,6 +18,23 @@ module Stimpack
|
|
18
18
|
def root
|
19
19
|
@root ||= Rails::Application.find_root(Dir.pwd)
|
20
20
|
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# This is temporary. For now, we allow Stimpack roots to be configured via Stimpack.config.root
|
24
|
+
# Later, if clients configure packs directly, we can deprecate the Stimpack setting and
|
25
|
+
# remove this function and its invocations.
|
26
|
+
#
|
27
|
+
def configure_packs
|
28
|
+
Packs.configure do |config|
|
29
|
+
roots = Array(Stimpack.config.root)
|
30
|
+
pack_paths = roots.flat_map do |root|
|
31
|
+
# Support nested packs by default. Later, this can be pushed to a client configuration.
|
32
|
+
["#{root}/*", "#{root}/*/*"]
|
33
|
+
end
|
34
|
+
|
35
|
+
config.pack_paths = pack_paths
|
36
|
+
end
|
37
|
+
end
|
21
38
|
end
|
22
39
|
|
23
40
|
@config = ActiveSupport::OrderedOptions.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stimpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ngan Pham
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|