4

When I call any of the Capifony database functions, cap database:move:to_remote for example, I get the following ruby error:

jeremykendall@isr-thinkpad-420s:~/dev/sites/app$ cap develop database:move:to_remote
    triggering load callbacks
* executing `develop'
    triggering start callbacks for `database:move:to_remote'
* executing `multistage:ensure'
* executing `database:move:to_remote'
* executing `database:dump:local'
/home/jeremykendall/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- FileUtils (LoadError)
        from /home/jeremykendall/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capifony-2.1.5/lib/symfony2.rb:101:in `block (3 levels) in load'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capifony-2.1.5/lib/symfony2.rb:159:in `block (3 levels) in load'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/execute.rb:45:in `each'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/execute.rb:34:in `execute!'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/execute.rb:14:in `execute'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/bin/cap:4:in `<top (required)>'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/bin/cap:19:in `load'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/bin/cap:19:in `<main>'

My deploy.rb:

set :stage_dir,       'app/config/deploy'
require 'capistrano/ext/multistage'
set :stages,          %w{production testing develop}

default_run_options[:pty] = true

set :application,     "appname"
set :deploy_to,       "/home/isr/sites/app"
set :deploy_via,      :remote_cache

set :scm,             :git
set :repository,      "git@github.com:jeremykendall/redacted.git"
set :user,            "isr"
set :use_sudo,        false

ssh_options[:forward_agent] = true

set :model_manager,   "doctrine"
set :keep_releases,   3
set :update_vendors,  true
set :shared_files,    ["app/config/parameters.yml", "app/config/parameters.ini"]
set :shared_children, [app_path + "/logs", app_path + "/cache", web_path + "/uploads", "vendor"]

My app/config/deploy/develop.rb

# Deploys to local vagrant box

set  :domain,           "192.168.33.10"
set  :symfony_env_prod, "dev"
set  :deploy_to,        "/home/vagrant/sites/app"
set  :branch,           "develop"
set  :user,             "vagrant"

role :web,              domain                   # Your HTTP server, Apache/etc
role :app,              domain                   # This may be the same as your `Web` server
role :db,               domain, :primary => true # This is where Rails migrations will run

What I've Tried

  • gem install fileutils
  • sudo aptitude install libfileutils-ocaml-dev (grasping at FileUtils straws)
  • gem update --system
  • gem update
Jeremy Kendall
  • 2,869
  • 17
  • 17

5 Answers5

9

Looks like it's a bug in capifony 2.1.5. Try grepping for require "FileUtils" and replacing with require "fileutils". That or maybe wait for the patch?

Daniel J. Pritchett
  • 1,061
  • 11
  • 18
4

You'll find that require 'FileUtils' will generally work on Mac OS X, however it is supposed to be lowercase fileutils. The problem is that most use Mac OS X with case insensitive filesystems and therefore when you deploy or move over to linux or other filesystems such as ZFS with case sensitivity turned on, it will fail.

ylluminate
  • 12,102
  • 17
  • 78
  • 152
  • This is the problem I am facing, working on Ubuntu and os x. But what is the solution? – Nino van Hooff Aug 07 '16 at 19:52
  • 1
    Hey thanks! I was facing the same issue on my build server. Replacing `require 'FileUtils'` by `require 'fileutils'` fixed the issue. – Andrew May 05 '17 at 17:48
2

Since FileUtils is part of corelib then it should be there in any ruby install, provided it could compile it when you installed ruby using RVM. I had similar problems myself with some of the corelibs not being there and it turned out I didn't have some of the dependencies installed when I compiled ruby with RVM.

These are the full requirements for all of the ruby corelib features plus a couple required by RVM. (Found using rvm requirements

apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core  zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev  autoconf libc6-dev ncurses-dev automake libtool bison subversion

Now, completely remove ruby and the sources then reinstall. (Otherwise it's possible that a previous configure option might not get unset and leave you in the same place)

rvm reinstall 1.9.3-p125
mpapis
  • 52,729
  • 14
  • 121
  • 158
vongrippen
  • 29
  • 1
  • 1
    No dice. I uninstalled all the ruby stuff I could find on my machine (via `dpkg -l | grep ruby`), uninstalled rvm with rvm implode, cleaned up all the associated rvm stuff, then reinstalled rvm. I checked the requirements, had them installed already, ran `rvm install 1.9.3`, created a named gemset for capifony, ran `gem install capifony`, tried to call one of the cap database functions, and got the **exact same error**. ARGH. – Jeremy Kendall Apr 12 '12 at 00:55
  • 1
    What happens if you fire up irb and type `require 'fileutils'`? It may be that it compiled correctly but your Capifony environment can't see it for some reason. I would make sure you can successfully `require 'fileutils'` before bothering with capifony at all. – Daniel J. Pritchett Apr 12 '12 at 01:54
  • 1
    `require 'fileutils'` returns `=> true`. – Jeremy Kendall Apr 12 '12 at 02:01
  • So you've got it compiled correctly and it's your capifony environment that's messed up. I hate to say this but you could consider trying it in `rbenv` instead. – Daniel J. Pritchett Apr 12 '12 at 02:02
  • 1
    But if I try `require 'FileUtils'` I get an error similar to my error report. – Jeremy Kendall Apr 12 '12 at 02:03
0

I had a somewhat similar error when attempting to gem install rails the other night, and it turned out I had erroneously trusted apt-get to get everything I needed.

I bet you're a little more careful than I am when it comes to installing packages and making sure they're actually what you want, but here's what I installed (roughly) that fixed it.

sudo apt-get install ruby-full build-essential

sudo aptitude install ruby build-essential libopenssl-ruby ruby1.8-dev

mdpatrick
  • 1,082
  • 9
  • 12
  • 1
    Thanks for the tips, man, but no dice. I had most of that installed already, and installing the other ruby libs didn't help. (I wasn't sure they would as I'm using rvm) – Jeremy Kendall Apr 11 '12 at 15:19
0

you have a gem for symphony deployment, it is automatically added to your deployment:

gem uninstall capifony

use gemsets or bundler exec capistrano ... to solve this

mpapis
  • 52,729
  • 14
  • 121
  • 158
  • I was using an rvm named gemset in the first place (AFAIK). After following vongrippen's suggestions, I created a new named gemset and tried again. Same exact issue. – Jeremy Kendall Apr 12 '12 at 00:59
  • but did you uninstalled capifony ? the error message has to change if there is no capifony, can you paste new error ? – mpapis Apr 12 '12 at 03:16
  • It was the very same error. Turns out it's a bug in Capifony. There are two pull requests pending related to this. – Jeremy Kendall Apr 12 '12 at 03:25