How do I name the .bowerrc file? - bower

This MEAN-stack tutorial describes using Bower to install AngularJS in your public folder. One of the steps describes creating a file called ".bowerrc" in your test-app folder. However, Windows won't let you create a file without a name. How do I accomplish this on a Windows system?

on the command line (make sure to cd into your working directory), issue this command:
touch .bowerrc
This will also work for other files common to webdev like .htaccess and .gitignore
Note: If you haven't installed git bash for windows, you may not have support for the touch command. In that case (as mentioned in one of the comments here), the easiest way to accomplish this is via the cli with:
echo "" > .bowerrc

To create a file that starts with a "." in Windows, you just need to add a trailing ".".
So, simply name your file ".bowerrc." instead of ".bowerrc".
See https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows for more information and more detailed solution if this doesn't work for you.

Another way to accomplish this is through Notepad++.
Create the file in Notepad++
Set the encoding to "Encoding in ANSI" (click "Encoding" in the menu bar)
Save the file as .bowerrc (change the "Save as type:" to . which is one list item up from *.txt)

Simply rename the file you created:
C:\project> ren bowerrc .bowerrc

Related

Ruby on Rails Tutorial - 5.26 - Sublime Text "Unable to Save" new file "spec/support/utilities.rb"

I am using Sublime Text 2 while following Michael Hartl's Ruby on Rails Tutorial.
The specific portion of the tutorial to which I am referring can be found at http://ruby.railstutorial.org/book/ruby-on-rails-tutorial (ctrl+F "Listing 5.26").
I am able to create the spec/support file. However, when trying to create the spec/support/utilities.rb file, I receive the message "Unable to save ~/rails_projects/sample_app/spec/support/utilities.rb".
Does anyone know why this might be?
Someone on the Sublime Text forum seems to have had the exact same problem: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=8570&p=36922#p36922
This issue sounds like it's a result of incorrect permissions or ownership of the folder. Change directories (cd) so you're outside of the folder where you're creating the .rb file and type:
ls -l
This terminal command lists the permissions attached to all files/folders in that directory. If "root" is listed as the folder owner, change its owner by typing:
sudo chown YOUR_COMP_USER_NAME FOLDER_NAME/
You should now be able to save files from inside that folder.
To diagnose this, first find out if it's an issue in Sublime or your file system:
Does that file already exist? Try looking for it on your file system (not using Sublime).
Verify that you have permission to write to that file. Use "ls -la" on the command line to show the file permissions.
Are you able to create and/or save that file using any different editor, for example TextMate, or Notepad?
The following sublime plugin fixed the Unable to save... bug
https://gist.github.com/3779601
The folder spec/support doesn't exist, and sublime won't create the missing folder, so it errors.
You just need to make the spec/support folder , then sublime will save the file.
I also highly recommend installing the AdvancedNewFile plugin ( Video of it action thanks to Jeffrey Way and NetTuts+ ) , which you can grab straight from Package Control.
It creates files, parent folders if needed, and if you try to create a file that already exists, it opens it instead.
This can happen if you are trying to create the file within a directory that does not currently exist. For ex. I was unable to save
~/rails_projects/sample_app/app/views/shared/_error_messages.html.erb
via the "subl" command from the Terminal because I was missing /shared/ folder. Hope that helps.
so #knice almost had it, I ran into the same problem with permission when starting my first rails project on mavericks.
as mentioned if you run ls -l you'll see your folder / files listed with their permissions
I solved this by changing ownership recursively with the following command from outside my project directory
sudo chown -Rv <your_username> <your_path_and_foldername>
for example if you're in your folder in terminal you should cd .. and then
sudo chown -Rv username ruby_proj/
the -R is for recursive meaning it will apply to all files and folder contained within the folder you specified, and the v after just produces verbose output, showing you which folder and file permissions have been changed.
Hope that helps someone else.

./create: No such file or directory error in terminal window

