注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Package:Ruby"

From Funtoo
Jump to navigation Jump to search
m (add puma init script example)
(no need for <pre> inside the file template)
Line 60: Line 60:


{{file|name=$HOME/testproject/config/puma.rb|desc=puma configuration file|body=
{{file|name=$HOME/testproject/config/puma.rb|desc=puma configuration file|body=
<pre>workers Integer(ENV['PUMA_WORKERS'] || 3)
workers Integer(ENV['PUMA_WORKERS'] || 3)
threads Integer(ENV['MIN_THREADS']  || 1), Integer(ENV['MAX_THREADS'] || 16)
threads Integer(ENV['MIN_THREADS']  || 1), Integer(ENV['MAX_THREADS'] || 16)


Line 77: Line 77:
     ActiveRecord::Base.establish_connection(config)
     ActiveRecord::Base.establish_connection(config)
   end
   end
end</pre>
end
}}
}}



Revision as of 22:47, August 30, 2014

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.

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

Gems are packaged wonky in portage so this page will explain how to work with rubygems rather than fight it. Arch wiki outlines a similar method.

https://wiki.archlinux.org/index.php/Ruby#RubyGems

Emerge ruby & rubygems:

root # emerge ruby rubygems

Remove conflicting gems:

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

Flush conflicting gems bad specs:

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


Fetch gems via rubygems:

root # gem install rdoc json rake racc
root # rubygems-update

update gem system:

root # update_rubygems
root # gem update --system
root # 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

root # gem install rails
root # rails new testproject
root # cd testproject
root # 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:

root # bundle install
   $HOME/testproject/config/puma.rb - puma configuration file
workers Integer(ENV['PUMA_WORKERS']

to start puma:

root # bundle exec puma

or if you added gems bin dir to your path

root # puma

a generic puma init script can be found here

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