rails and rmagick and webfaction - rmagick

I am having a problem loading imagemagick and rmagick on webfaction.
I have installed a rails app called Balderapp that organizes images.
I can't seem to upload the image through balder.
Balder uses imagemagick and rmagick
when i use the console and do this I get a nill as a return making me think rmagick is not working
irb(main):003:0> require 'RMagick'
=> nil
thx
sg

The general steps are:
Install ImageMagick from source in your home directory.
Install the RMagick gem, linked to the ImageMagick libraries that you built in step 1.
Detailed steps are available in WebFaction's procedure for installing ImageMagick and RMagick.

On Web faction make sure your are in the correct folder cd $HOME/webapps/app app is the name of your app. Make sure the rmagick gem is installed ./bin/gem list
in ./bin/irb then this should work:
require 'rubygems'
require 'RMagick'
if you are using ruby 1.8.* then do not forget to do the require 'rubygems'

Related

RuntimeError: Ninja is required to load C++ extensions

I've downloaded an implementation of stylegan2 from the following github:
I added the path to my PYTHONPATH variable and now when importing their models I get the following error:
RuntimeError: Ninja is required to load C++ extensions
I'm working on our University computers, it seems that cpp_extension.py is only looking for an installation of ninja that is local under /usr/local/bin however I don't have the permissions to install anything there.
I was able to use pip to install Ninja on my virtual environment. Is there any possible way of having this piece of code use ninja from there?
Thanks
try
pip install ninja
it works for me
https://github.com/NVlabs/stylegan2-ada-pytorch/issues/39#issuecomment-900970462

Is there a way to install a rubygem manually without accessing rubygems.org?

So i have this IPv6 thingy issue where i can't access rubygems and connection times out before it gets to use IPv4. One way or another i managed to install rubygems and when i type -v it all checks out. Now i need Jekyll and Jekyll-paginate-v2. I tried gem install jekyll and it didn't work for reasons stated above. Strangely enough i was able to install Jekyll via sudo apt install jekyll. Tried that with jekyll-paginate-v2 but there's no such option. So is there any way to install it without using gem command?
ok so i found a way of solving this issue.
to install a gem you need a .gem file and since you can't access rubygems.org we will get it from github. just go to your gem's github page, download it and then open bash in that directory, type gem build gemname.gemspec and it will create a .gem file in this directory. after that just use gem install --local gemname.gem and that's it.

How to instal modules with Drupal 8 and Composer?

I installed Drupal 8 via composer with:
composer create-project drupal-composer/drupal-project:8.x-dev my_site --stability dev --no-interaction
This downloaded all the files and run composer install. According to this tutorial - https://www.drupal.org/node/2718229 - doing so this way will also configure composer.json to allow installation of modules, themes etc too via composer. Nice
However, I'm trying to install a new module:
$ composer require drupal/codesnippet
Using version ^1.6 for drupal/codesnippet
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing drupal/codesnippet (1.6.0)
Downloading: 100%
Writing lock file
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles
However, when I go to Admin Bar > Extend > Install new module, I can search for the module and it says it's not installed yet. If I try to enable/install it from there it tells me I need to download and copy to the /libraries directory:
Before you can use the CKEditor CodeSnippet module, you need to download the codesnippet plugin from ckeditor.com and place it in /libraries/codesnippet. Check the README.txt for more information. Get the plugin here. (Currently using CodeSnippet version Plugin not detected)
Are these two completely different methods? How can I complete the installation with composer of this module?
Composer is a dependency manager, and whether or not third-party dependencies are included depends on how the module author managed their dependencies in the first place.
You aren't going to be able to complete the install via Composer alone, if a specific dependency isn't present on the repository that Composer downloads its packages from.
You're going to have to download the CKEditor CodeSnippet module from ckeditor.com. Composer can't manage that dependency for you, because that CKEditor plugin isn't a Composer package.
You can download it here: http://ckeditor.com/addon/codesnippet
Martyn, I guess you are confusing two different things into the same one: the drupal module and the external library required by the module.
The Drupal module codesnippet (https://www.drupal.org/project/codesnippet) is just a drupal integration module for the CKeditor addon with the same name, which you can download it (http://download.ckeditor.com/codesnippet/releases/codesnippet_4.6.2.zip) and place it in the drupal webroot /libraries folder manually (in your case my_site/web/libraries/ to be more specific - you have to create it if does not exist already).
Then you should be able to enable the drupal module.
PS: You could also add the library requirement in the composer.json library manually, which might be just a bit more complicated for beginners, because you also have to manually specify other things like a repository type, url and installer-paths for the extra external library that you need , but might be easier in the long run to deploy new Drupal8 installations with the same requirements just with a proper main composer.json file, without the need to go and manually download external libraries. There is a similar comment of mine(user zet) that you could read on this drupal dropzonejs module issue https://www.drupal.org/node/2853274

packaging jruby gems in self contained jar

I'm trying to package compass/sass into a self-contained jar so that I can use compass without installing jruby.
I installed jruby and warbler on a Windows7 machine, running Java 1.6.0_37
I created a folder, named it jrcompass, then installed compass into it, i.e.
jruby -S gem install compass -i .
then I ran in it:
jruby -S warble
which created a file named jrcompass.jar of about ~20MB in size. so far so good.
problem is that when I try to execute the jar I get an error message (below). it seemed from the error that jruby.home was not set, so I passed it as a property in the command line and that worked, but it defeats the purpose of having a self-contained jar.
if I try to pass . as jruby.home then I get an error that it can't find rubygems
any help would be appreciated. TIA.
C:\Apps\test\jrcompass>java -jar jrcompass.jar
Gem::LoadError: Could not find compass (>= 0) amongst [rake-0.9.2.2]
to_specs at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/dependency.rb:247
to_spec at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/dependency.rb:256
gem at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems.rb:1231
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/jrcompass/bin/compass:22
load at org/jruby/RubyKernel.java:1046
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/META-INF/main.rb:1
require at org/jruby/RubyKernel.java:1027
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/META-INF/main.rb:1
(root) at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1

Sqlite-3 error while running ROR application

When i try to run Ruby on Rails application.... i facing the following error
symbol lookup error: /home/user/.rvm/gems/ruby-1.9.2-preview3/gems/sqlite3-ruby-1.3.0/lib/sqlite3/sqlite3_native.so: undefined symbol: sqlite3_initialize
I don't know whats the error exactly. can any one please help me out this......
I had the same issue this morning after upgrading sqlite3-ruby to 1.3.0. A quick fix is to uninstall 1.3.0 and ensure 1.2.5 is installed:
gem uninstall sqlite3-ruby --version 1.3.0
gem install sqlite3-ruby --version 1.2.5
The better option is to set your gem config to ignore 1.3.0. For Rails 2.x, in config/environment.rb:
config.gem 'sqlite3-ruby', :lib => 'sqlite3', :version => '!= 1.3.0'
or if you want it play it really safe, explicitly pull in 1.2.5:
config.gem 'sqlite3-ruby', :lib => 'sqlite3', :version => '1.2.5'
If you lock your gemfile to sqlite3-ruby you will have problems starting your application on recent Rails versions since Rails wants to have the gem named "sqlite3". The real solution to this problem is to ensure that the .bundle file that the gem creates indeed links to the right sqlite3 libraries.
By default, sqlite3 gem will link to a nonexisting library in your /usr/lib. This is NOT right. What you need to do is set the compliation options straight for your system and reinstall the sqlite3 gem, and you can easily do this using
$bundle config
Their manpage specifies what it does, but this is the command that I needed to do (I have a roll-your-own SQLite install from their site, not via brew or macports).
$bundle config build.sqlite3 --with-sqlite3-include=/usr/local/include --with-sqlite3-lib=/usr/local/lib
This will always feed the right options to the gem when you try to "bundle install" it and your gem will build properly.
Note that this problem is kinda sneaky in that it will not occur on Ruby 1.9 - apparently rbconfig there has been updated and does better library lookup. But when you are going for 1.8 compatibility - use this bundle configuration and you will be all set.
I'm had the same issue on my Dreamhost server:
> bundle exec rails c
ruby: symbol lookup error: /home/user/settings/installs/rubygems/gems/gems/sqlite3-ruby-1.3.0/lib/sqlite3/sqlite3_native.so: undefined symbol: sqlite3_initialize
I downloaded and installed SQLite3 manually in my home directory, and added LD_LIBRARY_PATH to my .bashrc. This fixed the Rails console issue.
However, I still haven't gotten the app to launch in passenger yet, I'm still working on it.
Ruby Enterprise Edition installs the sqlite3 gem automatically, and 1.3.0 seems to be the problem.
If your Rails app doesn't need sqlite3, try uninstalling the gem and restarting your app.
sudo gem uninstall sqlite3

Resources