2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 17:24:41 +00:00
Commit Graph

259 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
f04a9e6e0d chore: Remove deprecated command switch-to-master 2021-04-23 11:25:24 +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 D'souza
1e56d04e94 Merge branch 'develop' of github.com:frappe/bench into declarative-setup-bench 2021-04-20 10:56:33 +05:30
Sagar Vora
ec2ce0f3b8 chore: remove support for older versions of frappe 2021-04-13 13:06:08 +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
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
c5d2fb9255
perf: Remove bench.config.common_site_config from the import tree 2021-02-21 10:06:44 +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
Gavin D'souza
3ddbff4eaa chore: Assign variables to simplify block 2020-09-10 11:49:03 +05:30
gavin
aa1a1b9a71
fix: Return repo_name if app_name doesn't exist 2020-09-10 11:44:45 +05:30
Chinmay D. Pai
186ba280f1
fix: add declarative config support for bench
bench will attempt to read name and version from setup.cfg before trying
to access setup.py for details

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-06-23 14:24:14 +05:30
gavin
70cb41fa0d
Merge branch 'develop' into fix-delete 2020-06-10 14:46:29 +05:30
Shivam Mishra
52ee67f298 fix: trailing slash deleting apps folder 2020-06-10 14:11:33 +05:30
Gavin D'souza
4480ea21ac chore(logging) set logging level to INFO 2020-05-21 12:45:28 +05:30
gavin
89dd9721c2
Merge pull request #975 from Thunderbottom/skip-restart-on-setup-req
chore: skip restart on bench setup requirements
2020-05-21 11:08:19 +05:30
gavin
119b08f531
Merge pull request #998 from gavindsouza/drop-dead-code
chore: drop dead code
2020-05-21 10:45:07 +05:30
gavin
56c2e14514
Merge branch 'develop' into skip-restart-on-setup-req 2020-05-21 10:23:37 +05:30
gavin
0185300afd
Merge branch 'develop' into drop-dead-code 2020-05-21 10:20:35 +05:30
gavin
e239f69fc2
Merge branch 'develop' into skip-restart-on-setup-req 2020-05-21 10:20:00 +05:30
gavin
7f3e4b9fbb
Merge branch 'develop' into fix-setup-requirements 2020-05-20 20:09:45 +05:30
Gavin D'souza
1bb07166d4 chore: drop check_url 2020-05-20 18:34:07 +05:30
gavin
1935afa634
Merge branch 'develop' into fix-setup-requirements 2020-05-20 17:34:24 +05:30
gavin
26e118a3d7
Merge branch 'develop' into bench-logger 2020-05-20 17:34:06 +05:30
gavin
ca6483ff70
Merge branch 'develop' into drop-dead-code 2020-05-20 17:33:53 +05:30
gavin
78c1b24345
Merge branch 'develop' into skip-restart-on-setup-req 2020-05-20 17:33:40 +05:30
Chinmay D. Pai
e52dc985c7
chore: rename postprocess to restart_bench
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-05-19 18:23:59 +05:30
Chinmay D. Pai
a4a9b59f42
fix: build assets regardless of postprocess
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-05-19 18:17:38 +05:30
Gavin D'souza
dd047002a1 fix: dont run ayrn install while setting up py reqs 2020-05-19 14:14:01 +05:30
Gavin D'souza
53919b624e fix: add log filter to handler 2020-05-19 13:47:48 +05:30
Gavin D'souza
0be833ad85 fix: cleaner and intuitive bench logs 2020-05-19 13:11:57 +05:30
Gavin D'souza
34de3d03a4 chore: drop dead code 2020-05-19 13:09:08 +05:30
Gavin D'souza
9f467d88e4 fix: force checkout during switch_branch and quiet fetch 2020-05-15 11:42:31 +05:30
Gavin D'souza
4ae8ae21f7 fix: PY2 compatible regex 2020-05-14 20:12:26 +05:30
Gavin D'souza
30473d3535 feat: added specific checks for git URLs
API Added: bench.utils.is_git_url
Reference: https://github.com/jonschlinkert/is-git-url
2020-05-14 17:45:28 +05:30
Gavin D'souza
74028074df fix(get-app): allow ssh urls 2020-05-12 11:00:15 +05:30
Gavin D'souza
67fb0a4042 fix: install node modules if package.json exists 2020-05-06 11:54:34 +05:30
Gavin D'souza
b3842d9b30 fix: handle app not found under GH frappe erpnext orgs 2020-05-04 17:44:46 +05:30
Gavin D'souza
03e512fdab fix: get-app sets up node requirements 2020-05-04 17:43:32 +05:30
Chinmay D. Pai
7f4b19cb7f
Merge branch 'master' of github.com:frappe/bench into pull_specific_apps
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-04-19 13:23:36 +05:30
Gavin D'souza
8fb831d870 style: clearer import paths 2020-03-11 12:12:24 +05:30
gavin
1f5c7ec201
chore: add travis, deepsource (#900)
* chore: added deepsource config

* chore: updated travis config

* chore: updated travis config

* chore: updated travis tests for 2.7, 3.6, 3.7, 3.8

* chore: quiet installs and sudo easy install

* fix(tests): add mariadb versioning

* fix(travis): print compat for pyhton 3

* fix: drop deprecated function usage

* chore(tests): update test_init

* tests: update branch to use version-12 for testing and use git module

* chore: quieten git command outputs on branch switch

* fix: execute 'setup production' via cli

* style: sort imports

* chore: update mariadb variables in .travis.yml

* chore: seperate jobs for easy install and production setup

* chore: use exec_cmd to log command output

* chore: pin tests to ubuntu trusty

* chore: use playbooks to install mariadb

* chore: mariadb fixes in travis

* chore: pin dist to ubuntu 18.04

* chore: setup envs according by type of test

* chore: ignore auto backup, procfile, assets build

* chore: change app frammeclient to frappe_theme

* test: try travis_wait

* tests: update and restructure tests

* tests: restructure flow of setUp, tearDown

* fix: python class inheritence fix

* chore: use local frappe repo instead of remote pull

* tests: skip assets during get-app

* fix(tests): remove reinstalling app after get_app called

* fix(tests): updated test_install_app

* fix: broken remove_app
tests: broken tests

* tests: no backup while dropping new_sites

* tests: added certain tests and py obj fixes

* tests: seperate basic and production setup tests

* tests: update travis, remove basic setup

* chore: move from function calls to exec_cmd

* chore: tests fixes

* chore: removed sudo from basic setup runs

* chore: use "sudo" for setting up sudoers

* fix: allow get_app from local folder

* fix: use gitpython to switch branch instead of exec_cmd

* chore: use test to check for file existing

* chore: restructure bench tests

* fix: fetch app repo before checking for version upgrade during
switch_branch

* fix: gitpython error in usage

* fix: boolean return value of file_exists

* fix: dont decode file contents

* fix: bench names and close open files

* chore: update bench config multiple benches

* chore: check where production fails

* chore: mention python version for init

* chore: remove node production test in CI

* fix: compatibility and permissions fixes

* chore: setup sudoers after prod setup

* fix: set remote upstream after local clone

* fix: disable production via cli

* chore(tests): fix upstream link

* chore: split tests and remove unused imports
2020-03-09 17:47:43 +05:30
Gavin D'souza
dc307b6880 fix: switch branches "better" 2020-03-09 13:53:13 +05:30
Gavin D'souza
016b7da9ff fix: remove deprecated pre_upgrade usage 2020-03-04 13:12:39 +05:30
Chinmay D. Pai
3bd83da49b
chore: remove redundant print messages
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-02-26 20:00:52 +05:30
Chinmay D. Pai
206d5ed3ae
chore: solve merge conflicts
* renme build_asset_files tp skip_asset
* add overwrite flag
* move building assets to postprocessing

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-02-25 11:58:49 +05:30
Chinmay D. Pai
0c0ed767f7
chore: add overwrite flag, repo_name format, and exit gracefully
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-02-25 11:45:03 +05:30
Chinmay D. Pai
be36a1411c
feat(bench update): allow pull-only update on specified apps
* renamed method pull_all_apps to pull_apps
* allow specifying a list of applications to be updated with:

	bench update --pull --apps frappe,erpnext

* if no applications are specified, all apps present inside apps.txt
  will be pulled

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-02-10 15:01:12 +05:30
Gavin D'souza
03c4d9610a chore: fixed validate branch on update 2020-01-21 14:27:00 +05:30
gavin
f60466caaf
Merge pull request #899 from gavindsouza/bench-cleanup
feat: rollback on bench init
2020-01-20 10:46:09 +05:30
Gavin D'souza
b85651653b fix: validate branch error message + cleanup 2020-01-20 09:43:51 +05:30
ckosiegbu
5762724cc7 fix: validate branch in bench update
bench update assumes that erpnext is an installed app in the bench. This is a wrong assumption. This work around checks for the intersection of installed apps with  the list ['frappe', 'erpnext'] and only attempts to get the current branch of apps that occur in the intersection. This way, if erpnext is not installed (very likely for those using frappe only to build their own apps) there wont be an error when get_current_branch is called for erpnext. The need to perform the kind of check being performed in validate_branch is a strong case for considering apps being able to add "bench update" hooks in their hooks.py

See this topic https://discuss.erpnext.com/t/bench-update-error-no-such-file-or-directory-apps-erpnext/56932?u=chude_osiegbu
2020-01-20 09:43:39 +05:30
Gavin D'souza
1b0008d709 fix: single process to pip install requirements, quiet flag added 2020-01-15 14:24:03 +05:30
Shridhar Patil
a65e9f09dc changed parameter name 2019-12-20 17:20:28 +05:30
Chinmay D. Pai
699705f64b
fix: incorrect import statement
use six.moves instead of six

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2019-12-15 13:46:14 +05:30
Chinmay D. Pai
d1a3017172
fix(get-app): handle existing directory and other formatting changes
* if a directory for the application already exists, provide user with 2
  options:

  * ask to remove the directory and reclone (overwrite)
  * ask if the user wants to reinstall the application

* separate get_app_name from get_app

* move building assets and postprocessing to install_app method

* make formatting changes to the code for flake8

* use reload_module from six instead of builtins

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2019-12-15 12:06:12 +05:30
Gavin D'souza
12912c5943 style: better readability and removed redundant flag 2019-11-17 16:06:24 +05:30
Gavin D'souza
025665a093 fix: update pinned requirements
after pinning requirements, to avoid incompatible 2nd level
dependencies of packages, pass the -U flag
2019-11-17 04:39:33 +05:30
gavin
ce6b4c8a11 fix: git depth, fixed requirements (#845) 2019-10-21 15:48:38 +05:30
Aditya Hase
46b78f4a53 fix: Remove the infamous print style 2019-07-23 19:32:30 +05:30
Saurabh
d32d905567 fix: validate branch before update 2019-07-22 16:10:34 +05:30
Faris Ansari
75b0901af4
fix: Build assets only for downloaded app (#802) 2019-05-15 14:26:07 +05:30
Sagar Vora
21925fa06f fix: syntax error 2019-01-29 23:58:23 +05:30
Sagar Vora
47a9aca0e7 fix: importing reload caused issues in python2 2019-01-29 23:52:31 +05:30
Sagar Vora
4d02801f53
fix: use reload only if imported 2019-01-29 19:51:12 +05:30
Shivam Mishra
fd4be52e32 Removed foundation dependency (#763) 2019-01-22 15:38:01 +05:30
Sagar Vora
856974939b
Merge pull request #747 from Thunderbottom/p3.7-fix
remove-app: fix for python3.7
2019-01-20 10:46:35 +05:30
Sagar Vora
0afb89a2c1 fix: default caching of pip packages, use reload_supervisor function 2018-12-13 09:49:55 +05:30
Chinmay Pai
ce7a5e757d
remove-app: fix for python3.7
"bench remove-app <app>" exits with TypeError on python3.7

converting the subprocess output to string fixes this issue.

Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
2018-11-12 13:51:11 +05:30
Chinmay Pai
15d2c8df16
[fix] reload(): use importlib for python3
reload() is an inbuilt function in python2 but has been moved to importlib since python3.4.

source: https://docs.python.org/3/library/importlib.html#importlib.reload

Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
2018-09-21 13:47:21 +05:30
Ameya Shenoy
e4e054e840
fix(remove_app): use app name instead of app path
pip 18 does not allow path to repo, instead we use the app name

Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
2018-09-19 15:32:16 +05:30
Ameya Shenoy
38601eabf8
Merge branch 'master' into multi_fixes 2018-07-03 14:28:48 +05:30
Prateeksha Singh
c33cff5fd8
Revert "get frappe_theme for foundation" 2018-06-26 17:08:01 +05:30
Ameya Shenoy
2395e242cb get frappe_theme for foundation 2018-06-26 14:06:49 +05:30
Rushabh Mehta
c1a8be4791 better way to install docs 2018-06-14 13:29:37 +05:30
Rushabh Mehta
9f917f8464 better way to install docs 2018-06-14 11:24:04 +05:30
Rushabh Mehta
8fc3a87a37 better way to install docs 2018-06-14 10:52:17 +05:30
Rushabh Mehta
c342a82aa1 better way to install docs 2018-06-14 10:37:11 +05:30