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

Add Runner class to monitor and activate ember apps #145

Merged
merged 2 commits into from
Apr 6, 2015
Merged

Add Runner class to monitor and activate ember apps #145

merged 2 commits into from
Apr 6, 2015

Conversation

seanpdoyle
Copy link
Contributor

Should address #107 and #139

@rwz
Copy link
Collaborator

rwz commented Apr 6, 2015

Does it work for you?

Any feedback from your projects @rondale-sc?

@seanpdoyle
Copy link
Contributor Author

@rwz this worked great for me!

c.app :frontend, path: "/path/to/your/ember-cli-app/on/disk"
c.app :frontend,
path: "/path/to/your/ember-cli-app/on/disk",
enable: -> path { path.starts_with?("/app/") }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rwz I've covered the positive use case, would it make sense also covering a negative case:

!path.starts_with?("/api/")

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess it's automatically implied. Anyone who sees a lambda passed in as an option should figure out it could be used for negative case by just inverting the logic.

@rondale-sc
Copy link
Collaborator

@rwz @seanpdoyle Works on our production app without any changes!

LGTM

🍻

(kinda obvi, but it doesn't restart ember until the next request)

rwz added a commit that referenced this pull request Apr 6, 2015
Add Runner class to monitor and activate ember apps
@rwz rwz merged commit 159e1b6 into thoughtbot:master Apr 6, 2015
@rwz
Copy link
Collaborator

rwz commented Apr 6, 2015

Released 0.3.0

@seanpdoyle seanpdoyle deleted the runner branch April 7, 2015 02:51
@slashmili
Copy link

How does this enable option work?

I have this config for EmberCLI

EmberCLI.configure do |c|
  c.app :myapp,
    path: "ui/myapp",
    enable: -> path { !path.starts_with?("/api/") }
end

And I have these routes:

Rails.application.routes.draw do
  root 'application#index'
  scope "/api/v1" do
    resources :users
  end
end

When I open http://localhost:3000/api/v1/users it goes to Ember and it complains that

Uncaught UnrecognizedURLError: /api/v1/users

@seanpdoyle
Copy link
Contributor Author

@slashmili I believe the root declaration must come last (at the bottom) in your routes file.

@slashmili
Copy link

Correct! Thanks

BTW it was not obvious though.

@seanpdoyle
Copy link
Contributor Author

@slashmili I agree. However, root isn't an ember-cli-rails construct, but something that comes from Rails itself: http://guides.rubyonrails.org/routing.html#using-root

@tonywok
Copy link

tonywok commented May 13, 2015

@seanpdoyle I'm not super familiar with asset pipeline internals. We have some assets that are still managed by rails - (fonts, images, etc). Would it step on the ember-cli-rails middleware to also flip enabled to false on cases of /assets/. Looking through the source and I'm not quite sure how that lamba's "path" maps to a "request uri".

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

5 participants