I have a pretty general question regarding Jekyll. When I try to install it on my mac I get an error saying I don't have write permissions to the ruby directory. After looking around online I've found that you can fix this by installing a ruby version manager. My question is why does this work? Is Jekyll essentially an extended version of Ruby? How are they related architecturally?
Thanks!
I think Jekyll is a Ruby Gem. So that would mean it is written in Ruby, and needs the Ruby interpreter on your system to install/run it.
RVM is just a tool to help you manage your different Ruby versions (because you could potentially install multiple versions at the same time, for different users for example).
Jekyll is built in Ruby and is available as rubygem. That's why it requires Ruby to build. It provides command line interface to carry out deploy and other operations and provides minimalistic HTTP server.
It is also equipped to convert markdown to HTML using redcarpet ruby gem.
It's AWESOME.
Related
i'm new user here. and this is my first question regarding Ruby on Rails. so, i wanted to ask what is the correct program version of Ruby on Rails, i have seen only 2.1 and 2.2.
i was looking for 5.0 to install and use it for first time. i chose RoR (nickname for Ruby on Rails) to create a website that can have many useful features like a site would do. but i'm at loss because i have no idea where i could find a RoR 5.0 or should i just install a older package of RoR to update to 5.0?
also, i have additional questions.
1: is RoR a program that can help you make website or blog, forum? or it's just a one in all package?
2: can you actually put together a section inside a site for news information/updates?
3: where do you find or make a code for mailing list which users can have a mail updates sent to their email?
these are my questions, you see i'm quite fond of a site that is run on RoR. so i'd like to try my hand on creating a site of my own, particularly one with a forum. like any kind of development, it's fun to learn. will you answer my questions and help me learn the program of Ruby on Rails?
Ruby is a programming language which has it's own version number. Rails is a library written in Ruby which has it's own version number as well.
The version of Ruby is not the same as the version of Rails. Rails 5.x requires Ruby version 2.2.2 or higher.
You can view the versions of each by using
$ ruby --version
$ rails --version
You can use the latest stable version of Ruby. – get it from here: https://www.ruby-lang.org/en/downloads/ (The current latest stable is 2.3.1)
To get the latest version of Rails, use the gem install command. (The current latest stable version is 5.0.0.1)
$ gem install rails
While installing RVM from, it is suggested to provide YAML source tar as well.
Don't know why YAML is needed by RVM? ( link :-https://github.com/rvm/rvm-site/blob/master/content/rvm/offline.md)
We can very well install it as a separate gem , right?
Please provide your insights.
YAML is part of Ruby's standard library and is thus shipped with Ruby itself. In order to compile Ruby with YAML support, you thus need libyaml installed. Since YAML is quite popular in Ruby and is e.g. used to specify all the metadata in packaged Rubygems, a Ruby without YAML is not very useful nowadays.
Now, some time ago, there was a pretty nasty bug in libyaml (the library used by Ruby to parse and generate YAML). In versions <= 0.1.4, it was possible to execute arbitrary code by making the ruby process parse a specially crafted yaml source.
Because of this, RVM usually downloads and compiles an up-to-date version of libyaml to ensure the compiles Rubies are safe from this vulnerability.
I've spent some time in web development and since I have decided that ruby is quite a nice language to code in I want to try the reason why some people say ruby got known : Rails
I installed rails in my linux machine however I am now trying to develop it in Windows. I know that it was recommended to install rails using RVM in linux however I'm not sure what is the best way to install it in Windows since I've read articles which said that
gem install rails
is a method which will cause you lots of bugs in both linux and windows
My question to you is what is a method which is "bugless" to install rails in windows?
Is
gem install rails
actually buggy?
Yeah, installing Rails on Windows is a little more complicated, but that's why they have bundles for it.
Go here and follow instructions.
http://railsinstaller.org/en
I've read through a few Q&A's here on this subject, but am still confused. I'm new to linux and new to programming, so please keep that in mind.
I understand that Ruby Gems is similar to apt-get. It's a package manager -- correct?
So if I want to install or remove gems, I can do it via a command like: sudo gems install {gem name}
So what then is RVM? Why would I want to use it? Doesn't Ruby Gems do what RVM does? Why then does Ruby Gems get installed with RVM?
Also, when specifying gems in a project's Gemfile, then using bundler to update, etc.. is this downloading the gems only to that project, or will they now be available across all projects?
Also, what is $PATH about? I don't know much about it, so when I read about it, I'm confused about what is the right $PATH, what if anything I should do to manage references in $PATH, etc. Can someone explain or point to any resources for beginners?
And finally, I'm using various tutorials, and they differ on versions for everything from Ruby to Rails to Gems. a) Should I be modifying my environment to match the version that they use? b) Once I'm done with a tutorial, should I leave all the versions alone, or should I try to upgrade everything up to the latest and greatest?
It's confusing because if I leave everything at the version levels in the tutorials, then I feel like I'm stuck in the past. While if I upgrade to the latest and greatest, I feel like things have all switched around on me and I'm not sure how to use all the tips and tricks I learned.
Thank you in advance for taking the time to help. Cheers.
This question is very broad so I chose to try to balance the explicitness with conciseness. If anyone finds anything wrong with the answer please tell and I'll straight up own up to it :)
RVM is a Ruby Version Manager. Hypothetically, some projects might require you to run ruby 1.9, another legacy project might require 1.8. RVM allows you to have both installations installed side-by-side, as opposed to having one authoritative system-level version of ruby. This facilitates installing later versions of ruby without fear of breaking anything, or of meddling with other user accounts' ruby version requirements (since usually one installs RVM at the user level, in your home directory). This even lets you try out the bleeding edge version of ruby without having anything to worry about, since you can always switch back easily.
When you install a gem, it generally becomes available to you everywhere that ruby installation is available to you, so in any project. When you specify gems in your Gemfile you're basically saying that independently of whatever gems you may have installed and their versions, that project requires gem x of version 2.2, y of version 3.1, and z of version 1.1. If you didn't already have those gems it installs them, if you did but not those versions, it installs them.
Path is an environment variable that allows operating systems to know where to look for programs when you invoke them. If you type someapp in the terminal, how can the operating system possibly know where someapp is? Well it searches for it in any of those directories supplied in $PATH. You can see what's in your path by doing echo $PATH in the shell.
As for varying versions of ruby, this brings me back to the reason for RVM. You can if you want install the version of ruby they use, and then in your Gemfile specifically state the version of the gems the tutorials use and you should be fine. You can have different versions of gems installed, and you can have different versions of ruby installed thanks to RVM.
Personally I would recommend working towards the latest version of everything so that it remains relevant. For example, it would be counterproductive to work on a tutorial that uses Rails 2 since it changed a lot when it went to 3, and somewhat from 3 to 3.1 and above etc. If possible use the latest versions, or at least be aware of the nuances (the base material tends to stay more or less the same), lest you work on a tutorial that is older only to get to work on your own project with the latest version of everything and not have it work.
Simple solution to your dilemma: ditch the tutorials that are too old. There are tons of resources out there that you're bound to find up-to-date material. Worst case, dated material typically has community support in form of comments which state the changes between the dated version of something and its corresponding recent version. E.g. "keep in mind that haha.what changed to lol.wut in version 3.1"
I can understand that this is confusing, RubyGems are as you write a package manager. RVM is a tool that makes it possible to have several versions of ruby installed on your system and easy swift between them.
If you using various tutorials, and they differ on versions for everything from Ruby to Rails to Gems you can (if you want to) create a RVM Gemset for the version you use. You will then create a sandbox for the Gems Bundler use in your project.
Bundler are as you write a tool for manage the Gems your application depends on. In the old days before Bundler it could be a hassle to figure out which gems your application depended on. Now Bundler do this for you.
Both Bundler and RVM are tools that is not absolutly necessary to use but they will help you. I personally do not use RVM anymore. It is to much of a monster in my taste so I use rbenv instead.
Regarding what versions of Rails to use I do agree that you should try to use 3.1 versions if possible but if you find some example application using Rails 3.0 you do not need to upgrade it. Also you do not need to run the absolute latest version of Rails. Rails 3.1 have a lot of bug fixes that the latest Rails 3.1.3 might not have.
I'm learning Ruby on Rails with the AWDR book and have had to be specific about which version of Rails and Ruby that I am running on my local machine. I have just discovered that I need to roll back from ruby 1.8.7 to ruby 1.8.6 here. I also needed to roll back Rails to support the scaffold method so I could start the tutorial easily.
My question is: When I start contracting, developing and deploying projects in the real world, how am I going to manage all these different versions?
It looks to me like Rail's low tolerance for legacy code negates its ease of use philosophy! But I'm sure I'll grow to appreciate RoR.
As for Rails, What you can do is freezing your version, for example:
Make sure to install the proper Rails version, suppose you want version 2.2.2 : gem install rails v=2.2.2
Freeze and pack Rails with the project itself : rake rails:freeze:edge RELEASE=2.2.2
Now you will find Rails packed inside the vendor folder of your project, so you don't have to install Rails on the deploying machine.
And for Ruby, I like Ruby Version Manager(RVM), the easiest way to manage Ruby versions.
RubyGems is Ruby's package manager. You can install as many versions of gems (packages) as you want. You can install the latest by running sudo gem install rails (at the moment it will install 2.3.5). If you need 2.2.2, specify that with the -v or --version option: sudo gem install rails --version 2.2.2. Rails also installs a binary (yes, I know it's not really a binary file), rails, which generates a project. Because you have several versions of the gem, you need to control which binary gets called. When you install the rails gem, RubyGems puts a file in it's bin/ dir, which is a "link" to the real rails binary. That is the one you "call" when you say rails on the command line. However, all of the rubygems "link" binaries accept a parameter of it's own, which is what version you want to use. You would use the 2.2.2 rails binary like this:
rails _2.2.2_ my_project
I think the default is to use the most recent version, so if you want to use the most recent version, do this:
rails myproject
However, I see that you use 2.2.2 to get access to the scaffold method. I would strongly suggest you not to use that method, there's a reason for removing it. The scaffold method hides code, and makes customization hard. Instead, use the scaffold generator:
./script/generate scaffold --help
Good luck on your future rails adventures!
The latest version of Agile Web is written for 2.2.2 I believe. For this basic app they walk you through I'm very certain it should work with 2.3.x
The answer to the question for how you keep up is that you update your apps as needed and read the api and Changleogs to find out what has changed and fix the stuff that upgrades break. A great way to help with this is having a good test suite with good test coverage.