Is it possible to put bower.json outside root folder? - bower

When defining a package, Is it possible to put the bower.json file inside a subdirectory of my git repository, and reference it in other projects?
I know that the docs says to put it in the root, but I already have my own directory structure on my git repository and want to put it inside a subdirectory.
I'm wondering if exists an option inside .bowerrc file to configure bower.json location. That would solve my problem.

I know this question is pretty old but none of the answers address the OP's actual question.
It is possible to store your bower.json in a subdirectory of your project (or another project for that matter).
In your .bowerrc, use the cwd (current working directory) setting to specify where your json file is stored.
More info can be found in the bower configuration docs.

Bower will create the ./bower_components folder next to the bower.json file.
So, as long as you ensure that the paths of the js/css files are OK, you can put the components wherever you want.
In my case, I have to use different versions/dependencies for an HTML5 mobile app and a Bootstrap/Angular backend. So I have something like that:
/bower.json
/bower_components/
/app/bower.json
/app/bower_components/
Just be sure to include your bower.json files in the GIT tree and add the bower_components folders to the .gitignore file
Hope it helps

Related

How is Bower working without .bowerrc file

I appreciate this is not a real problem, just curious...
I'm using bower version 1.7.2 and all my projects so far have a .bowerrc file in the main project folder.
On my current project (through an oversight with .gitignore) I lost the .bowerrc file. However bower still works just fine and everything gets created where I want it.
I've read the docs on the Bower site and there is nothing to suggest that it will work without the .bowerrc file, and plenty on stackoverflow suggests that I need the .bowerrc file - ALSO - there isn't a .bowerrc file in the file tree between the project folder and root (although there are plenty around in folders that have different paths)
My question then is: does bower work ok without a .bowerrc file (e.g. defaulting to directory:bower_components) ? or is there a way to see which .bowerrc file my bower is using?
Many thanks for any reply, although completely understandable if you read this and move on, like I said, my problem is that it works, and I don't think it should...
As the docs specify, the .bowerrc file can be either in the project dir, the user home (i.e ~/.bowerrc - depends on your OS) or the root dir.
If you didn't put it anywhere Bower uses defaults as specified here.
And to answer your question - the default directory for bower packages is bower_components
Yes , I tested in my project with out .bowerrc I am able to install packages with bower.If we don't specify the .bowerrc file bower_components directory is creating in the root directly which is default. If we want "bower_components" to be in specific location that should be specified in the .bowerrc file.
For example if we want bower_components folder in "app" folder
bowerrc file should specify directory location : "directory": "app/bower_components",
But while downloading packages from git ,if you computer has any proxy settings that need to be configured in .bowerrc file. If we don't specify the proxy settings in .bowerrc we wont be able to download packages form git.

Using rstan::rstan.package.skeleton to add to existing R package

I've already used devtools to create my package skeleton, then added a bunch of R code, metadata, documentation, etc. I would like to use rstan within this package. I understand that rstan::rstan.package.skeleton creates a package skeleton to facilitate this. So what is the best practice for augmented an existing package with the structure necessary to use rstan from that package? Thank you.
I would say to use rstan.package.skeleton to create the skeleton in a temporary directory and then copy the relevant stuff it creates into the package you created by devtools. This would include
cleanup and cleanup.win in the root of the directory
the tools directory
the exec directory
the inst/chunks subdirectory
the src directory
the R/stanmodels.R file
the DESCRIPTION file in the root of the directory
For the DESCRIPTION file, you may just have to combine it by hand with whatever DESCRIPTION file you have currently.

accidentally removed log folder in rails .gitignore, log folder not being generated on pull request

I'm new to git and rails. I checked out a rails project and had a bunch of log files come in with it. I wanted to remove the log files and add an entry into .gitignore to ignore contents of the log directory. I think I screwed up because when my colleague tried to checkout from master, his log directory didn't even get generated. I think instead of ignoring contents of the log file, I ignored the entire log directory. What's the best way to change this .gitignore file to only ignore log files NOT the log directory itself? Also I don't think I need all these things in the .gitignore. What's a nice clean and simple .gitignore for a rails project?
*.sublime-*
.bundle
db/*.sqlite3*
log/*.log
*.log
tmp/**/*
tmp/*
Gemfile.lock
doc/api
doc/app
*.swp
*~
.DS_Store
Thank you in advance.
Git ignores empty folders, in fact it doesn't really know they exist (it knows about trees pointing toward file contents). Since there is no file content to point to, there is no tree and hence git will not create a folder.
Common way around this is to add empty file within the folder. Convention is to name this file .keep. Add such file to the empty folder, add it to the index, commit and push and folder will be created on checkout.

Can't link to my bower_components folder using google web-starter-kit

My problem is I can't link to the bower_componets folder.
I am using web-starter-kit, and basically took those files into my dev environment/folder structure. I know that defeats the purpose of WSK, however I created a gulp work flow and wanted to try it out.
This is what i get in the console.
And this is my folder structure...
I am positive based on where the 'bower_components' folder exists this should be the path.
<script src="../../app/_bower_components/flowtype/flowtype.js"></script>
e.g. Start out of in development, then out of builds and dive into 'app'
Is there a bower config file that I am supposed to create?

Ignoring directories, sub-directories and files after that those was initialized

I am using Ruby on Rails, the Capistrano gem and git. Long time ago I initialized git and in the .gitignore file I stated the following:
.bundle
db/*.sqlite3
log/*.log
tmp/
One day I created a sub-directory in the /public directory of my RoR application: /public/users/.... Now in the latter directory I have the following file system structure:
/public/users/001/file1.png
/public/users/001/file2.png
/public/users/001/file3.png
...
/public/users/002/file1.png
/public/users/002/file2.png
/public/users/002/file3.png
...
...
At this time git is tracking all file in the /public directory including all directories and files inside /public/users/. So, when I deploy with Capistrano, all those will be updated on the remote machine, as well.
What I would like to do is to do not track anymore public/users directories, subdirectories and files (on my local machine) so that on the remote machine those will be not updated. That is, I would like to make possible that when I deploy with Capistrano all that is related to the public/users (on the remote machine) is untouched.
How can I do that?
P.S.: I read a lot of other questions and answers (eg: 1, 2, ...) but all them seem do not work for me.
I am almost sure that I must add the following text line to the .gitignore file:
# Ignoring "public/users/" directories, sub-directories and files
public/users/
and then (if the above code is valid) what I should do?
Try to put all user related files into one folder , say system then
You can put public/system/*.* in git ignore..
then your dir structure would be :
public
->404.html
->js.../..,..,..
->css ../..,..,..
->system
->users
->1/something
->2/something
->some-other-user-related-info
Also why is there a need to put development related files into git and then to server ?? No point .. so do not do it.. It will increase your repo size for no reason.
Since you are using capistrano your server dir structure will look like this :
APP
->Current
->releases
->shared
your public/system folder will keep pointing to shared/system
case 1: files in users/ not committed
put all the user related file in .gitignore
case 2: if files have been commited
perform a git delete and then commit
then add it to .git ignore

Resources