Module: Packs::UserEventLogger
- Extended by:
- T::Helpers, T::Sig
- Included in:
- DefaultUserEventLogger
- Defined in:
- lib/packs/user_event_logger.rb
Instance Method Summary collapse
- #after_add_dependency(pack_name) ⇒ Object
- #after_create_pack(pack_name) ⇒ Object
- #after_make_public ⇒ Object
- #after_move_to_folder(pack_name) ⇒ Object
- #after_move_to_pack(pack_name) ⇒ Object
- #after_move_to_parent(pack_name) ⇒ Object
- #before_add_dependency(pack_name) ⇒ Object
- #before_create_pack(pack_name) ⇒ Object
- #before_list_top_violations(type, pack_name, limit) ⇒ Object
- #before_make_public ⇒ Object
- #before_move_to_folder(pack_name) ⇒ Object
- #before_move_to_pack(pack_name) ⇒ Object
- #before_move_to_parent(pack_name) ⇒ Object
- #documentation_link ⇒ Object
- #on_create_readme(pack_name) ⇒ Object
Instance Method Details
#after_add_dependency(pack_name) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/packs/user_event_logger.rb', line 82 def after_add_dependency(pack_name) <<~MSG Your next steps might be: 1) Run `bin/packwerk update-todo` to update the violations. MSG end |
#after_create_pack(pack_name) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/packs/user_event_logger.rb', line 18 def after_create_pack(pack_name) <<~MSG Your next steps might be: 1) Move files into your pack with `bin/packs move #{pack_name} path/to/file.rb` 2) Run `bin/packwerk update-todo` to update the violations. Make sure to run `spring stop` if you've added new load paths (new top-level directories) in your pack. 3) Expose public API in #{pack_name}/#{ParsePackwerk::DEFAULT_PUBLIC_PATH}. Try `bin/packs make_public #{pack_name}/path/to/file.rb` 4) Update your readme at #{pack_name}/README.md MSG end |
#after_make_public ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/packs/user_event_logger.rb', line 62 def after_make_public <<~MSG Your next steps might be: 1) Run `bin/packwerk update-todo` to update the violations. Make sure to run `spring stop` if you've added new load paths (new top-level directories) in your pack. 2) Work to migrate clients of private API to your new public API 3) Update your README at packs/your_package_name/README.md MSG end |
#after_move_to_folder(pack_name) ⇒ Object
116 117 118 119 120 121 122 123 124 |
# File 'lib/packs/user_event_logger.rb', line 116 def after_move_to_folder(pack_name) <<~MSG Your next steps might be: 1) Delete the old pack when things look good: `git rm -r #{pack_name}` 2) Run `bin/packwerk update-todo` to update the violations. Make sure to run `spring stop` first. MSG end |
#after_move_to_pack(pack_name) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/packs/user_event_logger.rb', line 40 def after_move_to_pack(pack_name) <<~MSG Your next steps might be: 1) Run `bin/packwerk update-todo` to update the violations. Make sure to run `spring stop` if you've added new load paths (new top-level directories) in your pack. 2) Touch base with each team who owns files involved in this move 3) Expose public API in #{pack_name}/#{ParsePackwerk::DEFAULT_PUBLIC_PATH}. Try `bin/packs make_public #{pack_name}/path/to/file.rb` 4) Update your readme at #{pack_name}/README.md MSG end |
#after_move_to_parent(pack_name) ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'lib/packs/user_event_logger.rb', line 98 def after_move_to_parent(pack_name) <<~MSG Your next steps might be: 1) Delete the old pack when things look good: `git rm -r #{pack_name}` 2) Run `bin/packwerk update-todo` to update the violations. Make sure to run `spring stop` first. MSG end |
#before_add_dependency(pack_name) ⇒ Object
75 76 77 78 79 |
# File 'lib/packs/user_event_logger.rb', line 75 def before_add_dependency(pack_name) <<~MSG You are adding a dependency. See #{documentation_link} for other utilities! MSG end |
#before_create_pack(pack_name) ⇒ Object
11 12 13 14 15 |
# File 'lib/packs/user_event_logger.rb', line 11 def before_create_pack(pack_name) <<~MSG You are creating a pack, which is great. Check out #{documentation_link} for more info! MSG end |
#before_list_top_violations(type, pack_name, limit) ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/packs/user_event_logger.rb', line 153 def before_list_top_violations(type, pack_name, limit) if pack_name.nil? <<~PACK_CONTENT You are listing top #{limit} #{type} violations for all packs. See #{documentation_link} for other utilities! Pass in a limit to display more or less, e.g. `bin/packs list_top_violations #{type} #{pack_name} -l 1000` This script is intended to help you find which of YOUR pack's private classes, constants, or modules other packs are using the most. Anything not in pack_name/#{ParsePackwerk::DEFAULT_PUBLIC_PATH} is considered private API. PACK_CONTENT else <<~PACK_CONTENT You are listing top #{limit} #{type} violations for #{pack_name}. See #{documentation_link} for other utilities! Pass in a limit to display more or less, e.g. `bin/packs list_top_violations #{type} #{pack_name} -l 1000` This script is intended to help you find which of YOUR pack's private classes, constants, or modules other packs are using the most. Anything not in #{pack_name}/#{ParsePackwerk::DEFAULT_PUBLIC_PATH} is considered private API. PACK_CONTENT end end |
#before_make_public ⇒ Object
55 56 57 58 59 |
# File 'lib/packs/user_event_logger.rb', line 55 def before_make_public <<~MSG You are moving some files into public API. See #{documentation_link} for other utilities! MSG end |
#before_move_to_folder(pack_name) ⇒ Object
109 110 111 112 113 |
# File 'lib/packs/user_event_logger.rb', line 109 def before_move_to_folder(pack_name) <<~MSG You are moving one pack to a new directory. Check out #{documentation_link} for more info! MSG end |
#before_move_to_pack(pack_name) ⇒ Object
33 34 35 36 37 |
# File 'lib/packs/user_event_logger.rb', line 33 def before_move_to_pack(pack_name) <<~MSG You are moving a file to a pack, which is great. Check out #{documentation_link} for more info! MSG end |
#before_move_to_parent(pack_name) ⇒ Object
91 92 93 94 95 |
# File 'lib/packs/user_event_logger.rb', line 91 def before_move_to_parent(pack_name) <<~MSG You are moving one pack to be a child of a different pack. Check out #{documentation_link} for more info! MSG end |
#documentation_link ⇒ Object
174 175 176 |
# File 'lib/packs/user_event_logger.rb', line 174 def documentation_link 'https://github.com/rubyatscale/packs#readme' end |
#on_create_readme(pack_name) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/packs/user_event_logger.rb', line 127 def on_create_readme(pack_name) readme_template_pathname = Packs.config.readme_template_pathname readme_template = readme_template_pathname.read if readme_template_pathname.exist? return readme_template unless readme_template.nil? <<~MSG Welcome to `#{pack_name}`! If you're the author, please consider replacing this file with a README.md, which may contain: - What your pack is and does - How you expect people to use your pack - Example usage of your pack's public API (which lives in `#{pack_name}/#{ParsePackwerk::DEFAULT_PUBLIC_PATH}`) - Limitations, risks, and important considerations of usage - How to get in touch with eng and other stakeholders for questions or issues pertaining to this pack (note: it is recommended to add ownership in `#{pack_name}/package.yml` under the `owner` metadata key) - What SLAs/SLOs (service level agreements/objectives), if any, your package provides - When in doubt, keep it simple - Anything else you may want to include! README.md files are under version control and should change as your public API changes.#{' '} See #{documentation_link} for more info! MSG end |