2
0
mirror of https://github.com/frappe/bench.git synced 2024-06-21 01:12:19 +00:00
Commit Graph

1388 Commits

Author SHA1 Message Date
Gavin D'souza
af14bafe21 fix(restart): Setup restarts vars with fallback 2022-03-21 13:37:16 +05:30
Aradhya
bbca3e9fab feat: mimicking get-app behaviour when app is already installed 2022-03-20 22:15:41 +05:30
Gavin D'souza
fc7c047c28 fix: Allow sudo restart for supervisor (backwards compatibility) 2022-03-17 15:04:22 +05:30
Gavin D'souza
7a4ade9192 fix: Try setting supervisord conditionally 2022-03-17 13:03:04 +05:30
Gavin D'souza
d89f19e02e fix: Show better user messages when failed to update supervisord 2022-03-17 12:58:05 +05:30
Gavin D'souza
ad000f1be7 fix: Don't handle BaseExceptions 2022-03-17 11:41:57 +05:30
Gavin D'souza
d33d987b2c fix: User messages on get-app actions 2022-03-17 11:41:34 +05:30
Gavin D'souza
d38b63a483 fix: mkdir -p to ignore OSErrors
Closes https://github.com/frappe/bench/issues/1279
2022-03-17 10:23:41 +05:30
Gavin D'souza
25f49c2dbb fix: Respect bench config during restart
Fixes https://github.com/frappe/bench/issues/1261
2022-03-17 10:23:34 +05:30
saxenabhishek
d0bd294dc2 feat: slower alternative for get_required_deps 2022-03-14 05:33:44 +05:30
saxenabhishek
adbe19ac1b docs: is_valid_frappe_branch() docstring 2022-03-14 05:17:29 +05:30
saxenabhishek
8dd92c32b1 feat: alternative request to validate branch 2022-03-14 05:17:08 +05:30
Aradhya
bb16b73358 test: Updated tests 2022-03-11 18:38:21 +05:30
saxenabhishek
9ac091b4d9 feat: add required and order of install 2022-03-11 14:12:31 +05:30
saxenabhishek
af3c871632 fix: missing installed branch 2022-03-11 13:34:54 +05:30
saxenabhishek
67df07b732 fix: empty states json condition 2022-03-11 13:22:49 +05:30
saxenabhishek
7de1fa7c4d style: black-ish 2022-03-11 13:13:53 +05:30
saxenabhishek
2287f3f7ec fix: check current branch 2022-03-11 13:13:53 +05:30
saxenabhishek
c71432de3c test: update remove file creation check 2022-03-11 13:13:26 +05:30
saxenabhishek
56f7016e69 docs: rename states.json file 2022-03-10 23:07:44 +05:30
saxenabhishek
5bb3b52f23 fix: print required by in output 2022-03-10 23:07:15 +05:30
saxenabhishek
9004e1dd6a feat: add commit hash and branch in states.json 2022-03-10 23:06:47 +05:30
Aradhya
d178b08abb feat: verbose env setup & checking for compatible versions 2022-03-10 18:33:49 +05:30
saxenabhishek
79765e6b25 fix: check for valid branch in resolve 2022-03-10 12:59:14 +05:30
Aradhya
17888a5ce5 test: Updated tests for is_valid_frappe_branch 2022-03-07 19:16:29 +05:30
Aradhya
6c15327348 fix: fixed frappe branch check 2022-03-07 19:07:20 +05:30
Aradhya
c71fd096cc refactor: removed code added through merge commit 2022-03-02 23:09:20 +05:30
Aradhya
fbee987490 test: removed required urls tests as it's covered in test_get_dependencies 2022-03-02 23:08:31 +05:30
Aradhya
ca4530528c fix: merge conflicts 2022-03-02 22:47:50 +05:30
Aradhya
b0ae3ae359 perf: Using github API 2022-03-02 22:44:12 +05:30
saxenabhishek
7ea09ce7c9 test: get_dependencies() 2022-03-02 15:11:18 +05:30
saxenabhishek
03a435330b test: app states creation & update 2022-03-01 18:15:34 +05:30
saxenabhishek
6609ad20c4 test: is_valid_frappe_branch() 2022-03-01 18:11:46 +05:30
saxenabhishek
a1e1572937 test: get_required_deps_url() 2022-03-01 18:11:13 +05:30
Aradhya
a26f3ce564 fix: logging when in init-bench 2022-02-28 15:29:58 +05:30
Aradhya
0d51206241 refactor: ignoring app deps when install app without --resolve-deps 2022-02-28 15:29:58 +05:30
Aradhya
94105c0aa8 fix: minor fixes 2022-02-28 15:29:58 +05:30
saxenabhishek
cccd76729f test: get-app resolve_deps 2022-02-28 15:29:58 +05:30
Aradhya
95b0834932 feat: printing resolved dependencies when using resolve-deps flag wih get-app 2022-02-28 15:29:58 +05:30
Aradhya
5b641758cf fix: added code removed via erroneous commit 2022-02-28 15:29:58 +05:30
Aradhya
58319a21b7 feat: added support for fetching dependencies from hooks.py 2022-02-28 15:29:58 +05:30
Aradhya
1cd914933f refactor: changed resolve to resolve-deps 2022-02-28 15:29:58 +05:30
Aradhya
4feb07684a refactor: using hooks.py instead of toml files to read dependencies 2022-02-28 15:29:58 +05:30
Aradhya
30a4ec3b42 fix: fixed app states and checking/updating frappe version on install
fix: fixed valid branch check in init
2022-02-28 15:29:58 +05:30
Aradhya
88c23673d6 fix: fixed init in get-app and frappe versions 2022-02-28 15:29:58 +05:30
Aradhya
210146d222 refactor: moved resolve and install to get-app 2022-02-28 15:29:58 +05:30
Aradhya
fdab757f9b feat: Added app states 2022-02-28 15:29:58 +05:30
Aradhya
cdaeea1d4a feat: Added bench command for resolve and install 2022-02-28 15:29:58 +05:30
saxenabhishek
bfd69c37eb feat: introduced simple resolver 2022-02-28 15:29:58 +05:30
Aradhya
de315f27ad fix: logging when in init-bench 2022-02-28 14:29:05 +05:30
Aradhya
bb911b5e5a refactor: ignoring app deps when install app without --resolve-deps 2022-02-25 16:51:06 +05:30
Aradhya
6d05fe2f53 Merge branch 'develop' of github.com:Aradhya-Tripathi/bench into dependency-resolution 2022-02-25 16:27:41 +05:30
gavin
5bc2706175
Merge branch 'develop' into tests 2022-02-25 00:35:47 +05:30
Aradhya
df76415e6b refactor: running utils tests before bench tests 2022-02-24 12:40:00 +05:30
Aradhya Tripathi
60084fd6b3
Merge branch 'develop' into uri-path 2022-02-24 00:42:58 +05:30
Aradhya
3dcd28f569 test: updated tests to check for correct parsing of file uris 2022-02-23 21:53:08 +05:30
Aradhya
8fb6796250 test: Added tests for app utils 2022-02-23 21:44:55 +05:30
Aradhya
2fed369066 fix: file-uri while app initialisation 2022-02-23 14:56:15 +05:30
Aradhya
6e4f121fc6 Merge branch 'develop' of github.com:Aradhya-Tripathi/bench into dependency-resolution 2022-02-22 13:31:00 +05:30
Sagar Vora
3c5944623a fix: clearer docstrings 2022-02-19 09:50:20 +05:30
DaizyModi
28e681689f
feat: Setup Requirements for specific apps (#1265)
* feat:  flag for Setup Requirements

* chore: Moved __get_installed_app method in Bench

* fix: improve help message

* fix: allow muliple apps to be specified

Co-authored-by: Sagar Vora <sagar@resilient.tech>
Co-authored-by: gavin <gavin18d@gmail.com>
2022-02-18 17:34:39 +05:30
Aradhya
e629ca6f86 fix: minor fixes 2022-02-17 21:48:40 +05:30
Aradhya
28325acd3b Merge branch 'dependency-resolution' of github.com:Aradhya-Tripathi/bench into dependency-resolution 2022-02-17 21:39:07 +05:30
Aradhya
bba4019579 feat: printing resolved dependencies when using resolve-deps flag wih get-app 2022-02-17 21:38:01 +05:30
saxenabhishek
129e2fd922 test: get-app resolve_deps 2022-02-11 16:51:34 +05:30
Aradhya
6c9fb2d9f9 Merge branch 'develop' of github.com:Aradhya-Tripathi/bench into dependency-resolution 2022-02-07 12:38:18 +05:30
Aradhya
7e28a3dd9e fix: added code removed via erroneous commit 2022-02-07 12:24:50 +05:30
Aradhya
7f678a3047 feat: added support for fetching dependencies from hooks.py 2022-02-07 10:24:58 +05:30
Aradhya
80cfb9dfb4 refactor: changed resolve to resolve-deps 2022-02-07 10:23:22 +05:30
Aradhya
c8dfe39c05 refactor: using hooks.py instead of toml files to read dependencies 2022-02-07 10:21:50 +05:30
Aradhya
42f4d74beb fix: fixed app states and checking/updating frappe version on install
fix: fixed valid branch check in init
2022-02-07 10:16:50 +05:30
Aradhya
e3bd34c12c fix: fixed init in get-app and frappe versions 2022-02-07 10:00:38 +05:30
Aradhya
2363fe38d5 refactor: moved resolve and install to get-app 2022-02-07 09:53:55 +05:30
Aradhya
549e8e2a1d feat: Added app states 2022-02-07 09:34:35 +05:30
Aradhya
7a311a242d feat: Added bench command for resolve and install 2022-02-07 09:31:15 +05:30
saxenabhishek
d41e05e24f feat: introduced simple resolver 2022-02-07 09:29:14 +05:30
saxenabhishek
c66283dd08 test: test_switch_to_branch() which is lower 2022-02-05 01:49:11 +05:30
saxenabhishek
5b1b84bc5f fix: use frappe13 in py 3.7 2022-01-31 19:14:16 +05:30
Gavin D'souza
23b37a3606 style: Re-order import statement 2022-01-04 17:08:17 +05:30
Gavin D'souza
e3b9c2a239 fix: Set remote_server attr "better"
So better here is relative. The point was to not have the parsing break
everything. So, idk whats org and repo now right off the bat...and since
we're not using this info, we dont need to care about it rn
2022-01-04 17:04:45 +05:30
Gavin D'souza
0898e2d2a2 fix: Don't recompute URLs when name passed in App 2022-01-04 16:23:16 +05:30
Gavin D'souza
2fa25d8791 fix: Command picking & execution
Parse sys.argv appropriately and use them to match commands "better".
Using hacks to match with flags and options appear to be faulty, so
dropped that. Only matching with command names remains.

Fixes https://github.com/frappe/bench/issues/1223
2021-12-28 13:39:23 +05:30
Gavin D'souza
2caf7e7d15 fix: Set verbosity if --verbose is passed anywhere period
Fixes https://github.com/frappe/bench/issues/1224
2021-12-28 12:42:53 +05:30
Gavin D'souza
9802feaa9c fix: Set correct remote_server for cloning
Fixes https://github.com/frappe/bench/issues/1228
2021-12-28 12:35:59 +05:30
Gavin D'souza
217f27f511 fix: Set proper branch to clone
Fixes https://github.com/frappe/bench/issues/1242
2021-12-28 12:35:06 +05:30
gavin
b0ad6426a8
Merge pull request #1222 from gavindsouza/reload-bench
refactor: bench restart
2021-12-21 15:29:58 +05:30
Dany Robert
fd82585d5f
chore: remove unnecessary shutil import 2021-12-17 19:39:51 +05:30
Dany Robert
a648590be4
fix: replace shutil.move with Path.rename
Co-authored-by: gavin <gavin18d@gmail.com>
2021-12-17 19:38:41 +05:30
Dany Robert
aaf48566b7
fix: PosixPath object has no attribute 'rstrip' 2021-12-09 13:03:01 +05:30
Rohan Bansal
660287a1a7 fix: process SSH git URLs 2021-12-07 15:16:49 +05:30
Gavin D'souza
ec369a16a1 fix: Clear Bench instance cache on every chdir 2021-12-02 14:22:34 +05:30
Gavin D'souza
814bcc6320 refactor: Bench restart
* Commonify reloading processes' logic
* Add functionality to restart web workers in development
* Use Bench.reload instead
2021-12-02 14:21:52 +05:30
phot0n
2a25a6d2d9 feat: add no-git option to new-app command 2021-12-01 00:00:18 +05:30
Gavin D'souza
b11f5b0f96 fix: Check if archived_sites directory exists before running 2021-11-30 17:46:56 +05:30
Gavin D'souza
357fcc0bbd fix: Trailing slash not setting app name properly
Re-do of https://github.com/frappe/bench/pull/1021, somewhat
2021-11-30 11:33:02 +05:30
Gavin D'souza
a17af670df style: Black-ish make & app 2021-11-29 18:57:40 +05:30
Gavin D'souza
8275d678f4 fix: Pass skip_assets while resolving dependant apps 2021-11-29 18:55:47 +05:30
Gavin D'souza
8480eb5df7 feat(minor): --install-app option in init 2021-11-29 18:55:21 +05:30
Gavin D'souza
a2ccc30bc3 fix: Initialize bench in get-app with --init-bench 2021-11-29 18:34:58 +05:30
Gavin D'souza
877e812fbb fix: Patch to move archived_sites to archived/sites
This patch runs only if Frappe >= v14. Doesn't do anything else

Frappe PR: https://github.com/frappe/frappe/pull/15060
2021-11-26 18:53:13 +05:30
Gavin D'souza
b7994e21b1 fix: Show warning while using experimental features
This shows a "WARNING:..." whenever any --use-feature flag is used
2021-11-26 16:28:18 +05:30
Gavin D'souza
1b2bb87ab7 refactor: Bench verbosity
It's off by default. If you want it enabled, pass --verbose or -v
following `bench`. The verbosity only changes how pip installs work.
Other stuff is immaterial at this point.

Eg: bench -v setup requirements
2021-11-26 16:24:56 +05:30
Gavin D'souza
6081690d7b refactor(minor): python packages setup 2021-11-26 12:47:29 +05:30
Gavin D'souza
d63a9883e0 feat(minor): Bench.python property that points to env python 2021-11-26 11:54:32 +05:30
Gavin D'souza
27128c7c18 fix: Import bench.cli
For whatever reason, Travis complained saying "AttributeError: module 'bench' has no attribute 'cli'" but works fine locally :')
2021-11-18 19:02:22 +05:30
Gavin D'souza
a8564f3991 chore: Mark methods under job/step 2021-11-18 18:26:48 +05:30
Gavin D'souza
7c653db703 refactor: CLI entry point
* Optimized condiitonal checks
* Removed warnings for src, --version
* Handled positional shifts due to usages of --use-feature (by
  set.intersection)
* Raise Exception always instead of hiding the traceback
2021-11-18 18:26:39 +05:30
Gavin D'souza
225fce5be6 fix: Show bench init job via bench get-app (conditional)
This happens when dynamic-feed is enabled
2021-11-18 18:13:14 +05:30
Gavin D'souza
f230778972 refactor: CLI Rendering Engine
* Hanlde job-step renders
* Use context manager for managing renders and state
* Job and Step remain process agnostic - neither are dependant on the
  other
2021-11-18 18:10:01 +05:30
Gavin D'souza
6d10d75bb1 fix: Show pip's help menu when --help is passed in pip command 2021-11-18 18:07:32 +05:30
Gavin D'souza
7c4b6cea2b style: Black-ish + Flake8 2021-11-18 12:02:37 +05:30
Gavin D'souza
b92fb1401b feat: Pass --use-feature='dynamic-feed' for new CLI 2021-11-18 12:02:03 +05:30
Gavin D'souza
806d543fac fix: Show traceback if error occurs during init, get outside bench dir 2021-11-18 01:04:02 +05:30
Gavin D'souza
f117959801 feat: Dynamic Output rendering
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.
2021-11-18 01:00:04 +05:30
Gavin D'souza
3995b9237b fix: raise (by default) when exec_cmd fails 2021-11-18 00:41:37 +05:30
Gavin D'souza
cd1f526d09 perf: Cache Bench and App instantiation 2021-11-18 00:39:48 +05:30
Gavin D'souza
ac07d8dc52 refactor: bench.utils.log
Maintain `bench.LOG_BUFFER` for entire process when `bench.cli.fancy` is set
2021-11-18 00:36:13 +05:30
Gavin D'souza
747be65f92 refactor(minor): switch branch
* 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 ....
2021-11-18 00:31:51 +05:30
Gavin D'souza
58e3d4931b refactor: bench update workflow
* Separate out branch validation logic
* Add type hints
* Raise named Exception "CannotUpdateReleaseBench" instead of SystemExit
* Use "newer" APIs wherever possible
2021-11-18 00:18:10 +05:30
Gavin D'souza
4655f6e785 refactor(minor): Dependency resolving
* Added a requirements method under BenchSetup
* Resolve Frappe dependencies prior to other apps
* Fixed issues with missing path in update_env_pip
2021-11-18 00:10:25 +05:30
Gavin D'souza
84d1b209ba chore: Added Typing + styling 2021-11-18 00:03:42 +05:30
Gavin D'souza
cd252d3476 refactor: setup dev requirements
* 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
2021-11-17 23:56:55 +05:30
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
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
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
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 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
Gavin D'souza
b75d352454 feat: Aliased Commands
* Added alias for get-app as get
* Now run `bench get erpnext` to install ERPNext on your bench
2021-10-20 00:45:05 +05:30
Gavin D'souza
906ad5a099 feat: bench drop {bench_path}
* Drops bench if no sites' folders found
* Tries to drop crontab entry made for backups
2021-10-20 00:43:46 +05:30
Gavin D'souza
ce00798b5d feat: App Meta Base Class
* Less messier way of setting up and managing pre-fetched app meta
* Added support to fetch apps using the GitHub org/repo pattern
* Can be used to get apps and easily handle dependencies through version
  identifiers
2021-10-20 00:37:36 +05:30
Pruthvi Patel
a28a0d0d23 fix: correct patches.txt 2021-10-18 18:21:24 +05:30
Pruthvi Patel
9f74ec0adb feat: add live_reload to default_config 2021-10-18 16:29:05 +05:30
Francisco Roldán
593b80eec9
feat: Add custom workers in Procfile (#1201)
* feat: updated procfile

* fix: add missing context

* fix: add missing context
2021-10-07 12:20:36 +05:30
kevgeni
641181260e
fix: Allow git url with custom username (#1200)
Allow git url with custom user, and not just the git user.
2021-09-17 15:29:14 +05:30
Francisco Roldán
e0b9461d41
Merge branch 'develop' into queues 2021-09-14 08:43:31 -03:00
Francisco Roldan
75f84625ad fix: rename key 2021-09-14 08:42:06 -03:00
Ankush Menat
b51f0ed2b2
feat: bench setup requirements --dev (#1196)
* chore: typo

* chore: update project description

* feat: command to install dev-requirements.txt

Often applications have development or test specific requirements which
are not required in production.

- Add new command `bench setup dev-requirements`
- installs all `dev-requirements.txt` in app's root folder.

* refactor: remove duplicate function

* refactor: use `log` instead of print

* refactor: merge dev-requirement command

* feat: install dev-dependencies in get-app if dev

When developer mode is enabled install all dev dependencies too while
doing `get-app`

* fix: warn about --dev not supporting node
2021-09-13 20:55:21 +05:30
Francisco Roldán
58ef0ac430
Merge branch 'develop' into queues 2021-09-09 08:56:34 -03:00
Gavin D'souza
6fd3ad738b fix(command_cache): Return iterable as fallback 2021-09-09 16:05:42 +05:30
Gavin D'souza
b35af193d3 chore: Remove unnecessary returns, re-order cli resolution
Changes suggested by LGTM https://lgtm.com/projects/g/frappe/bench/rev/pr-560978725461013796d605b409ffc5c85c774829
2021-09-09 14:56:32 +05:30
Gavin D'souza
a015501699 fix: Return fallback list in cached_frappe_commands 2021-09-09 13:54:35 +05:30
Gavin D'souza
6160ff48ab style: Black 2021-09-09 13:54:19 +05:30
Gavin D'souza
552b935f6b fix: Always set return code via cli 2021-09-09 13:20:26 +05:30
Gavin D'souza
a94ea19bf4 fix: Hit command cache before fetching all commands 2021-09-09 13:19:44 +05:30
Francisco Roldan
e12f53d1a5 feat: added option to provide custom queues 2021-08-30 12:35:53 -03:00
gavin
beb14c8681
Merge branch 'develop' into referrer-policy 2021-08-30 12:38:59 +05:30
Abhishek Balam
6137086e03
feat: Set default version for easy install to v13 (#1189)
* feat: set default version for easy install to v13

* fix: python version based version picking fixed and reverted changes to node version in installation script

* fix: revert test version

Co-authored-by: gavin <gavin18d@gmail.com>
2021-08-30 12:29:09 +05:30
leela
46e66226c2 feat: Redis ACL config is added to conf templates 2021-07-20 06:22:15 +05:30
Roberto Murguia
a514a0e97b fix: ssl nginx directive deprecation 2021-06-15 09:35:04 -05:00
Gavin D'souza
5e0d46db24 Merge branch 'develop' into perf-remove-app 2021-05-13 14:18:15 +05:30
Gavin D'souza
54d48f61a3 fix: Remove PY2 compatibility code
* Set Python requires Python 3.6+ but < Py4
* Remove six from dependencies
* Use click.confirm instead of self implemented confirm code
* Fix imports for 3.6+ compatibility

References for updated imports:
* https://docs.python.org/3/library/configparser.html
* https://docs.python.org/3/library/urllib.request.html#legacy-interface
* https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlparse
* https://docs.python.org/3/library/importlib.html#importlib.reload
2021-05-11 12:01:32 +05:30
Gavin D'souza
5d563f23ab style: Use f-strings instead of old string formatting methods
These changes are valid only for Py3.6+ and will remove bench CLI
support for Python 3.5 and lesser.

* Converted to f-strings using flynt
* Manual conversion of failed cases
* Simplification of logic
2021-05-11 11:30:27 +05:30
Gavin D'souza
dcdb15d471 fix: Handle command execution failures 2021-05-10 19:10:06 +05:30
gavin
0c21718f7a
Merge branch 'develop' into perf-remove-app 2021-05-10 18:51:57 +05:30
Gavin D'souza
01abc561e0 fix: Added warning for unshallow without --reset 2021-05-10 17:35:31 +05:30
Gavin D'souza
f46126ce2b chore: Remove deprecated option from config template 2021-05-10 14:51:52 +05:30
Gavin D'souza
096c2cfe6b fix: Show step titles while running operations 2021-05-10 14:51:14 +05:30
Gavin D'souza
4cadf2c719 fix: Unshallow clone if update without --reset
If an unshallow clone has to be updated, the only way to update it
without a reset will require an unshallow. This is because there may be
uncommitted or committed changes in any of the apps, although unfavoured
should be handled safely. The only way to update such repos is via the
user configured settings..or a ff only merge.
2021-05-10 14:45:46 +05:30
Gavin D'souza
ebc3cebd19 perf: Faster bench remove-app
Biggest bottleneck is in the validation stage which checks if the app is
installed on any existing sites on the bench. instead of triggering
multiple list-apps for each sites, do one for all.
2021-05-05 16:34:10 +05:30
Gavin D'souza
ed3f2d28fb fix: Remove set-default-site from CLI 2021-04-26 20:16:16 +05:30
Hussain Nagaria
324b58622c chore: Remove set-default-site command 2021-04-26 17:06:30 +05:30
Gavin D'souza
64fbeee1e6 Revert "fix: Use execve and set envvars instead of execv"
This reverts commit 530a980ef7.
2021-04-26 11:32:20 +05:30
Gavin D'souza
7e1db3fd74 test: Update env test
Env folder's include may be empty or non existent
2021-04-23 19:14:30 +05:30
Gavin D'souza
530a980ef7 fix: Use execve and set envvars instead of execv
Changed from execv to execve with empty env dict because bench commands on macOS 10.14.6 PY3.9.0a4 fails with "Error while finding module specification for 'frappe.utils.bench_helper' (ModuleNotFoundError: No module named 'frappe')"

This error has come up in the past too. I'm now suspecting it has
something to do with the current process passing on it's environment
variables to the process that's going to replace it, which causes these
issues.

Note that direct execution of the commands without the bench wrapper
worked fine although via bench failed with the specified error
2021-04-23 18:38:27 +05:30
Gavin D'souza
b0ccb6efbe fix: Invoke pip via python
Due to "WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly."
2021-04-23 18:37:03 +05:30
Gavin D'souza
405f41e434 test: Use frappe_theme to test apps instead of erpnext
* Don't skip assets
2021-04-23 11:25:29 +05:30
Gavin D'souza
f04a9e6e0d chore: Remove deprecated command switch-to-master 2021-04-23 11:25:24 +05:30
Gavin D'souza
da85e0ccdd refactor: Optimize and simplify imports
* make relative imports absolute
* minor: Simplify logic
2021-04-23 11:05:06 +05:30
Gavin D'souza
778fe6cb0b fix: Don't break update if no sites exist on patching sites stage 2021-04-23 10:47:36 +05:30
gavin
4b31ac078b
Merge pull request #1130 from CaseSolvedUK/shallow_pull
feat: Keep repos shallow if --reset and shallow_clone are specified in bench update --pull
2021-04-23 10:28:47 +05:30
gavin
cba3f7d8a4
Merge pull request #1147 from ankush/fix_compile
fix: use correct path for compiling py files
2021-04-21 11:53:10 +05:30
Gavin D'souza
1e56d04e94 Merge branch 'develop' of github.com:frappe/bench into declarative-setup-bench 2021-04-20 10:56:33 +05:30
gavin
558006068f
Merge branch 'develop' into fix_compile 2021-04-19 18:15:49 +05:30
Sagar Vora
ec2ce0f3b8 chore: remove support for older versions of frappe 2021-04-13 13:06:08 +05:30
Ankush Menat
b3a0757e38
fix: use correct path for compiling py files 2021-04-02 19:48:04 +05:30
Mohammad Hasnain Mohsin Rajan
4c627e4531
chore: update version (#1138)
* chore: update version

* chore: use dev version on develop branch

* chore: move develop branch check before imports
2021-03-18 13:57:21 +05:30
casesolved-co-uk
a1db48b57e fix: serious bug capable of deleting apps path 2021-03-17 16:20:47 +00:00
Richard Case
0ff8dddef9 fix: only get the specific branch for version check 2021-03-17 16:20:47 +00:00
Richard Case
895c403278 fix: only fetch current branch 2021-03-17 16:20:47 +00:00
Richard Case
82173c1d42 fix: only fetch what is necessary, simplify & improve grepability 2021-03-17 16:20:47 +00:00
Richard Case
66240e1f8d feat: Keep repos shallow if --reset is specified and shallow_clone is set 2021-03-17 16:20:47 +00:00
Revant Nandgaonkar
f109c3eaad
Merge branch 'develop' into setup-supervisor-skip-redis 2021-03-02 13:08:34 +05:30
gavin
f3809b00ac
Merge pull request #1121 from NicolasStr/develop
fix: create bench folder in user directory
2021-02-26 19:22:09 +05:30
gavin
034e0085e9
Merge pull request #1124 from adityahase/perf-cli
perf: Faster CLI
2021-02-26 16:39:01 +05:30
Revant Nandgaonkar
5cf1363481 feat: skip redis config during supervisor setup 2021-02-26 07:55:04 +05:30
Aditya Hase
b70aa21a73
chore: Remove unused import comment blocks 2021-02-21 11:24:32 +05:30
Aditya Hase
5d90346660
perf: Remove six.moves.reload_module from the import tree 2021-02-21 11:12:57 +05:30
Aditya Hase
2df0bf726d
perf: Remove semantic_version from the import tree 2021-02-21 11:12:40 +05:30
Aditya Hase
07ecaa1f77
perf: Remove shutil from the import tree 2021-02-21 11:12:00 +05:30
Aditya Hase
6706b230da
perf: Remove six.moves.urllib from the import tree 2021-02-21 11:10:43 +05:30
Aditya Hase
c5d2fb9255
perf: Remove bench.config.common_site_config from the import tree 2021-02-21 10:06:44 +05:30
Aditya Hase
cab2d44df5
perf: Remove bench.config.letsencrypt from the import tree 2021-02-21 10:06:11 +05:30
Aditya Hase
36e48c7dd7
perf: Remove bench.config.nginx from the import tree 2021-02-21 10:05:40 +05:30
Aditya Hase
5525548ced
perf: Remove six.moves.urllib from the import tree 2021-02-21 10:04:03 +05:30
Aditya Hase
e12717d63a
perf: Remove crontab from the import tree 2021-02-21 10:03:36 +05:30
Aditya Hase
6c0e1a359e
perf: Remove siz.moves.configparser from the import tree 2021-02-21 10:03:03 +05:30
Aditya Hase
8527b106c3
perf: Remove multiprocessing from the import tree 2021-02-21 10:02:41 +05:30
Aditya Hase
104efd349b
perf: Remove ast from the import tree 2021-02-21 10:02:20 +05:30
Aditya Hase
2a4377ac6f
perf: Remove crontab from the import tree 2021-02-21 10:02:02 +05:30
Aditya Hase
ad37665e8b
perf: Remove multiprocessing from the import tree 2021-02-21 10:01:44 +05:30
Aditya Hase
ad90d9485f
perf: Remove Jinja and PackageLoader from the import tree 2021-02-20 13:52:39 +05:30
Aditya Hase
df773d4f9f
perf: Remove git from the import tree 2021-02-20 13:22:56 +05:30
Aditya Hase
cc92584927
perf: Remove requests from the import tree 2021-02-20 13:14:56 +05:30
DANY ROBERT
fec8921214
fix: fail2ban help message 2021-02-18 11:31:38 +05:30
Nicolas Streng
5c5d2b57df fix: create bench folder in user directory 2021-02-16 16:45:07 +01:00
Ankush Menat
bc21abb095
Merge branch 'develop' into branch_help_command 2021-02-09 11:09:10 +05:30
Ankush Menat
7e171967b3
docs: Update help message for --frappe-branch 2021-02-09 11:06:04 +05:30
Raffael Meyer
7f9bed4c8e
fix: nginx proxy buffer 2021-01-25 19:36:56 +01:00
Samuel Danieli
9de383a760
feat: better flag description
Co-authored-by: gavin <gavin18d@gmail.com>
2020-12-02 12:01:25 +01:00