Skip to content

Commit

Permalink
Merge branch 'feature/gcviewer' of https://github.com/ahmedagdmoun/de…
Browse files Browse the repository at this point in the history
…vonfw-ide into feature/gcviewer
  • Loading branch information
ahmedagdmoun committed Sep 6, 2022
2 parents ec0e015 + 21f7245 commit 9f5c4ea
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ New release with various improvements and bugfixes:
* https://github.com/devonfw/ide/issues/810[#810]: Add OpenShift CLI
* https://github.com/devonfw/ide/issues/692[#692]: Improve Windows Terminal with gitbash
* https://github.com/devonfw/ide/issues/786[#786]: Improve Windows Terminal with powershell
* https://github.com/devonfw/ide/issues/867[#867]: ERROR: Error opening the file. There may be a disk or file system error.
* https://github.com/devonfw/ide/pull/829[#829]: #701: fix registry import paths for Windows Terminal
* https://github.com/devonfw/ide/pull/802[#802]: #798: English grammar fix for success message
* https://github.com/devonfw/ide/issues/803[#803]: git pull not working on debug
Expand Down
39 changes: 34 additions & 5 deletions documentation/devonfw-ide-contribution-getting-started.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,47 @@ toc::[]
== Installation
To start developing devonfw-ide, you must first install it on your computer.
Therefore simply follow the link:setup.asciidoc[setup] guide.
It is important to notice that this installation gives you the latest published version of the devonfw-ide with which you can execute commands like eclipse or docker whose scripts are located inside the "${DEVON_IDE_HOME}$/scripts/command, but for commiting code we use a differing folder structure.
This will be addressed under xref:Contribution[Contribution].

== Contribution
To begin, read through the https://github.com/devonfw/.github/blob/master/CONTRIBUTING.asciidoc[Contribution Guidelines], which you should be sure to follow.
First steps regarding forks or cloning of repos and creating branches, as well as some git commands, https://github.com/firstcontributions/first-contributions[can be found here].
Clone the https://github.com/devonfw/ide[project IDE] at the beginning.
First steps regarding forks or cloning of repos and creating branches, as well as some git commands, can be found in the https://github.com/firstcontributions/first-contributions[first contributions guideline].
To contribute code or documentation regarding the devonfw-ide at first you need to fork the https://github.com/devonfw/ide[devonfw-ide] repository and then you can clone your fork into the folder `workspaces/main` in your devonfw-ide installation.
Open git-bash in the cloned fork at `workspaces/main/ide` and run the following command:
```
git remote add upstream https://github.com/devonfw/ide.git
git fetch upstream
```
Whenever you want to implement a new change first do the following things:
```
git checkout master
git pull upstream/master
git checkout -b feature/«issue-id»-«brief-feature-description»
```
Now you can do the changes, improvements, and fixes.
Once they are tested and seem to work, you can commit them (`git commit -m "#«issue-id»: «description»"`).
If some days have passed meanwhile you should merge changes that meanwhile happened on the offical `ide` repo:
```
git pull upstream/master
```
Once you are complete and everything is merged and comitted, you can push your local feature branch and make it a remote branch of your fork on github:
```
git push -u origin feature/«issue-id»-«brief-feature-description»
```
Now you can go to https://github.com/devonfw/ide/pulls and create the pull-request (PR) from your new feature.
Therefore, please click on the right down arrow of the green button and choose `Create draft pull request` and then click on `Draft pull request`.
When the checks have completed you can check the link:DoD.asciidoc[Definition-of-Done] (DoD).
Once, all checks of the DoD are addressed, you can go the the very bottom of the PR and click on `Ready for review` what will take the PR out of the draft mode.
FYI: If you forgot the upstream merge (`git pull upstream/master`) or the upstream changed again while your PR is still open, you will see `This branch is out-of-date with the base branch` at the bottom of your PR and can click on `Update branch`.

For further development and testing, it is recommended to xref:symbolic-links[symlink] the modified scripts into your devonfw-ide installation.
Alternatively, the scripts can be adapted in the installation folder and then committed to the project.
For creating a contribution also check the link:DoD.asciidoc[Definition of Done] (DoD).

=== ShellCheck

To improve the code quality the https://github.com/koalaman/shellcheck/[ShellCheck] is used for devon-ide.
To improve the code quality the https://github.com/koalaman/shellcheck/[ShellCheck] is used for devonfw-ide.
There is a GitHub action _CI build PR_ for this. If this fails at the PR, you can find the error messages in the big logfile under _Build project with Maven_.
For example, these look like this:

Expand Down Expand Up @@ -101,7 +130,7 @@ The following sub-sections give you some tipps and tricks to boost your producti
With link:advanced-tooling-windows.asciidoc##create-symbolic-links[symbolic links] you can use one file or folder that is located inside one directory in one or multiple other directories, without copying the whole file or folder into the other directories.
The file is still only saved at the initial location, but can be accessed through the created links in a much more comfortable way.
So you are actually just linked to the original file and therefore don't have to worry about differing versions of the file in your directories.
This is very helpful for testing our devon-ide, because e.g. the commandlets folder for testing is not the same as the commandlets folder for git-commits.
This is very helpful for testing our devonfw-ide, because e.g. the commandlets folder for testing is not the same as the commandlets folder for git-commits.
Install https://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html[link shell extension] and follow the instructions for installation and usage first.
Later on you can make symbolic links of files or folder from your "git folder" and add them into the folder in which the testing is supposed to take place:

