Git Product home page Git Product logo

hubcaps's People

Contributors

adamcstephens avatar alpire avatar artturin avatar aturon avatar badboy avatar bitdivision avatar carols10cents avatar cole-h avatar dbaron avatar dpc avatar dt665m avatar dwijnand avatar euclio avatar grahamc avatar jasonwhite avatar jessfraz avatar joprice avatar keirlawson avatar khuey avatar marwes avatar mranno avatar nickelc avatar olix0r avatar piegamesde avatar redrield avatar rocallahan avatar shepmaster avatar softprops avatar xion avatar zhiburt 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hubcaps's Issues

Getting list of open PRs no longer works

Code worked just fine for almost a month; it even worked yesterday just fine, but today it no longer works.

Line where it fails: https://github.com/zetok/gopull/blob/843d012152f751c38ab39c8cacc937af564944f1/src/gh_interaction.rs#L43

fails with:

thread 'main' panicked at 'Failed to get list of PRs: Codec(Syntax(InvalidType(Unit), 1, 46248))', ../src/libcore/result.rs:788
stack backtrace:
   1:     0x559f609dcddf - std::sys::backtrace::tracing::imp::write::h46e546df6e4e4fe6
   2:     0x559f609dfc7b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h077deeda8b799591
   3:     0x559f609df8ff - std::panicking::default_hook::heb8b6fd640571a4f
   4:     0x559f609d408e - std::panicking::rust_panic_with_hook::hd7b83626099d3416
   5:     0x559f609dfec1 - std::panicking::begin_panic::h941ea76fc945d925
   6:     0x559f609d4a1a - std::panicking::begin_panic_fmt::h30280d4dd3f149f5
   7:     0x559f609dfe5e - rust_begin_unwind
   8:     0x559f60a1571f - core::panicking::panic_fmt::h2d3cc8234dde51b4
   9:     0x559f6080c340 - core::result::unwrap_failed::h1e1e300e203e4634
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/obj/../src/libcore/macros.rs:29
  10:     0x559f6080c0e5 - _<core..result..Result<T, E>>::expect::h57d9c62efb974bc6
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/obj/../src/libcore/result.rs:750
  11:     0x559f60800ca2 - gopull::gh_interaction::list_open_pulls::h0872ed321f596244
                        at /home/zetok/git_zetok/rust/gopull/src/gh_interaction.rs:43
  12:     0x559f607ffb22 - gopull::main::h81ddba921818c910
                        at /home/zetok/git_zetok/rust/gopull/src/main.rs:50
  13:     0x559f609df538 - std::panicking::try::call::hca715a47aa047c49
  14:     0x559f609e74db - __rust_try
  15:     0x559f609e747e - __rust_maybe_catch_panic
  16:     0x559f609defde - std::rt::lang_start::h162055cb2e4b9fe7
  17:     0x559f608018e9 - main
  18:     0x7f4fe86ac83b - __libc_start_main
  19:     0x559f607ff7b8 - _start
  20:                0x0 - <unknown>

Error listing my repositories - `Err(Decoding(ExpectedError("String", "null")))`

Hi! I see in #21 that you mention deserialization has been a bunch of trial and error... and I think I have an error for you to try :)

When I try and list my repositories, I get Err(Decoding(ExpectedError("String", "null"))). This is the code i'm using, also available in a convenient github repository!

extern crate hyper;
extern crate hubcaps;

use hubcaps::Github;

fn main() {
    let client = hyper::Client::new();
    let github = Github::new(
        "my-cool-user-agent/0.1.0",
        &client,
        None::<String>,
    );
    println!("{:?}", github.user_repos("carols10cents").list());
}

If there's any other information I can provide, please let me know! I might take a look at the json and see if I can figure this out, and if so i'll send in a PR, but I wanted to file the issue either way :)

Better test coverage for decoding sample payloads

Most testing and bug findings for deserialization errors has been done by hand in tial and error fashion. Let's set up a better test harness for this and let travis do all the work.

This will also come in handy in particular for regessuon testing after the switching serde.

Add methods to get latest release and release by tag name

Hi, I'd like to have API to get the latest release and release by tag name.

Something like the following. I will submit PR if you like.

impl<'a> Releases<'a> {
...
    // https://developer.github.com/v3/repos/releases/#get-the-latest-release
    pub fn latest(&self) -> Result<Release> {
        self.github.get::<Release>(&self.path("/latest"))
    }

    // https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name
    pub fn by_tag(&self, tag: &str) -> Result<Release> {
        self.github.get::<Release>(&self.path(&format!("/tags/{}", tag)))
    }
}

Reference

0.2.2 doesn't build

$ cargo build
   Compiling hubcaps v0.2.2
/home/alex/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/hubcaps-0.2.2/build.rs:14:29: 14:42 error: mismatched types:
 expected `&mut syntex::Registry`,
    found `&mut syntex::Registry`
