{"id":389,"date":"2017-07-20T11:55:20","date_gmt":"2017-07-20T15:55:20","guid":{"rendered":"https:\/\/mberlove.com\/blog\/?p=389"},"modified":"2017-07-20T11:55:20","modified_gmt":"2017-07-20T15:55:20","slug":"hanami-ruby-on-ubuntu","status":"publish","type":"post","link":"https:\/\/mberlove.com\/blog\/hanami-ruby-on-ubuntu\/","title":{"rendered":"Hanami (Ruby) on Ubuntu"},"content":{"rendered":"<figure class=\"graf graf--figure\"><img decoding=\"async\" class=\"graf-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1000\/1*ndu9cc1TFei71uezU5AGjA.png\" data-image-id=\"1*ndu9cc1TFei71uezU5AGjA.png\" data-width=\"1920\" data-height=\"948\" \/><\/figure>\n<p class=\"graf graf--p\">Hanami is a modern Ruby web framework. I\u2019m experimenting with it right now.<\/p>\n<p>&nbsp;<\/p>\n<p class=\"graf graf--p\">Ubuntu, compared to other linux distros, or to a mac, can often require different steps when getting started with a new tool. Here is the process I followed, which got me up and running in just a few moments of work.<\/p>\n<p>&nbsp;<\/p>\n<p><a class=\"markup--anchor markup--li-anchor\" href=\"https:\/\/rvm.io\/rvm\/install#ubuntu\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/rvm.io\/rvm\/install#ubuntu\">Install RVM<\/a><br \/>\nRuby Version Manager (RVM) is one of the easiest ways to handle Ruby versioning, stay up to date, and minimize frustration.<\/p>\n<p>&nbsp;<\/p>\n<p>If you already have RVM, run <code class=\"markup--code markup--li-code\">rvm get stable<\/code> to make sure you\u2019re up to date. Then run <code class=\"markup--code markup--li-code\">rvm cleanup all<\/code> to get rid of any cruff (not strictly necessary, just useful).<\/p>\n<p>&nbsp;<\/p>\n<p>For Hanami, you\u2019ll need to be using a modern version of Ruby, 2.3.1 or higher.<br \/>\nYou can have RVM list the Ruby versions it\u2019s aware of by typing <code class=\"markup--code markup--li-code\">rvm list known<\/code>. From this list you can select the version you want and install that with <code class=\"markup--code markup--li-code\">rvm install<\/code>; at time of writing the newest stable Ruby version was 2.4.0, so I ran <code class=\"markup--code markup--li-code\">rvm install ruby-2.4.0<\/code>.<br \/>\nThis should also set your newly installed version of Ruby as the one that is selected to be used, but if you want to change it manually, you can run <code class=\"markup--code markup--li-code\">rvm use ruby-2.4.0<\/code>, etc.<\/p>\n<p>&nbsp;<\/p>\n<p>Now we\u2019re ready for Hanami itself. Simply install the Hanami gem by running <code class=\"markup--code markup--li-code\">gem install hanami<\/code>.<\/p>\n<p>&nbsp;<\/p>\n<p>You\u2019ll also need to make sure you have your database of choice installed (sqlite, postgres, etc).<br \/>\nFor my purposes, I ran s<code class=\"markup--code markup--li-code\">udo apt-get install sqlite-3 libsqlite-dev<\/code>. Chances are, on Ubuntu, you can skip this step, as it will already be installed.<\/p>\n<p>&nbsp;<\/p>\n<p>Create a new project with hanami\u2019s <code class=\"markup--code markup--li-code\">new<\/code> command, e.g:<br \/>\n<code class=\"markup--code markup--li-code\">hanami new myproject<\/code><\/p>\n<p>The <code class=\"markup--code markup--li-code\">new<\/code> command will create a directory of the name you specified for the project; move into that directory (<code class=\"markup--code markup--li-code\">cd<\/code>, etc), and run a <code class=\"markup--code markup--li-code\">bundle install<\/code> to make sure everything\u2019s ready to go. This might take a few minutes.<\/p>\n<p>&nbsp;<\/p>\n<p>You\u2019re now ready! Run <code class=\"markup--code markup--li-code\">bundle exec hanami server<\/code> to check out your new project being served at <code class=\"markup--code markup--li-code\">localhost:2300<\/code>.<\/p>\n<p>&nbsp;<\/p>\n<p>You can use <a class=\"markup--anchor markup--li-anchor\" href=\"http:\/\/hanamirb.org\/guides\/getting-started\/\" target=\"_blank\" rel=\"noopener\" data-href=\"http:\/\/hanamirb.org\/guides\/getting-started\/\">Hanami\u2019s getting started guide<\/a> as a launching pad, or check out the <a class=\"markup--anchor markup--li-anchor\" href=\"https:\/\/www.google.com\/search?q=hanami+tutorial&amp;ie=utf-8&amp;oe=utf-8\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.google.com\/search?q=hanami+tutorial&amp;ie=utf-8&amp;oe=utf-8\">numerous guides and resources<\/a> for learning this framework.<\/p>\n<p>&nbsp;<\/p>\n<p class=\"graf graf--p\">Good luck, and have fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hanami is a modern Ruby web framework. I\u2019m experimenting with it right now. &nbsp; Ubuntu, compared to other linux distros, or to a mac, can often require different steps when getting started with a new tool. Here is the process [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[125,169,147,104],"tags":[212,72],"class_list":["post-389","post","type-post","status-publish","format-standard","hentry","category-programming","category-ruby","category-software-engineering","category-web-dev","tag-hanami","tag-ruby"],"_links":{"self":[{"href":"https:\/\/mberlove.com\/blog\/wp-json\/wp\/v2\/posts\/389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mberlove.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mberlove.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mberlove.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mberlove.com\/blog\/wp-json\/wp\/v2\/comments?post=389"}],"version-history":[{"count":3,"href":"https:\/\/mberlove.com\/blog\/wp-json\/wp\/v2\/posts\/389\/revisions"}],"predecessor-version":[{"id":392,"href":"https:\/\/mberlove.com\/blog\/wp-json\/wp\/v2\/posts\/389\/revisions\/392"}],"wp:attachment":[{"href":"https:\/\/mberlove.com\/blog\/wp-json\/wp\/v2\/media?parent=389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mberlove.com\/blog\/wp-json\/wp\/v2\/categories?post=389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mberlove.com\/blog\/wp-json\/wp\/v2\/tags?post=389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}