-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New user command #10
New user command #10
Conversation
Addresses #6. |
@@ -6,15 +6,23 @@ extern crate git2; | |||
use std::env; | |||
use std::path::Path; | |||
|
|||
fn main2() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebase on top of issue 4 when that's done, and make sure that src/main.rs is all cleaned up afterwards.
Kaaaay, I ripped it apart. Good luck :) |
Oh and add some integration tests, like the ones in |
@@ -1,17 +1,38 @@ | |||
/// Structure to represent a Proton Project. | |||
/// This is what will be written to a Protonfile at the project root. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be right next to Project. Move User down below pub struct Project
and above impl Project
.
} | ||
} | ||
|
||
// Adds a user to the project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc comment (3 slashes)
If |
No, forget everything I said about references earlier. Just keep everything as Strings like earlier. You had it right before, because that String goes from Args -> run_new_user -> new_user -> User -> Project -> disk, and then is never used again. So it's totally fine. |
@@ -1,17 +1,38 @@ | |||
/// Structure to represent a Proton Project. | |||
/// This is what will be written to a Protonfile at the project root. | |||
#[derive(Debug, RustcEncodable, RustcDecodable)] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of this blank line. Comments should be directly next to what they're doc-ing. Otherwise it just looks weird. Do you not think so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it looks weird next to the #[derive()]
statement. Move the derive inside the struct? Otherwise it does look better than having the space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/**
* Merges stuff
* @param dataIds
*/
@Override
public String runMerge(List<String> dataIds) throws TException {
Idk, it looks normal to me to not have a line there in Java. Well, do it however you want. Maybe we should run rustfmt on it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, don't bother. Looks pretty good w/o the blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you even move the derive? I don't think you can. Though you shouldn't anyway, it would be different from everything else. You can move the doc comment into the struct by changing it to use //!
, but again, taht would be inconsistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, for now, just leave the line there. We can try rustfmt out later, in a different issue.
@@ -43,3 +56,13 @@ impl PartialEq for Project { | |||
|
|||
impl Eq for Project { | |||
} | |||
|
|||
impl PartialEq for User { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of both PartialEq and Eq impls. Add #![derive(Eq)]
to Project and User.
Sort of. You did find_user. I should really just read the code before I comment.
|
1 and 2: Could we use a HashSet or HashMap, with the public key being the key and the user being the value? That takes care of uniqueness of the key, and might make the lookup simpler |
Sounds good. So, something like this:
Can we JSON en/decode the in built hash maps? -- Yes we can, the traits are implemented for hashmap in the rustc-serialize package that we use. Then we need two commands instead. Do we actually want that? I think it's actually better to just make it one to one, because then its less complicated for the users. I mean, we're going to be distributing the private key to every person doing sequencing anyway (at least, I can't think of another way to do it. We can just call it a password and tell them to plug it in when they open the GUI). It's not like they're going to use the private keys for general use on their own computers. |
I'm alright with keeping it simple and making it one to one. If they use multiple systems, they will just have to copy the private key manually. That would make Project and User look the same as before, just with added checks inside |
Yup, sounds good. |
Now find user is only checking if the name AND key are equal. You need to check if name OR key are equal. |
} | ||
|
||
/// Creates a temporary directory to run a test out of | ||
/// and initializes a new project inside this directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't initialize a new project.
Thanks, good catch. Just in time to make my tests pass too |
Good? |
Almost good. The only thing I noticed was in the tests was that you when you reset the current directory, you only go up to But actually, I don't think you need that in the first place. Tests shouldn't depend on the directory they're in, unless they set it up themselves. So you can probably just get rid of all the directory resets. After that, LGTM. |
And let me check real quick if there's a way to specify how many threads to use in the cargo.toml. |
And no, there's not currently a way to set the |
Great! |
Whoops, needs to commit changes still |
Oh k. Well, go ahead and merge when you're ready. |
* Added name to authors (#4) * Name (#7) * Added Vlad to authors list (#10) * Overhaul of structure to use DAOs and database for backend storage (#11) * Initial database implementations (#12) * Updated README (#14) * Working code for 2016 show (#19) * Created initial 'it works' test * Restructured into separate tests. 'is-working' tests complete? * Restructured 'all working' test * Added more tests. Reorganized again * One more test * Added test for seq sec editor added on perm change. Implemented; passing * All tests implemented except working and 0 sections * All tests passing * Restructured so sequence not returned on resection * Converted main code to new permissions api * Tests using new api. Removed check for sequence section editor. Some tests failing * All tests passing * Removed editor from sequence_section type * Tests now want seq sec in range [0, numSections) * SeqSec now 0-indexed. Removed last traces of editor field * Updated README and fixed error in main * Added checks * Moving towards Fixtures instead of 2d blocks of sequence data * Restructured to use DAOs and database setup instead of storing in flat files * Added initial database backup * Postgres connection working in channel dao * Generalized common functionality * Updated names, public instead of private key, uid for list-permissions * Init project returns generated public key * Updated database definition * Looser Cargo package versions for upgrading/good documentation * Adding initial user mostly implemented. Util function to gen pub/priv keys * Store both pub/priv key. Trim before compare. Get uid from key started * Permission handling stuff. PermissionEnum is string now for simplicity * new-user fully implemented * A little cleanup of tests; moving towards using again * Removed unused imports. New return type for get-uid * PermissionEnum updated. Preliminary work on add_sequence done * new_sequence working? * get_sequence command added to main * new-layout function set up * Reading layout from file. Locations and rotations checked * Adding layout implemented. Transactions/removing not implemented * Layout as of 11/21/2016 added * Project in db behind DAO now as well. General cleanup * set-sequence-layout working * Existential dao functions * Channel data now in separate table * Moved db backups to separate folder * get-layout-id command added, not implemented * Finished implementing add-sequence * get-playlist-data implemented * new-vixen-sequence working. Nullable values changed to options. * Updated Cargo.toml * Added seqid to playlist output * Changed the format of playlist data * Added music file to playlist outputted data * Made functional again after rebase * Added sequence duration to Sequence object for accurate num_frames calc * Added internal channel to Channel type and layout reading * Patching stuff * Added current db backup with internal channel * Patching working now; hackish fix * Added patch file * Updated layout and patch * Working show backed up * Stopped copying music over * Using postgres FUNCTION for patching * Added DB with FUNCTION in last commit added * New patch * Added newer patches * main.rs alphabetized. Added get-project command * Cleaned up warnings * More verbose patching * Added SQL to reset database to clean state * Fixed error with reading file as string * WORKINGgit st! * Working show backup * Adding admin key for 1202 backup * Actual working show backup (whoops) * add-sequence turned into insert-sequence * Udated patch * Print statemets for verbosity * 12_03 patch * Different format for outputting playlist data * Removed public keys from repo * New sequences don't copy their music files to a Music/ directory * Version now 0.19.1 as per SemVer (#33) * Adding beginning of testing framework post-overhaul (#32) * Documentation (#28) * Removed rebase artifacts. Updated version in Cargo.lock (#34) * Permissions checks moved from the second-tier functions to main.rs (#35) * Permissions checks moved from the second-teir functions to main.rs * Fixes issues to moving permissions check * Updated version numbers for dependencies (removing wildcards) (#36)
No description provided.