lockedata / starters

R Package πŸ“¦ for initializing projects for various R activities :nut_and_bolt:
https://itsalocke.com/starters/
GNU General Public License v3.0
124 stars 16 forks source link

Error: object 'github' not found #124

Closed moldach closed 5 years ago

moldach commented 5 years ago

I was about to send a PR for the open = FALSE argument; things were going great for the first three functions but then something went horribly wrong on the fourth one 😭

Obviously, I thought it was a mistake I made in the code. I made sure to delete the local repo and install a-new, then I used lookup::lookup to make sure that I was in fact using code from lockedata/starters. Now all four functions won't work for me!

At first the error was:

Error: Error in 'git2r_remote_add': remote 'origin' already exists

A SO post suggested the following:

git remote -v show
origin  git@github.com:moldach/wellThisSucks.git (fetch)
origin  git@github.com:moldach/wellThisSucks.git (push)

git remote rm origin

I get a new error but not sure how to resolve.

> starters::createBasicProject("brokeGIT2")
New project 'brokeGIT2' is nested inside an existing project './', which is rarely a good idea.
Do you want to create anyway?

1: For sure
2: No way
3: Negative

Selection: 1
βœ” Setting active project to '<no active project>'
βœ” Setting active project to 'C:/Users/Matthew/Documents/brokeGIT2'
βœ” Writing 'DESCRIPTION'
Package: Documents
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R (parsed):
    * Matthew Oldach <moldach686@gmail.com> [aut, cre]
Description: What the package does (one paragraph).
License: MIT + file LICENSE
Encoding: UTF-8
Language: es
LazyData: true
Can I create directoryC:/Users/Matthew/Documents/brokeGIT2/.checkpointfor internal checkpoint use?

Continue (y/n)? y
βœ” Writing 'README.Rmd'
βœ” Adding '^README\\.Rmd$' to '.Rbuildignore'
βœ” Adding Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. badge to 'README.Rmd'
● Re-knit 'README.Rmd'
Error: object 'github' not found
Oops! An error was found and the `brokeGIT2` directory was deleted
βœ” Setting active project to 'C:/Users/Matthew/Documents'
> starters::createBasicProject("IbrokeGIT")
New project 'IbrokeGIT' is nested inside an existing project './', which is rarely a good idea.
Do you want to create anyway?

1: No way
2: Absolutely not
3: For sure

Selection: 3
βœ” Setting active project to '<no active project>'
βœ” Setting active project to 'C:/Users/Matthew/Documents/IbrokeGIT'
βœ” Writing 'DESCRIPTION'
Package: Documents
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R (parsed):
    * Matthew Oldach <moldach686@gmail.com> [aut, cre]
Description: What the package does (one paragraph).
License: MIT + file LICENSE
Encoding: UTF-8
Language: es
LazyData: true
Can I create directoryC:/Users/Matthew/Documents/IbrokeGIT/.checkpointfor internal checkpoint use?

Continue (y/n)? y
βœ” Writing 'README.Rmd'
βœ” Adding '^README\\.Rmd$' to '.Rbuildignore'
βœ” Adding Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. badge to 'README.Rmd'
● Re-knit 'README.Rmd'
Error: object 'github' not found
Oops! An error was found and the `IbrokeGIT` directory was deleted
βœ” Setting active project to 'C:/Users/Matthew/Documents'

using starters::start_here() I see:

Checking GitHub account can be guessed...
βœ” Your GitHub username is moldach.
Checking git is installed...
βœ” git seems to be installed!
Checking gitconfig...
βœ” gitconfig is already set!
Checking GITHUB_PAT...
βœ” GITHUB_PAT is already set!
Checking default description values...
βœ” DESCRIPTION defaults are already set!
Checking build tools are available...
βœ” Build tools are available!
βœ” All set now!
maelle commented 5 years ago

Thanks! I was not able to reproduce the bug. Can you try again but not nested inside a project? And I've updated the function a little bit to have the checkpoint stuff at the end, but to be safe and see whether it comes from checkpoint or not, please run createBasicProject("projectname", packagdeps = "none").

