diff --git a/.github/BRANCH_NAMING_CONVENTION.md b/.github/BRANCH_NAMING_CONVENTION.md new file mode 100644 index 0000000..1eacce6 --- /dev/null +++ b/.github/BRANCH_NAMING_CONVENTION.md @@ -0,0 +1,36 @@ +# Branch naming convention + +## Branch naming + +> Please note for new pull requests create new branches from current `develop` branch only. + +Branch name should include type of your contribution and context. Please follow next pattern for naming your branches: + +```bash +feature/add-some-feature +technical/some-technical-improvements +bugfix/fix-some-bug-name +``` + +## Before PR actions + +### Squash commits + +Please squash all branch commits into the one before openning your PR from your fork. It's simple to do with the git: + +```bash +git rebase -i [hash your first commit of your branch]~1 +git rebase -i 6467fe36232401fa740af067cfd8ac9ec932fed2~1 # example +``` + +### Add commit description + +Please complete your commit description folowing next pattern: + +``` +Technical/Add info files # should be the same name as your branch name + +* Added license, changelog, contributing, code of conduct docs +* Added GitHub templates +* Updated project license link +``` diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..e2047cd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,28 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG] Your bug report title here" +labels: bug +assignees: bestwebua + +--- + + + +### New bug checklist + +- [ ] I have updated `frs` to the latest version +- [ ] I have read the [Contribution Guidelines](https://github.com/RubyWorkout/frs/blob/master/CONTRIBUTING.md) +- [ ] I have read the [documentation](https://github.com/RubyWorkout/frs/blob/master/README.md) +- [ ] I have searched for [existing GitHub issues](https://github.com/RubyWorkout/frs/issues) + + + +### Bug description + + +##### Complete output when running frs, including the stack trace and command used + +
+
[INSERT OUTPUT HERE]
+
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..4e0e4ed --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,27 @@ +--- +name: Feature request +about: Suggest an idea for FRS +title: "[FEATURE] Your feature request title here" +labels: enhancement +assignees: bestwebua + +--- + + + +### New feature request checklist + +- [ ] I have updated `frs` to the latest version +- [ ] I have read the [Contribution Guidelines](https://github.com/RubyWorkout/frs/blob/master/CONTRIBUTING.md) +- [ ] I have read the [documentation](https://github.com/RubyWorkout/frs/blob/master/README.md) +- [ ] I have searched for [existing GitHub issues](https://github.com/RubyWorkout/frs/issues) + + + +### Feature description + + diff --git a/.github/ISSUE_TEMPLATE/issue_report.md b/.github/ISSUE_TEMPLATE/issue_report.md new file mode 100644 index 0000000..89276fc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue_report.md @@ -0,0 +1,28 @@ +--- +name: Issue report +about: Create a report to help us improve +title: "[ISSUE] Your issue report title here" +labels: '' +assignees: bestwebua + +--- + + + +### New issue checklist + +- [ ] I have updated `frs` to the latest version +- [ ] I have read the [Contribution Guidelines](https://github.com/RubyWorkout/frs/blob/master/CONTRIBUTING.md) +- [ ] I have read the [documentation](https://github.com/RubyWorkout/frs/blob/master/README.md) +- [ ] I have searched for [existing GitHub issues](https://github.com/RubyWorkout/frs/issues) + + + +### Issue description + + +##### Complete output when running frs, including the stack trace and command used + +
+
[INSERT OUTPUT HERE]
+
diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..9d2a761 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,22 @@ +--- +name: Question +about: Ask your question to FRS team +title: "[QUESTION] Your question title here" +labels: question +assignees: bestwebua + +--- + + + +### New question checklist + +- [ ] I have read the [Contribution Guidelines](https://github.com/RubyWorkout/frs/blob/master/CONTRIBUTING.md) +- [ ] I have read the [documentation](https://github.com/RubyWorkout/frs/blob/master/README.md) +- [ ] I have searched for [existing GitHub issues](https://github.com/RubyWorkout/frs/issues) + + + +### Question + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..80ca843 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,47 @@ +# PR Details + + + + + + +## Description + + + +## Related Issue + + + + + + +## Motivation and Context + + + +## How Has This Been Tested + + + + + +## Types of changes + + + +- [ ] Docs change / refactoring / dependency upgrade +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist + + + + +- [ ] My code follows the code style of this project +- [ ] My change requires a change to the documentation +- [ ] I have updated the documentation accordingly +- [ ] I have read the [**CONTRIBUTING** document](https://github.com/RubyWorkout/frs/blob/master/CONTRIBUTING.md) +- [ ] I have manually tested my feature diff --git a/.gitignore_global b/.gitignore_global new file mode 100644 index 0000000..867debd --- /dev/null +++ b/.gitignore_global @@ -0,0 +1,18 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..ff7458d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at admin@bestweb.com.ua. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4172ed8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,46 @@ +# Contributing to FRS + +Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved. + +Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features. + +## Using the issue tracker + +The issue tracker is the preferred channel for [issue/bug reports](#issuebug-reports), [feature requests](#feature-requests), [questions](#questions) and submitting [pull requests](#pull-requests). + +## Issue/bug reports + +A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you! + +Guidelines for issue/bug reports: + +1. **Use the GitHub issue search** — check if the issue has already been reported +2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or `develop` branch in the repository +3. FRS [issue template](.github/ISSUE_TEMPLATE/issue_report.md)/[bug template](.github/ISSUE_TEMPLATE/bug_report.md) + +A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What would you expect to be the outcome? All these details will help people to fix any potential bugs. + +## Feature requests + +Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible. + +## Questions + +We're always open to a new conversations. So if you have any questions just ask us. + +## Pull requests + +Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits. + +**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project. + +Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). Not all features proposed will be added but we are open to having a conversation about a feature you are championing. + +Guidelines for pull requests: + +1. FRS [pull request template](.github/PULL_REQUEST_TEMPLATE.md) +2. Fork the repo, checkout to `develop` branch +3. Run the tests. This is to make sure your starting point works +4. Read our [branch naming convention](.github/BRANCH_NAMING_CONVENTION.md) +5. Create a new branch and make your changes. This includes tests for features! +6. Push to your fork and submit a pull request to `develop` branch diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..d630804 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Vladislav Trotsenko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e23a5fb --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# FRS - fast Ruby setup + +Automation script for spin-up Ruby developer environment. Configure your developer stuff on Linux Ubuntu in minutes 🚀 + +## Features + +* Installs & configures [ZSH](https://www.zsh.org), [OhMyZsh](https://ohmyz.sh) and [Spaceship Promt](https://spaceship-prompt.sh) +* Installs & configures [asdf](https://asdf-vm.com), [asdf Ruby plugin](https://github.com/asdf-vm/asdf-ruby) +* Installs & configures latest [MRI Ruby](https://www.ruby-lang.org/en/downloads/releases) with default gems +* Installs & configures [Visual Studio Code](https://code.visualstudio.com) +* Configures git + +## Requirements/Preconditions + +1. Fresh Linux Ubuntu 20.04.3 LTS / Linux Ubuntu 21.10 +2. `wget` system dependency +3. GitHub personal access token. Go to `Github/Settings/Developer settings/Personal access tokens` to create it. + +## Using + +### Install wget + +Open your terminal. Install `wget`: + +```bash +sudo apt-get install wget +``` + +### Download setup script + +```bash +wget https://raw.githubusercontent.com/RubyWorkout/frs/master/setup.sh +``` + +### Run script + +Run Fast Ruby Setup script with your email, name (registered on github), github username and github personal access token as position arguments: + +```bash +. ./setup.sh johndoe@example.com "John Doe" git_username git_token +``` + +Reboot and focus on development, not on developer tools! + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/RubyWorkout/frs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. Please check the [open tickets](https://github.com/RubyWorkout/frs/issues). Be sure to follow Contributor Code of Conduct below and our [Contributing Guidelines](CONTRIBUTING.md). + +## License + +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). + +## Code of Conduct + +Everyone interacting in the FRS project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md). + +## Credits + +- [The Contributors](https://github.com/RubyWorkout/frs/graphs/contributors) for code and awesome suggestions +- [The Stargazers](https://github.com/RubyWorkout/frs/stargazers) for showing their support + +## Versioning + +FRS uses [Semantic Versioning 2.0.0](https://semver.org) diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..9a65a88 --- /dev/null +++ b/settings.json @@ -0,0 +1,9 @@ +{ + "workbench.colorTheme": "Visual Studio Dark", + "editor.tabSize": 2, + "editor.renderWhitespace": "none", + "editor.detectIndentation": false, + "diffEditor.ignoreTrimWhitespace": false, + "editor.minimap.enabled": false, + "editor.suggestSelection": "first" +} diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..5d186aa --- /dev/null +++ b/setup.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +# This bash script will help to prepare and configure your developer +# environment on latest Linux Ubuntu in minutes. +# +# (c) Vladislav Trotsenko 2022, MIT +# +# Example of usage: . ./setup.sh johndoe@example.com "John Doe" git_username git_token + +# Coloring stdout +red=$(tput setaf 1) +green=$(tput setaf 2) +bold=$(tput bold) +reset=$(tput sgr0) + +# Local vars +email=$1 +name=$2 +git_username=$3 +git_token=$4 +steps_counter=0 +steps_errors=() +final_step_index=6 + +function step_title() { + echo "${bold}${green}STEP $1: $2...${reset}" +} + +# Install ZSH and friends +function step_1() { + cd ~ + step_title $1 "Installing ZSH, OhMyZsh and Spaceship Promt" + sudo apt update + sudo apt-get install -y git curl wget zsh powerline fonts-powerline software-properties-common apt-transport-https + sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --unattended" + sudo chsh -s $(which zsh) + git clone https://github.com/spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1 + ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme" + sed -i 's/robbyrussell/spaceship/' .zshrc +} + +# Install asdf, updates terminals configs +function step_2() { + step_title $1 "Installing ASDF extendable version manager" + git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.9.0 + echo ". $HOME/.asdf/asdf.sh" >> ~/.bashrc + echo ". $HOME/.asdf/completions/asdf.bash" >> ~/.bashrc + source ~/.bashrc + echo ". $HOME/.asdf/asdf.sh" >> ~/.zshrc +} + +# Install asdf ruby plugin, requiered system dependencies, mri ruby 3.1.0, asdf config +function step_3() { + step_title $1 "Installing ASDF Ruby plugin, build system dependencies, MRI Ruby 3.1.0" + default_gems_config="$HOME/.default-gems" + echo -n "" > ${default_gems_config} + echo $(printf %"s\n" bundler pry gem-ctags) > ${default_gems_config} + asdf_config="$HOME/.asdfrc" + $(asdf plugin add ruby) + sudo apt-get install -y make gcc libssl-dev libreadline-dev zlib1g-dev + echo -n "" > ${asdf_config} + echo "legacy_version_file = yes" >> ${asdf_config} + $(asdf install ruby 3.1.0) + $(asdf global ruby latest) +} + +# Install vscode +function step_4() { + step_title $1 "Installing Visual Studio Code" + wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add - + sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" + sudo apt install code +} + +# Configure git +function step_5() { + step_title $1 "Configuring git" + wget https://raw.githubusercontent.com/RubyWorkout/frs/master/.gitignore_global + credentials="$HOME/.my-credentials" + echo -n "" > ${credentials} + echo "https://${git_profile}:${git_token}@github.com" >> ${credentials} + git config --global user.email ${email} + git config --global user.name ${name} + git config --global credential.helper "store --file ${credentials}" + git config --global alias.ignore "update-index --skip-worktree" + git config --global alias.unignore "update-index --no-skip-worktree" + git config --global alias.ignored "!git ls-files -v | grep \"^S\"" + git config --global core.editor nano + git config --global core.excludesfile "$HOME/.gitignore_global" + git config --global pull.rebase false +} + +# Configure vscode +function step_6() { + step_title $1 "Configuring Visual Studio Code" + wget https://raw.githubusercontent.com/RubyWorkout/frs/master/settings.json -P ~/.config/Code/User/settings.json +} + +# Step runner +function run_step() { + if ! eval "step_$1 $1"; then steps_errors+=($1) + fi +} + +# Failed steps summary +function print_fails_steps { + printf -v joined '%s, ' "${steps_errors[@]}" + echo "${red}Failed number of step(s): ${joined%,*} ${reset}" +} + +# Step list iterator +for s in $(seq 1 $final_step_index) +do + ((steps_counter++)) + if eval "run_step $s" + then echo "${green}$steps_counter of $final_step_index steps is done!${reset}" + else echo "${red}Step $steps_counter fails.${reset}" + fi +done + +# Final result message +if [[ ${#bundler_build_errors[@]} == 0 ]] + then + echo "${green}Congrats, your Ruby developer environment is ready${reset} 🚀" + echo "Please reboot your OS for start developing!" +else print_fails_steps +fi