(expected struct `syntex::Registry`,
    found a different struct `syntex::Registry`) [E0308]
/home/alex/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/hubcaps-0.2.2/build.rs:14     serde_codegen::register(&mut registry);
                                                                                                                                             ^~~~~~~~~~~~~
/home/alex/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/hubcaps-0.2.2/build.rs:14:29: 14:42 help: run `rustc --explain E0308` to see a detailed explanation
/home/alex/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/hubcaps-0.2.2/build.rs:14:29: 14:42 note: Perhaps two different versions of crate `syntex` are being used?
/home/alex/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/hubcaps-0.2.2/build.rs:14     serde_codegen::register(&mut registry);
                                                                                                                                             ^~~~~~~~~~~~~
error: aborting due to previous error
error: Could not compile `hubcaps`.

To learn more, run the command again with --verbose.

From my Cargo.lock

[[package]]
name = "hubcaps"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
  "hyper 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_codegen 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",                                                                                                           
  "serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "serializable_enum 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "syntex 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_codegen"                                                                                                                                                                     
version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
  "aster 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "quasi 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "quasi_codegen 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "syntex 0.35.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "syntex_syntax 0.35.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

In build.rs, syntex::Registry::new(); creates a 0.33.0 struct and then attempts to pass it to serde_codegen::register() which is expecting a 0.35.0 struct. It looks like this has already been fixed in master. Will there be a release soon? Or is there an older version I can use?

break up rep.rs

this file is getting unwieldy. perhaps soft of these should live under module folders

before/now

foo_mod.rs // rest interfaces
rep.rs // representations (for everything)

after

foo/mod.rs // rest interfaces
foo/rep.rs // representations for foo

Small ergonomic issue with no token

Due to the polymorphism of Github::new(), if you try to pass in just a None, you get a very confusing error:

