Ruby

Revision as of 19:03, May 21, 2015 by Threesixes (Talk | contribs) (more details)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

dev-lang/ruby


Source Repository:Repository:Gentoo Portage Tree

https://www.ruby-lang.org

Summary: Centralized Ruby extension management system

Use Flags

rubytests
Install ruby tests that can only be run after ruby is installed
readline
Use the sys-libs/readline library to provide the readline extension, used for instance by the irb tool. This flag is meaningful only if the libedit USE flag is disabled. If neither libedit nor readline USE flags are enabled, the readline extension will not be built (and irb will lose line editing functionality).
yaml
Use the dev-libs/libyaml library to build the psych extension, available since Ruby 1.9.2_rc2, in alternative to the bundled syck-based parser.
rdoc
Install dev-ruby/rdoc after installing Ruby.
jemalloc
Use dev-libs/jemalloc for memory allocation.

News

Drobbins

Perl Updates

Gentoo has bumped perl from 5.20 to 5.22. Be sure to run perl-cleaner --all after the upgrade.
2015-07-25 by Drobbins
Drobbins

ARM Rebuild

ARM systems will use new stage3's that are not compatible with earlier versions.
2015-06-27 by Drobbins
Drobbins

ABI X86 64 and 32

Funtoo Linux has new 32-bit compatibility libraries inherited from Gentoo. Learn about them here.
2015-06-18 by Drobbins
More...

Ruby

Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


Ruby is a programming language with its own package management system to extend the language.

Ruby Ruby's way

Rubygems is a package management system to extend the ruby language.

Gems are packaged in portage and those are good for production server application. ruby ruby's way is more friendly on the development of rails side. this will explain how to work with rubygems rather than fight it. Arch wiki outlines a similar method.

Emerge ruby & rubygems:

# emerge ruby rubygems

Remove conflicting gems:

# emerge -C dev-ruby/rake dev-ruby/racc dev-ruby/json dev-ruby/rdoc

Flush conflicting gems bad specs:

# mv /usr/local/lib64/ruby/gems/2.1.0/specifications/ /usr/local/lib64/ruby/gems/2.1.0/specifications.backup

Fetch gems via rubygems:

# gem install rdoc json rake racc
# rubygems-update

update gem system:

# update_rubygems
# gem update --system
# gem pristine --all

Now you're ready to use gem to manage gems.

To add gems to your path:

$HOME/.bashrc - add gem bin directory to your path
PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"

ruby on rails

# gem install rails
# rails new testproject
# cd testproject
# bundle install

puma

puma is a fast web server for ruby on rails.

To enable puma in your project:

$HOME/testproject/Gemfile - add puma gem to your rails application
gem 'puma'

To pull in puma:

# bundle install
$HOME/testproject/config/puma.rb - puma configuration file
workers Integer(ENV['PUMA_WORKERS'] || 3)
threads Integer(ENV['MIN_THREADS']  || 1), Integer(ENV['MAX_THREADS'] || 16)

preload_app!

rackup      DefaultRackup
port        ENV['PORT']     || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
  # worker specific setup
  ActiveSupport.on_load(:active_record) do
    config = ActiveRecord::Base.configurations[Rails.env] ||
                Rails.application.config.database_configuration[Rails.env]
    config['pool'] = ENV['MAX_THREADS'] || 16
    ActiveRecord::Base.establish_connection(config)
  end
end

to start puma:

# bundle exec puma

or if you added gems bin dir to your path

# puma

a generic puma init script can be found here

https://gist.github.com/666threesixes666/d8bca7f67439763d3e94

media