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

(Difference between pages)
m (insert media)
 
m (insert media)
 
Line 1: Line 1:
 
{{Ebuild
 
{{Ebuild
|Summary=Centralized Ruby extension management system
+
|Summary=The standard GNU Bourne-again shell.
|CatPkg=dev-ruby/ruby
+
|CatPkg=app-shells/bash
 
|Maintainer=
 
|Maintainer=
|Homepage=https://www.ruby-lang.org
 
 
}}
 
}}
 +
This is the ebuild for <tt>bash</tt>, the standard shell for Funtoo Linux systems.
  
Ruby is a programming language with its own package management system to extend the language.
+
'''Bash''' is the GNU Project's ''Bourne Again SHell'', a complete implementation of the IEEE POSIX and Open Group shell specification with interactive command line editing, job control on architectures that support it, csh-like features such as history substitution and brace expansion, and a slew of other features. [http://tiswww.case.edu/php/chet/bash/bashtop.html]
  
Rubygems is a package management system to extend the ruby language.
+
== Learning Bash ==
  
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. 
+
The following articles, written originally for IBM developerWorks by Daniel Robbins, serve as an excellent introduction to the bash shell:
  
https://wiki.archlinux.org/index.php/Ruby#RubyGems
+
* [[Bash by Example, Part 1]]
 +
* [[Bash by Example, Part 2]]
 +
* [[Bash by Example, Part 3]]
  
Emerge ruby & rubygems:
+
== Moving on Command Line ==
<console>###i## emerge ruby rubygems</console>
+
  
Remove conflicting gems:
+
{|class="table table-striped"
<console>###i## emerge -C dev-ruby/rake dev-ruby/racc dev-ruby/json dev-ruby/rdoc</console>
+
|| Shortcut || Description
 +
|-
 +
|| <code>Tab</code> || Autocomplete
 +
|-
 +
|| <code>Ctrl + r</code> || Search as you type from lastlog
 +
|-
 +
|| <code>Ctrl + a</code> || Move to the start of line
 +
|-
 +
|| <code>Ctrl + e</code> || Move to the end of line
 +
|-
 +
|| <code>Ctrl + k</code> || Cut from cursor to the end of line
 +
|-
 +
|| <code>Ctrl + w</code> || Cut from cursor to the previous whitespace
 +
|-
 +
|| <code>Ctrl + c</code> || Clear line
 +
|-
 +
|| <code>Ctrl + l</code> || Clear screen
 +
|-
 +
||<code>Alt + f</code> || Move one word forward
 +
|-
 +
|| <code>Alt + b</code> || Move one word backwards
 +
|-
 +
|| <code>Alt + d</code> || Cut from cursor to the end of word
 +
|-
 +
|| <code>Alt + backspace</code> || Cut from cursor to the start of word
  
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>
+
  
 +
== Bash Completion ==
 +
See [[Package:Bash completion|bash completion page]].
  
Fetch gems via rubygems:
+
== Configuration Files ==
<console>###i## gem install rdoc json rake racc</console>
+
=== ~/.bashrc ===
 +
<code>~/.bashrc</code> gets loaded on bash startup. You can source files, put aliases, functions and export variables there.
 +
{{file|name=~/.bashrc|lang=bash|desc=bash runtime configuration|body=
 +
source /etc/profile.d/bash-completion.sh
  
<console>###i## rubygems-update</console>
+
export EDITOR="vim"
  
update gem system:
+
alias mv='mv -v'
<console>###i## update_rubygems
+
alias cp='cp -v'
###i## gem update --system
+
alias rm='rm -v'
###i## gem pristine --all
+
</console>
+
  
Now you're ready to use gem to manage gems.
+
alias e='emerge'
 +
alias eu='emerge -uavDN --with-bdeps=y @world'
  
To add gems to your path:
+
alias used='cat  ~/.bash_history {{!}} sort {{!}} uniq -c {{!}} sort -n'
{{file|name=$HOME/.bashrc|desc=add gem bin directory to your path|body=
+
PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
+
}}
+
  
==ruby on rails==
+
calculator() {
<console>###i## gem install rails
+
        echo "$@" {{!}} bc
###i## rails new testproject
+
}
###i## cd testproject
+
###i## bundle install</console>
+
 
+
==puma==
+
puma is a fast web server for ruby on rails.
+
 
+
To enable puma in your project:
+
{{file|name=$HOME/testproject/Gemfile|desc=add puma gem to your rails application|body=
+
gem 'puma'
+
 
}}
 
}}
 
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=PL1512BD72E7C9FFCA}}
+
{{#widget:YouTube|playlist=PLDOiVunkOLsEJF2toupqFubpWtVasDqOg}}
 
+
[[Category:Programming language]]
+
  
 
{{EbuildFooter}}
 
{{EbuildFooter}}

Latest revision as of 02:48, November 4, 2014

app-shells/bash


Source Repository:Funtoo Overlay

Summary: The standard GNU Bourne-again shell.

Use Flags

bashlogger
Log ALL commands typed into bash; should ONLY be used in restricted environments such as honeypots
mem-scramble
Build with custom malloc/free overwriting allocated/freed memory
net
Enable /dev/tcp/host/port redirection
plugins
Add support for loading builtins at runtime via 'enable'

Bash

This is the ebuild for bash, the standard shell for Funtoo Linux systems.

Bash is the GNU Project's Bourne Again SHell, a complete implementation of the IEEE POSIX and Open Group shell specification with interactive command line editing, job control on architectures that support it, csh-like features such as history substitution and brace expansion, and a slew of other features. [1]

Learning Bash

The following articles, written originally for IBM developerWorks by Daniel Robbins, serve as an excellent introduction to the bash shell:

Moving on Command Line

Shortcut Description
Tab Autocomplete
Ctrl + r Search as you type from lastlog
Ctrl + a Move to the start of line
Ctrl + e Move to the end of line
Ctrl + k Cut from cursor to the end of line
Ctrl + w Cut from cursor to the previous whitespace
Ctrl + c Clear line
Ctrl + l Clear screen
Alt + f Move one word forward
Alt + b Move one word backwards
Alt + d Cut from cursor to the end of word
Alt + backspace Cut from cursor to the start of word

Bash Completion

See bash completion page.

Configuration Files

~/.bashrc

~/.bashrc gets loaded on bash startup. You can source files, put aliases, functions and export variables there.

~/.bashrc: bash runtime configuration (bash source code)
source /etc/profile.d/bash-completion.sh
 
export EDITOR="vim"
 
alias mv='mv -v'
alias cp='cp -v'
alias rm='rm -v'
 
alias e='emerge'
alias eu='emerge -uavDN --with-bdeps=y @world'
 
alias used='cat  ~/.bash_history | sort | uniq -c | sort -n'
 
calculator() {
        echo "$@" | bc
}

media