src/main.rs:10:18: 10:29 error: unable to infer enough type information about `_`; type annotations or generic parameter binding required [E0282]
src/main.rs:10     let github = Github::new(
                                ^~~~~~~~~~~

I fixed this by passing None::<String>, but that's a bit awkward.

I'm not sure what the right thing is here.

Allow non_camel_case_types

Some enums are based in gh reps. Let's relax the warnings for now. Moving to serde and aliasing will also help with this

Feature request: oauth

This might not be something you'd want in hubcaps proper, but it would be nice to be able to have some helper stuff around GitHub's oauth implementation. The use case here is a website with "log in via GitHub" that wants to use hubcaps for interacting with GitHub.

Does not compile on the latest nightly

┌ euclio@apollo ~/r/hubcaps (master)
└╌╌┄┄ ❯❯ rustc --version
rustc 1.10.0-nightly (764ef92ae 2016-05-19)
┌ euclio@apollo ~/r/hubcaps (master)
└╌╌┄┄ ❯❯ cargo test
   Compiling rustc-serialize v0.3.18
   Compiling gcc v0.3.26
   Compiling semver v0.1.20
   Compiling serde v0.7.0
   Compiling traitobject v0.0.1
   Compiling libc v0.2.8
   Compiling openssl v0.7.8
   Compiling language-tags v0.2.2
   Compiling memchr v0.1.10
   Compiling aho-corasick v0.5.1
   Compiling rand v0.3.14
   Compiling utf8-ranges v0.1.3
   Compiling lazy_static v0.1.15
   Compiling rustc_version v0.1.7
   Compiling unicase v1.4.0
   Compiling num_cpus v0.2.11
   Compiling num v0.1.31
   Compiling winapi-build v0.1.1
   Compiling typeable v0.1.2
   Compiling unicode-normalization v0.1.2
   Compiling serializable_enum v0.3.0
   Compiling bitflags v0.4.0
   Compiling kernel32-sys v0.2.1
   Compiling pkg-config v0.3.8
   Compiling matches v0.1.2
   Compiling unicode-bidi v0.2.3
   Compiling uuid v0.1.18
   Compiling openssl-sys v0.7.8
   Compiling openssl-sys-extras v0.7.8
   Compiling serde_json v0.7.0
   Compiling idna v0.1.0
   Compiling url v0.5.7
   Compiling httparse v1.1.1
   Compiling unicode-xid v0.0.3
   Compiling log v0.3.5
   Compiling url v1.1.0
   Compiling mime v0.2.0
   Compiling bitflags v0.5.0
   Compiling regex-syntax v0.3.0
   Compiling winapi v0.2.6
   Compiling hpack v0.2.0
   Compiling time v0.1.34
   Compiling term v0.2.14
   Compiling cookie v0.2.2
   Compiling solicit v0.4.4
   Compiling regex v0.1.58
   Compiling syntex_syntax v0.32.0
   Compiling syntex_syntax v0.30.0
   Compiling hyper v0.9.3
   Compiling env_logger v0.3.2
   Compiling syntex v0.32.0
   Compiling quasi v0.8.0
   Compiling aster v0.14.0
   Compiling syntex v0.30.0
   Compiling quasi_codegen v0.8.0
   Compiling serde_codegen v0.7.1
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:15:5: 15:20 warning: attributes of the form `#[derive_*]` are reserved
for the compiler
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:15     #[derive_Debug]
                                                                                               ^~~~~~~~~~~~~~~
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:15:5: 15:20 help: add #![feature(custom_derive)] to the crate attribute
s to enable
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:53:5: 53:20 warning: attributes of the form `#[derive_*]` are reserved
for the compiler
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:53     #[derive_Debug]
                                                                                               ^~~~~~~~~~~~~~~
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:53:5: 53:20 help: add #![feature(custom_derive)] to the crate attribute
s to enable
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:104:5: 104:20 warning: attributes of the form `#[derive_*]` are reserve
d for the compiler
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:104     #[derive_Debug]
                                                                                                ^~~~~~~~~~~~~~~
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:104:5: 104:20 help: add #![feature(custom_derive)] to the crate attribu
tes to enable
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:147:5: 147:20 warning: attributes of the form `#[derive_*]` are reserve
d for the compiler
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:147     #[derive_Debug]
                                                                                                ^~~~~~~~~~~~~~~
/home/euclio/repos/hubcaps/target/debug/build/serde_codegen-e34b6067af326668/out/lib.rs:147:5: 147:20 help: add #![feature(custom_derive)] to the crate attribu
tes to enable
   Compiling hubcaps v0.2.1 (file:///home/euclio/repos/hubcaps)
build.rs:14:29: 14:42 error: mismatched types [E0308]
build.rs:14     serde_codegen::register(&mut registry);
                                        ^~~~~~~~~~~~~
build.rs:14:29: 14:42 help: run `rustc --explain E0308` to see a detailed explanation
build.rs:14:29: 14:42 note: expected type `&mut syntex::Registry`
build.rs:14:29: 14:42 note:    found type `&mut syntex::Registry`
build.rs:14:29: 14:42 note: Perhaps two different versions of crate `syntex` are being used?
build.rs:14     serde_codegen::register(&mut registry);
                                        ^~~~~~~~~~~~~
error: aborting due to previous error
error: Could not compile `hubcaps`.

To learn more, run the command again with --verbose.

add support for basic auth

the interaction is a bit weird when 2factor auth is involved. it may not be worth it at all given the other options. let's leave this issue as documentation that it doesn't exist yet

Impossible to compile 0.2.2

It's currently impossible to use the release v0.2.2, as it has dependencies on two different versions of syntex.

$ grep '"syntex ' Cargo.lock
 "syntex 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "syntex 0.39.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "syntex 0.39.0 (registry+https://github.com/rust-lang/crates.io-index)",

Error:

   Compiling hubcaps v0.2.2
error: mismatched types [--explain E0308]
  --> /home/jer/.cargo/registry/src/github.com-1ecc6299db9ec823/hubcaps-0.2.2/build.rs:14:29
   |>
14 |>     serde_codegen::register(&mut registry);
   |>                             ^^^^^^^^^^^^^ expected struct `syntex::Registry`, found a different struct `syntex::Registry`
note: expected type `&mut syntex::Registry`
note:    found type `&mut syntex::Registry`
note: Perhaps two different versions of crate `syntex` are being used?
  --> /home/jer/.cargo/registry/src/github.com-1ecc6299db9ec823/hubcaps-0.2.2/build.rs:14:29
   |>
14 |>     serde_codegen::register(&mut registry);
   |>                             ^^^^^^^^^^^^^

error: aborting due to previous error
error: Could not compile `hubcaps`.

This is on a bare minimum new project with hubcaps as a direct dependency.

git seems to work fine. Maybe push out a new (bugfix) release?

`missing field` error

(Same as reported via Twitter)

We're using Hubcaps to create releases: https://github.com/semantic-rs/semantic-rs/blob/9d833599126b012485cf8c083c488e7cd41ed997/src/github.rs

The code runs after tests on Travis, where it sometimes fails with

GitHub(Codec(Syntax(missing field "field", 1, 132)))

Link: https://travis-ci.org/badboy/test-project/jobs/118362428#L771

I was not able to reproduce it locally (yet). The build runs with RUST_LOG=debug, but no Hubcaps logs are shown (didn't check if there are some in the code path we're triggering).

Seems like that field field belongs to FieldErr struct, but I don't know where it comes from at the moment.
The Git tag is already pushed when that release happens.
The error does not happen everytime. Some builds run just fine.

Any idea what's causing this or how we could debug this further?

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.