Code Monkey home page Code Monkey logo

clone's Introduction

clone.io

A simple way to work with remote data.

walkthrough

installing

Install clone.io.

$ npm install -g clone.io

cloning a resource

Clone a resource using its url. The JSON will be pretty-printed, and the information needed to update it will be added if it doesn't already exist. If it's a hypermedia API, like GitHub, the url in the original request will be used.

$ cd ~/Desktop
$ clone.io https://github.com/resources/clone.io get
$ ls -A1p
clone.io.json

Note that the command appears after the resource. This makes it easy to perform a different command on the same resource.

viewing information about a resource

The first argument can either be a URL or a file. The local file contains a link to the remote resource, so it can be used to perform actions involving both the local and remote resource.

Running the command with just the name of the file:

$ cd ~/Desktop
$ clone.io clone.io.json

Will print out the following YAML:

url:  https://github.com/resources/clone.io
type: /services/github/repo
subresources:
  - clone.io clone.io.json ./code get
  - clone.io clone.io.json ./issues get
  - clone.io clone.io.json ./wiki get
  - clone.io clone.io.json get --all
actions:
  - clone.io clone.io.json get    # update clone.io.json
  - clone.io clone.io.json diff   # compare local and remote resource
  - clone.io clone.io.json patch  # patch remote resource with local updates
  - clone.io clone.io.json show   # pretty-print the data

getting an updated copy

To update the local resource from the remote resource, call get:

$ clone.io clone.io.json get

TODO: provide a tool or recommend a practice to preserve the old data.

editing and patching

First, open index.json in an editor and change the description. If you like, you can use $EDITOR:

$ clone.io clone.io.json edit

Now you can view a diff, which uses jsonpointer:

$ clone.io clone.io.json diff
https://api.github.com/repos/resources/clone.io#/description
  - "A way to work with remote data using your own tools on your own filesystem."
  + "a simple way to work with remote data"

Now that you know what is going to change, you can patch it on the server:

$ clone.io clone.io.json patch
Patching https://api.github.com/repos/resources/clone.io...
Enter GitHub username:
Enter GitHub password:
Successfully patched https://api.github.com/repos/resources/clone.io.

status

Not yet implemented. Starting with github project data.

license

MIT.

clone's People

Contributors

benatkin avatar

Watchers

 avatar  avatar  avatar

clone's Issues

implement cloning a public github project

  • make cli script
  • accept clone.io <url>
  • match URL
  • create directory if it doesn't already exist (otherwise err)
  • put clone.yml file in directory
  • get JSON from API
  • put project data in project.yml

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.