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 rake tasks #9

Merged
merged 8 commits into from Sep 21, 2018

Conversation

Projects
None yet
2 participants
@y9v
Contributor

y9v commented Sep 19, 2018

This PR adds two rake tasks as described in https://cultofmartians.com/tasks/logux-rails-rake.html.

> bundle exec rake logux:actions
   action.type Class#method
blog/notes/add Actions::Blog::Notes#add
   comment/add Actions::Comment#add
> bundle exec rake logux:channels
channel Class
   post Channels::Post

y9v added some commits Sep 19, 2018

Add `logux:actions` rake task
Rake task `logux:actions` lists all available action types from
app/logux/actions in following format:

action.type     Class#method
comment/add     Actions::Comment#add
Add `logux:channels` rake task
Rake task `logux:channels` lists all available channels from
app/logux/channels in following format:

channel Class
post    Channels::Post
@y9v

This comment has been minimized.

Contributor

y9v commented Sep 19, 2018

There is still a failing test example, when running the full suite (the output of rake logux:actions contains a class which was dynamically created in another test example).

I will fix this issue tomorrow, it seems that the object is not removed from ObjectSpace after the constant removal (manually triggering GC doesn't help either)

y9v added some commits Sep 20, 2018

@y9v

This comment has been minimized.

Contributor

y9v commented Sep 20, 2018

There is still a failing test example, when running the full suite (the output of rake logux:actions contains a class which was dynamically created in another test example).

I will fix this issue tomorrow, it seems that the object is not removed from ObjectSpace after the constant removal (manually triggering GC doesn't help either)

Fixed it, it's removed from ObjectSpace if we remove it's methods first.

@wilddima

This comment has been minimized.

Member

wilddima commented Sep 20, 2018

Thank you for the pull request, I'm gonna check it soon.

@y9v

This comment has been minimized.

Contributor

y9v commented Sep 20, 2018

@wilddima I still need to add support for namespaced actions and channels. I'll ping you when it's ready

y9v added some commits Sep 20, 2018

@y9v

This comment has been minimized.

Contributor

y9v commented Sep 20, 2018

@wilddima the issues are fixed; I also made the output a bit prettier

README.md Outdated
@@ -38,6 +38,8 @@ After this, POST requests to `/logux` will be processed by LoguxController. You
LoguxRails will try to find Action for the specific message from logux-server. For example, for `project/rename` action, you should define `Action::Project` class, inherited from `Logux::Action` base class, and implement `rename` method.
You can execute `rake logux:actions` to get the list of available action types, or `rakelogux:channels` to get the list of available channels

This comment has been minimized.

@wilddima

wilddima Sep 21, 2018

Member

Typo rakelogux:channels 🙂

This comment has been minimized.

@y9v

y9v Sep 21, 2018

Contributor

thanks, fixed

@wilddima

@ymn great work, thanks!

@wilddima wilddima merged commit 89ef937 into logux:master Sep 21, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@y9v

This comment has been minimized.

Contributor

y9v commented Sep 21, 2018

@wilddima thank you!

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