Is bower auto-updating itself from github? - bower

From the documentation it is not clear to me how to update the packages by Bower when I increase the version number. By npm you have to run npm publish. Does bower auto-updates the stored packages from github after I registered the package, or how does this work?
Should I add only the browser specific builds to the bower.json and let nodejs ppl install my lib from npm? (currently only nodejs is supported by my lib, but I intend to support browsers with browserify later.)

Bower does automatically keep up with your package updates, as long as you tag your releases and push the tags:
git commit -am "new version"
git tag -a v1.0.1 -m "1.0.1"
git push origin master --tags
More specification in the docs would be nice. This is the best hint that I can find:
Your package must be publically available at a Git endpoint (e.g.,
GitHub). Remember to push your Git tags!

Related

How to author a bower package?

We have created successfully a bower package and it is working great with Subversion and private-bower.
The issue I am facing now, is that we need also the generated files to be commited into (Subversion or Git) to work properly for
bower install
or
bower update
Now every build creates a conflict in the local copy of the repository.
My question is, can I tell bower to do a post install or post update command to execute a build?
In my case it should run a grunt task to build the files locally.
Just wondering if bower is not capable of doing such steps to avoid conflicts on the git/svn repository?
Or what is the suggested way to avoid merge conflicts?
There are postinstall hooks in bower https://github.com/bower/bower/blob/master/HOOKS.md but you can't rely on it as a package provider (they're designed to be used by the developpers who install your package)
For your situation, teams that provide bower packages that require a build step have two main workflows:
The repo tied to the bower registry is the source repo. Sources & build files are in it (like bootstrap). So when you bower install, you retrieve the whole repo with all the sources, build routines, etc ... which can be quite big. That's your case currently.
The repo tied to the bower registry and the repo holding the sources are two different repos (like angular):
Your build directory is in fact the repo tied to bower
Each time you make a new release, you build and then commit from that repo.
If you're having versionning problems, maybe you should switch to the second workflow (which will also let you clean all the unecessary files like build routines).

Git problems, 'git not installed'

I have set up my github account, configured it with SSH and now I am trying to retrieve group work from gitlab. I have managed to pull the work so that it is on my machine but when I go to bundle install I encounter an error.
It says that I need to install git in order to gems from git repository.
I've added an image which might help.
Check if Git is installed in a folder with spaces or special character.
Try and unzip a recent Git (like PortableGit-2.3.7.1-dev-preview-64-bit.7z.exe) under C:\Git, and add that to your PATH:
set PATH=C:\Git\cmd;%PATH%
bundle install
The PATH issue was mentioned before in issue 5027 and in "Can't run bundle update on Windows".

Branch Then 'Reset' Rails Git Repository

I have a bit of a tricky problem. I restarted a current rails project from scratch in a new folder because I was redoing the app as a personal exercise. We've run into some issues on the 'official' version and now need to restart the project.
The problem is that we've been using git to keep track on the official project but I haven't been using it for my personal version.
I've branched the official git master repository using
git checkout -b restart_app
Now I'd like to clear out all the code in that branch and replace it with my personal version. I've tried to google the best approach to doing so but found some differing answers and I'm pretty new to working with git so I thought I'd put up a question here. What would be the best practice/solution for approaching this problem?
"I want replace all the files in restart_app with files from a different project folder"
Delete and replace the files by the ones you want.
The best practice is to do a git rm * first, then add your files, git add and commit.
A nice trick, you can use the --work-tree option of git:
git checkout restart_app
git rm -rf .
git add -A .
git commit -m "empty restart_app"
git --work-tree=/path/to/untracked/code add .
git commit -m "add new code"

Installing rails plugins as git submodules

(Why there is no|Is there a) way to run
./script/plugin install -SOME_HIDDEN_OPTION git://github.com...
So that the plugin is installed as git submodule. The reason for submodules is to keep unrelated code off project's repository.
Perhaps there is a reason not keep plugins as submodules?
./script/plugin install git://github.com/something/something...
Should work without a submodule...
If you want to update the plugin, just navigate into that plugin's folder and do a git pull.
The only advantage of the submodule is that you can see all your submodules from anywhere in the git repository. Otherwise, git just find the nearest git repository and works on that... in te above case, navigating to the plugin's directory will make it the repository you are working on.
Submodules are a bit warty. Also if you clone your repo and one of your submodule remotes is down you're stuck.
I end up tweaking the local code on occasion as well, which necessitates it being in my repo.
Braid makes managing this situation simple.

How to update rails plugins installed through git but in a svn repo?

My rails app is in a svn repository, but several of the plugins are installed through git and later added to the svn repo. How can I update these plugins? I can't seem to get script/plugin update to do anything. I'd really like to update activemerchant to get rid of the Inflector warnings.
If you haven't made any local changes to the plugin and you don't need to track what changes to it the update will bring, you can just run script/plugin install again, passing in --force if you need to. For example:
script/plugin install --force git://github.com/dchelimsky/rspec.git
If you already have a static copy of a plugin checked into Subversion, it can be a pain to update it via script/plugin, so here's what I end up doing in order to switch it from a static install to a Git checkout all within one Subversion commit:
git clone git://github.com/foo/bar.git ~/foobar
mv ~/foobar/.git rails_app/vendor/plugins/foobar/.git
rm -rf ~/foobar
cd rails_app/vendor/plugins
git reset --hard
Then make sure to add .git and everything else that has changed to the Subversion project and you will be all up-to-date. You can use other git commands to pull down updates, move to a different branch, etc. Then just check things in again once they are at the state that you want.
One thing I do in this case, I remove the plugin directory then I commit to SVN, this will remove the old plugin in the repo. (I usually moved it in a tmp directory, just in case and delate it later once the new one is working fine)
I then reinstall the new version of the plugin, and commit again.
Easy.
You should just be able to navigate to the plugin's directory and hit:
git pull
. I'm pretty sure that script/install plugin just checks the code out from the git repo.
In order for Git to be able to recognise the repository as a Git repository, you will need to add the .git subdirectory and everything under it to Subversion as well. Otherwise, the plugin will just look like another pile of source code and Git will say it's "Not a Git repository".
Ran into the same situation and used this solution: had paperclip installed as a plugin sitting in an svn repo as part of my app. Now I wanted to use the latest version instead and didnt change a bit of the paperclip plugin so I could easyly remove it from the app/svn and install it as a gem instead. done.

Resources