2.6 KiB
Getting started
Intro
To start, open Quickstart page localhost:8020 for quick access to all the tools
From the quicklaunch page you can open workspace tools, such as code editor or terminal
The main code editor of this workspace is Code-server
Workspace has full-size browser-base terminal
Ruby
Check Ruby version
ruby -v
Install Rails - a web application development framework written in the Ruby programming language.
gem install rails
Check version
rails --version
Bundler
Create file Gemfile
with the following content
source 'https://rubygems.org'
gem 'nokogiri'
gem 'rack', '~> 2.0.1'
gem 'rspec'
Install all of the required gems
bundle install
Rbenv
Use rbenv to pick a Ruby version for your application and guarantee that your development environment matches production.
List available versions, and install another one
rbenv install --list
rbenv install 3.0.4
Lists all Ruby versions known to rbenv, and shows an asterisk next to the currently active version.
rbenv versions
global environment
Change global Ruby (for all folders)
rbenv global 3.0.4
local environment (specific folder)
Chose local Ruby environment for this specific folder
rbenv local 3.0.4
Basic example
Create file http_server.rb
# http_server.rb
require 'socket'
server = TCPServer.new 8030
while session = server.accept
request = session.gets
puts request
session.print "HTTP/1.1 200\r\n" # 1
session.print "Content-Type: text/html\r\n" # 2
session.print "\r\n" # 3
session.print "Hello world! The time is #{Time.now}" #4
session.close
end
Serve simple server
ruby http_server.rb
Open browser on localhost:8030