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

Processes ERB in yaml config files for page layouts, cells, and elements #760

Closed
wants to merge 5 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@phaedryx
Contributor

phaedryx commented Apr 7, 2015

  • In Rails you can put ERB in the config files (e.g. database.yml) and it will be parsed before it is loaded. This pull request makes alchemy consistent with Rails behavior.
  • It will allow parts of a page to be generated programatically (which I would like to try)
  • It will allow me to include yaml files in other yaml files (which will help my team structure their code better)
@TeatroIO

This comment has been minimized.

TeatroIO commented Apr 7, 2015

I've prepared a stage to preview changes. Open stage or view logs.

@tvdeyen

This comment has been minimized.

Member

tvdeyen commented Apr 7, 2015

Ok, thanks. @mamhoff @robinboening what do you think about this feature? For me it seems ok, since we cache the files anyway and they are not faced to the admin user and therefore can't break anything.

@mamhoff

This comment has been minimized.

Contributor

mamhoff commented Apr 7, 2015

I like the feature! 👍

@robinboening

This comment has been minimized.

Contributor

robinboening commented Apr 7, 2015

👍 me too! I don't see any drawbacks. Thanks for contributing!

The only thing I noticed is there could be tests for the erb parsing.

@tvdeyen

This comment has been minimized.

Member

tvdeyen commented Apr 7, 2015

Yes, tests would be great. @phaedryx could you please add some? Thanks.

@tvdeyen tvdeyen added this to the 3.2 milestone Apr 7, 2015

@phaedryx

This comment has been minimized.

Contributor

phaedryx commented Apr 8, 2015

As these are all private methods, I wasn't sure how you wanted them tested.

@tvdeyen

This comment has been minimized.

Member

tvdeyen commented Apr 8, 2015

You could test the method that calls the private method (I.e. Alchemy::PageLayout.all

@@ -14,8 +14,12 @@ module Alchemy
expect(subject.collect { |l| l['name'] }).to include('standard')
end
it "should allow erb generated layouts" do
expect(subject.collect { |l| l['name'] }).to include('erb_layout')

This comment has been minimized.

@houndci-bot

houndci-bot Apr 8, 2015

Prefer map over collect.

@@ -10,6 +10,10 @@ module Alchemy
it "should return an Array" do
expect(Cell.definitions).to be_a(Array)
end
it "should allow erb generated definitions" do
expect(Cell.definitions.collect {|d| d['name']}).to include('erb_cell')

This comment has been minimized.

@houndci-bot

houndci-bot Apr 8, 2015

Prefer map over collect.
Space between { and | missing.
Space missing inside }.

@@ -33,6 +33,10 @@ module Alchemy
end
describe '.definitions' do
it "should allow erb generated elements" do
expect(Element.definitions.collect {|el| el['name']}).to include('erb_element')

This comment has been minimized.

@houndci-bot

houndci-bot Apr 8, 2015

Prefer map over collect.
Space between { and | missing.
Space missing inside }.

@phaedryx

This comment has been minimized.

Contributor

phaedryx commented Apr 8, 2015

Is this what you're looking for?

Also, should I change 'collect' to 'map'? I was just following the style of the other tests.

@phaedryx

This comment has been minimized.

Contributor

phaedryx commented Apr 8, 2015

(well, I might as well make hound happy)

@tvdeyen

This comment has been minimized.

Member

tvdeyen commented Apr 8, 2015

Look perfect. Thanks

@tvdeyen

This comment has been minimized.

Member

tvdeyen commented Apr 8, 2015

merged via 8c265ea

@tvdeyen tvdeyen closed this Apr 8, 2015

@tvdeyen

This comment has been minimized.

Member

tvdeyen commented Apr 8, 2015

Thanks \o/

@phaedryx phaedryx deleted the phaedryx:erb-in-yaml branch Apr 21, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment