I've got a Rails 3.2 app with capistrano 2 installed and I have a number of submodules. I just moved vendor/assets/javascripts/ui-utils to a submodule.
[submodule "app/assets/javascripts/jquery.autotab"]
path = app/assets/javascripts/jquery.autotab
url = git@github.com:map7/jquery.autotab.git
[submodule "app/assets/javascripts/jquery.overdrive"]
path = app/assets/javascripts/jquery.overdrive
url = git@github.com:map7/jquery.overdrive.git
[submodule "app/assets/javascripts/jquery.validationEngine"]
path = app/assets/javascripts/jquery.validationEngine
url = https://github.com/posabsolute/jQuery-Validation-Engine.git
[submodule "app/assets/javascripts/keymaster"]
path = app/assets/javascripts/keymaster
url = git@github.com:map7/keymaster.git
[submodule "vendor/assets/javascripts/ui-utils"]
path = vendor/assets/javascripts/ui-utils
url = github.com:/map7/ui-utils.git
It's only the bottom submodule which I'm having trouble with. Could this be because it's in the vendor/assets area?
Now when I do a cap deploy
I get the following error
* executing "cd -- /srv/pais/releases/20140630042430 && RAILS_ENV=production RAILS_GROUPS=assets env RBENV_ROOT=\"/usr/local/rbenv\" PATH=\"/usr/local/rbenv/shims:/usr/local/rbenv/bin:$PATH\" RBENV_VERSION=\"2.1.1\" /usr/local/rbenv/bin/rbenv exec bundle exec rake assets:precompile"
** [out :: staging.pais.com.au] rake aborted!
** [out :: staging.pais.com.au] Sprockets::FileNotFound: couldn't find file 'ui-utils/modules/keypress/keypress.js'
** [out :: staging.pais.com.au] (in /srv/pais/releases/20140630042430/app/assets/javascripts/application.js:42)
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:102:in `resolve'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:142:in `require_asset'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/directive_processor.rb:215:in `process_require_directive'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/directive_processor.rb:165:in `block in process_directives'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/directive_processor.rb:163:in `each'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/directive_processor.rb:163:in `process_directives'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/directive_processor.rb:97:in `evaluate'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:193:in `block in evaluate'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `each'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `evaluate'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:12:in `initialize'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:249:in `new'
** [out :: staging.pais.com.au] /srv/pais/shared/bundle/ruby/2.1.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:249:in `block in build_asset'
On my development machine this file does exist and works.
I've tried putting the following into my deploy.rb with no luck
set :git_enable_submodules, 1 # Get submodules
set :git_submodules_recursive, true
namespace :git do
desc "Init & update submodules"
task :update_submodules, :roles => :app do
run("cd #{release_path} && git submodule init && git submodule update")
end
end
before "deploy:assets:precompile", "git:update_submodules"
Update 30/06/14
Noticed that if I go to any of the other submodules and type git status
then I get the following;
# On branch master
# Your branch is up-to-date with 'origin/master'.
#
nothing to commit, working directory clean
If I go to my ui-utils submodule and type git status
I get
# HEAD detached at 4e86ac7
nothing to commit, working directory clean
I'm running git version 1.9.1, if I run the following
git submodule deinit -f vendor/assets/javascripts/ui-utils
Then try adding it again using
git submodule add git@github.com:map7/ui-utils.git vendor/assets/javascripts/ui-utils
I get the following error
A git directory for 'vendor/assets/javascripts/ui-utils' is found locally with remote(s):
origin https://github.com/map7/ui-utils.git
If you want to reuse this local git directory instead of cloning again from
git@github.com:map7/ui-utils.git
use the '--force' option. If the local git directory is not the correct repo
or you are unsure what this means choose another name with the '--name' option.
Update
I managed to remove the vendor/assets/javascripts/ui-utils from git completely by following How do I remove a submodule?
I've now added it again through submodule and now it's like the other submodules but I still get the deploy problem.
Update
If I use cap --debug deploy
and stop it just before the error, then I ssh over to my server and do a git status I can see some problems with the submodule and capistrano on the server;
git status
# On branch deploy
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# (commit or discard the untracked or modified content in submodules)
#
# deleted: log/searchd.test.pid
# modified: vendor/assets/javascripts/ui-utils (modified content)
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# REVISION
# app/assets/javascripts/jquery.autotab/
# log
no changes added to commit (use "git add" and/or "git commit -a")