packs 0.0.45 → 0.2.0

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: ad12cf46cbfafc5f4b3b2d785f2ec2f3f67ed34cb8322bba6929a7ae584d06e1
4
- data.tar.gz: 8712c08b31b3457b403d3814764496f3c4d46e53867f88760cadd10083e38a63
3
+ metadata.gz: 9a2fde399cc66508a90dac9a91d026179a732e2ff9675e6d385bf4981ae5fb45
4
+ data.tar.gz: 2aeb3c2b828d169a387755af328ad67b2e2133a482bed16f976e884d08e27ea8
5
5
  SHA512:
6
- metadata.gz: bad96e8500d53692f4930cb08ae0ed1be99b8b0524283027d424a05094d23039b5ed9bd646d94db4e67de158ca5af480288c05e799af0a82e6c46cc2c4190fc0
7
- data.tar.gz: ed7ebf9ed287b16336187500dc1ebfb833ce569039f7ad9775e9cf84fee53be47f6326fd8b7a4f3abc61d922080dc9ae2ab8e3049583bf8165871b7a4e763ffb
6
+ metadata.gz: 32accbb46babdc0cf1478cd905cd95cc144f6a53d184cfc56a97cf6368a009508dcb48e8218ae680f0dcd493b08134c16786550208aa96929c4aff83792f70f1
7
+ data.tar.gz: b9932164a175a19ea41762dd2743ba080fac999e0b4393e4f9265ed68c913f54a0bb9fa59b89269619eec6daef851196a72e737e5de106d62a323c731108a3fd
data/README.md CHANGED
@@ -15,6 +15,11 @@ pack_paths:
15
15
  - gems/* # gems can be packs too!
16
16
  ```
17
17
 
18
+ To customize the README template, include a `README_TEMPLATE.md` file in the root of your project. If you want to use a custom path for your README template, you can specify it in the `packs.yml` file in the root of your project:
19
+ ```yml
20
+ readme_template_path: my_folder/README_STUFF.md
21
+ ```
22
+
18
23
  # Ecosystem
19
24
  The rest of the [rubyatscale](https://github.com/rubyatscale) ecosystem is intended to help make using packs and improving the boundaries between them more clear.
20
25
 
@@ -7,6 +7,9 @@ module Packs
7
7
  class Configuration
8
8
  extend T::Sig
9
9
 
10
+ CONFIGURATION_PATHNAME = T.let(Pathname.new('packs.yml'), Pathname)
11
+ DEFAULT_README_TEMPLATE_PATHNAME = T.let(Pathname.new('README_TEMPLATE.md'), Pathname)
12
+
10
13
  sig { params(enforce_dependencies: T::Boolean).void }
11
14
  attr_writer :enforce_dependencies
12
15
 
@@ -45,6 +48,18 @@ module Packs
45
48
  def default_enforce_dependencies
46
49
  true
47
50
  end
51
+
52
+ sig { returns(Pathname) }
53
+ def readme_template_pathname
54
+ config_hash = CONFIGURATION_PATHNAME.exist? ? YAML.load_file(CONFIGURATION_PATHNAME) : {}
55
+
56
+ specified_readme_template_path = config_hash['readme_template_path']
57
+ if specified_readme_template_path.nil?
58
+ DEFAULT_README_TEMPLATE_PATHNAME
59
+ else
60
+ Pathname.new(specified_readme_template_path)
61
+ end
62
+ end
48
63
  end
49
64
 
50
65
  class << self
data/lib/packs/private.rb CHANGED
@@ -69,7 +69,7 @@ module Packs
69
69
  team: team
70
70
  )
71
71
  add_public_directory(package) if package.enforce_privacy
72
- add_readme_todo(package)
72
+ add_readme(package)
73
73
 
74
74
  Logging.section('Next steps') do
75
75
  next_steps = Packs.config.user_event_logger.after_create_pack(pack_name)
@@ -140,7 +140,7 @@ module Packs
140
140
  end
141
141
  end
142
142
 
143
- add_readme_todo(package)
143
+ add_readme(package)
144
144
 
145
145
  per_file_processors.each do |processor|
146
146
  processor.after_move_files!(file_move_operations)
@@ -446,18 +446,22 @@ module Packs
446
446
 
447
447
  if public_directory.glob('**/**.rb').none?
