Difference between pages "Python" and "Package:Ruby"

(Difference between pages)
m (insert media)
 
m (insert media)
 
Line 1: Line 1:
Python is a scripting language as well as a high-level programming language, and is used extensively by Funtoo and Gentoo Linux. [[Portage]], the ports system used by Funtoo and Gentoo Linux, is written in Python (along with bash-based ebuilds.)
+
{{Ebuild
 +
|Summary=Centralized Ruby extension management system
 +
|CatPkg=dev-ruby/ruby
 +
|Maintainer=
 +
|Homepage=https://www.ruby-lang.org
 +
}}
  
== Introduction ==
+
Ruby is a programming language with its own package management system to extend the language.
  
Funtoo Linux contains many enhancements related to Python, and most of these enhancements are the result of integrating the Progress Overlay into Funtoo Linux. This new functionality allows Portage to do a much, much better job of keeping Python-based packages up-to-date on your system.
+
Rubygems is a package management system to extend the ruby language.
  
== Prior Issues in Gentoo/Funtoo ==
+
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. 
  
With the older <tt>python.eclass</tt> in Gentoo (and that used to be in Funtoo Linux,) no usable accounting information is stored by Portage so that it could "know" what versions of Python various ebuilds were built to use. This created a problem when new versions of Python were installed, as Portage didn't have the ability to automatically update Python-based packages to work with newer versions of Python that were installed.
+
https://wiki.archlinux.org/index.php/Ruby#RubyGems
  
This created the need for a separate tool, called <tt>python-updater</tt,> which was used to rebuild all Python-related ebuilds so that they properly utilize the currently-installed versions of Python.
+
Emerge ruby & rubygems:
 +
<console>###i## emerge ruby rubygems</console>
  
== Progress in Funtoo ==
+
Remove conflicting gems:
 +
<console>###i## emerge -C dev-ruby/rake dev-ruby/racc dev-ruby/json dev-ruby/rdoc</console>
  
The new Progress Overlay that has been integrated into Funtoo Linux goes a very long way towards solving the prior problems that existed when dealing with Python-based packages/ebuilds. The Progress Overlay adds two important things. The first is a new eclass that allows new Python-related ebuilds to be written in a way so that Portage can understand what versions of Python they were built against.
+
Flush conflicting gems bad specs:
 +
<console>###i## mv /usr/local/lib64/ruby/gems/2.1.0/specifications/ /usr/local/lib64/ruby/gems/2.1.0/specifications.backup</console>
  
By being integrated into Funtoo Linux, Progress Overlay also offers Funtoo Linux users hundreds of updated ebuilds. Hundreds (over four hundred) ebuilds that interact with Python in some way have been enhanced to take advantage of the new Python eclass. These new enhancements allow Portage to do what <tt>python-updater</tt> used to do for you -- keep your system up-to-date and all dependencies satisfied, even in the case where you may upgrade or change Python versions installed on your system.
 
  
== How To Use It ==
+
Fetch gems via rubygems:
 +
<console>###i## gem install rdoc json rake racc</console>
  
You don't need to do anything special to take advantage of the new Python functionality from Progress Overlay. It is already integrated into your Portage tree and is working for you behind the scenes to keep Python-related packages working properly.
+
<console>###i## rubygems-update</console>
  
The new Python functionality uses a special configuration variable called <tt>PYTHON_ABIS</tt>. By default, <tt>PYTHON_ABIS</tt> is set to "<tt>2.7 3.2</tt>" in Funtoo Linux profiles. This setting tells Portage that by default, any Python-related ebuilds should be built so that they can be used with both python-2.7 and python-3.2, if the ebuilds are compatible and will run using these versions of Python. If an ebuild doesn't support python-3.2, for example, Portage will still ensure that a python-2.7-compatible version of the package is installed. If an ebuild supports ''both'' versions, then special steps will be taken to install two separate sets of python modules and binaries, in order to ensure full compatibility with either Python interpreter.
+
update gem system:
 +
<console>###i## update_rubygems
 +
###i## gem update --system
 +
###i## gem pristine --all
 +
</console>
  
If you'd like to change <tt>PYTHON_ABIS</tt>, simply overwrite the setting in <tt>/etc/make.conf</tt> as follows:
+
Now you're ready to use gem to manage gems.
  
<pre>
+
To add gems to your path:
PYTHON_ABIS="2.6 2.7 3.2"
+
{{file|name=$HOME/.bashrc|desc=add gem bin directory to your path|body=
</pre>
+
PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
 +
}}
  
This is useful if you would like Portage to target other Python ABIs (like jython, for example, or 2.6) that you might be interested in.
+
==ruby on rails==
The new setting above would tell Portage to also ensure that Python-related ebuilds are built against python-2.6 as well as python-2.7 and 3.2.
+
<console>###i## gem install rails
 +
###i## rails new testproject
 +
###i## cd testproject
 +
###i## bundle install</console>
  
== Resources ==
+
==puma==
 +
puma is a fast web server for ruby on rails.
  
For more information, see:
+
To enable puma in your project:
 +
{{file|name=$HOME/testproject/Gemfile|desc=add puma gem to your rails application|body=
 +
gem 'puma'
 +
}}
  
* [[Progress Overlay Python]] - this page contains detailed developer documentation about the new Progess Overlay functionality, and how to write new-style Python-related ebuilds that take advantage of new Progress functionality.
+
To pull in puma:
 +
<console>###i## bundle install</console>
 +
 
 +
{{file|name=$HOME/testproject/config/puma.rb|desc=puma configuration file|body=
 +
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:
 +
<console>###i## bundle exec puma</console>
 +
or if you added gems bin dir to your path
 +
<console>###i## puma</console>
 +
 
 +
a generic puma init script can be found here
 +
 
 +
https://gist.github.com/666threesixes666/d8bca7f67439763d3e94
  
 
== media ==
 
== media ==
{{#widget:YouTube|playlist=PLEA1FEF17E1E5C0DA}}
+
{{#widget:YouTube|playlist=PL1512BD72E7C9FFCA}}
 +
 
 +
[[Category:Programming language]]
 +
 
 +
{{EbuildFooter}}

Revision as of 02:47, November 4, 2014

dev-ruby/ruby


Source Repository:Gentoo Portage Tree
Homepage

Summary: Centralized Ruby extension management system

Ruby


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:

# 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