Expand All @@ -124,7 +153,7 @@ That's why it is often enough to implement code for Mac or Linux (at least to so

Let's get to the practical part of the Bash-usage.

**If you are using Windows**, make sure that you have git-bash installed, so you can execute the Bash commands mentioned in this intruduction. [Here you can find git for windows](https://git-scm.com/download/win). In some cases later on you may want or need to use WSL. Our project teams standard way is to install WSL via Rancher Desktop, which is easily installable with the devon-ide by using the command `devon docker setup`. If you don't have the devon-ide yet, then you can follow [this guide](https://github.com/devonfw/ide/blob/master/documentation/setup.asciidoc)
**If you are using Windows**, make sure that you have git-bash installed, so you can execute the Bash commands mentioned in this intruduction. [Here you can find git for windows](https://git-scm.com/download/win). In some cases later on you may want or need to use WSL. Our project teams standard way is to install WSL via Rancher Desktop, which is easily installable with the devonfw-ide by using the command `devon docker setup`. If you don't have the devonfw-ide yet, then you can follow [this guide](https://github.com/devonfw/ide/blob/master/documentation/setup.asciidoc)

The https://www.youtube.com/watch?v=oxuRxtrO2Ag[following video] gives you some important and helpful basics, still you don't need to know all of these commands directly by heart. Instead under the video you'll find a list with the commands mentioned in the video to make a command return to your mind. Also directly play around with those commands while watching the video to learn faster.

Expand Down
2 changes: 1 addition & 1 deletion documentation/variables.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ Please note that we are trying to minimize any potential side-effect from `devon
|`EXTRA_JAVA_VERSION`|`-`|An additional (newer) version of link:java.asciidoc[java] that will be used to run java-based IDEs (e.g. link:eclipse.asciidoc[eclipse] or link:intellij.asciidoc[intellij]).
|`«TOOL»_BUILD_OPTS`|e.g.`clean install`|The arguments provided to the build-tool `«TOOL»` in order to run a build.
|`«TOOL»_RELEASE_OPTS`|e.g.`clean deploy -Dchangelist= -Pdeploy`|The arguments provided to the build-tool `«TOOL»` in order to perform a release build.
|`DEVON_IDE_TRACE`||If value is not an empty string, the `devonfw-ide` scripts will trace each script line executed. For bash two lines output: before and again after expansion. *ATTENTION:* This is not a regular variable working via `devon.properties`. Instead manually do `export DEVON_IDE_TRACE=true` in bash or `DEVON_IDE_TRACE=true` in windows CMD before running a devon command to get a trace log that you can provide to experts in order to trace down a bug and see what went wrong.
|`DEVON_IDE_TRACE`||If value is not an empty string, the `devonfw-ide` scripts will trace each script line executed. For bash two lines output: before and again after expansion. *ATTENTION:* This is not a regular variable working via `devon.properties`. Instead manually do `export DEVON_IDE_TRACE=true` in bash or `set DEVON_IDE_TRACE=true` in windows CMD before running a devon command to get a trace log that you can provide to experts in order to trace down a bug and see what went wrong.
|=======================
10 changes: 4 additions & 6 deletions scripts/src/main/resources/scripts/command/ide
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function doUpdateSettings() {
then
SETTINGS_URL="${defaultSettingsUrl}"
fi
doInstall "${SETTINGS_URL}" "${SETTINGS_PATH}" "devonfw-ide-settings"
doGitPullOrClone "${SETTINGS_PATH}" "${SETTINGS_URL}"
if [ ${?} = 0 ]
then
# shellcheck source=scripts/environment-project
Expand Down Expand Up @@ -459,17 +459,15 @@ function doCreate() {
then
mkdir -p "${create_path}"
fi
# shellcheck disable=SC2012
count_lines="$(ls -alF "${create_path}" | wc -l)"
if [ "${count_lines}" -gt 3 ]
if ! doIsEmptyDirectory "${create_path}"
then
doAskToContinue "Directory is not empty, continue?"
fi

doUpgradeMavenArtifact "${create_path}/" "${DEVON_IDE_REPO_URL}" "devonfw-ide-scripts" "${target_version}" ".tar.gz"

cd "${create_path}" || exit 255
[ -f "${create_path}/.devon.software.version" ] && rm "${create_path}/.devon.software.version"
[ -f "./.devon.software.version" ] && rm "./.devon.software.version"
shift
./setup "${@}"
}
Expand Down
9 changes: 9 additions & 0 deletions scripts/src/main/resources/scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,15 @@ function doIsWindows() {
return 255
}

# $1: dirctory
function doIsEmptyDirectory() {
local dir="${1}"
if [ ! -d "${dir}" ] || [ -z "$(find "${dir}" -maxdepth 0 -empty)" ]
then
return 1
fi
}

function doIsPackageJsonContainingScript() {
doDebug "Checking if package.json contains script section named $1"
if sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/§/g' package.json | tr -d '\r' | grep -q "[\"']scripts[\"']\s*:\s*{\s*§.*[\"']${1}[\"']\s*:"
Expand Down

0 comments on commit 9f5c4ea

Please sign in to comment.