448
448
  FileUtils.mkdir_p(public_directory)
449
- todo_md = Packs.config.user_event_logger.on_create_public_directory_todo(package.name)
450
- public_directory.join('TODO.md').write(todo_md)
449
+ package_name = package.directory.basename.to_s
450
+ FileUtils.mkdir_p(public_directory.join(package_name))
451
451
  end
452
452
  end
453
453
 
454
454
  sig { params(package: ParsePackwerk::Package).void }
455
- def self.add_readme_todo(package)
455
+ def self.add_readme(package)
456
456
  pack_directory = package.directory
457
457
 
458
458
  if !pack_directory.join('README.md').exist?
459
- readme_todo_md = Packs.config.user_event_logger.on_create_readme_todo(package.name)
460
- pack_directory.join('README_TODO.md').write(readme_todo_md)
459
+ readme_md = Packs.config.user_event_logger.on_create_readme(package.name)
460
+ pack_directory.join('README.md').write(readme_md)
461
+
462
+ if pack_directory.join('README_TODO.md').exist?
463
+ pack_directory.join('README_TODO.md').delete
464
+ end
461
465
  end
462
466
  end
463
467
 
@@ -124,30 +124,12 @@ module Packs
124
124
  end
125
125
 
126
126
  sig { params(pack_name: String).returns(String) }
127
- def on_create_public_directory_todo(pack_name)
128
- <<~MSG
129
- This directory holds your public API!
130
-
131
- Any classes, constants, or modules that you want other packs to use and you intend to support should go in here.
132
- Anything that is considered private should go in other folders.
133
-
134
- If another pack uses classes, constants, or modules that are not in your public folder, it will be considered a "privacy violation" by packwerk.
135
- You can prevent other packs from using private API by using packwerk.
136
-
137
- Want to find how your private API is being used today?
138
- Try running: `bin/packs list_top_violations privacy #{pack_name}`
139
-
140
- Want to move something into this folder?
141
- Try running: `bin/packs make_public #{pack_name}/path/to/file.rb`
127
+ def on_create_readme(pack_name)
128
+ readme_template_pathname = Packs.config.readme_template_pathname
129
+ readme_template = readme_template_pathname.read if readme_template_pathname.exist?
142
130
 
143
- One more thing -- feel free to delete this file and replace it with a README.md describing your package in the main package directory.
131
+ return readme_template unless readme_template.nil?
144
132
 
145
- See #{documentation_link} for more info!
146
- MSG
147
- end
148
-
149
- sig { params(pack_name: String).returns(String) }
150
- def on_create_readme_todo(pack_name)
151
133
  <<~MSG
152
134
  Welcome to `#{pack_name}`!
153
135
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.45
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-30 00:00:00.000000000 Z
10
+ date: 2025-01-07 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bigdecimal
@@ -329,7 +328,6 @@ metadata:
329
328
  source_code_uri: https://github.com/rubyatscale/packs
330
329
  changelog_uri: https://github.com/rubyatscale/packs/releases
331
330
  allowed_push_host: https://rubygems.org
332
- post_install_message:
333
331
  rdoc_options: []
334
332
  require_paths:
335
333
  - lib
@@ -344,8 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
342
  - !ruby/object:Gem::Version
345
343
  version: '0'
346
344
  requirements: []
347
- rubygems_version: 3.5.16
348
- signing_key:
345
+ rubygems_version: 3.6.2
349
346
  specification_version: 4
350
347
  summary: Provides CLI tools for working with ruby packs.
351
348
  test_files: []