2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-17 02:25:16 +00:00
Commit Graph

1918 Commits

Author SHA1 Message Date
Gavin D'souza
30e3e725a8 fix: Show traceback on bench init failure
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
2021-11-17 23:55:15 +05:30
Gavin D'souza
a192240cec fix: Check if app is installed in env via initialize_apps
Consequence: Bench.apps only will have valid frappe apps that are installed in env
2021-11-17 23:51:28 +05:30
Gavin D'souza
67e5db6979 chore: Drop dead code
bench.prepare_staging module wasn't being utilized from any internal
APIs. Dropped it ;)
2021-11-17 23:49:11 +05:30
Gavin D'souza
b6fc562b48 refactor: get_app flow
* 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
2021-11-17 23:45:30 +05:30
Gavin D'souza
4ba5422b65 fix: Move logging to lower level App.get API 2021-11-15 12:40:20 +05:30
Gavin D'souza
13ed9beca5 fix: frappe app can exist without public folder
other change:
* sync apps.txt manually after dep apps are also setup; right before
  build step
2021-11-15 12:39:33 +05:30
Gavin D'souza
5170048d6d style: Black-ish app.py for readability 2021-11-15 12:37:43 +05:30
Gavin D'souza
68c0549c18 refactor(get_app): Workflow for clones/install 2021-11-15 12:37:03 +05:30
Gavin D'souza
79980c3c55 fix: Archived app naming, apps.txt sync
* 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
2021-11-13 14:54:08 +05:30
Gavin D'souza
c636c7c133 fix: Use test frappe app - frappe_docs instead of wiki or chat 2021-11-13 14:27:45 +05:30
Gavin D'souza
6890d98847 feat: Add alias for remove-app: rm, remove 2021-11-13 14:27:25 +05:30
Gavin D'souza
e074a1d886 fix: Show traceback in dev mode and set exit code on errors 2021-11-13 14:26:37 +05:30
Gavin D'souza
6123cd5b49 feat: Restart process manager for develop mode 2021-11-13 14:24:39 +05:30
Gavin D'souza
3709682231 fix: Handle collisions while moving apps 2021-11-13 14:23:49 +05:30
Gavin D'souza
17edb4797b fix: Don't fetch meta for rm app 2021-11-13 14:23:08 +05:30
Gavin D'souza
1330e66d07 style: Flake8 + Black-ish
Tried styling and following standards over teh following modules:
* bench.app
* bench.bench
* bench.exceptions
* bench.utils
2021-11-13 03:01:55 +05:30
Gavin D'souza
d2fba5fe52 fix: Cleanup import hell (contd) 2021-11-13 02:53:32 +05:30
Gavin D'souza
e2fd9de921 fix: Cleanup import hell
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
2021-11-13 01:48:30 +05:30
Gavin D'souza
b2e0fd15c6 ci: Don't install bench in sudo 2021-11-13 00:25:01 +05:30
Gavin D'souza
fafb29477c test: Use frappe/chat as the test install app 2021-11-13 00:24:32 +05:30
Gavin D'souza
c4b8391716 fix: Raise and handle Exception class
* Instead of sys.exit, raise ValidationError
* Let's not handle BaseException, just Exception
* Use ValidationError instead of invalid syntax raise str
2021-11-13 00:20:05 +05:30
Gavin D'souza
e08a12477d chore: Get rid of import * utils 2021-11-13 00:19:12 +05:30
Gavin D'souza
a2ecb398dd ci: Use Nodejs version 14 for Tests 2021-11-12 23:15:49 +05:30
Gavin D'souza
4d1ddc4722 refactor: Bench.sync => Bench.apps.sync
* Added missing imports
* Fixed broken import paths
2021-11-12 22:13:27 +05:30
Gavin D'souza
71d178dde9 fix: sync apps file in init, imports and no warn in CI 2021-11-12 20:31:25 +05:30
Gavin D'souza
ee6a967a20 fix: import path for util 2021-11-12 18:56:24 +05:30
Gavin D'souza
89fdd1c5ac chore: Deprecate bench setup socketio 2021-11-12 18:18:21 +05:30
Gavin D'souza
e1ed4d4e53 refactor(minor): Use Bench object to remove app 2021-11-12 18:17:49 +05:30
Gavin D'souza
bae338ad0b feat(minor): Any procman in bench start
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
2021-11-12 18:15:51 +05:30
Gavin D'souza
d04c7feab7 refactor(minor): bench init
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.
2021-11-12 18:13:01 +05:30
Gavin D'souza
53e811fe0a feat: New methods in Bench class
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
2021-11-12 18:09:35 +05:30
Gavin D'souza
54f9741385 feat: New methods in the App Class
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`
2021-11-12 17:58:24 +05:30
Gavin D'souza
1f11cf4847 chore: Use newer import paths
* 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
2021-11-12 17:57:03 +05:30
Gavin D'souza
c32616d0f2 refactor(utils): Re-arrange, clean-up
* 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
2021-11-12 17:51:20 +05:30
Gavin D'souza
5c9ac457dd chore: Drop unused setup_env util
This util was dropped in favour of Bench(path).setup.env()
2021-10-30 02:46:18 +05:30
Gavin D'souza
93e5655570 refactor: bench.utils.exec_cmd
Refactoring the official way to run any commands through bench. Added a
way to pass on envvars, and use the new log API w click ;)
2021-10-30 02:44:00 +05:30
Gavin D'souza
ba289fba25 refactor(log): use click to colour everything
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)
2021-10-30 02:40:29 +05:30
Gavin D'souza
20560c97c4 feat: Skip warnings if envvar BENCH_DEVELOPER set 2021-10-30 02:39:14 +05:30
Gavin D'souza
616dff8fbb fix: Drop support for Frappe v4-5-6 ;)
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
2021-10-30 02:35:32 +05:30
Gavin D'souza
984959beb8 refactor: Adoption of new style Bench notations
* Updated multiple functions
* Updated flow & re-ordered steps of `bench init` - tested with multiple
  args
* Updated exceptions
2021-10-30 02:32:04 +05:30
Gavin D'souza
153546afd7 refactor: Simplify Bench with OOP
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
2021-10-30 02:25:38 +05:30
Gavin D'souza
b59379c5a9 refactor(minor): AppMeta class
* Fix tuple addition
* Rename App to AppMeta - it's more apt given how Bench classes are
  being structured now
2021-10-30 02:06:10 +05:30
Gavin D'souza
c5a38b3647 refactor: Exceptions, Setup & Styles 2021-10-21 16:37:49 +05:30
Gavin D'souza
01442ba150 chore: Add compatibility & license shields to README 2021-10-21 15:31:03 +05:30
gavin
8d5f408204
Merge branch 'develop' into get-app-on-steroids 2021-10-20 21:38:52 +05:30
Gavin D'souza
c060ce7b54 refactor(minor): bench install-app
Getting rid of the dependency on the manual coloring of all prints using
color
2021-10-20 19:43:10 +05:30
Gavin D'souza
dafddaef6d refactor: bench get-app
* Added app dependencies resolving using `required_apps`
* Simplified workflow + docstring to explain what's goin on xD
* Get rid of redundant restart_bench kwarg from get_app
2021-10-20 19:42:52 +05:30
Gavin D'souza
1865eeeb6d feat(minor): App Meta handling on disk repos 2021-10-20 19:33:16 +05:30
gavin
b9b1d444b1
Merge pull request #1205 from resilient-tech/add-live-reload
feat: add `live_reload` to default `common_site_config`
2021-10-20 12:53:34 +05:30
Gavin D'souza
38382b84fb feat: Initialize bench on bench get(-app) if not created
Why bother creating a bench well in advance? If someone wants to install
your app, they should be able to with a single command.

For instance, you can run simply `bench get healthcare` in any directory and bench will be setup automatically
2021-10-20 01:05:40 +05:30