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

Merged
merged 8 commits into from Sep 21, 2018
Merged

Add rake tasks #9

merged 8 commits into from Sep 21, 2018

Conversation

@y9v
Copy link
Contributor

@y9v 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 2 commits Sep 19, 2018
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
Rake task `logux:channels` lists all available channels from
app/logux/channels in following format:

channel Class
post    Channels::Post
@y9v
Copy link
Contributor Author

@y9v 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
Copy link
Contributor Author

@y9v 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
Copy link
Member

@wilddima wilddima commented Sep 20, 2018

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

@y9v
Copy link
Contributor Author

@y9v 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
Copy link
Contributor Author

@y9v 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
Copy link
Member

@wilddima wilddima Sep 21, 2018

Typo rakelogux:channels 🙂

Copy link
Contributor Author

@y9v y9v Sep 21, 2018

thanks, fixed

Copy link
Member

@wilddima wilddima left a comment

@ymn great work, thanks!

@wilddima wilddima merged commit 89ef937 into logux:master Sep 21, 2018
1 check passed
@y9v
Copy link
Contributor Author

@y9v 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
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants