How can I get SASS/Compass into the DDEV web container? - ruby

A client needs Compass for SASS compilation inside the DDEV-Local web container. How can I get compass in there?

Compass requires ruby and rubygems, and rubygems requires a full build environment to build compass. (See http://compass-style.org/install/)
You can get all that with a .ddev/web-build/Dockerfile like this:
ARG BASE_IMAGE
FROM $BASE_IMAGE
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests build-essential ruby-full rubygems
RUN gem install compass
A slightly smaller approach would be to just add webimage_extra_packages: [ ruby-full, rubygems, build-essential ] to your .ddev/config.yaml and then use ddev exec sudo gem install compass when you need compass.

Related

Can't install gosu gem

I am trying to install gosu gem using docker but I am getting the following error:
/usr/local/bundle/gems/gosu-1.4.5/lib/gosu.so: warning: undefining the allocator of T_DATA class swig_runtime_data
/usr/local/bundle/gems/gosu-1.4.5/lib/gosu/swig_patches.rb:18:in `initialize': Could not initialize SDL Video: No available video device (RuntimeError)
I have tried modifying the dockerfile or installing additional libraries
For example:
ENV XDG_RUNTIME_DIR=/tmp
or
apt install xorg-dev
Here is my Dockerfile
from ruby:latest
WORKDIR /usr/src/app
COPY . .
RUN apt-get update && apt-get -qq -y install curl && apt-get install -y build-essential libsdl2-dev libgl1-mesa-dev libopenal-dev libgmp-dev libfontconfig1-dev xorg-dev && gem install gosu
ENV XDG_RUNTIME_DIR=/tmp
EXPOSE 3000
It depends on the SDL library to display graphics. Add this to docker file,
RUN apt-get update && apt-get install -y libsdl2-dev
RUN gem install gosu
Refer this for the set of libraries to be further added for docker if the above command don't solve the issue. unable to install Gosu library in Ruby in Linux .

I want to run wpscan on Ubuntu vps server, but getting ruby errors

Firstly i installed wpscan on ubuntu by following these methods
apt-get install git
sudo apt-get install libcurl4-openssl-dev libxml2 libxml2-dev libxslt1-dev ruby-dev build-essential libgmp-dev zlib1g-dev
git clone https://github.com/wpscanteam/wpscan.git
cd wpscan
sudo gem install bundler && bundle install --without test development
Then when i run it by typing ruby wpscan.rb
it said
Could not find ffi-1.9.18 in any of the sources
Run `bundle install` to install missing gems.
when i run bundle install i got that output
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.4.0/gems/ffi-1.9.18 for
inspection.
Results logged to
/var/lib/gems/2.4.0/extensions/x86_64-linux/2.4.0/ffi-1.9.18/gem_make.out
An error occurred while installing ffi (1.9.18), and Bundler cannot
continue.
Make sure that `gem install ffi -v '1.9.18'` succeeds before bundling.
In Gemfile:
typhoeus was resolved to 1.3.0, which depends on
ethon was resolved to 0.10.1, which depends on
Help will be appreciated , thanks
INSTALL RMV
Pre-requisites
sudo apt-get install software-properties-common
Add the PPA and install the package
sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt-get update
sudo apt-get install rvm
sudo usermod -a -G rvm $USER
Change your terminal window
At terminal window, click Edit > Profile Preferences, click on Title and Command tab and check Run command as login shell.
Edit Profile
3.Reboot
A lot of changes were made (scripts that needs to be reloaded, you're now member of rvm group) and in order to properly get all them working, you need to reboot (in most cases a logout/login is enough, but in some Ubuntu derivatives or some terminal emulators, a shell login is not performed, so we advise to reboot).
Enable local gemsets
Now enable local gemsets. Open a terminal (Ctrl+Alt+T) and run:
rvm user gemsets
Install a ruby
Now you're ready to install rubies. Open a terminal (Ctrl+Alt+T) and run:
rvm install ruby
RVM Usage
man rvm
INSTALL - WPSCAN
From RubyGems
gem install wpscan
You can update the local database by using
wpscan --update
Enumerating usernames
wpscan --url https://target.tld/ --enumerate u
Enumerating a range of usernames
wpscan --url https://target.tld/ --enumerate u1-100
Doc>> https://github.com/wpscanteam/wpscan/wiki/WPScan-User-Documentation

Installing Compass & Susy on Ubuntu 12.04

I'm trying to install Compass and Susy on my Ubuntu 12.04.
What I have tried are the following steps on the console:
sudo apt-get install rubygems1.8
sudo gem install rubygems-update # Instead of sudo gem update --system
sudo update_rubygems
sudo gem install compass # Installing Compass & Sass
sudo gem install susy
So the gems are installed and will be listed when I do the following command:
gem list
But now, when I try to create a new compass project with
compass create project
I get the following error:
/usr/local/bin/compass: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory
My current ruby version is 1.8.7. So I installed ruby 1.9.1 and get it working.
The console still says the current ruby version is 1.8.7
My question: Do I have to run with both ruby versions to get that working? Is there another way under ubuntu? It's working, I know, but it's a bit confusing.
Using Ubuntu's package manager for multiple ruby versions is a bit of a lost cause.
Most people use rvm, which allows you to install and switch between multiple rubies very easily.
Other popular options are rbenv and chruby. It's just a question of personal preference, but I'd say that rvm has the slight edge for beginners.
Also, I wouldn't recommend installing ruby 1.9.1 - it's best to use 1.9.3 as there are some compatibility issues with other 1.9.x versions.
You can then install compass and sass via ruby gems (rather than aptitude):
$ gem install compass
$ gem install sass
This simple command works on ubuntu 14.10
sudo apt-get install ruby-compass
RVM is awesome and really easy to install. I managed to install rvm, compass, and sass with these commands in my terminal:
Firstly:
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled --ruby=1.9.3
This will instal rvm, it will put a command in ~/.bash_profile to load rvm automatically, except this isn't what Ubuntu uses so put this line into your ~/.bashrc file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Then simply run:
gem install compass
gem install susy #(or sass)
Install build-essentials and ruby-dev packages to install compass without errors.
sudo apt-get install build-essential
sudo apt-get install ruby
sudo apt-get install ruby-dev
sudo gem install compass
Masterchief's answer is close, but didn't work for me. This web page provided a clear and reliably working way to install rvm on my ubuntu server instance: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

Why am I getting a command not found for Padrino?

EDIT: This seems to work on my CentOS machine but not my Ubuntu box.
$ which gem
/usr/bin/gem
$ which padrino
/usr/bin/padrino
$ which padrino-gen
/usr/bin/padrino-gen
I started playing with Sinatra but when I started thinking about some admin/authentication support I was lead to Padrino.
Problem is as follows.
I ran:
sudo gem install padrino
but then when I ran the create command, I got a command not found issue:
$ padrino g project demo-app
padrino: command not found
This seems to work in my directory where I created my heroku app because there's a gemfile there so I can run bundle exec before the padrino command. But shouldn't I be able to create a padrino project without a gemfile??
I faced the same issue and the following helped me out:
Simply just restarted my terminal.
If it is not feasible in your case, try to source your .bashrc/.bash_profile.
Environment managers like rbenv, rvm unfortunately require this step.
pretty strange, try with:
sudo gem install padrino-gen
If doesn't help try to directly
padrino-gen project demo-app
this worked for me in Ubuntu 11.04
# Setup Ubuntu LTS 10.4
sudo apt-get install ruby
sudo apt-get install ruby-dev
sudo apt-get install sqlite
sudo apt-get install libsqlite3-dev
sudo apt-get install irb
sudo apt-get install rdoc
sudo apt-get install libopenssl-ruby
sudo apt-get install g++
wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
>tar zxvf rubygems-1.3.6.tgz
cd rubygems-1.3.6
sudo ruby setup.rb
sudo gem1.8 install rake rspec padrino --no-ri --no-rdoc
padrino g project foo -d activerecord -b
padrino g admin
padrino rake ar:setup
ref: https://gist.github.com/1016133
I had this same problem, and fixed it by copying this command from the .bash_profile file which was created when I installed RVM, and adding it to the end of my .bashrc:
source "$HOME/.rvm/scripts/rvm"

Ruby: Installing rmagick on Ubuntu

I'm trying to get RMagick setup on Ubuntu 10.04. Looked here but had no joy. I even compiled and installed ImageMagick from source, but the instructions here still didn't help me when I try to install RMagick using RubyGems. I got this error:
carcher#carcher-laptop:~/Code/temp/RMagick-2.13.1$ sudo gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
carcher#carcher-laptop:~/Code/temp/RMagick-2.13.1$
What does it all mean? :) I'm new to Ruby and RubyGems so please be gentle. My setup is as follows:
Ruby: 1.8.7
RubyGems: 1.3.7
I'm pretty much out of ideas (and tired too!). I tired to compile RMagick from source using the link above but it failed as there was no ./configure script :(
Any and all help appreciated!
Install the packages imagemagick and libmagickwand-dev (or libmagick9-dev). You should then be able to install the Rmagick Gem.
sudo apt-get install imagemagick libmagickwand-dev
If not, you are missing ruby related development packages like build-essential and ruby1.8-dev. If that's the case, a generic "ubuntu install ruby 1.8" query in google should sort you out.
You don't need a lot of the other junk in these answers, just:
sudo apt-get install libmagickwand-dev
On Ubuntu 12.04 libmagick9-dev is gone. graphicsmagick-libmagick-dev-compat should be used instead.
apt-get install graphicsmagick-libmagick-dev-compat
On Ubuntu 15.04, what solved it for me was to remove all previous *magick installations, reinstall required packages and then symlink the config file:
sudo apt-get purge graphicsmagick graphicsmagick-dbg imagemagick-common imagemagick imagemagick-6.q16 libmagickcore-6-headers libmagickwand-dev graphicsmagick-libmagick-dev-compat
sudo apt-get autoremove
sudo apt-get install imagemagick libmagickwand-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
gem install rmagick
In Ubuntu 14.04
Below code is worked for me
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
Then,
gem install rmagick
On Ubuntu 12.0.4.2 sudo apt-get install libmagickwand-dev libmagickcore-dev libmagickcore4-extra libgraphviz-dev libgvc5 worked for me.
graphicsmagick-libmagick-dev-compat installed but didn't include the header files so rmagick wouldn't compile.
Please note, you need to remove graphicsmagick-libmagick-dev-compat before running the command above.
this worked for me...
sudo apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev
gem install rmagick
...
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
(ubuntu 12.0.4 64bit)
You got message extconf.rb:1:in 'require': no such file to load -- mkmf (LoadError) because package ruby1.8-dev isn't installed. Install it (sudo apt-get install ruby1.8-dev) and try again.
In Ubuntu 13.10
This code worked for me
sudo apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev
gem install rmagick
To get bundle to stop failing on ubuntu 12.04.
apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev
This is my gemfile
gem 'rmagick'
gem 'mini_magick'
On Ubuntu, you can run:
sudo apt-get install libmagickwand-dev
On Centos, you can run:
sudo yum install gcc ImageMagick-devel make which
Then install
gem install rmagick
If you want to try installing the native deb package instead of the gem, be aware that the librmagick-ruby was broken on Ubuntu 10.04 until just very recently:
https://bugs.launchpad.net/ubuntu/+source/librmagick-ruby/+bug/518122
See comment #17 in particular. I believe this has already been fixed so now apt-get install librmagick-ruby might "just work". Otherwise here's how to build it yourself from source
$ cd /usr/src
$ sudo apt-get build-dep librmagick-ruby
$ sudo apt-get source librmagick-ruby
$ cd librmagick-ruby-2.11.1
$ sudo dch -i
(add changelog entry)
$ sudo dpkg-buildpackage
$ cd ..
$ sudo dpkg -i librmagick-ruby*.deb
In ubuntu 16.04.3:
This i worked:
sudo apt install imagemagick imagemagick-6.q16
It means this installed imagemagick then you can run RMagick.
If you are using Linux then simply run these commands.
sudo apt-get install imagemagick libmagickwand-dev
and then
bundle install
Hope this will resolve your issue.
And if you are using mac then simply run following commands
First of all unlink your installed imagemagick which was not properly installed in latest mac high sierra by using.
brew unlink imagemagick
then install latest imagemagic6 using below command
brew install imagemagick#6 && brew link imagemagick#6 --force
Then install gem rmagick using below command
gem install rmagick
bundle install
It will work perfectly fine.
Follow below 3 steps proven on UBUNTU 16.04
sudo apt-get install build-essential imagemagick libmagickwand-dev
#In .bashrc or .bash_profile add below code. Just check the ImageMagick dir name.
export PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"
gem install rmagic #Install Gem

Resources