Skip to content

Instantly share code, notes, and snippets.

@hochun836
Last active August 8, 2023 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hochun836/782d5c55de85b2102f32af23c54c4b38 to your computer and use it in GitHub Desktop.
Save hochun836/782d5c55de85b2102f32af23c54c4b38 to your computer and use it in GitHub Desktop.
# base
# RubyInstaller (install ruby for windows)
ridk --help // RubyInstaller Development Kit
ridk version // print RubyInstaller and MSYS2 versions
ridk install // install MSYS2 and MINGW dev tools (development toolchain)
ridk use // switch to a different ruby version
NOTE:
MSYS2 is required to install gems with C extensions
NOTE:
install MSYS2 by run 'ridk install' or manually from 'https://msys2.github.io/'
IMPORTANT:
after install MSYS2 manually from 'https://msys2.github.io/'
please remember to run 'ridk install' to check other dependencies
# pik (ruby version manager for windows)
# ruby
ruby -h
ruby --help // for more info
ruby -v // print the version number, then turn on verbose mode
ruby --version // print the version number, then exit
# gem (like 'package' in node)
gem -h
gem -v
gem help commands
gem help examples
gem help platforms // platforms <=> platform
gem help <command> // show help on command
gem server // present a web with info about installed gems (need: gem install rubygems-server)
gem list -h
gem list // default: --local --no-details
gem list -i <gem> // check the specified gem is installed or not
gem list -I <gem> // check the specified gem is noinstalled or not
gem list -l // -l <=> --local
gem list -d // -d <=> --details
gem install -h
gem install <gem> // default: --both --version '>= 0' --no-force --install-dir C:/Ruby32-x64/lib/ruby/gems/3.2.0 --lock --document=ri
gem install bundler
gem install jekyll
gem install bundler jekyll
gem install bundler:1.17.3 // install gem with the specified version
NOTE: what is a gem ?
each gem has a name, version, and platform
=> ref: https://guides.rubygems.org/what-is-a-gem/
NOTE: when run 'gem install jekyll', see 'Building native extensions'
that means it's compiling some C code in order to bundle an extension along with the given gem
=> ref: https://stackoverflow.com/a/23853653/6751999
# bundler & bundle (ruby dependency management, like 'npm' in node)
| bundler is a gem
| bundle is a command
bundler // show manual
bundle -h // show manual
bundle version
bundle init // generate a simple Gemfile, placed in the current directory
bundle show // show the gems in the bundle (need: Gemfile or .bundle/)
bundle install // install the gems specified by the 'Gemfile' file
bundle _1.17.3_ install // use bundle with the specified version
bundle exec jekyll serve
# jekyll
gem install bundler jekyll
jekyll new my-awesome-site
cd my-awesome-site
bundle exec jekyll serve // http://localhost:4000
=> ref: https://jekyllrb.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment