File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11PATH
22 remote: .
33 specs:
4- packs (0.0.3 )
4+ packs (0.0.4 )
55 sorbet-runtime
66
77GEM
Load diff This file was deleted.
Original file line number Diff line number Diff line change 77
88module Packs
99 PACKAGE_FILE = T . let ( 'package.yml' . freeze , String )
10- ROOTS = T . let ( %w[ packs components ] , T ::Array [ String ] )
1110
1211 class << self
1312 extend T ::Sig
@@ -45,6 +44,11 @@ def config
4544
4645 sig { params ( blk : T . proc . params ( arg0 : Private ::Configuration ) . void ) . void }
4746 def configure ( &blk )
47+ # If packs.yml is being used, then ignore direct configuration.
48+ # This is only a stop-gap to permit Stimpack users to more easily migrate
49+ # to packs.yml
50+ return if Private ::Configuration ::CONFIGURATION_PATHNAME . exist?
51+
4852 yield ( config )
4953 end
5054
Original file line number Diff line number Diff line change @@ -4,20 +4,21 @@ module Packs
44 module Private
55 class Configuration < T ::Struct
66 extend T ::Sig
7+ CONFIGURATION_PATHNAME = T . let ( Pathname . new ( 'packs.yml' ) , Pathname )
8+
79 DEFAULT_PACK_PATHS = T . let ( [
8- 'packs/*' ,
9- 'packs/*/*' ,
10- ] , T ::Array [ String ] )
10+ 'packs/*' ,
11+ 'packs/*/*'
12+ ] , T ::Array [ String ] )
1113
1214 prop :pack_paths , T ::Array [ String ]
1315
1416 sig { returns ( Configuration ) }
1517 def self . fetch
16- configuration_path = Pathname . new ( 'packs.yml' )
17- config_hash = configuration_path . exist? ? YAML . load_file ( 'packs.yml' ) : { }
18+ config_hash = CONFIGURATION_PATHNAME . exist? ? YAML . load_file ( CONFIGURATION_PATHNAME ) : { }
1819
1920 new (
20- pack_paths : pack_paths ( config_hash ) ,
21+ pack_paths : pack_paths ( config_hash )
2122 )
2223 end
2324
Original file line number Diff line number Diff line change 11Gem ::Specification . new do |spec |
22 spec . name = 'packs'
3- spec . version = '0.0.3 '
3+ spec . version = '0.0.4 '
44 spec . authors = [ 'Gusto Engineers' ]
55 spec . email = [ 'dev@gusto.com' ]
66 spec . summary = 'Packs are the specification for gradual modularization in the `rubyatscale` ecosystem.'
Original file line number Diff line number Diff line change 2424 write_file ( 'packs/my_pack/package.yml' )
2525 write_file ( 'components/my_pack/package.yml' )
2626 write_file ( 'packs.yml' , <<~YML )
27- pack_paths:
28- - packs/*
29- - components/*
27+ pack_paths:
28+ - packs/*
29+ - components/*
3030 YML
3131 end
3232
4444
4545 it { expect ( Packs . all . count ) . to eq 2 }
4646 end
47+
48+ context 'in an app with a differently configured root configured via ruby and YML' do
49+ before do
50+ write_file ( 'packs/my_pack/package.yml' )
51+ write_file ( 'components/my_pack/package.yml' )
52+ write_file ( 'packages/my_pack/package.yml' )
53+ write_file ( 'packs.yml' , <<~YML )
54+ pack_paths:
55+ - packs/*
56+ - components/*
57+ YML
58+ Packs . configure do |config |
59+ config . pack_paths = [ 'packs/*' ]
60+ end
61+ end
62+
63+ it 'prioritizes the YML configuration' do
64+ expect ( Packs . all . count ) . to eq 2
65+ end
66+ end
4767 end
4868
4969 describe '.find' do
7090 write_file ( 'packs/my_pack/package.yml' )
7191 write_file ( 'components/my_pack/package.yml' )
7292 write_file ( 'packs.yml' , <<~YML )
73- pack_paths:
74- - packs/*
75- - components/*
93+ pack_paths:
94+ - packs/*
95+ - components/*
7696 YML
7797 end
7898
You can’t perform that action at this time.
0 commit comments