What is Ruby?
Come explore Ruby as a programming language, Ruby Gems, Ruby on Rails, and hosting your own Ruby Gems repository the easy way with Cloudsmith!
Why is Ruby such a popular programming language for the Cloud? What exactly is a Ruby Gem, or Ruby on Rails, and how do these relate to Ruby itself? And how does and Organization go about hosting their own Ruby Gems? Come with us as we dive in and explore!
An Introduction to Ruby
Ruby is an open source, interpreted, general purpose programming and scripting language. It was developed and first released by Yukihiro "Matz" Matsumoto in 1995. Ruby is object-oriented in nature, and this lends to the reusability of code as objects, which in turn increases the speed of development.
Though Ruby has been around for almost three decades, it still maintains popularity as one of the preferred languages for web development, static site generation, DevOps, and automation. The ability of Ruby developers to quickly and easily set up a web application or site using Ruby, with simple and readable code, speaks to the sheer versatility of the language.
Ruby on Rails
An important secret weapon in Ruby’s popularity for web development is Ruby on Rails. Ruby on Rails, first open sourced by David Heinemeier Hansson in 2004, combines Ruby with a web application development framework called Rails. Ruby on Rails includes a great deal of boilerplate Ruby code and standardized conventions for tasks like standing up a web server, communicating with a database, sending and receiving messages, rendering HTML templates, and even securing against common web attacks. All this utility baked right into Ruby on Rails makes it a chosen web framework for full-stack developer productivity. It’s no wonder this combination is utilized in some of the most popular sites on the Internet, including GitHub, Shopify, AirBnB, Twitch, Hulu, Bloomberg, and Instacart.
Ruby can be packaged in shareable units of code called Ruby Gems. Most languages have a standardized package format, so that devs aren’t stuck reinventing the wheel. Plenty of reusable programs and libraries exist as Ruby Gems (also known as gems), and the package manager for handling the structure, packaging, download, and installation of gems is also called RubyGems.
The general structure of gems is as follows:
gemname/ ├── bin/ │ └── gemname ├── lib/ │ └── gemname.rb ├── test/ │ └── test_gemname.rb ├── README ├── Rakefile └── gemname.gemspec
You can read more about this structure in the “What is a Gem” article at RubyGems.org. To summarize, there are three main elements in a gem:
- The Ruby Code (including tests and supporting utilities)
- Documentation for the gem
gemspecfile that contains metadata about the gem (version, title, author, etc.)
RubyGems.org Community Repository
As with most popular programming languages, alongside a package format exists a public repository for sharing OSS packages with the Ruby Community; namely, RubyGems.org . As of this article’s writing, there have been over 1.08 billion downloads of gems from RubyGems.org .
Hosting your own RubyGems Repository (the Easy Way)
As a Ruby developer, you probably already understand the importance of being able to share your Ruby code for efficiency, reuseability, and standardization. However, if you’re in an Organization with private code that cannot legally be shared in public repositories, how do you go about maintaining your developer team productivity while still preserving your intellectual property?
Cloudsmith is an excellent Cloud-native SaaS artifact management solution for this purpose. We take the hassle out of hosting your own repository on servers you have to patch and maintain. We offer support for gems, as well as 28+ package formats; we even allow you to host multiple formats in the same repository! Also, every artifact uploaded to our platform is highly available in 225+ points of presence around the World, thanks to our Package Delivery Network (PDN). If you’d like to learn more, feel free to check out our Ruby Gems repository documentation.
If you’d rather try Cloudsmith for yourself first, we also offer a 14-day free trial, no questions asked and no credit card required.
🎉New: Ruby Upstreams🎉
If your development team would like to leverage the power of RubyGems.org in your own private highly-available Cloudsmith repository, we now offer support for Ruby Upstreams! You can set RubyGems.org as your upstream source for your Cloudsmith repo, and then only set your Cloudsmith repo as your single source of truth on endpoints and pipelines. Your Cloudsmith repository will not only host your private gems, but also any gems from RubyGems.org that are requested and installed by your development team. All of these gems and dependencies will also be cached in your Cloudsmith repository automatically in the background. Now, even if there is an outage or performance issues with RubyGems.org, your Cloudsmith repo will remain available and your Production pipelines and deploys will not be affected.
Just a heads up that our Ruby Upstreams are currently in Public Beta (August 2022), so we'd greatly appreciate your feedback if you hit a snag. We take feedback very seriously, as it directly helps shape our roadmap to building a better Cloudsmith!
You can read more about setting up Ruby Upstreams in our documentation.
Ruby, Ruby Gems, and Ruby on Rails are all popular tools for developers, be it web development, automation, data processing, or even standalone desktop apps. Using an artifact repository like Cloudsmith to host your Organization’s gems will help your dev team stay productive. Using a Cloud-Native solution like Cloudsmith takes the headache out of managing another service, and lets your team focus on your core application, service, or mission. Now with Ruby Upstreams, you can combine the power of a highly-available private repository with the plethora of OSS gems on RubyGems.org.
Start your 14-day free trial of Cloudsmith today, and come find out for yourself what all the fuss is about! 😉
If you prefer a video guide, here's a short video on getting started with Ruby and Cloudsmith:
If you'd like to explore other package formats we support, check out our other articles in this series below: