Each operation can be broken down to multiple jobs. For instance, the
update operation can be broken down into: setting up bench dirs, env,
backups, requirements, etc.
Each step has a lot of output since Frappe requires a lot of complex
stuff to be done as a pre-requisite. Bench tries to simplify a lot in a
single command. Once, a step is completed, it's output is not really
required. So, we can ignore it to reduce the noise.
Here's where the `bench.cli.fancy` variable kicks in. Along with the
refactored log and new step wrapper, it makes the above thing possible.
At this point, there's no way to set this var from the end user...given
I'm still developing this. In the later commits, the idea is to pass a
flag similar to pip's --use-feature flag.
* Don't update node packages twice (already managed via
update_requirements)
* Don't reload bench.utils - this made sense back when bench was updated
along with the apps
* Fix utils namespaces. Import instead of ....
* Separate out branch validation logic
* Add type hints
* Raise named Exception "CannotUpdateReleaseBench" instead of SystemExit
* Use "newer" APIs wherever possible
* Remove unwanted log message 🤢. It was inconsistent...this had to be
done...rip
* Fix missing import - install_python_dev_dependencies
* Don't setup node + python requirements when --dev flag is passed
Other changes:
* Invoke internal init function instead of invoking click
command. This was done to avoid handling random Exceptions that are done
in the command definition
* os.chdir after initializing new bench in get_app
* Changes in get_app fix path/cwd issues and order of resolving deps: py
-> dev py -> yarn
* Pass verbosity in setup_app_dependencies via get_app
* Say hi to new utils: get_available_folder_name, get_traceback
* apps.txt wasn't being synced in time so the build was failing, this
changes that
* Apps archived on the same day weren't being numbered properly...it
went from _1 to _1_2 and so forth. This is fixed to show _1, _2 and so
on
There was this bug that said `bench.utils.bench` doesn't have attribute
VERSION or whatever bench/__init__ was supposed to have. Now
bench/utils/__init__ had an `import bench` statement that was supposed
to ask for the top level module...but conflicted with the utils.bench
namespace. Changed the line in utils to `from bench import PROJECT_NAME,
VERSION` and it just works now...oh well
Other changes made were an attempt to cleanup and simplify the multi
level dotted path calls
* Instead of sys.exit, raise ValidationError
* Let's not handle BaseException, just Exception
* Use ValidationError instead of invalid syntax raise str
Using the `-m` flag, we can use any process manager instead of the
standard honcho. For instance, you've installed overmind on your machine
and are married to it, just run `bench start -m overmind` :P
Rename --frappe-branch flag to --version, both are allowed though. Cause
of rename: Makes more sense as version rather than frappe_branch. This
is because you can pass any git reference instead of just branches, including
version tags.
New methods added in Bench class:
* excluded_apps property
* shallow_clone property
* apps property - check if frappe app & sort
* sync: Sync the apps.txt file from the installed set of Frappe apps
* build: Build bench assets
* reload: Reload the Frappe processes - supervisor restart
New methods added in BenchApps class:
* add/append: Adding an App object to this, installs the app on the
Bench
* remove: Removing an App from here, uninstalls and archives the app
Methods available in the App class:
* get: Clone remote/local repos into set bench
* remove: Uninstall from env & move app into `archived/apps` folder.
Changed location from `archived_apps`
* install: Install app's Frappe, Python & Node dependencies on set bench
* uninstall: Uninstall Python package of the Frappe App. Does nothing
else...just a `pip uninstall`
* Although the utils refactor was done in such a way that there was no
need of changing import paths, a cleanup was due.
* Got rid of duplicated utils
* Remove unused imports
* Cleaner APIs - got rid of redundant and repeated checks
* Easier understanding on what's called where? ;) hopefully
* Separation of utils to avoid confusion
* Remove redundant utils
* Use newer standard library APIs
A year (longer) ago, I added color to bench manually. I hadn't explored
much of click back then. Had to figure out when we had to and we didnt
have to colour stuff. At times the chars would just be ignored and
rather printed to the terminal which was awkward...anyway, here,
goodbyetoallthat :cheers: (hopefully)
This was long time due. Removing software that won't be compatible with
this version of Bench is a no-brainer. Sorry for not posting this in
advance but the world has been moving too fast.
Use `pip install frappe-bench --only-binary='all'` to install the latest
supported version for your machine :D
Goals:
- Commonify bench operations in a way that intuitive
- Get rid of the multiple duplicate functions because it's so hard to
understand flow in the codebase ;)
- Eliminate the need to guess, re-guess and pass bench info in each
function that needs to do literally anything
- Increase my happiness index because I just realised that I'm the top
contributor of this project and I'd like to make it my own.
- Adopt the principles of Least Surprise & The Principle of The Bigger Smile (of DHH) [inspired by ruby & ror]
Changes:
- The bench module has Bench and the action classes that can be accessed
through the bench object
- Used the Bench class to access properties like sites, apps & run (to execute commands in context) to reduce effort and clutter
- Style improvements & minor changes included