Running Comparison Tests in Rails - ruby-on-rails

I'm working on my copy of project XYZ; and Bob is working on his copy of project XYZ as well.
Bobs project has a few minute changes than mine; only I don't know where they are.
Other than using github, how can I run and compare my folder against someone else's, and see all of the differences between the two? Is there a way to do this in terminal locally?
Thanks!

If you are in Linux run this command
$ diff dir1 dir2
This will show the list of differences between folders including difference in file contents.

Related

How to get rid of files which end in .Identifier in Laravel

I cloned a laravel-8 sail project via gitlab but everywhere in every folder which containing files there is a file which ends in .Identifier
I don't know where they come from. There may be 1000 files like this in the project.
My question is:
How can I get rid of those files which endr with .Identifier?
Is there some kind of Ubuntu or docker command that searches the entire project for such file which ends in .Identifier and then deletes them?
Maybe phpStorm has such a function?
If you are on Linux machine, then open terminal in you project folder and run rm *.Identifier. And if you are on Windows machine then open command prompt in your project folder and run del *.Identifier. This will do the trick for you.

Same VSCode-Settings for the whole crew?

We want to have the same VSCode settings for the whole crew of developers. Also it would be fine to have a oneline command to tear VSCode down and restart it from scratch with predefined settings and plugins so that you do not have to worry about trying out plugins and getting beck to the known state. Kind of Config-as-Code for VSCode.
I already found:
https://code.visualstudio.com/docs/editor/extension-gallery#_command-line-extension-management
https://github.com/microsoft/vscode-dev-containers
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync&ssr=false#qna
https://github.com/gantsign/ansible-role-visual-studio-code-extensions
https://code.visualstudio.com/docs/remote/containers
https://github.com/gantsign/ansible-role-visual-studio-code
But non of these provides a good solution to me
We are using Mac and Windows machines and develop most of the time locally (not remotely in the cloud or the like).
I imagine like having a script like
.... projectname up
or
.... projectname reset
(or
.... projectname down)
to receive/reset the configured settings and newest plugins that have been configured for the project.
Have any ideas or use a similar solution already?
After doing a lot of research, playing with Docker, Ansible and so on... it seems that although I excluded it at first the plugin Settings Sync Plugin from Shan Khan is the way to go. It has round about 1 million installs!
Only dependency - you need a GitHub account to host your configs. That is what held me back at first - but it should be not that much of a problem to get one for everyone in the team and connect it to like a company-github-account.
Copy the files settings.json and keybindings.json to your target machine(s) to copy the settings. You can find those files here:
Win: ~\AppData\Roaming\Code\User
Mac: ~/Library/Application Support/Code/User/
Linux: ~/.config/Code/User
You can copy extentions from ~/.vscode/extensions or C:\Users\username\.vscode\extensions from linux/mac or windows respectively.
FalcoGer's answer should explain how to copy the files in a way VS Code will pick them up. If you only need to copy the config files once, this solution would be fine.
If you need to "sync" these config files on a regular basis, I would advise to create a Git repository where all config files will be stored.
When cloning the repo to local machines, you can symlink the files to the config destinations (see FalcoGer's anwser). Then when you need to "sync", you only have to run git pull and restart VS Code to apply the changes.
For your other script-related question, you could create a CLI for this. Python would be the most friendly way to do this. You can find an example here.

gsutil path name not passed from the command line to the destination bucket

I have spotted an odd change to the Google SDK I cannot see any release notes about.
It appears somewhere between versions 4.28 and 4.34 the way path names are passed through the gsutil command have altered.
Before:
gsutil cp myfolder/myfile.csv gs://mybucket/
Would copy the file into a sub folder called gs://mybucket/myfolder
Now, with the latest version, it is only copied to the top folder specified gs://mybucket/
The issue I have is that I have dozens of batch files which all do the following...
for %%f in (./Myfolder/*.csv) do (
call gsutil cp Myfolder/%%f gs://mis_sc/
)
Now I realise its a simple (but rather tedious) change to add the folder on the end of all of my gsutil commands but we have a mix of versions across PC's and if the older version runs with changed script I get two folders the same name, one under the other. Also the logic was the folder name on the network = bucket name so the jobs can be very generic.
We have tested on two PC's, pre and post upgrade to ensure its not a PC config causing the difference in behaviour.
Any ideas, was this a deliberate change?
We are concerned that if we do update everything, will it ever revert back?
Thanks
Steve
The "Before" behavior you describe is not how gsutil was ever supposed to have worked: As noted here, "copying individually named files will result in objects named by the final path component of the source files".
If you are able to get gsutil to reproduce the "Before" behavior you describe using an older version of gsutil please provide the details to reproduce it: the gsutil version, bucket contents before copying, and source folder/object name. You can get to all the previous versions under gs://pub/gsutil_*

tests/**/*.coffee not matching root files on debian

I have a project which for its tests runs:
./node_modules/.bin/mocha tests/**/*.coffee -r coffee-script/register -c
tests/ looks like this:
_helper.coffee
database-tests.coffee
routers/
index-router-tests.coffee
team-router-tests.coffee
On my windows dev machine it works fine running _helper.coffee first and then the rest of the files.
On my CI server running debian it only tries to run routers/* missing out anything in the root folder.
I am assuming that tests/**/*.coffee isnt right for unix?
Moving Comments to an Answer for others since it appears to have fixed your problem.
I have had the same problems on Windows where it is not returning the files in the same order that you see them listed on the drive. I have therefore used tests/*.coffee and then tests/**/*.coffee.
I found that Windows will retrieve the files in the order they were likely written to the hard drive, while a directory or other list will have them sorted for display. This seemed to be the problem I was encountering.
The parent directory ('tests') does not seem to be included when using tests/** which seams to mean directories under the tests folder, and does not include the tests folder itself.

Noob Capistrano question on preserving upload directories

In response to this blog post: http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/
I have three questions:
Can anyone confirm if the recipe there works?
Where and how do I put that recipe?
I have two folders need to stay across each revisions: /products and /public/images/site_images what recipe should I run to be able to achieve this?
I have near zero experience with Capistrano and all I have been able to do so far was just cap deploy and cap deploy:cold, so a script which I could just copy-paste would be greatly appreciated.
Thank you
Yes, I'm currently using it in my own projects.
You can just append the code at the end of your deploy.rb file
If products is outside the public folder, you can't link it from the public side. Also, public/images is already expected to be checked into your SCM repository
The recipe assumes you want to have a complete new folder available from public side to host the user uploaded documents.
The folder should be excluded from your SCM configuration to prevent accidental commits. You should avoid to use the public/images folder for external uploaded files or you will have many headaches trying to synchronize your development configuration, managed by a SCM, with the public state.
This is how I did it in the end, by manual approach
I hope this will help all the early coders out there:
1. cd to releases to find out folder to synchronize
cd /home/yourapp/rails_apps/main/releases/
2. find the folder to sync, one level above last folder shown with ls
REMEMBER!
With ls, the folder list goes as follows:
folder1    folder5
folder2    folder6
folder3    folder7
folder4    folder8
So in this case, copy from folder7
3. copy the folders
To copy images
rsync -av --stats --progress /home/yourapp/rails_apps/main/releases/20100517183232/public/images/ /home/yourapp/rails_apps/main/current/public/images/
To copy products
rsync -av --stats --progress /home/yourapp/rails_apps/main/releases/20100517183232/products/ /home/yourapp/rails_apps/main/current/products/
Wondering if they could be automated somehow?

Resources