Monday, May 25, 2015

executing apm with atom on windows

If you have installed atom via chocolatey,
the default path to apm for atom is located in

C:\Users\yourname\AppData\Local\atom\app-0.201.0\resources\app\apm\bin


Thursday, May 21, 2015

deploying to production via capistrano with passenger and sub uri

due to digested assets requirement in production environment,
the url of images cannot be use in relative to path to css file.

example normal assets:
/assets/frontend/all.css

example of digested assets

/assets/all.XXX.css

due to this, the only way to accurately point to images in css is to add relative path to the url.
one way todo it is to use ENV['RAILS_RELATIVE_URL_ROOT'],
first, you will need to change .css file to .css.erb.
and add in <%=ENV['RAILS_RELATIVE_URL_ROOT']%> to the url path.
example: background-image: url('<%=ENV['RAILS_RELATIVE_URL_ROOT']%>/img/logo.png');

but since we are precompiling via capistrano, it is a must to add this environment into deploy/production.rb
example:
set :bundle_flags, '--deployment' # set this to ensure traces of assets compilation can be shown via --trace
set :default_env, {
  'RAILS_RELATIVE_URL_ROOT' => '/shop'
}

and then run:
cap production deploy --trace

took me hours to try to figure all the issues in place to resolve this.
hope it helps you :)