# SCT The **SCT** command line tool helps developers set up and maintain a Kubernetes (k8s) cluster on their development machine which closely resembles the production setup. The tool is geared towards the implementation of a local development environment in compliance with the [*Visma Cloud Delivery Model*](https://www.visma.com/blog/our-large-scale-devops-transformation/) (SCT) to be deployed on *Google Cloud Services*. The SCT tool is a collection of commands that can be run from your local development environment. These commands will take care of some steps necessary to initialize the development environment, but also of some recurring tasks to keep this environment going on a daily base. This README will provide an installation guide, an overview of the available commands and a brief guide for developers that need to contribute to the **SCT** CLI tool. The tool is written in Ruby and is meant to run on *Windows, Linux and Mac* environments. ## Installation 1) Open a terminal or bash window and make sure [**Ruby**](https://www.ruby-lang.org/en/documentation/installation/) is installed on your machine with _version >= 2.6.*_ $ which ruby $ ruby --version 2) As this Ruby Gem is not yet published, you will need to install the *SCT* tool from this repository and use Ruby [**bundler**](https://bundler.io/) to manage dependencies. $ gem install bundler 3) Navigate to a (new) folder where you want the SCT code, and clone this repository: $ git clone https://github.com/reshadf/sct.git 4) Then let **bundler** manage the dependencies: $ bundle 5) And let **gem** create a binary: $ gem install sct 6) Now, the **sct** tool is available anywhere from the command line $ sct --help ## Usage SCT offers a number of commands to help developers set up a local development environment for Visma Cloud To get an overview of what **sct** can do, run $ sct --help To initialize a **sct** configuration file $ sct init To patch the hostfile with the local IP of the k8s cluster: $ sct hostfile To add the secret for the MySQL proxy: $ sct mysql_proxy ## Development For development of the **sct** tool, the installation needs to be a bit different. Repeat steps 1-3 from the installation instruction above. 4) We will use [**rake**](https://github.com/ruby/rake) as a Ruby develoment tool for running tests and generating binaries: $ gem install rake 5) Use the setup script from the repo to install dependencies: $ bin/setup 5) Do tests to make sure everything works fine before you start: $ rake spec 6) Install dependency gems: $ bundle exec rake install 7) Your development environment is now ready. After you have made edits to the code, you can generate a new binary to test the code like this: $ rake install 8) You can then run the binary directly from the command line: $ sct --help ### Development tips - To release a new version, update the version number in `version.rb`, and then run: $ bundle exec rake release This will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). ### Adding commands Adding a new command is as simple as adding a new 'Command' Class to the *lib/sct/commands* folder. As long as you implement the constants and methods of *lib/sct/command_interface.rb*, your new Command will automatically appear in the CLI Help and can be called. Use the *lib/sct/command_option.rb* to define command options. Examples of Command Classes can be found inside the *lib/sct/commands* folder. ## Contributing Bug reports and pull requests are welcome on GitHub at https://gitlab.com/proactive-software/packages/sct. 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. ## 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 Sct project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/proactive-software/packages/sct/blob/master/CODE_OF_CONDUCT.md).