Install R package from Atlassian Stash - r

I made an R package which is hosted on my employer's instance of Atlassian Stash. I have been telling other users to clone the repo and then use devtools::install("<path-to-repo>") to install the package.
How can I have users install the package without cloning the repository? Can I do this without hosting the code somewhere more accessible?

Using this solution as a starting point, I discovered that you can use devtools with a Stash ssh url:
devtools::install_git("ssh://git#stash.yourdomain.com:1234/project/repo.git")
That will install from the latest commit on the master branch. You can also install a specific branch:
devtools::install_git("ssh://git#stash.yourdomain.com:1234/project/repo.git", branch="develop")
or tag:
devtools::install_git("ssh://git#stash.yourdomain.com:1234/project/repo.git", branch="v1.0")
(note you don't need the tags/ prefix when using a tag)
This will only work if you have SSH keys for your machine on your Stash account. Using the http clone url will not work, because you can't authenticate properly.

Related

Using WP-CLI on Windows to Manage Remote WordPress Installation?

I'm trying to manage my remote shared hosting WordPress installation via WP-CLI installed on my local Windows machine. So far I have managed to install WP-CLI (The "WP" command is available to run).
But when I try and connect to a remote URL with "wp --http", I get the following messsage:
RESTful WP-CLI needs to be installed. Try 'wp package install wp-cli/restful'
So I run the suggested command and I get:
Composer directory for packages couldn't be created.
I hadn't installed via composer. Instead, I manually instaled PHP and then downloaded the "wp-cli.phar" file. So I tried to install composer on Windows, but couldn't make head or tail of what downloads where. I "think" I managed to install wp-cli, but couldn't see where it had installed the files...and it just didn't work out.
Do you guys know of a more straightforward way to do this?
Concerning the error: Composer directory for packages couldn't be created.
If you did not set the environment variable WP_CLI_PACKAGES_DIR the default is ~/.wp-cli/packages/ which works for Linux but not for Windows.
I set this variable and the command 'wp package install wp-cli/restful' now successfully creates the directory for packages and the composer.json file but still doesn't install wp-cli/restful.
So I used composer directly and it successfully installs wp-cli/restful.
If I use the parameter --http=me.local.com (which matches example in the documentation) I get the error "Couldn't auto-discover WP REST API endpoint from me.local.com.' However, if I change this to --http=me.local.com/wp-json it works. The actual command I used is:
wp --http=me.local.com/wp-json rest post list

Develop and Debug Atom Package

I have just began working on Atom.io Package development, and based on this tutorial, have learnt from how to create package development skelton file to how to publish your package.
However, I do not know how to check/debug/develop your package. I know I can use Jasmine via alt-cmd-I or Developer Console (for Atom is based on Chromium), still if you want to check the behavior of your package, do I have to re-publish or install your package manually every time?
When working on packages locally, here's the recommended workflow:
Clone your package from GitHub using apm develop <package-name>. This will clone the package's repo to your local ~/.atom/dev/packages/<package-name>
cd into this directory
Start Atom in this directory using atom -d .
Now you can work on the package, make changes, etc. Once you're ready to reload, you can use View > Developer > Reload Window to restart Atom with the changed package.
If you have your package sources locally on your machine, you can skip the first step (apm develop) and simply create a symbolic link from your sources to ~/.atom/dev/packages/<package-name.
Already have a local repo of the package?
To add to nwinkler's answer, if you already have a repo of the package locally, you can use
apm link --dev
to automatically create a symbolic link to the ~/.atom/dev/packages/ directory.
Make sure to completely restart atom in developer mode with
atom -d
or in View > Developer > Open In Dev Mode...
If you just want to use a local package (not in dev mode), you can use apm link directly. And apm unlink to remove the symbolic link to ~/.atom/packages.

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 use meteors own non-core packages when running from a git checkout

When running meteor from a git checkout, there are 2 packages available at path
<meteor-path>/packages/non-core
npm-bcrypt/
npm-node-aes-gcm/
How to use/enable these packages (best practise) on own project?
You can use the published versions of your packages already, because they're on Atmosphere:
meteor add npm-bcrypt
If you want to use specifically their git checkout versions, you need to create a packages subdirectory in your app's directory, and symlink there the paths to the packages.
Much easier than symlink is just setting the PACKAGE_DIRS env var. Have a look at https://forums.meteor.com/t/missing-non-core-packages-when-running-meteor-from-checkout/1140 for more details.

Can I run Meteor from two paths?

How do I clone and run auth branch with my app, installed at [SRH/meteor/myapp], in addition to having master meteor installed in [usr/local/meteor]?
After having cloned the auth branch, when I attempt to add a package to my app (via meteor add accounts-ui), an error states the package is not available. Clearly, it is looking for the package at: [usr/local/meteor], while I am attempting to run meteor from [SRH/meteor].
Is it OK to have meteor installed at two locations? Obviously, I am confused.
More specifically, how do I clone the auth branch directly to [usr/local] location? Note: I am a newbie to git cloning. Took me a long time to find a tip on how to clone a branch, using:
git clone -b auth git://github.com/meteor/meteor.git
Thanks!
You can do one of two things.
Clone the auth branch to a location (as you have described) and then run meteor via
../../path/to/cloned/auth/branch/meteor run
Use meteorite which was basically created to do this for you.

Resources