2014-07-25 at

Ruby Training (2014-?)

Provisioning


Controlling the Ruby Version Environment

Analogous to chroot. Pick one of these
  1. RVM

    RVM refers to sandboxes (interpreters, gems, and irb [REPL]) as gemsets.
    Example: installing RVM and a specific Ruby version, at once; then creating a gemset linking this Ruby to a Rails version, and installing the latter.
    $ curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.2
    $ rvm use ruby-2.1.2@rails4.1.0 --create
    $ gem install rails --version=4.1.0
  2. rbenv

    app_name/
    ├── bin/
    │ └── stuff
    ├── lib/
    │ └── stuff.rb
    ├── README
    └── .ruby-version

Package Management

Analogous to apt-get, npm. Packages are called gems.
  • The gem executable

    RubyGems (on Wikipedia), is part of the Ruby standard library. (I'm not sure if RubyGems is itself considered to be a gem.)
    • Gem pre/installation convention

      $ gem build gem_name.gemspec
      $ gem install gem_name-version.gem
    • Gem directory structure

      gem_name/
      ├── bin/
      │ └── gem_name
      ├── lib/
      │ └── gem_name.rb
      ├── test/(or spec/)
      │ └── test_gem_name.rb
      ├── README
      ├── Rakefile
      └── gem_name.gemspec (the specification)
  • The Bundler gem

    Bundler takes care of dependency management for applications ("apps").
    • The bundle executable

      Example:
      $ cd app_name
      $ bundle install
      (manual)
    • App directory structure

      Example, a Rails 4.x app:
      app_name/
      ├── app/
      ├── bin/
      ├── config/
      ├── db/
      ├── doc/
      ├── lib/
      ├── log/
      ├── public/
      ├── test/
      ├── tmp/
      ├── vendor/
      ├── Capfile (used by Capistrano)
      ├── config.ru (used by Rack)
      ├── Gemfile
      ├── Gemfile.lock
      ├── Rakefile
      └── README.rdoc

    • Gemfile

      This file describes the dependencies of the current gem (refer to the Gemfile manual). Each required dependency is specified as a range of acceptable versions.
    • Gemfile.lock

      This file records the specific version that was installed, for each required dependency

      Commit this if you are developing an app; but not if you are developing a gem.
    • rbenv-binstubs

Task Automation ("Task Running")

"This plugin makes rbenv transparently aware of project-specific binstubs created by bundler.

This means you don't have to type bundle exec ${command} ever again!"

Deployment

  • The Rack gem

    An interface between webservers, and Ruby applications. A quick intro.
  • The Capistrano gem

    A remote multi-server automation tool.

Implementation Shoot-outs

For the tuning freaks.





every minute is punctuated by me swearing at the hipster tendency to avoid calling a spade a spade. Call it a motherfucking library for fucks's sake... lol. Gem, gemspec, gemfile, bundler, barometer, constantinople, blistering barnacles, dickwad... -_-

... which brings me back to my life's work of demonstrating that there's nothing hard about math / technology - a lot of the friction in pedagogy is due to EPIC, INFORMALLY NAMED SCHEMATA.

#morphology

No comments :

Post a Comment