Skip to content

Add more build specs and include bugfixes#850

Merged
faustinoaq merged 19 commits into
masterfrom
fa/add-more-build-specs
Jun 21, 2018
Merged

Add more build specs and include bugfixes#850
faustinoaq merged 19 commits into
masterfrom
fa/add-more-build-specs

Conversation

@faustinoaq
Copy link
Copy Markdown
Contributor

@faustinoaq faustinoaq commented Jun 16, 2018

Description of the Change

This PR depends on #826

This PR add more build specs like recipes repo already does:

model/template ecr slang
granite 👍 👍
crecto 👍 👍

Alternate Designs

Add more built specs (mysql, sqlite)?

Benefits

This will help us to prevent issues with projects ecr and crecto because this combination is currently untested. We had several issues in the past with crecto/ecr mainly because no build specs on them

Possible Drawbacks

This will check all amber features are working fine (well, except other db 😅 )

@eliasjpr
Copy link
Copy Markdown
Contributor

It would be great if we can move all the templates to recipes, not sure if thats possible, but this will removed the overhead of testing the generated apps and have those tests in one central place.

Not sure how feasible is this since I know there are concerns about pulling generators from the recipe repos.

@eliasjpr
Copy link
Copy Markdown
Contributor

@faustinoaq can we move these tests to the Recipe repo? Even if we duplicate the templates for now.

@damianham do you think you can work on making a default recipe for amber. @amberframework/contributors lets also brainstorm how we can move the API generator (if possible)

Ideally the CLI can be a shell that only runs command without the template dependencies. ❤️

@faustinoaq
Copy link
Copy Markdown
Contributor Author

can we move these tests to the Recipe repo? Even if we duplicate the templates for now.

All these test (an more) already exist on recipe repo, see: https://github.com/amberframework/recipes/tree/master/spec

@eliasjpr We already discussed recipes on #750 and we concluded we gonna try current recipe implementation (optional), and migrate templates to recipes or shards progressively.

Currently, This PR is very useful to cover untested features like crecto and ECR templates for amber projects generated without recipes.

@damianham
Copy link
Copy Markdown
Contributor

@eliasjpr my current thinking based on the work I did on my Maze test framework is to have a base (default) recipe as a shard in the organisation so it would be at https://github.com/amberframework/base

I haven't answered all the questions so it is still a work in progress but I think it is moving in the right direction. Going forward we might need to remove the ORM option from the CLI so that the base recipe is Granite only with other ORMs as different recipes.

@faustinoaq
Copy link
Copy Markdown
Contributor Author

I haven't answered all the questions so it is still a work in progress but I think it is moving in the right direction. Going forward we might need to remove the ORM option from the CLI so that the base recipe is Granite only with other ORMs as different recipes.

@damianham Yeah, you're right, I think we should try current implementation and then bring new infrastructure changes in next minor versions (with well documented guides 😉 )

@faustinoaq
Copy link
Copy Markdown
Contributor Author

@eliasjpr @elorest This PR is passing now! 🎉

@faustinoaq
Copy link
Copy Markdown
Contributor Author

Thanks to this PR I found several issues on models, formatting, etc 👍

@faustinoaq
Copy link
Copy Markdown
Contributor Author

This PR is required by amberframework/recipes#23

@faustinoaq faustinoaq changed the title Add more build specs Add more build specs and include bugfixes Jun 21, 2018
Copy link
Copy Markdown
Contributor

@eliasjpr eliasjpr left a comment

Choose a reason for hiding this comment

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

Some comments

Comment thread spec/build_spec_helper.cr Outdated

include CLIHelper

macro generate_app(*options)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why this has to be a macro?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@eliasjpr I did this to preserve every spec scope (actually this just avoid boilerplate code 😅 )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this can be done without a macro, I will give it a try. The specs should run independently

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed macros 👍

Also the describe are running their specs it independently 🎉

Comment thread spec/build_spec_helper.cr Outdated

spec_result = `crystal spec`

puts spec_result
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we want to output here? why not output on failures only?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@eliasjpr This was a fix introduced on #820

puts spec_result on success will print insignificant output

Comment thread spec/build_spec_helper.cr Outdated

puts spec_result

it "can be executed" do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it compiles project?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@eliasjpr Actually this spec was introduced by you here 😅

Maybe we should simply use system("crystal spec").should be_true WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like this a lot system("crystal spec").should be_true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done! 👍

Comment thread spec/build_spec_helper.cr Outdated
spec_result.should_not contain "Error in line"
end

it "has no failures" do
Copy link
Copy Markdown
Contributor

@eliasjpr eliasjpr Jun 21, 2018

Choose a reason for hiding this comment

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

we can delete this spec if you add system("crystal spec").should be_true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done! 👍

Comment thread spec/build_spec_helper.cr Outdated
spec_result.should contain "Finished in"
end

it "has no errors" do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we can delete this spec if you add system("crystal spec").should be_true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done! 👍

@faustinoaq faustinoaq added this to the Version 0.8.0 milestone Jun 21, 2018
Copy link
Copy Markdown
Contributor

@eliasjpr eliasjpr left a comment

Choose a reason for hiding this comment

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

Nice cleanup!

@faustinoaq faustinoaq merged commit d8aaaa1 into master Jun 21, 2018
@faustinoaq faustinoaq deleted the fa/add-more-build-specs branch June 21, 2018 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants