Commit Graph

351 Commits

Author SHA1 Message Date
Sebastian Thiel
e434563215 chore(cargo): compilation without local overrides
Also checked in code for groupsmigration to allow others to test it
simply by checking out the right commit.
2015-05-12 17:21:57 +02:00
Sebastian Thiel
f83dff672b refactor(config): bring in all required field data
Previously we only knew the type as string, now we have enums and
additional type information, like whether or not it's a POD.

However, borrow-checker doesn't like the current code, will need more
work.
2015-05-12 12:17:36 +02:00
Sebastian Thiel
a2dd71451d feat(config): basis for simplified value setting
Previously we would set static structures manully, using complex cases
and utility functions. Now we setup the foundation to allow setting
a generic `json::value::Value` instead, which can later be deserialized
into the target structure.

Related to #111
2015-05-12 11:17:42 +02:00
Sebastian Thiel
2ca0529297 fix(rustup): dc630d01e 2015-05-09
* Vec::add was removed ... which forces me to write 4 lines instead of
  one very readable one :(.
  Not everything is to the better here, even though I can imagine they
  did it to prevent people from thinking this is a cheap operation.

[skip ci]
2015-05-11 10:58:00 +02:00
Sebastian Thiel
ee84fefb4a fix(rustup): deal with rustc lifetime issue
Related to #109
2015-05-11 10:56:36 +02:00
Sebastian Thiel
5e5f0dcc66 chore(osx-deployment): fix tar-handling
Previously it would fail as '*' was in fact not substituted by the
subshell. Now I just take the brutal route, using find.

[skip ci]
2015-05-11 06:32:30 +02:00
Sebastian Thiel
383595c44e docs(CLI): added Download information
That way, it's easy to obtain the respective precompiled binary, as
well as seeing the source-code.

Overall, it makes promoting the tools easier as the CLI docs can be
linked directly.

Closes #108
[skip ci]
2015-05-10 19:40:25 +02:00
Sebastian Thiel
9e64d1bd10 fix(deployment): limit tar.gz to executable
Previously it could re-pack tar-files and mess everything up.

[skip ci]
2015-05-10 19:00:25 +02:00
Sebastian Thiel
e92f440d9b imp(index.html): download links to tar.gz files
That way, we save bandwidth and preserve the executable bit of the
respective program.

Closes #107
[skip ci]
2015-05-10 18:51:08 +02:00
Sebastian Thiel
ad6dd7758e chore(bash): move all scripts into src/bash
That way, they are more official than hidden scripts dumped in the
project root.

[skip ci]
2015-05-10 18:09:00 +02:00
Sebastian Thiel
69b12104a9 imp(index.html): DL title contains os-name
That way, it's clearer, besides the icons themselves, which OS you are
downloading for.

Related to #106
[skip ci]
2015-05-10 11:43:02 +02:00
Sebastian Thiel
52027c6db5 feat(index.html):added download links (osx,ubuntu)
All assets are configured via shared.yaml and are located elsewhere in
the web. This could lead to broken assets at some point, but I am just
risking it for know, knowing that it's easily done to have local
resources.

Closes #106
[skip ci]
2015-05-10 11:03:36 +02:00
Sebastian Thiel
0e6605d7a4 feat(index.html): added back-link to crates.io
* url is created per-API and features a nice crates image coming
  from githubusercontent.

Closes #105
[skip ci]
2015-05-10 09:10:25 +02:00
Sebastian Thiel
5c284e1c41 refactor(index.html): non-redundant data access
Previously we would define information about the program types
in two places, once for the index, and once per program type.
Now within the index.html, we just load the respective program type
information to have access to the latest at all times.

Closes #104
[skip ci]
2015-05-10 08:37:05 +02:00
Sebastian Thiel
e86e55cae7 imp(API): improved display of BadRequest
Previously you would only see "BadRequest ... " without the information
that would actually help you to understand what the cause of the issue
is.
Now we will print all the information we have, accordingly, which
greatly improves usability.

Closes #103
[skip ci]
2015-05-09 19:15:16 +02:00
Sebastian Thiel
fff466f6bc docs(CLI): after_help url for method scmds
That way, whenever the extended help of a method (e.g. apis get-rest)
is queried, you can easily jump to the online docs to get details about
required data-structures or parameters for instance.

[skip ci]
2015-05-09 14:36:40 +02:00
Sebastian Thiel
15daf311ea refactor(API): use json_tools::IteratorExt
That way, we can invert the flow and produce more idiomatic code.
[skip ci]
2015-05-09 09:57:26 +02:00
Sebastian Thiel
5894c8163a imp(CLI): remove null in pretty-printed json
Without all that clutter, it's so much more enjoyable to read the
output.

The implementation is based on a suggestion of @erickt, which is
converts into a json::Value (able to represent any json structure),
on which the filtering is applied.

If we should ever implement pretty-printing in json-tools, we might
still consider using these capabilities instead, as we would avoid
building potentially large datastructures, all we would need is
a sufficiently large destination buffer which is a single alloc and
a consecutive region in memory.

Closes #102
[skip ci]
2015-05-08 19:12:45 +02:00
Sebastian Thiel
26314e743e imp(API): faster null-value removal
Previously reserialization of token streams with removed null values
was performed on a byte-per-byte basis, which was quite inefficient
to say the least.

Now it uses `io::copy` to copy in chunks of 65kb, which makes out
our throughput and should deliver about 150MB/s at least.
2015-05-08 19:06:38 +02:00
Sebastian Thiel
3efa4f2b12 fix(API): filter null values of requrest structs
Some servers, like youtube, reject null values possibly thanks to
the reliance on parts. Now we are filtering them (in a very inefficient,
but working way), which seems to be fine with the servers.

Effectively, we seem to be able now to upload videos ... .

More testing required !
2015-05-08 12:38:59 +02:00
Sebastian Thiel
3fe2732a01 fix(compat): upgrade to hyper v0.4.0
It was basically just a find-and-replace to adapt to the changed names
of Error and Result types.
2015-05-08 11:52:28 +02:00
Sebastian Thiel
2485343caa refactor(CLI): use arg_enum! clap-rs macro
That way, we get a better (case-insensitive) implementation of `FromStr`
which reduces the amount of code we have to maintain.

Closes #101
[skip ci]
2015-05-06 11:58:45 +02:00
Sebastian Thiel
ef63790422 refactor(CLI): better vector building
Instead of using multiple lines to add vectors up involving iterators,
I just add slices together. This should produce less, and possibly
faster machine code, with less ascii code.

Downloads tested with drive2, and are verified to be working !

Close #97
2015-05-06 11:04:19 +02:00
Sebastian Thiel
f1fe6bac01 refactor(CLI): move global params to runtime
Global params were repeated per method, even though they were global,
per API. Now they are kept in vectors and used at runtime, accordingly.
We save a little bit of code, have simple matches, and less repition.

It's unclear if this reduces the size of the binary though ... or the
compile times, as the extra loop is an extra loop after all ;).

Still need to test the download mode using drive1

Related to #97
[skip ci]
2015-05-05 21:44:27 +02:00
Sebastian Thiel
9274938f9f fix(CLI): completed list of parameter names
Previously the 'did-you-mean' functionality only knew the global
paramters, but not the method-local ones.
2015-05-05 20:46:45 +02:00
Sebastian Thiel
bbab1f2e38 refactor(CLI): use raw strings for argparser
That way, we should be save from contained '"' characters, and whatever
else.

Closes #100
2015-05-05 20:02:26 +02:00
Sebastian Thiel
b27c990db8 fix(API): simplified call to form_urlencode
It now supports more generic inputs, as suggested in a lenghty
dialog on a corresponding github issue.

Required to build with >=0.2.33
2015-05-05 08:48:25 +02:00
Sebastian Thiel
96415d17ca feat(CLI): did you mean for struct values
* functionality is cursor-aware, and fixes the actual string the user
  passed in. That way, it is made very clear how the suggested value
  is to be used.
* it's a known weakness of the implementation that it operates on a
  flattened list of field names, and thus may make nonsensical
  suggestions.
* added punctuation to all errors

Fixes #67
[skip ci]
2015-05-02 14:07:28 +02:00
Sebastian Thiel
89432cc646 fix(CLI): gate usage of upload_media_params
Previously the local stack variable would be used even though it
wasn't initialized as there were no upload flags. Now this only
happens if there are media params.

[skip ci]
2015-05-02 09:57:08 +02:00
Sebastian Thiel
75b80de3c6 feat(CLI): -u <mode> <file> parsing
* As `possible_values()` applies to all arguments, we cannot use it
  anymore but have to check the UploadProtocol type ourselves.
  Besides that, switching to the latest `clap` simplified our lives
  a little.
* ajusted docs to not enforce using `-r` all the time

Fixes #92
[skip ci]
2015-05-01 20:00:25 +02:00
Sebastian Thiel
c346645fc9 fix(API): let delegate forget uploaded urls
When uploading using the resumable protocol, we are now telling the
delegate to forget the previously stored URL after successful upload.
Previously it would have tried to return such a URL and thus made
the system retry uploading a file that was already uploaded.

Fixes #85
[skip ci]
2015-05-01 16:24:31 +02:00
Sebastian Thiel
bf6a2ba60c fix(CLI): handle repeated required strings
In a single case we wouldn't properly pass on string arguments that
were repeated. Now we handle them with a nice one-liner.

Fixes #96

[skip ci]
2015-05-01 15:22:59 +02:00
Sebastian Thiel
153324ebcc fix(CLI): 'about()' text for main commands
It shows up in the help, and makes it easier to navigate the command
tree without bringing up the html documentation.

Fixes #95
[skip ci]
2015-04-30 17:30:45 +02:00
Sebastian Thiel
94c821e09d fix(CLI): adjust JsonTokenStorage to yup-oauth
Signature of `set()` changed to return a `Result<(), _>` instead of
an `Option<_>`.