I am very new to iPhone development and I am looking to work with the PhoneGap framework to create iPhone apps. I installed Phonegap on Mac OS X Lion. I got this error in the terminal window for ./create <project_folder_path> <bundle_id> <project_name>:
./create: No such file or directory
I have searched Google to solve this error, but I can't find any idea from there. Could you please help me solve this issue and run the project? Thanks in advance. Looking forward to your answers.
You probably need to check your current directory with the pwd command, which is what the . is shorthand for. The create executable sits in the Cordova bin directory, not your project directory.
For example, this site shows the required command line to be (spread across multiple lines for readability):
./path/to/cordova-ios/bin/create
/path/to/my_new_cordova_project
com.example.cordova_project_name
CordovaProjectName
In other words, create is separate from your project.
The solution is probably to fully specify the path name of create.
./path/to/cordova-ios/bin ./create
~/<project_folder_path> <bundle_id> <project_name>
This works for me :
Download cordova-3.0.0 and put the folder in your document folder. Expand cordova-ios.zip inside.
Create a folder CordovaTestProject inside your document folder.
Then, open the terminal and try :
./Documents/cordova-3.0.0/cordova-ios/bin/create /Users/<username>/Documents/CordovaXY/HelloWorld org.apache.cordova.HelloWorld HelloWorld
replace <username> by your username. You can get it with pwd in terminal. In terminal, type "pwd" and you will get your username
Make sure that you are inside \phonegap-2.7.0\lib\ios\bin before entering ./create command. Refer the Blog Tutorial for a simple and straight forward explanation of PhoneGap instalation in Mac for iOS and creating a new project.

How to see vimrc files used during startup

I've moved my vimrc file out of the home directory to pathogenize the setup, but it looks like my vim is still picking up a redundant vimrc file that I made somewhere. Is there some variable in vim that I can echo that'll show what files were used during startup?
:scriptnames lists all sourced script names, in the order they were first sourced.
Look for the $MYVIMRC variable:
:echo $MYVIMRC
After starting vim, you can type
:set runtimepath
See the docs here: http://vimdoc.sourceforge.net/htmldoc/options.html#'runtimepath'
I don't think #skinp's answer is necessarily sufficient. the runtimepath variable is the very definition of all places vim looks
Additionaly, you can launch Vim with
$ vim --startuptime filename
which should write a list of loaded scripts (including vimrc) and their respective processing time to file filename.

Opening a db/migrate/* file more effectively? Wildcard to complete the beginning of the name of the file?

Working from a bash shell and utilizing vim, I generally have a pretty effective workflow. However, when I attempt to access files in the db/migrate directory of a rails project, it becomes very tedious to access the files as the each contain a long integer at the being of their file names. I've tried vim db/migrate/*name_of_migration.rb but to no avail.
Is there a way to access files via wildcard of in this manor?
If you're using vim-7.3, then you can do this from inside vim:
:set path=/path/to/your/project/root/**
:find migrate/*cr<tab>
and vim will show you the possible candidates for completion.
If you're typing the name of the migration correctly, I assure you that the * will match the leading digits.
For example, from the root of your project,
$ vim db/migrate/*create_users.rb
will open 20111123142812_create_users.rb.
Otherwise, my preferred method is to use
$ vim db/migrate
to "open" the directory in vim, and use the in-vim navigator to select the migration you're interested in from the list of files.

How to launch and edit a file from Git using Notepad++?

I have set up Notepad++ as my default editor as in this topic:
How can I set up an editor to work with Git on Windows?
with this command:
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Now, I'm working through a Ruby on Rails tutorial. On one step, the author uses the command:
$mate README.markdown to launch his TextMate editor and edit the readme file.
My question is, now that I have set up Notepad++ as my default editor, what is the equivalent command that I should use to launch Notepad++ and edit the file?
Note: I'm a beginner with this Git and Ruby on Rails. Please go easy on me! Thanks in advance.
C:/Program Files/Notepad++/notepad++.exe README.markdown
And since you'll probably want to use notepad++ a lot from the command line, you may want to alter your PATH to include its root directory, so you don't need to write the full path each time.
Add notepad++.exe to your Windows path enviromental variable( the whole path), this option is in computer, right click, advance system setting enviromental variables.
After from command promp just do:
notepad++ markdown.README
You could also just use the whole path to notepad.exe everytime but that gets old, just learn how to edit your enviromental variables in windows.
You must first add Notepad++ as the main program. On Git Bash
git config --global core.editor "'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Notepad.lnk' -multiInst -notabbar -nosession -noPlugin
And then you will be able to create the file by writting
start notepad README.md
start notepad++ README.md

Resources