maelle commented 5 years ago

What I was able to do is to improve the code creating and resetting projects but it won't solve your problem. :thinking:

moldach commented 5 years ago

Kind of wondering if this may be a .file issue nowπŸ€·β€β™‚οΈ

I remember the "./" warning from my first issue. I'll look back into the closed issues to see what I did before to "fix" this; a few days prior when everything ran fine, I don't recall seeing the "creating a project in a project" warning.

Sent from my iPhone

On Feb 28, 2019, at 04:28, MaΓ«lle Salmon notifications@github.com<mailto:notifications@github.com> wrote:

CAUTION: This Email is External.

What I was able to do is to improve the code creating and resetting projects but it won't solve your problem. πŸ€”

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/lockedata/starters/issues/124#issuecomment-468200754, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFe62br_C5t8cAVF_dM7VDw6YYIcDEHVks5vR6EqgaJpZM4bV_5g.

CAUTION: External Email This Email originated from outside the University of Calgary. Please exercise caution when opening attachments, clicking on links or when asked to enter usernames/passwords. Report suspicious emails to "reportphishing​@​ucalgary.ca" or via the Junk Email Reporting Add-in in the Outlook toolbar. For more information, call the IT Support Centre.

maelle commented 5 years ago

Delete the .rproj/.git that might be at ./, now starters should no longer create those by mistake (I had some bad code for setting /resetting projects that caused this weird issue)

moldach commented 5 years ago

There was a .git folder (and .rproj) in ./ and I've deleted them. The other three functions work but I'm presented with a new error from createPackageProject() now:

createPackageProject("packageProjTest")
βœ” Creating 'packageProjTest/'
βœ” Writing 'DESCRIPTION'
Package: Documents
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R (parsed):
    * Matthew Oldach <moldach686@gmail.com> [aut, cre]
Description: What the package does (one paragraph).
License: MIT + file LICENSE
Encoding: UTF-8
Language: es
LazyData: true
βœ” Writing 'NAMESPACE'
βœ” Writing 'Documents.Rproj'
βœ” Adding '.Rproj.user' to '.gitignore'
βœ” Adding '^Documents\\.Rproj$', '^\\.Rproj\\.user$' to '.Rbuildignore'
βœ” Setting active project to '<no active project>'
βœ” Setting active project to 'C:/Users/Matthew/Documents/packageProjTest'
βœ” Writing 'CODE_OF_CONDUCT.md'
βœ” Adding '^CODE_OF_CONDUCT\\.md$' to '.Rbuildignore'
● Don't forget to describe the code of conduct in your README:
  Please note that the 'Documents' project is released with a
  [Contributor Code of Conduct](CODE_OF_CONDUCT.md).
  By contributing to this project, you agree to abide by its terms.
  [Copied to clipboard]
βœ” Writing 'LICENSE.md'
βœ” Adding '^LICENSE\\.md$' to '.Rbuildignore'
βœ” Writing 'LICENSE'
βœ” Writing 'R/Documents-package.R'
Error: cannot open the connection
Oops! An error was found and the `packageProjTest` directory was deleted
βœ” Setting active project to 'C:/Users/Matthew/Documents'
Warning message:
In cat(lines, file = con, sep = "") :
  cannot open file 'C:/Users/Matthew/Documents/packageProjTest/R/Documents-package.R': No such file or directory

It seems to be still trying to create those (.rproj and .git) in ./

maelle commented 5 years ago

Weird is this due to some restrictions on the file created? I.e no write rights?

moldach commented 5 years ago

Hmm strange thing, not sure what I did to fix it but I was doing some work on one of my git repos for a bit and returned to try this again and it magically worked all of a sudden.

I've just made my first PR for the open = FALSE argument

maelle commented 5 years ago

Good, I'll close this issue but of course feel free to open any new issue if you encounter a new problem! And thanks for the PR!