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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46d22ca966c49e9a2f424291c0c44caec1ea24664c3239f1cca1fa4e218e91bf
4
- data.tar.gz: 5a393fa3f27d5b9bcab1edf0d193f9a4cf7d64410d4184725b6cc26ac6e66679
3
+ metadata.gz: ee9d95c857e2c73710212e52a6e971fb95acff552596eeddb6f4f43363c8a691
4
+ data.tar.gz: fea0ccd68662307735ce43893ca3fc00167d31a8a557449aaffe2393ced6c796
5
5
  SHA512:
6
- metadata.gz: 97ab5bfa795b0cd6008a13df1bb297e51191b5da2e561421e64b1fef71a80724709ffed50fdb66504102ca4625d532afb77564744564b8f77919c2aa3ff68b1b
7
- data.tar.gz: 70eb5b61e2739cd657f31bd0ec79bc221f12ac3c0507365fec6701fda7deaae4839d0c127c6bab423ac3083b35852e03d0b5b0e4fd042245c894e45e48dce166
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
- # 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
- 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?
@@ -1,3 +1,3 @@
1
1
  module Stimpack
2
- VERSION = "0.8.1".freeze
2
+ VERSION = "0.8.3".freeze
3
3
  end
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.1
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: 2022-12-28 00:00:00.000000000 Z
11
+ date: 2023-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties