Skip to content
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

Xcode scheme --work-dir path was hard coded #36

Merged
merged 1 commit into from
Feb 20, 2016
Merged

Xcode scheme --work-dir path was hard coded #36

merged 1 commit into from
Feb 20, 2016

Conversation

mpclarkson
Copy link
Contributor

Changed to: --work-dir=($SRCROOT) as it was hard coded to /Users/tanner...

I'm still having all sorts of problems getting anything to build on OSX using the SPM (at least without resorting to Docker) so I have to build using Xcode. This will make it easier for anyone else in my situation.

@mpclarkson
Copy link
Contributor Author

I have added the ability to created nested resources. I have implemented this the same way as Laravel - namely using dot notation for the path - although this could also be achieved using the controller name.

The parameters are all snake_case for consistency but this can be easily changed. Just let me know what you prefer.

I'll write some tests for this tomorrow (it is night down here) but it works.

The new behaviour is:

Nested Resources

Route.resource("foo.bar", controller: FooBarController())
//Get foo/:foo_id/bar nil
//Post foo/:foo_id/bar nil
//Get foo/:foo_id/bar/:bar_id nil
//Put foo/:foo_id/bar/:bar_id nil
//Delete foo/:foo_id/bar/:bar_id nil

Single Resource
This remains the same -i.e. the trailing parameter is simply :id

Route.resource("foo", controller: FooController())
//Get foo nil
//Post foo nil
//Get foo/:id nil
//Put foo/:id nil
//Delete foo/:id nil

@mpclarkson mpclarkson changed the title Xcode scheme --work-dir path was hard coded Nested Resources and Xcode scheme --work-dir path was hard coded Feb 20, 2016
//Construct the path for show, update and destroy
let fullPath = num == 1
? "\(path)/\(params.last!)"
: Zip2Sequence(components, params)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is Zip2Sequence?

@tanner0101
Copy link
Member

This looks great, but I will need to check it out on Mac / Linux and also write tests.

Anyway you could separate the workDir fix into a different PR that I could merge now?

.joinWithSeparator("/")

//The path for index and store (ie without the trailing id)
let shortPath = fullPath.stringByReplacingOccurrencesOfString("/" + params.last!, withString: "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't run on linux for me, there'll need to be compatibility code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers thanks. I'll update.

@mpclarkson mpclarkson changed the title Nested Resources and Xcode scheme --work-dir path was hard coded Xcode scheme --work-dir path was hard coded Feb 20, 2016
@mpclarkson
Copy link
Contributor Author

Done. I have moved the nested resources into a separate branch and will submit a pull request later after I've written some tests.

@mpclarkson
Copy link
Contributor Author

So this now only includes the --work-dir change

@tanner0101
Copy link
Member

Perfect, thanks!

tanner0101 added a commit that referenced this pull request Feb 20, 2016
Xcode scheme `--work-dir` path was hard coded
@tanner0101 tanner0101 merged commit 5765526 into vapor:master Feb 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants