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) " Your next steps might be:\n\n 1) Run `bin/packwerk update-todo` to update the violations.\n MSG\nend\n" |
#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) " Your next steps might be:\n\n 1) Move files into your pack with `bin/packs move \#{pack_name} path/to/file.rb`\n\n 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.\n\n 3) Expose public API in \#{pack_name}/\#{ParsePackwerk::DEFAULT_PUBLIC_PATH}. Try `bin/packs make_public \#{pack_name}/path/to/file.rb`\n\n 4) Update your readme at \#{pack_name}/README.md\n MSG\nend\n" |
#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 " Your next steps might be:\n\n 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.\n\n 2) Work to migrate clients of private API to your new public API\n\n 3) Update your README at packs/your_package_name/README.md\n MSG\nend\n" |
#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) " Your next steps might be:\n\n 1) Delete the old pack when things look good: `git rm -r \#{pack_name}`\n\n 2) Run `bin/packwerk update-todo` to update the violations. Make sure to run `spring stop` first.\n MSG\nend\n" |
#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) " Your next steps might be:\n\n 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.\n\n 2) Touch base with each team who owns files involved in this move\n\n 3) Expose public API in \#{pack_name}/\#{ParsePackwerk::DEFAULT_PUBLIC_PATH}. Try `bin/packs make_public \#{pack_name}/path/to/file.rb`\n\n 4) Update your readme at \#{pack_name}/README.md\n MSG\nend\n" |
#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) " Your next steps might be:\n\n 1) Delete the old pack when things look good: `git rm -r \#{pack_name}`\n\n 2) Run `bin/packwerk update-todo` to update the violations. Make sure to run `spring stop` first.\n MSG\nend\n" |
#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) " You are adding a dependency. See \#{documentation_link} for other utilities!\n MSG\nend\n" |
#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) " You are creating a pack, which is great. Check out \#{documentation_link} for more info!\n MSG\nend\n" |
#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? " You are listing top \#{limit} \#{type} violations for all packs. See \#{documentation_link} for other utilities!\n Pass in a limit to display more or less, e.g. `bin/packs list_top_violations \#{type} \#{pack_name} -l 1000`\n\n This script is intended to help you find which of YOUR pack's private classes, constants, or modules other packs are using the most.\n Anything not in pack_name/\#{ParsePackwerk::DEFAULT_PUBLIC_PATH} is considered private API.\n PACK_CONTENT\n else\n <<~PACK_CONTENT\n You are listing top \#{limit} \#{type} violations for \#{pack_name}. See \#{documentation_link} for other utilities!\n Pass in a limit to display more or less, e.g. `bin/packs list_top_violations \#{type} \#{pack_name} -l 1000`\n\n This script is intended to help you find which of YOUR pack's private classes, constants, or modules other packs are using the most.\n Anything not in \#{pack_name}/\#{ParsePackwerk::DEFAULT_PUBLIC_PATH} is considered private API.\n PACK_CONTENT\n end\nend\n" |
#before_make_public ⇒ Object
55 56 57 58 59 |
# File 'lib/packs/user_event_logger.rb', line 55 def before_make_public " You are moving some files into public API. See \#{documentation_link} for other utilities!\n MSG\nend\n" |
#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) " You are moving one pack to a new directory. Check out \#{documentation_link} for more info!\n MSG\nend\n" |
#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) " You are moving a file to a pack, which is great. Check out \#{documentation_link} for more info!\n MSG\nend\n" |
#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) " You are moving one pack to be a child of a different pack. Check out \#{documentation_link} for more info!\n MSG\nend\n" |
#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? " Welcome to `\#{pack_name}`!\n\n If you're the author, please consider replacing this file with a README.md, which may contain:\n - What your pack is and does\n - How you expect people to use your pack\n - Example usage of your pack's public API (which lives in `\#{pack_name}/\#{ParsePackwerk::DEFAULT_PUBLIC_PATH}`)\n - Limitations, risks, and important considerations of usage\n - 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)\n - What SLAs/SLOs (service level agreements/objectives), if any, your package provides\n - When in doubt, keep it simple\n - Anything else you may want to include!\n\n README.md files are under version control and should change as your public API changes.\#{' '}\n\n See \#{documentation_link} for more info!\n MSG\nend\n" |