Related to https://github.com/Byron/yup-oauth2/issues/5
[skip ci]
2015-04-30 17:14:12 +02:00
Sebastian Thiel
2f200217f9 fix(CLI): unified error handling
* Use `Result` everywhere, instead of Option or tuples
* Properly handle error occurring after the dry-run. We do it in an
  extensible way, in case we need to do more than handle invalid output
  files at some point. Output files that could not be opened will now
  result in a nice error message with all the information we have.

Fixes #66
2015-04-30 16:31:49 +02:00
Sebastian Thiel
894b5b5ec7 feat(CLI): adjust to serde usage in yup-oauth
* More detailed error type for JsonTokenStorage
* removed all traces of rustc_serialize
* use pretty-printers everywhere to allow writing human-readable json
  files for secretes and for tokens

Fixes #93
2015-04-30 15:20:56 +02:00
Sebastian Thiel
fac50418a7 fix(CLI): escape subcommand descriptions
Otherwise, we could have had invalid rust strings.

[skip ci]
2015-04-30 13:48:11 +02:00
Sebastian Thiel
bd27046cc8 docs(clap): update STRUCT_FLAG and UPLOAD flags
* adjust documentation to resemble actual upload flag semantics. It was
  still using the one previously used in docopt.
* Make -m <mime-type> optional, defaulting to 'application/octet-stream'

Should have been fixed alongside of #81
2015-04-30 13:40:48 +02:00
Sebastian Thiel
d46c083975 fix(API): remove unused std_misc feature
Hopefully this will not trigger errors elsewhere, but we will
just find out I guess ;)
2015-04-30 11:18:58 +02:00
Sebastian Thiel
4115d50ca7 fix(API): adjust to latest hyper header macros 2015-04-30 11:15:48 +02:00
Sebastian Thiel
d0ce221ba3 fix(clap):re-introduce UploadProtocol,fix CallType
* CallType now represents either Upload or Standard calls, whereas
  the Upload variant is represented by the UploadProtocol enum.
  That way it's clear what happens, and we don't mix orthogonal concepts
  in one enumeration just for convenience.

All tested APIs seem to build, verified

* upload
* download
* request structures
* parameters
* scopes
* config-dir
* debug[-auth]

Fixes #81
2015-04-30 10:20:02 +02:00
Sebastian Thiel
b039b38244 fix(clap): update docs and fix calltype handling
* mkdoc docs grammar is now hierarchical, making the command structure
  more obvious and easier to understand. It's a nice addition to the
  auto-generated, hierachical usage of clap.
* UploadProtocol enum is now CallType, to ease handling the different
  ways the Call has to be executed. It looks quite clean, even though
  combining upload protocols and the calltype is a bit hacky.
2015-04-30 10:05:55 +02:00
Sebastian Thiel
7a38f7e4d5 fix(clap): various fixes and improvements
* `--version` now includes the API revision we embody
  (using crate_version())
* Allow multiple scopes to be specified, instead of just one. Previously
  this was problemantic due to argument parsing of docopt being greedy.
  However, this also means we have to specify the `-r` flag for each
  invocation. See https://github.com/kbknapp/clap-rs/issues/89 .
* Adapted to new signature of `Arg::possible_values()` and used the
  previously orphaned `UploadProtocol` enum.
* Deduplicated code a little by adding the new `opt_values()` generator
  function.

 Related to #81
2015-04-30 09:03:11 +02:00
Sebastian Thiel
63e23dd48f fix(clap): print usage if command is missing
Also, fixed config-dir substitution in flag's help message
2015-04-29 22:08:47 +02:00
Sebastian Thiel
5320a48e68 fix(clap): tweaks to make youtube3 work
Mainly minor cleanup, and handling of generator branches that
didn't show up in smaller APIs that were used during the first steps.

related to #81
2015-04-29 21:59:06 +02:00
Sebastian Thiel
bac4e1a82f fix(clap): adjust option usage to changed API
Discovery API now builds and seems to work even ! More testing
will have to be done though to be sure.

Related #81
2015-04-29 21:04:50 +02:00
Sebastian Thiel
feaa3a06ed fix(clap): handle apis without media upload
We are annotating the type of the optional protocols if that shall be
required.
2015-04-29 19:48:45 +02:00
Sebastian Thiel
02a4129662 fix(clap): call iter() directly
As IntoIter is only implemented for slices up a sice of 32.
DFAReporting though will reach 55, at least.

Also added dfareporting-cli code to show how stackoverflow issues can be
circumvented efficiently.
2015-04-29 19:32:04 +02:00
Sebastian Thiel
656fcae2b4 feat(clap): implement -u as good as possible
We can't have the `-u <mode> <file> <mime>` style yet, but
https://github.com/kbknapp/clap-rs/issues/88 might help with that
at some point.

Related to #92 and #81
2015-04-29 18:36:39 +02:00
Sebastian Thiel
1aff3135d9 fix(clap): commit before un-using UploadProtocol
We will try to wait for https://github.com/kbknapp/clap-rs/issues/87
to allow us to use the enumeration instead of strings, as well as
an iterator, which will look more idiomatic in the end.
2015-04-29 17:16:50 +02:00