Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #81 from logux/logux-rack
Browse files Browse the repository at this point in the history
Extract logux-rack gem
  • Loading branch information
dsalahutdinov authored Oct 21, 2019
2 parents 4a3ac37 + 5f4e18b commit 5fd1cca
Show file tree
Hide file tree
Showing 54 changed files with 74 additions and 1,702 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).

# 0.1
## 0.2
* Core Logux facilities are moved to `logux-rack` gem.
* `Logux::Actions` is soft-deprecated. Please use `Logux::Action` from now on.
* `Logux::Model::UpdatesDeprecator` is now coupled with `Logux::ActionCaller` via Logux configuration.

## 0.1.1
* Rails 6.0 support.

## 0.1
* Initial release.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in logux_rails.gemspec
gemspec

# NOTE: Remove this line after logux-rack is released on rubygems
gem 'logux-rack', github: 'logux/logux-rack'
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,22 @@ Logux.configuration do |config|
end
```

Mount logux in routes:
Mount `Logux::Rack` in your application routing configuration:

```ruby
# config/routes.rb
Rails.application.routes.draw do
mount Logux::Engine => '/'
end
```

After this, POST requests to `/logux` will be processed by `LoguxController`. You can redefine it or inherit from, if it necessary, for example, for implementing custom authorization flow.

Logux Rails 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 `rake logux:channels` to get the list of available channels.
### Rake commands

Use `rails logux:actions` command to get the list of available action types, or `rails logux:channels` for channels. The default search path is set to `app/logux/actions` and `app/logux/channels` for actions and channels correspondingly, assuming `app` directory is the root of your Rails application. Both command support custom search paths: `rails logux:actions[lib/logux/actions]`.

## Development with Docker

Expand Down
41 changes: 0 additions & 41 deletions app/controllers/logux_controller.rb

This file was deleted.

3 changes: 1 addition & 2 deletions app/helpers/logux_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true

module LoguxHelper
end
module LoguxHelper; end
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

Logux::Engine.routes.draw do
resource :logux, only: %i[create], controller: :logux
mount Logux::Rack::App => '/'
end
107 changes: 0 additions & 107 deletions lib/logux.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/logux/actions.rb → lib/logux/action.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Logux
class Actions < ::ActionController::Parameters
class Action < ::ActionController::Parameters
def action_name
type&.split('/')&.dig(0)
end
Expand Down
42 changes: 0 additions & 42 deletions lib/logux/action_caller.rb

This file was deleted.

6 changes: 0 additions & 6 deletions lib/logux/action_controller.rb

This file was deleted.

37 changes: 0 additions & 37 deletions lib/logux/add.rb

This file was deleted.

6 changes: 0 additions & 6 deletions lib/logux/auth.rb

This file was deleted.

37 changes: 0 additions & 37 deletions lib/logux/base_controller.rb

This file was deleted.

24 changes: 0 additions & 24 deletions lib/logux/channel_controller.rb

This file was deleted.

Loading

0 comments on commit 5fd1cca

Please sign in to comment.