{"id":111489,"date":"2019-02-18T17:00:00","date_gmt":"2019-02-18T17:00:00","guid":{"rendered":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/"},"modified":"2025-02-25T01:48:46","modified_gmt":"2025-02-25T01:48:46","slug":"use-gems-gemfiles-and-the-bundler","status":"publish","type":"post","link":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/","title":{"rendered":"Use Gems, Gemfiles, and the Bundler"},"content":{"rendered":"<p>Gem, Gemfile and the Bundler are those terms which are often used in the Ruby community but do you know exactly what they are and how to use them?<\/p>\n<p>However, please keep reading our instructional writing on <strong>How to use Gems, Gemfiles, and the Bundler<\/strong> to know more deeply about the meanings of those mentioned terms and ways take advantages.<\/p>\n<h2 id=\"how-to-use-gems-gemfiles-and-the-bundler\">How to use Gems, Gemfiles, and the Bundler<\/h2>\n<ul>\n<li><a href=\"#what-is-a-gem\">What is a Gem?<\/a><\/li>\n<li><a href=\"#what-is-a-gemfile\">What is a Gemfile?<\/a><\/li>\n<li><a href=\"#how-is-the-look-of-a-gemfile\">How is the look of a Gemfile?<\/a><\/li>\n<li><a href=\"#what-is-the-bundler-and-how-to-use-it\">What is the Bundler and how to use it?<\/a><\/li>\n<\/ul>\n<h3 id=\"what-is-a-gem\">What is a Gem?<\/h3>\n<p>General speaking, a Gem is a bundle of codes that we can include in Ruby projects. This gives you permission to take anyone else\u2019s code and drop it into your project. Gems are able to perform functionalities such as:<\/p>\n<ul>\n<li>Pagination<\/li>\n<li>Interact with APIs such as Github<\/li>\n<li>Converting a Ruby object to JSON<\/li>\n<\/ul>\n<p>Every gem has a name, a platform, and a version. For instance, the rake gem as a 0.8.7 version. Additionally, the platform of Rake is Ruby, that is to say, it works on any platform that Ruby runs on.<\/p>\n<p>Inside gems are some components given below:<\/p>\n<ul>\n<li>Code<\/li>\n<li>Gemspec<\/li>\n<li>Documentation<\/li>\n<\/ul>\n<p>Every individual of gems do follow the same standard structure of code organization:<\/p>\n<div class=\"language-plaintext highlighter-rouge\">\n<div class=\"highlight\">\n<pre class=\"highlight\"><code>% tree freewill\nfreewill\/\n\u251c\u2500\u2500 bin\/\n\u2502   \u2514\u2500\u2500 freewill\n\u251c\u2500\u2500 lib\/\n\u2502   \u2514\u2500\u2500 freewill.rb\n\u251c\u2500\u2500 test\/\n\u2502   \u2514\u2500\u2500 test_freewill.rb\n\u251c\u2500\u2500 README\n\u251c\u2500\u2500 Rakefile\n\u2514\u2500\u2500 freewill.gemspec\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p>There is another thing that you may need to know: Jekyll is a Gem itself as many other Jekyll plugins such as <a href=\"https:\/\/github.com\/jekyll\/jekyll-feed\">jekyll-feed<\/a>, <a href=\"https:\/\/github.com\/jekyll\/jekyll-archives\">jekyll-archives<\/a>, and <a href=\"https:\/\/github.com\/jekyll\/jekyll-seo-tag\">jekyll-seo-tag<\/a><\/p>\n<h3 id=\"what-is-a-gemfile\">What is a Gemfile?<\/h3>\n<p>A Gemfile is a file created for the use of describing gem dependencies for Ruby programs. That is to say, A Gemfile is the dependency management system of Ruby or is a list of Gems that a Ruby project needs to run. It is necessary to note that your Gemfile is evaluated as Ruby code. When we have Jekyll plugins when need to use Gemfiles on Jekyll sites.<\/p>\n<h3 id=\"how-is-the-look-of-a-gemfile\">How is the look of a Gemfile?<\/h3>\n<p>Firstly, please use the jekyll-feed and jekyll-seo-tag plugins to create a Gemfile for a Jekyll site.<\/p>\n<p>A Gemfile needs at least one source that can tell you where to download the Gems.<\/p>\n<p>The next step to do is to specify the Gems we\u2019re using. If you want a specific version, you can include a version number. It is significant to always have Jekyll in our Gemfile.<\/p>\n<p>In order to let Jekyll know about our plugin Gems in <code class=\"language-plaintext highlighter-rouge\">_config.yml<\/code>, we would have to specify them. You are able to avoid this by putting Gems in a \u201cjekyll_plugins\u201d group that Jekyll automatically includes.<\/p>\n<div class=\"language-plaintext highlighter-rouge\">\n<div class=\"highlight\">\n<pre class=\"highlight\"><code>source 'https:\/\/rubygems.org'\n\ngem 'jekyll', '3.1.6'\n\ngroup :jekyll_plugins do\n  gem 'jekyll-feed'\n  gem 'jekyll-seo-tag'\nend\n<\/code><\/pre>\n<\/div>\n<\/div>\n<h3 id=\"what-is-the-bundler-and-how-to-use-it\">What is the Bundler and how to use it?<\/h3>\n<p>The bundler is the program that can read the Gemfile and download the Gems. Please kindly note that Bundler is itself installed as a GemPlease run<\/p>\n<div class=\"language-plaintext highlighter-rouge\">\n<div class=\"highlight\">\n<pre class=\"highlight\"><code>gem install bundler\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p>to get the bundler installed.<\/p>\n<p>We also need to run <code class=\"language-plaintext highlighter-rouge\">bundle install<\/code> to create or to change a Gemfile. This can perform 2 tasks:<\/p>\n<ul>\n<li>Create a <code class=\"language-plaintext highlighter-rouge\">Gemffile.lock<\/code> file if it is not available yet. This file is automatically generated and includes all the Gems in <code class=\"language-plaintext highlighter-rouge\">Gemffile<\/code> with a version number even when it was not specified. This is to make sure that those people we have shared the source code will have the same version of the Gems.<\/li>\n<li>Download the Gems in <code class=\"language-plaintext highlighter-rouge\">Gemfile.lock<\/code>.<\/li>\n<\/ul>\n<p>As usual, when we r\u1ee5n Jekyll we tend to do something like this:<\/p>\n<div class=\"language-plaintext highlighter-rouge\">\n<div class=\"highlight\">\n<pre class=\"highlight\"><code>jekyll serve\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p>When using a Gemfile, we need to run Jekyll in a different way. We may have various versions of the jekyll-feed plugin on the machine and if we run <code class=\"language-plaintext highlighter-rouge\">jekyll serve<\/code>, maybe it could run the wrong version. Fortunately, we can handle this using <code class=\"language-plaintext highlighter-rouge\">bundle exec<\/code> which makes only the Gems in the Gemfile available.<\/p>\n<p>For instance, if you want to run <code class=\"language-plaintext highlighter-rouge\">jekyll serve<\/code>, you shoulnd run:<\/p>\n<div class=\"language-plaintext highlighter-rouge\">\n<div class=\"highlight\">\n<pre class=\"highlight\"><code>bundle exec jekyll serve\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p>Using Gemfiles and the bundler could make handling various versions of plugins much easier and you can be certain that you can have a consistent environment for your site across multiple machines.<\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>Thanks for reading this instruction! For more information, please look at some more of our available related posts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gem, Gemfile and the Bundler are those terms which are often used in the Ruby community but do you know exactly what they are and how to use them? However, please keep reading our instructional writing on How to use Gems, Gemfiles, and the Bundler to know more deeply about the meanings of those mentioned [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[356,383],"tags":[],"class_list":["post-111489","post","type-post","status-publish","format-standard","hentry","category-shopify","category-shopify-devdocs"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to use Gems, Gemfiles, and the Bundler in Shopify<\/title>\n<meta name=\"description\" content=\"Master the use of Gems, Gemfiles, and Bundler in Shopify development to manage dependencies and streamline Ruby on Rails projects.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use Gems, Gemfiles, and the Bundler in Shopify\" \/>\n<meta property=\"og:description\" content=\"Master the use of Gems, Gemfiles, and Bundler in Shopify development to manage dependencies and streamline Ruby on Rails projects.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/\" \/>\n<meta property=\"og:site_name\" content=\"Avada Commerce\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/avada.io\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-18T17:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-25T01:48:46+00:00\" \/>\n<meta name=\"author\" content=\"Sam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@avadaio\" \/>\n<meta name=\"twitter:site\" content=\"@avadaio\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sam\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use Gems, Gemfiles, and the Bundler in Shopify","description":"Master the use of Gems, Gemfiles, and Bundler in Shopify development to manage dependencies and streamline Ruby on Rails projects.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/","og_locale":"en_US","og_type":"article","og_title":"How to use Gems, Gemfiles, and the Bundler in Shopify","og_description":"Master the use of Gems, Gemfiles, and Bundler in Shopify development to manage dependencies and streamline Ruby on Rails projects.","og_url":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/","og_site_name":"Avada Commerce","article_publisher":"https:\/\/www.facebook.com\/avada.io\/","article_published_time":"2019-02-18T17:00:00+00:00","article_modified_time":"2025-02-25T01:48:46+00:00","author":"Sam","twitter_card":"summary_large_image","twitter_creator":"@avadaio","twitter_site":"@avadaio","twitter_misc":{"Written by":"Sam","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/#article","isPartOf":{"@id":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/"},"author":{"name":"Sam","@id":"https:\/\/avada.io\/#\/schema\/person\/cc9c647e3ec94d00dc61ae2e653cafb7"},"headline":"Use Gems, Gemfiles, and the Bundler","datePublished":"2019-02-18T17:00:00+00:00","dateModified":"2025-02-25T01:48:46+00:00","mainEntityOfPage":{"@id":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/"},"wordCount":661,"publisher":{"@id":"https:\/\/avada.io\/#organization"},"articleSection":["Shopify","Shopify Devdocs"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/","url":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/","name":"How to use Gems, Gemfiles, and the Bundler in Shopify","isPartOf":{"@id":"https:\/\/avada.io\/#website"},"datePublished":"2019-02-18T17:00:00+00:00","dateModified":"2025-02-25T01:48:46+00:00","description":"Master the use of Gems, Gemfiles, and Bundler in Shopify development to manage dependencies and streamline Ruby on Rails projects.","breadcrumb":{"@id":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/avada.io\/blog\/use-gems-gemfiles-and-the-bundler\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/avada.io\/"},{"@type":"ListItem","position":2,"name":"Shopify","item":"https:\/\/avada.io\/category\/shopify"},{"@type":"ListItem","position":3,"name":"Shopify Devdocs","item":"https:\/\/avada.io\/category\/shopify-devdocs\/"},{"@type":"ListItem","position":4,"name":"Use Gems, Gemfiles, and the Bundler"}]},{"@type":"WebSite","@id":"https:\/\/avada.io\/#website","url":"https:\/\/avada.io\/","name":"Avada Commerce","description":"Blog","publisher":{"@id":"https:\/\/avada.io\/#organization"},"alternateName":"Avada Commerce","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/avada.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/avada.io\/#organization","name":"Avada Commerce","alternateName":"Avada Commerce","url":"https:\/\/avada.io\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/avada.io\/#\/schema\/logo\/image\/","url":"https:\/\/avada.io\/wp-content\/uploads\/2023\/06\/Avada-logo.jpeg","contentUrl":"https:\/\/avada.io\/wp-content\/uploads\/2023\/06\/Avada-logo.jpeg","width":1200,"height":1200,"caption":"Avada Commerce"},"image":{"@id":"https:\/\/avada.io\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/avada.io\/","https:\/\/x.com\/avadaio","https:\/\/www.youtube.com\/@avadaio","https:\/\/www.linkedin.com\/company\/avadacommerce"]},{"@type":"Person","@id":"https:\/\/avada.io\/#\/schema\/person\/cc9c647e3ec94d00dc61ae2e653cafb7","name":"Sam","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/fdce01bbdb8b8eaa162f8ed372062707058abcd85e8b233af7cb4e01191c75f4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/fdce01bbdb8b8eaa162f8ed372062707058abcd85e8b233af7cb4e01191c75f4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fdce01bbdb8b8eaa162f8ed372062707058abcd85e8b233af7cb4e01191c75f4?s=96&d=mm&r=g","caption":"Sam"},"description":"Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Vietnam. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.","sameAs":["https:\/\/wordpress-466542-3512282.cloudwaysapps.com","https:\/\/vn.linkedin.com\/in\/samng80"],"url":"https:\/\/avada.io\/authors\/sam\/"}]}},"meta_title":"How to use Gems, Gemfiles, and the Bundler in Shopify","meta_description":"Master the use of Gems, Gemfiles, and Bundler in Shopify development to manage dependencies and streamline Ruby on Rails projects.","meta_keywords":"","feature_image_custom":"","updated_at_migrate":"2019-02-19T00:00:00+07:00","_links":{"self":[{"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/posts\/111489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/comments?post=111489"}],"version-history":[{"count":1,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/posts\/111489\/revisions"}],"predecessor-version":[{"id":118103,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/posts\/111489\/revisions\/118103"}],"wp:attachment":[{"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/media?parent=111489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/categories?post=111489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/tags?post=111489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}