Skip to content

nachobonilla/ruby-learning-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 

Repository files navigation

ruby-learning-path

This is a document containing the most important things about ruby, and tends to be a learning path to Ruby as to become a proficient developer in this language.

The guide will be divided in three components aimed to be followed in order:

  1. A gentle introduction to the Ruby sintax and singularities.

  2. A theorical and practical primer on the main concepts of Ruby.

  3. Useful Libraries

  4. Notes on the different issues I have come across.

    • Installing a gem RubyGems is the package manager of Ruby, which can be helpful for you in the development process. For example, in my case I wanted to install SQLITE3 to be able to easily interact with a SQLite database. To install a gem, the command used is: gem install <gemName> But, running that command was ending with an error:

          ERROR: Failed to build gem native extension.
              current directory: /var/lib/gems/2.5.0/gems/nokogiri-1.10.3/ext/nokogiri
              /usr/bin/ruby2.5 -r ./siteconf20190807-22036-snjnej.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
              extconf failed, exit code 1
      
              Gem files will remain installed in /var/lib/gems/2.5.0/gems/n-okogiri-1.10.3 for inspection.
              Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.10.3/gem_make.out
      

      Which seems to be a problem on the header files, but after Googling for a bit, I found the command needed to install the ruby-dev dependencies that are needed to fix this problem in an Ubuntu box:

      sudo apt-get install rubyruby -e 'puts RUBY_VERSION[/\d+.\d+/]'-dev

      Also, at this point I added the Ruby package path to source by running:

      gem env and grabbing the "RUBY E XECUTABLE" value, and then:

      export PATH=$PATH:/var/lib/gems/2.5.0/

      Nevertheless, once I ran again the command, I encountered another error:

          Fetching: sqlite3-1.4.1.gem (100%)
              Building native extensions. This could take a while...
              ERROR:  Error installing sqlite3:
                      ERROR: Failed to build gem native extension.
      
                  current directory: /var/lib/gems/2.5.0/gems/sqlite3-1.4.1/ext/sqlite3
              /usr/bin/ruby2.5 -r ./siteconf20190807-9493-wzuepa.rb extconf.rb
              checking for sqlite3.h... no
              sqlite3.h is missing. Try 'brew install sqlite3',
              'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
              and check your shared library search path (the
              location where your sqlite3 shared library is located).
              *** extconf.rb failed ***
              Could not create Makefile due to some reason, probably lack of necessary
              libraries and/or headers.  Check the mkmf.log file for more details.  You may
              need configuration options.
      
              Provided configuration options:
                      --with-opt-dir
                      --without-opt-dir
                      --with-opt-include
                      --without-opt-include=${opt-dir}/include
                      --with-opt-lib
                      --without-opt-lib=${opt-dir}/lib
                      --with-make-prog
                      --without-make-prog
                      --srcdir=.
                      --curdir
                      --ruby=/usr/bin/$(RUBY_BASE_NAME)2.5
                      --with-sqlcipher
                      --without-sqlcipher
                      --with-sqlite3-config
                      --without-sqlite3-config
                      --with-pkg-config
                      --without-pkg-config
                      --with-sqlcipher
                      --without-sqlcipher
                      --with-sqlite3-dir
                      --without-sqlite3-dir
                      --with-sqlite3-include
                      --without-sqlite3-include=${sqlite3-dir}/include
                      --with-sqlite3-lib
                      --without-sqlite3-lib=${sqlite3-dir}/lib
      
              To see why this extension failed to compile, please check the mkmf.log which can be found here:
      
              /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/sqlite3-1.4.1/mkmf.log
      
              extconf failed, exit code 1
      
              Gem files will remain installed in /var/lib/gems/2.5.0/gems/sqlite3-1.4.1 for inspection.
              Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/sqlite3-1.4.1/gem_make.out
          ```
          
      

    This error was because of missing dependencies (again), and the command to add them is: sudo apt-get install libsqlite3-dev

    Now, you can run gem install sqlite3 and everything will work correctly So, you can take two takeaways from this Note:

    • Add your Gem folder to PATH.
    • You may be missing some dependencies to install the correct Gem, so search for the error in DuckDuckGo and enjoy the slick StackoverFlow widget they have on their search engine.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •