subdirectory .rubocop.yml inherits from parent .rubocop.yml - rubocop

Inside the folder of my main application, I have another folder inside of which is a Rails Engine. I've excluded the engine subdirectory from Rubocop to avoid writing Rubocop rules from the engine into one file (parent file), but when I run Rubocop inside the subdirectory it inspects 0 files.
I don't manually inherit the parent .rubocop yml file inside the engine.

By default it inherits from the .rubocop.yml file in the parent folder. You need to run it with the --ignore_parent_exclusion option, which ignores all Exclude: settings from all .rubocop.yml files present in parent folders. Otherwise, it reachs the parent .rubocop.yml and exclude the directory you are trying to inspect.

Related

./ and ../ directory differences

I know this question will get so many downvotes and will be marked as a duplicate.
The problem is I searched a lot about that question and never got a satisfying answer.
When working with sources in HTML and we want to get an image from the same folder of the HTML file we type the image name directly. If it's inside a folder which is in the same place as the HTML file is, we type the folder name then image, and so on....
If the image is in a folder which contains another folder in which the HTML file exists, so we want to get one step back. We type ../ which means go one step back then the image name.
When I started learning node and how to use modules, modules which were in the same folder as the node file is, must be imported using ./ which was explained as 'in the same folder', while when we import modules like 'fs' and 'events' they don't need a ./
Can someone explain why we don't use ./ in html files while they are used sometimes in node and sometimes no?!
I want to explain it because the node default import setting.
like 'fs' and 'events', these library was installed with node installed, and was included by default. And these will be stored in system directory. Just like <stdio.h> for c, fs from python. It's the default library for the corresponding language.
But sometimes you write you own libraries wanted to be import by other node file, you should import it by using relative path...Because if you don't write './', it will default search the system file directory where is stored 'fs', 'http' and so on, node will not find your libraries.
Before we start ./ and ../ notation is used to refer files relatively.
Why we sometimes don't use ./ in node?
All the modules we install in NodeJS are in the folder node modules. Whenever you require a module require('fs') or require('3rdparty'). Node exactly knows where to look for the module as it is installed as a folder in local node_modules or global node_modules. And then it loads the index.js and then so on..
When to use ./ in node?
./ is a way(Relative way) to refer files in the file system. If you have a script which is part of the file system and not as part of a node_module, then you use './' or '../' notation based on your file location
Why we don't use ./ in HTML files?
As said by #sami, you can use either ./ or not. It works in both ways. I am accustomed to ./ when I work. It's more of personal opinion.
Hope this helps.

How to build documentations project placed outside of docs directory using ReadTheDocs?

I am generating documentation project using ReadThedocs (mkdocs). But It's generating documentation project for the .md files which are placed in docs directory. My requirement is, I want to build documentation project for every .md file placed anywhere in the github repository.
How to achieve this?
You need to specify in the Mkdocs configuration (mkdocs.yml) the location of your documentation directory to be the current directory '.'.
Example:
site_name: My Documentation Project
docs_dir: '.'
By default, the Mkdocs looks in a subdirectory of your project labled docs:
docs_dir
Lets you set the directory containing the documentation source markdown files. This can either be a relative directory, in which case it is resolved relative to the directory containing you configuration file, or it can be an absolute directory path.
default: 'docs'
This is not possible in MkDocs by default. See this GitHub issue thread for rationale. There is however a plugin called mkdocs-same-dir that can be used to achieve this.

Difference between "../" and "~/" relative path

I am storing style sheets in {root}/styles while images in {root}/images for a website.
what is difference between ../ and ~/. ?
../ references the parent directory.
~/ has no special meaning in standard URLs. It does have special meaning in
ASP.NET where it references the root of the application
UNIX shells where it references the current user's home directory
../ is relative to the current path of the file.
~/ is relative to the root of the application (in ASP.NET).
../ goes up one dir from the current dir.
~/ goes to the dir where you originally came from (not usable in html).
Depends on the framework you are working on.If you have ASP.NET context ~/with ResolveUrl refers to the root level directory, ignoring the sub directories as well.
In CSS we navigate to the previous directories using ../. If you use ../../ you navigate to two steps back and so on.If you use ./, you can reach to the root

Tidying up folder structure for libraries added with composer

Starting with a default installation of SilverStripe (using composer), I have the folders framework, cms, mysite, etc.
Using composer I then added some additional code, such as userforms with the command:
composer require silverstripe/userforms
This created the folder userforms in the root of my site.
However, to manage my code more easily, it would be nicer if all modules added by composer were in a subfolder together. This answer indicates how a default vendor-dir directory can be specified using the composer.json file.
There is already a vendor folder in existence (if I understand correctly, this is used by composer). Is it ok to use the vendor folder as the default vendor-dir setting, or would it be better to create a new folder instead?
Also, what do I need to do to move existing folders (such as userforms) into the appropriate sub-folder?
This behaviour is specified by type. The packages with "type": "library" will be placed into vendor folder.
This is how the framework was designed, it expects the files to be located where they are now. It uses legacy code and is unable to make use of Composer autoloading.

Padrino app not aware of its own root path

I have a Padrino app which doesn't seem to be aware of its own root path. The app works fine, but when I try to require a file I wrote and put into the models folder, it says it cannot find it. The file is required from within another file in the models folder: DvdActor.rb. I can use any of these paths and it won't find it:
/app/models/file.rb
file.rb
models/file.rb
app/models/fie.rb
...
It will only find it if I use:
"#{Padrino.root}/app/models/file.rb"
Furthermore, the Thnking Sphinx gem will also have problems writing its configuration file or indexing (if I hardcode the path to the config file).
And when I have Padrino generate a Model, it will create a new model folder in the root folder insted of in the app folder itself.
I could recreate my app from scratch and copy the files over but I already have Heroku and git setup, etc. and don't want to recreate all this (sometimes simply copying the files over doesn't work properly).
Is there a way to reset this?