How to reset compressed assets in rails after config update - ruby-on-rails-3

I have an issue with rails assets. First time I've run it on prod with
config.assets.compress = true.
Now I want to get uncompressed assets for better debug options, but after config update and server restart still have single file for css and js.
Also remove cache manually with no effect with this:
rm -rf tmp/cache/assets/{*,.*}
What part I miss?

There is a rake task to clean the assets, I think this removes the public/assets dir
rake assets:clean

Related

Get typescript-eslint to detect single run mode in yarn repository

I have been running into Out Of Memory errors with typescript-eslint in a monorepo with ~20 TypeScript projects. This is a known issue and one of the mitigations is to enable single run detection with the parserOptions.allowAutomaticSingleRunInference = true option. This doesn't appear to ever trigger in a yarn managed repository though. Looking at the source, will this ever work? It seems like because yarn runs in a /tmp directory it will never match the file path to detect single run mode:
$ yarn exec which eslint
/tmp/xfs-3826b2c0/eslint

NPX create-react-app creating other folders

So whenever i use
npx create-react-app my-app
it generates outside the folder "my-app" a lot of others folders such as _locks, _npx, _cacache and a json file named anonymous-cli-metrics.
I tried changing the cache location, but I couldn't do it, I want to use the command without creating these files does anyone know how to solve it?
I've also had this same problem. You should install your nodejs on your c:/ directory. Uninstall nodejs and remove cache files and remove the PATH variable and reinstall it in your C:/ directory.
Another possible problem is with chocolatey, if you've installed along with nodejs you should remove that also and do a fresh install on your root directory
Or try setting yout npm cache to,
npm config set cache C:\cache

Duplicate assets after deployment of app in Heroku

I'm very new with rails development and deployment using Heroku.
So recently I found that some JavaScript files that seems to be duplicated. For example I made a javascript function in one file (sample.js), then I erased this file, and I put the function inside of application.js.
Under my test development, it works perfect. But then when I commit the changes to heroku, I end up having the same function twice!
The javascript files are under the folder /app/assets/javascripts/
So how can I tell heroku to remove the duplicate files?
Am I missing some step before sending new version of my app to heroku?
Any help will be greatly appreciated
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
Rails 3.1.0
You're only deleting files from the repo when you use the git rm command. Even if you delete the actual file, it's still in the repo, and won't be changed by the git add -f * command (which only adds changed files).
You should be able to remove the file from heroku by running these commands:
$ git rm app/assets/javascripts/sample.js
$ git commit -m 'your commit message'
$ git push heroku master

The --deployment flag requires a Gemfile.lock

I have spent couple of hours but unable to solve this problem.
When I try to deploy my local rails app to production server using capistrano I get the below error:
The --deployment flag requires a Gemfile.lock. Please make sure you have checked your Gemfile.lock into version control before deploying.
Any idea on how to solve this?
My rails application folder is under version control using Git. I have pushed the local git repo to github and the Gemfile.lock is there on github. So it is under version control. However capistrano continues to give the same error.
Deploy.rb file: https://gist.github.com/brahmadpk/4748991
Remove BUNDLE_FROZEN: "true" from .bundle/config file and run bundle again.
Make sure there is nothing in the releases folder that is not a release. See this comment on a bundler issue for more details.
This blogpost titled Capistrano Deployment Trouble explains the same issue.
EDIT TO INCLUDE CONCLUSION FROM DISCUSSION IN COMMENTS
The deploy_to param was not set to an absolute path; hence capistrano wasn't able to find the folder to deploy, causing this error message.
I solve this with:
set :bundle_gemfile, "your_app_name/Gemfile"
in the deploy.rb
Run bundle and add your Gemfile.lock to your version control.
I had the same problem, even though I had no files or folders in the releases folder. Turned out it was a silly little thing: the gemfile.lock file in my repo was in lowercase for some reason, while capistrano needs Gemfile.lock with a capital G.
This is how I solved it:
Delete gemfile.lock
Delete gemfile.lock from you repo (git rm ...)
run bundle install
add the new Gemfile.lock file to your repo: git add Gemfile.lock
remove the folders from the server (don't know if this is really needed, did it anyway)
deploy
After adding bundle config unset deployment this line in the terminal, bundle install started working again for me.
I am getting exactly the same problem.
There is nothing in my releases folder (at all - my deploy cold keeps rolling back).
My gemfile.lock is checked in to Subversion.
I get:
** [out :: localhost] The --deployment flag requires a Gemfile.lock. Please make sure you have checked your Gemfile.lock into version control before deploying.
Is there any way to stop the rollback so that I can see what the releases folder looks like at the time it tries to run
cd /var/qlarity/releases/20130222003607 && bundle install --gemfile /var/qlarity/releases/20130222003607/Gemfile --path /var/qlarity/shared/bundle --deployment --quiet --without development test
Later....
I found that I could prevent the rollback by commenting out the code as shown from
gems\capistrano-2.14.1\lib\capistrano\recipes\deploy.rb
task :update_code, :except => { :no_release => true } do
# on_rollback { run "rm -rf #{release_path}; true" }
strategy.deploy!
finalize_update
end
This enabled me to examine my releases folder and sure enough, there was no Gemfile.lock in it. Turns out I have ended up with an unnecessary folder in my Rails project file structure so that instead of
myapp/trunk/app
myapp/trunk/config
...
myapp/trunk/Gemfile
I had
myapp/trunk/myapp/app
myapp/trunk/myapp/config
...
myapp/trunk/myapp/Gemfile
This meant I ended up with a folder containing my Gemfile
releases/nnnn/myapp
and bundle was looking for Gemfile in
releases/nnnn
When I changed my Capistrano config from
deploy.rb
set :repository, "file:///D:/_SVN//myapp/trunk"
to
deploy.rb
set :repository, "file:///D:/_SVN//myapp/trunk/myapp"
now all is good. Really should look at fixing the folder structure next!

Do I have to run rake assets:clean before rake assets:precompile?

I deploy code to my production server using git. This might include changes to JS and CSS files.
Do I have to run rake assets:clean at all before I run rake assets:precompile? I'm worried that not cleaning the previous precompiled assets might have side effects.
This is a little silly, but my google-fu didn't find any answers. My AWS instance runs rake assets:clean pretty slowly and I'm wondering if it's needed at all.
Also, can I replace the clean command with a simple rm -r public/assets?
No you do not need to run rake assets:clean before, just running rake assets:precompile will recompile your assets. It will recreate your cache busting digest and manifest.yml (which contains key/value mappings that match each asset name to its MD5 cache-busted name)
and yes you can just run rm -r public/assets