stimpack 0.8.1 → 0.8.2

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: 46d22ca966c49e9a2f424291c0c44caec1ea24664c3239f1cca1fa4e218e91bf
4
- data.tar.gz: 5a393fa3f27d5b9bcab1edf0d193f9a4cf7d64410d4184725b6cc26ac6e66679
3
+ metadata.gz: 5c1c50146a16145446bf9b0bc74d29d19f8cb62fe9194a98d7767163ab5ffe31
4
+ data.tar.gz: 335d8aaaf0fcd39058d2379d646f4fa1c4ba02c811b70dfc90e316668be35004
5
5
  SHA512:
6
- metadata.gz: 97ab5bfa795b0cd6008a13df1bb297e51191b5da2e561421e64b1fef71a80724709ffed50fdb66504102ca4625d532afb77564744564b8f77919c2aa3ff68b1b
7
- data.tar.gz: 70eb5b61e2739cd657f31bd0ec79bc221f12ac3c0507365fec6701fda7deaae4839d0c127c6bab423ac3083b35852e03d0b5b0e4fd042245c894e45e48dce166
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?
@@ -1,3 +1,3 @@
1
1
  module Stimpack
2
- VERSION = "0.8.1".freeze
2
+ VERSION = "0.8.2".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.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-28 00:00:00.000000000 Z
11
+ date: 2022-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties