stimpack 0.8.1 → 0.8.3
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 -1
- data/lib/stimpack/integrations/rails.rb +4 -6
- 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: ee9d95c857e2c73710212e52a6e971fb95acff552596eeddb6f4f43363c8a691
|
4
|
+
data.tar.gz: fea0ccd68662307735ce43893ca3fc00167d31a8a557449aaffe2393ced6c796
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4efa4b625c20b4169d696e28357a14dd7b06b194673852c3b8d59ad449dcff42bc618ea62a23ae0bfed668d4318b3a8c7de12ece8a22585782afd29da88077b7
|
7
|
+
data.tar.gz: 004d9f9c681456efead9801881330d635af3410131b125eb149b5fe535f62fb84372dc4c586d073c7c93787f3345872f08c3efa22571fa9099dc6a8345f746c2
|
@@ -5,8 +5,9 @@ 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
|
-
Packs.all.each do |pack|
|
10
|
+
Packs.all.reject(&:is_gem?).each do |pack|
|
10
11
|
app.config.factory_bot.definition_file_paths << pack.relative_path.join("spec/factories").to_s
|
11
12
|
end
|
12
13
|
end
|
@@ -10,16 +10,14 @@ 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
|
-
|
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
|
-
Packs.all.each do |pack|
|
20
|
+
Packs.all.reject(&:is_gem?).each do |pack|
|
23
21
|
next unless pack.metadata['engine']
|
24
22
|
|
25
23
|
create_engine(pack)
|
@@ -27,7 +25,7 @@ module Stimpack
|
|
27
25
|
end
|
28
26
|
|
29
27
|
def inject_paths
|
30
|
-
Packs.all.each do |pack|
|
28
|
+
Packs.all.reject(&:is_gem?).each do |pack|
|
31
29
|
Stimpack.config.paths.each do |path|
|
32
30
|
@app.paths[path] << pack.relative_path.join(path)
|
33
31
|
end
|
@@ -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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ngan Pham
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|