Questions tagged [ruby]

Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features.

Filter by
Sorted by
Tagged with
13
votes
2answers
6k views

Best way to upgrade vim/gvim to 7.3 in Ubuntu 10.04?

I have to use Ubuntu 10.04 at work, and can't upgrade it. I'm using Vim/gVim 7.2. I want to upgrade it to 7.3 (with Python and Ruby extension support). Which is the best way? Add an entry in sources....
10
votes
5answers
19k views

Advantages (or downsides) of GVim over Vim to edit code [closed]

Should I install vim or GVim ? I develop mainly Ruby on Rails (I also use IDE's, but different topic). Are there any differences or advantage of using Gvim vs vim ?
9
votes
4answers
36k views

git push fails with remote: error: hook declined to update refs/heads/master

I'm recently trying to start my own project on a community git repo, and I've been having some complications. I'm new to git, but here's what I've been trying to do to just test it. I run the ...
8
votes
2answers
10k views

How to specify a higher ruby version for installing a gem?

I install a ruby package. $ sudo gem install pdfbeads ERROR: Error installing pdfbeads: nokogiri requires Ruby version >= 1.9.2. says that it needs ruby version greater than 1.9.1. My ruby ...
8
votes
1answer
7k views

How to use specify version of ruby for shell script with rbenv?

I'm going to write some short script in ruby. And I want to specify ruby version by shebang or in another way. I'll use the script in many environments. I'm using rbenv in the evironments, but it's ...
7
votes
3answers
2k views

How to configure Ruby to use the correct gemset or Ruby version on a per-project basis?

I open a terminal and navigate to my project folder (ex: cd /proj/tickecting_app). After this I execute this command: rvm use ruby 1.9.x@gemset . I want this command to run this every time I open the ...
7
votes
2answers
4k views

How do you specify alternative script interpreters (shebangs)?

In an executable file, you specify the environment using a shebang: #!/usr/bin/env ruby # ruby code here But what if you want to specify multiple possible environments? For example, if you have ...
7
votes
2answers
4k views

TinyCore Linux & RVM

I'm running TinyCore Linux and when I tried to install RVM (needed a portable linux distro for QA Automation) I keep getting an error sh: syntax error:unexpected redirection. I am unsure why I am ...
6
votes
2answers
22k views

Making ruby available to all users

I intend to use Ruby when programming my Raspberry Pi which is running the Debian based Occidentals. Via SSH, I executed: curl -L https://get.rvm.io | bash -s stable --ruby which downloaded the ruby ...
6
votes
3answers
3k views

What's the best way to determine the working directory for UNIX process using 'ps'?

I am running a Ruby command line script (rufus.sh)which ultimately calls Thread.new, which spawns a UNIX process as shown below. I run this script for more than 1 directory as the output of the ps ...
6
votes
1answer
3k views

`kill -s TERM` works, `kill -s ABRT` gets “Operation not permitted”

There is a process that I own whose documentation claims I can send SIGABRT to in order to get some debugging information. However, when I try to send SIGABRT, I get back "Operation not permitted". I ...
6
votes
3answers
1k views

Small Linux distro with Ruby

I have been using Puppy Linux for basic Linux needs, however now I would prefer one that has Ruby included, so that it does not have to be downloaded. I would prefer a small distro that can run from ...
5
votes
1answer
4k views

Can I refresh my shell within a shell script?

I am trying to setup a script that starts with a minimal CentOS 6 install and provisions it for Ruby development. #!/bin/bash # Add PostgreSQL Repo rpm -i http://yum.postgresql.org/9.1/redhat/rhel-6-...
4
votes
1answer
15k views

How to properly automatically/manually rotate log files for production Rails App

I am taking over administration for a server which has a custom made 3rd party Rails app. The app developer informed me that the ruby log files are getting large and pointed me to the following link: -...
4
votes
1answer
243 views

With gnu find, what is the difference between -print0 and -printf “%p\0”

In a terminal I can run... find . -type f -print0 ./testdir/testfile2.txt./testdir/testfile.txt And then... find . -type f -printf "%p\0" ./testdir/testfile2.txt./testdir/testfile.txt They both ...
4
votes
2answers
8k views

`ERROR: Failed to build gem native extension` while trying to install compass

I am using Ubuntu 14.04 I tried this command sudo gem install compass and it gave me this error: Fetching: multi_json-1.11.2.gem (100%) Fetching: compass-core-1.0.3.gem (100%) Fetching: compass-...
4
votes
1answer
612 views

Why doesn't rate limiting with trickle work with ruby?

I'm attempting to limit the bandwidth available to a running ruby process to prevent it flooding our link and affecting other traffic. The process is downloading large files over HTTP. I've found ...
3
votes
2answers
2k views

How to install Ruby 1.9.3 on Arch?

The wiki suggests using $sudo pacman -S ruby1.9 but the package isn't there... I'd rather not compile it from source but I can if no one knows.
3
votes
2answers
647 views

Time running a Ruby script is different locally than over SSH

Has anyone else seen this behavior? I created a simple Ruby script for giggles to see how fast it would count up on a couple machines I have. Here's the source: for n in 1...1000000 do ...
3
votes
1answer
478 views

Is there man command for bundle?

There is a command bundle in ruby. I want use man command or similar function for bundle. Does it exist? If there is it, I want to know how to look for separated command like bundle gem. I can see ...
3
votes
1answer
173 views

I shouldn't use root on my new ubuntu cloud instance, right?

I am playing with ubuntu on my new Rackspace cloud instance. However, the information they give me is for root access -- that doesn't seem like a best practice for doing development on this thing. ...
3
votes
2answers
1k views

Can you tell if a file has been renamed?

Many tools out there for syncing files aren't quite right for syncing you're home directory. Because of this, and to learn Ruby, I've been working on my own sync tool. An issue I've encountered, ...
3
votes
2answers
1k views

How to select unique array values?

I have an array and I want to get the unique 2nd members bash doesn't really have 2-dimensional array so I've defined it this way, using :: as the separator of the two elements: ruby_versions=( '...
3
votes
1answer
313 views

Remove multiple strings from file on command line, high performance [closed]

Is there an elegant, high-performance one-liner way to remove multiple complete strings from an input? I process large text files, e.g., 1 million lines in inputfile, and 100k matching strings in ...
3
votes
1answer
6k views

Crontab + Ruby on Rails: /usr/bin/env: ruby: No such file or directory

I have a ruby on rails app and I need to schedule a crontab for a rake task. */5 * * * * RAILS_ENV=production /usr/local/bin/rake -f /usr/local/www/mysite-web-production/current/Rakefile my_site:...
3
votes
3answers
1k views

Command line options of rackup are not shown in ps output or procfs

As you know if you wish to get command-line runtime arguments for running command you can parse ps -e or /proc/<pid>/cmdline. But I have encountered issue when this method returns only command ...
3
votes
2answers
931 views

Ruby update not working using two methods

I tried to install ruby version 1.9.3 with this on my mac 10.6.8: $ \curl -L https://get.rvm.io | bash -s stable --ruby Oskar-Niburskis-MacBook-Pro:~ oskarniburski$ rvm install ruby-1.9.3-p362 ...
3
votes
1answer
2k views

Gem install producing “OpenSSL” error

For at least a week now i have been trying to install Bettercap on my Raspberry PI using gem but whenever i type in: sudo gem install bettercap i receive an error message that says ERROR: While ...
2
votes
1answer
996 views

How to pipe to bash as a different user

I am running an experiment as a way to solve a bigger problem. For the experiment, I need to install rvm as a user who does not have a shell. To install rvm, you use the following command \curl -L ...
2
votes
3answers
2k views

Why does passing a HEREDOC as a string to `ruby -e` not work?

For reasons I don't understand, it seems to be impossible to pass a heredoc as an expression to a Ruby interpreter: $ ruby -e <<END heredoc> puts 'hi' heredoc> END ruby: no code ...
2
votes
4answers
163 views

Copy files to new directory only if name of file is in an array

I'm not much of a zsh buff but I imagine this should be an easy layup for someone: I can bulk copy files from sourcedir to targetdir with the following: $ find sourcedir -type f -exec cp {} ...
2
votes
2answers
144 views

How can I test for a file having a value?

I am using source ~/.rvm/scripts/rvm repos="repo_1_ruby_193 repo_2_ruby_211 repo_3_ruby_191" > rvm_check.txt for repo in $repos do cd ~/zipcar/$repo 2>rvm_check.txt cd .. echo $repo if [...
2
votes
2answers
973 views

sed - remove unmatched “}”, “)” or ']" (only for the line in question)

I have a file with a lot of lines. Some of the lines end in unmatched braces, i.e. "}" This is only true for lines that contain ".to" How can I remove the unmatched braces with sed for ALL lines ...
2
votes
4answers
5k views

Can't install pg gem

I can't get the pg gem to install. I have tried --with-pg_config and it didn't work. Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/local/rvm/rubies/ruby-1....
2
votes
2answers
510 views

Using RVM with gvim without installing the ruby binary

In Arch Linux, apparently gvim requires to install ruby as a dependency. However, if I want to work with RVM, then I don't need the binary ruby installed. Can that cause problems? Can ruby be ...
2
votes
1answer
2k views

Running a shell script with vagrant provision

I have setup a vagrant box using precise64 (ubuntu 14.04) and installed packages needed for octopress. I can ssh into the vagrant box and generate posts and run preview for my octopress site. Now I ...
2
votes
1answer
823 views

How to let pacman notice the ruby installed by rbenv?

I use rbenv to manage ruby versions. I want to install gvim on my ArchLinux and one of it's dependency is ruby. I'm already use rbenv to install the version 2.0.0-p247 of ruby as root ...
2
votes
3answers
18k views

packages have unmet dependencies - unable to install packages

I am trying to install passenger module with bellow command: sudo passenger-install-apache2-module And I am getting following output: * GNU C++ compiler... found at /usr/bin/g++ * Curl ...
2
votes
1answer
637 views

How can I launch irb from a bash script, execute some commands, then pass the irb session to the console?

I am creating a ruby gem and to speed my testing I wrote a script to build and install my gem, then to open irb for me to manually poke around. How can I run the following ruby commands before ...
2
votes
1answer
4k views

How can I run script without root to sniff network (libpcap)?

I have a script (in ruby): require 'ffi/pcap' pcap = FFI::PCap::Live.new(:dev => "wlan0", :timeout => 1) pcap.loop() do |this,pkt| puts pkt.body end When I try to run the script , I get the ...
2
votes
1answer
81 views

How can I syntax highlight Ruby range bounds in gtksourceview3.0?

I do most of my coding in gedit, which highlights integers and other syntax. When I use an integer range in Ruby, represented as 0..3 for example, the integers are not properly highlighted and are ...
2
votes
1answer
729 views

How to get 'TZ' with out '$TZ' being set?

I writing a Ruby program. I need a way to get something like America/New_York as ActiveSupport::TimeZone and require "tzinfo" can't get my current timezone. (Note that Time.now.zone can get things ...
2
votes
3answers
3k views

How can I create a bash script which runs irb, then some ruby code?

I'm trying to do this to make unit testing a breeze for myself. The contents of an example script in question are as follows: irb require 'random_utils.rb' a = SuccessChecker.new Right now this ...
2
votes
1answer
124 views

How do I make the “1.9.2” Ruby string point to the final release with RVM?

I'm using RVM to manage my Ruby environment on OSX, and currently it's interpreting '1.9.2' as ruby-1.9.2-rc2 instead of the final release. How can I update this to make it behave as expected?
2
votes
1answer
3k views

Bash Commands not working on Mac

Hello I open my terminal window on Mac Os 10.6.8 as I am trying to update my ruby to 1.9.3 and the terminal gives me this response immediately as I open it: -bash: export: /Library/Frameworks/Python....
2
votes
1answer
773 views

Why doesn't Ruby's configure script detect my executables and header files?

I'm trying to compile Ruby and really understanding what's going on while doing so. I've used and written Makefiles before, but not autoconf's configure.in files, so maybe the result I'm getting is by ...
2
votes
0answers
494 views

x64_mingw not a valid platform - Rails 5

Bluehost Shared Server ruby -v 2.2.2 rails -v 5.0.0.1 gem -v 2.4.5 ~/.bashrc export HPATH=$HOME export GEM_HOME=$HPATH/ruby/gems export GEM_PATH=$GEM_HOME:/lib64/ruby/gems/1.9.3 export GEM_CACHE=$...
2
votes
0answers
258 views

Metasploit ruby “bad interpreter: Permission denied”

When I'm typing in my terminal msfconsole I got something like this: bash: /usr/bin/msfconsole: /usr/share/metasploit-framework/ruby: bad interpreter: Permission denied ls -l /usr/share/metasploit-...
2
votes
1answer
633 views

Can using chcon to essentially bypass selinux be less secure than setting selinux to permissive?

I was wondering if it is possible to make a CentOS 7 server less secure by using chcon than it would be if SELinux were in Permissive mode. I am essentially trying to set up Phusion Passenger with ...
2
votes
1answer
348 views

EACCESS err while installing thin

I am trying to install thin in linux mint 17. I have installed ruby via rvm . I have already install the thin gem. When I ran thin install I got this error Installing thin service at /etc/init.d/...