GithubHelp home page GithubHelp logo

computercraft-github's Introduction

computercraft-github

Warning

This project is no longer maintained. I am no longer actively using computercraft, and so have no way to meaningfully review PRs or fix issues. See the list of forks for more up to date versions.

Seen these cool projects on github? Pain to download? This program is for you!

Installation

The easiest way to install this project on your computercraft computer is by running:

pastebin run p8PJVxC4 [<branch>|<tag>]

The branch or tag argument is optional, and defaults to 'master'.

Usage

Cloning a repo

github clone <user>/<repo> [-b <branchname> | -t <tagname>] [<destination>] [-a <username>]

The branch and tag arguments are optional, and default to 'master'. You may only specify a branch or tag, you may not specify both.

The destination folder is optional, and defaults to the current folder name. Watch out - this script will happily overwrite any existing files!

The Authentication argument is optional. You must first create a user with github auth (see below) to use the authorized requests.

> github clone eric-wieser/computercraft-github ccgit
Discovering files...
Downloading:
  github
  readme.md
  apis/dkjson
  apis/github
  programs/github
[============================================] 100%
> ls ccgit
apis      programs
github readme.md

Adding Authentication

To use authenticated requests you must first create a github api token on your github account. You do not need to provide any api scopes for the token unless you plan on accessing private repositories.

github auth <user> [<api token> | -d]

The delete argument is optional and will delete the specified user.

Warning: data provided to github auth will be stored locally on the computercraft computer. You can delete the access token at anytime by hitting the delete button in your personal access tokens menu on github.

Thanks to David Kolf for his dkjson module, which made parsing github APIs possible.

computercraft-github's People

Contributors

aaronmallen avatar arsdragonfly avatar danports avatar eric-wieser avatar hugeblank avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

computercraft-github's Issues

OS unsafe

It is not safe to install this directly onto the rom folders so all computers may run this..

No errors occur. But all computer Operating systems will stop being able to load..

Must manually install on each computer in order to even use it. Otherwise.. Its completely unsafe to use..

Repository class caches trees forever

Forever is a long time. There should be an automatic or manual way to flush the Repository.tree cache. Options:

  1. Check the SHA of the provided commit-ish on GitHub. If it matches the cached SHA, cool; otherwise flush the cache and instantiate a new Tree.
  2. Add a method on Repository to remove the cache entry for a particular commit-ish (or all cache entries).

I like the first option better. If one API call is too much of a perf hit for Repository.tree, we could make the staleness check optional with a parameter. Thoughts?

(Needed for danports/amber#14)

Support for GitHub releases

Hi there, it would be great to have some basic support for GitHub releases (getting the latest release, getting a specific release by tag name, and fetching the tree for a release).

I originally implemented this in danports@03c8e8b (sorry, mixed some other changes in there).

@eric-wieser If you're amenable to this approach, I'll clean it up and send a PR.

Support for GitHub commits

I thought this code was already in master, but when I rebased my fork recently it disappeared. Was the code deleted from master? Or was this part of my fork that I never pushed?

-- A class for a commit
local Commit = {}
Commit.__index = Commit
Commit.new = function(repo, sha)
	local url = ('repos/%s/%s/git/commits/%s'):format(repo.user, repo.name, sha)
	local status, data = getAPI(url, repo.auth)
	if not status then
		error('Could not get github API from ' ..url)
	end
	return setmetatable({data = data}, Commit)
end

Only download updated files

It would be very nice if instead of always downloading everything this program could only download the files that changed.

So I think this can be achieved by storing the latest commit SHA in a file like .commit and when a repo is requested to be cloned check for that file and if it exists generate a diff and only downloading the files that were changed in that diff (I'm aware that just downloading and applying the file diff is way too difficult).

If this was added I'd argue it would make sense to add a flag to disable this behavior (or add a flag to enable it).

Enhancement: Add LICENSE to repo

I would like to see a LICENSE file added to the repo (preferably MIT).

MIT License

Copyright (c) 2016 Eric Wieser

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

OS Safety

Found the cause of the OS Safety (#2)

When you install this manually by putting it into the rom folder of computercraft..

You must edit the first line in github in the apis folder to

local JSON = dofile("rom/apis/dkjson")

This fixes that issue..

The reason it works if you manually install on a single computer is because its already calling an apis folder.
As when you install it globalling. The file location is rom/apis/dkjson

It seems the issue also persist in the program itself also when you install globally . Simple fix of editing the same lines on the program itself.

error on line 87

After cloning so many times I get this error message:
github:87: Could not get github API from repos/hugeblank/BagelBot/git/trees/unstable-as
What would be the cause of this? the repo is in existence, and I had no prior problems with it. I have also found that after a 5-10 minute wait that this issue fixes itself, but it eventually occurs again.

Generate release

It would be awesome to have a tag on the current master so as to reference this version of computercraft-github when calling the pastebin install script.

Attempt to call nil

When cloning any repository I always get the error 'github:145: attempt to call nil'
Using both advanced and normal computers
computercraft 1.75

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.