Meteor changing package name with colon to suit Windows - meteor

I used to develop meteor app using Mac. I have written package for app with name foo:bar and package is under packages/foo:bar
This week meteor team has officially released metero.js for Windows. Cloning the the git repo to windows is failing because of colon : in the directory name.
Is there any official way to migrate/rename package directory name in Mac so that it works properly across all operating system.

You can name the package folder anything you want. In the package.js file under the Package.describe method, use foo:bar as the name instead.
Meteor will use this as the name of the package instead of the name of the directory containing the package thereon.

Related

Checking constraints for a Meteor package

In order to customize a third-party Meteor package, I copied the package folder from /Users/<name>/.meteor/packages/accounts-ui-unstyled/.1.1.8.cfkrwq++os+web.browser+web.cordova/ and pasted it into the packages folder at the root of my app as accounts-ui-unstyled/.
Now when the app compiles, I get this error:
Errors prevented startup:
While selecting package versions:
error: No version of accounts-ui-unstyled satisfies all constraints: #=0.0.0, #=1.1.8
Constraints on package "accounts-ui-unstyled":
* accounts-ui-unstyled#=0.0.0 <- top level
* accounts-ui-unstyled#=1.1.8 <- top level
* accounts-ui-unstyled#1.1.8 <- accounts-ui 1.1.6
Your application has errors. Waiting for file change.
Where are these constraints being declared, and what do I need to change to get the accounts-ui-unstyled/ folder in the packages folder to be correctly identified?
Normally you would like to create a local copy of a package by cloning its repository from GitHub (provided the source is available), and not from your local file system (which holds pre-built versions of the packages).
Sometimes (as it is the case with the core Meteor packages), they are "hidden" in sub-directories of the repository.
A neat trick is to use SVN in order to quickly get a snapshot of that sub-directory:
$ mkdir packages && cd packages
$ svn export https://github.com/meteor/meteor/trunk/packages/accounts-ui-unstyled
If you want to pull from a specific branch, use
$ svn export https://github.com/meteor/meteor/branches/<branch_name>/packages/<package-name>
The constraints will be specified in the package.js file, as expected.
Note: MDG are planning to move the core packages into their own repository/repositories, so those instructions may not be valid for the core packages in the future.

How To modify quantmod package with GIT

I currently have quantmod installed. I would like to modify the source code.
Do I need to uninstall the current version?
I currently was trying
(1) Installed GIT
(2) then I went to New Project>> Version Control >>create a new project form version control GIT and when I click that I get this error
"Git was not detected in the system path. to create projects from GIT repositories you should install GIT and then restart Rstudio. Not tha tif GIT is installed an not on the path then you can specify its location using the options dialog."
(3) So I went to the global options>>GIT/SVN>>Git executable and put this path
C:\Users\me\AppData\Local\Programs\Git\bin\git.exe
(4) then I restarted RSTUDIO and now I get further so when I go to
New Project>> Version Control >>create a new project form version control GIT>>CLONE GIT REPISITORY
Here it asks for a Repository URL, Project Directory name, and Create project as subdirectory of. Here is where I am unsure where I need to put this project so that the modification I make to the quantmod package will be picked up by my version of R
For Repository URL I was going ot put:
https://github.com/joshuaulrich/quantmod
For Project Directory I am unsure: can you advise??
For Create project as sub directory I am unsure: can you advise??
My R libraries are here: C:\Users\me\Documents\R-3.1.2\library
Also currently I have quantmod installed here:
C:\Users\me\Documents\R-3.1.2\library\quantmod
Do I need to uninstall that current version?
Appendix:
On My computer GIT is here: C:\Users\Me\AppData\Local\Programs\Git
On My computer R is here: C:\Users\Me\Documents\R-3.1.2
The project directory is just the name of the folder you will be putting the repo inside. Generally it is the name of package to make things clear. In your case quantmod.
The sub directory you can ignore unless you want to choose some other location (besides the current directory) for you code.
You don't need to uninstall the current version. My usual recommendation is to just increment the subversion of the package in the DESCRIPTION file. For example, increment:
Version: 1.0.1
to
Version: 1.0.2
Now when you rebuild and install you will have the new version. If you need the original again, you can just reinstall the old one (i.e. install.packages). Having both installed at the same time would likely result in conflicts between the packages and just causing a headache.

How to re-use an already installed package in Meteor?

I installed couple of packages for 'Project A' (e.g bootstrap) assuming that it will be available for all subsequent projects. But when a new meteor project 'Project B' was created, meteor list showed only default packages. So my assumption that meteor packages are like ruby gems available globally is incorrect. As I work offline every now and then, Is there a way I can manually copy/re-use installed packages?
Yes they are similar to gems. Packages are installed in ~/.meteor/packages, in precompiled form. They can be installed globally this way.
When you add a package to your project it will essentially copy the package from there into your build-cache directory hidden in the .meteor directory of your project.
To install a package locally where you can easily re-use it you would have to clone the github repository of the package and place the output in the /packages directory of your Meteor app.
For example for bootstrap, twbs:bootstrap you would clone this reposistory: https://github.com/twbs/bootstrap, into a directory like /packages/twbs:bootstrap (name doesn't matter if its defined in the package.js file on the repository.
In general you can easily re-use a package without the hassle of adding it in manually like so. It's better to use the global packages which are kept up to date.
The trouble comes with being offline. If you use a local package its nearly guaranteed to always work. Whereas the global ones can give a bit of trouble once in a while when you try to add a package in as meteor tries to check the package is up to date, especially where npm packages are involved with the package.
To keep it short if you added a package in using meteor add twbs:bootstrap you should most likely be able to add it to another project using the same command. Only if you keep your packages & meteor up to date.

Meteor package incorrect folder name

I just ran the following meteor command:
sudo meteor create --package blah:my-package
and meteor has created a folder called TECM60~2 ... I thought it was supposed to create a folder with the package name - any ideas?
Note: I am running Ubuntu on Virtualbox (developing on Windows) and accessing the package folder via a Samba share to Windows Explorer. I suspect this problem is because Windows does not allow colons in folder names (?)
As per Ethaan's comment, it is possible to create packages without the username: in front of it. I did raise this with the Meteor team and they said they will address this in a fuuture release.

Where does meteor stores its packages?

I have a meteor 1.0 app. I've added a bunch of packages, for example: meteor add kevohagan:ramda. But I cannot find it anywhere. I can't even find it on my system.
In my project:
$> meteor list
kevohagan:ramda 0.1.2 A practical functional library for Javascript programmers.
meteor-platform 1.2.0 Include a standard set of Meteor packages in your app
...
$> ls packages
ls: packages: No such file or directory
$> mdfind ramda.js # file added by the package
# no results
Where are they ?
If you add a package via meteor add author:pkg it will be added to the meteor installation (e.g. ~/.meteor/packages); here you can find different versions of the package. In your project home, the package name will be added to the .meteor/packages file.
Later, if run your project, the package will be added to the build directory (and of course only one version can be found here).
I think that they all are in
.meteor/local/build/programs/server/packages
but they are ninified, and the file names are changed, like "kevohagan_ramda.js" or "meteor-platform.js"
If you check out your project folder then you'll find two 'packages' folders. One at the root of your project and the other deep down inside .meteor. Below I've listed both of them.
.meteor/packages //this consist of the packages that you built yourself or other top-level packages like spinner & iron:router
.meteor/local/build/programs/server/packages //other packages

Resources