Code Monkey home page Code Monkey logo

logux_rails's People

Contributors

ai avatar anaumov avatar dmitrytsepelev avatar dreikanter avatar dsalahutdinov avatar frostmark avatar gazay avatar moofkit avatar ojab avatar paderinandrey avatar wilddima avatar y9v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

logux_rails's Issues

Add solution for random meta.id and send_to_logux

With send_to_logux we can check what Rails sent to Logux during specs. But sent days contains some inconsistent days, for example meta.id.

We need to add pattern matching to send_to_logux to allow to pass something like id: kind_of(String)

Better logger output

Current output:

7gfgqnq

How we can imporve it:

  1. Write to loguxWrite to Logux response
  2. Searching action for action: #{action}, meta: #{meta}Searching action for Logux action: #{action}, meta: #{meta}
  3. Searching policy for action: #{action}, meta: #{meta}Searching policy for Logux action: #{action}, meta: #{meta}
  4. Logux addReceive from Logux
  5. Add color to output. Use yellow for messages and JSON highlighter for JSON message in Receive from Logux

Cleanup spec/dummy

Do minor cleanup for test environment:

  • Remove Gemfile/Gemfile.lock
  • Remove excess support for development enviroment
  • Remove unused files such as spec/dummy/bin
  • Run dummy migrations instead of commiting database

По поводу работы

Здравствуйте, Дмитрий.
Заранее извиняюсь, что пишу в github.
Я Дмитрий. 27 августа на вашу почту отправлял вакансии Ruby on Rails dev.
Хочу узнать вы готовы рассмотреть предложение о работе?

Fix spec warnings

➤ b rake spec
/home/ai/.rubies/2.5.3/bin/ruby -I/home/ai/Dev/logux_rails/.bundle/gems/rspec-core-3.8.0/lib:/home/ai/Dev/logux_rails/.bundle/gems/rspec-support-3.8.0/lib /home/ai/Dev/logux_rails/.bundle/gems/rspec-core-3.8.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
DEPRECATION WARNING: Leaving `ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer`
set to false is deprecated. SQLite databases have used 't' and 'f' to serialize
boolean values and must have old data converted to 1 and 0 (its native boolean
serialization) before setting this flag to true. Conversion can be accomplished
by setting up a rake task which runs

  ExampleModel.where("boolean_column = 't'").update_all(boolean_column: 1)
  ExampleModel.where("boolean_column = 'f'").update_all(boolean_column: 0)

for all models and all boolean columns, after which the flag must be set to
true by adding the following to your application.rb file:

  Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
 (called from <top (required)> at /home/ai/Dev/logux_rails/spec/rails_helper.rb:13)
...............................WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. NoMethodError, NameError and ArgumentError), meaning the code you are intending to test may not even get reached. Instead consider using `expect { }.not_to raise_error` or `expect { }.to raise_error(DifferentSpecificErrorClass)`. This message can be suppressed by setting: `RSpec::Expectations.configuration.on_potential_false_positives = :nothing`. Called from /home/ai/Dev/logux_rails/spec/logux/model/updates_deprecator_spec.rb:18:in `block (3 levels) in <top (required)>'.
...................................

@wilddima warnings are not the Logux way :)

Better error answer

Now gem writes ['error', 'message']. We need to write: ['error', meta.id, e.backtrace.join("\n")]

Add resend command

Хороший новости — наконец-то у нас есть спецификация протокола между бэкендом и Логаксом:
https://logux.io/protocols/backend/spec/#action

Плохие новости — протокол пришлось обновить. Один парень нашёл, что наш старый API (когда клиент выставляет кому переслать событий) провоцировал на шибки безопасности (волноваться не стоит, у нас на Амплифере всё безопасно). Теперь сервер будет решать, кому переслать новое событие.

В Logux::ActionController надо добавить метод resend:

def resend
  { channel: "users/#{ action.userId }" }
end

logux_rails при получении команды action должен сначала ответить ['resend', meta.id, { "channel": "users/1" }], а потом как раньше approved и processed.

Getting started

Hi guys, It seems I've made everything as written in your basic guide but I am getting "ActionController::RoutingError (No route matches [POST] "/")" from rails server when logux proxy server sends initial auth request.

Also is there a reason why logux_rails v2 gem doesn't support rails 6.1? (it requires rails >= 5.0, < 6.1)
Sorry in advance, I am new to ruby world.

Remove Amplifr’s methods from `Action`

Logux::Action has few methods, which are not part of Logux core: action_name, channel_name, channel_id.

Let’s remove them since we should not copy Amplifr-only methods to core system.

Fix Logux.add API

API should be:

Logux.add(action, { meta })

If user needs batch, they should use:

Logux.add_batch([[action, meta], [action, meta], ])

Maybe we should even use Logux.add(action, meta) to be consistence with JS API.

Strange behaviour

I am adding prices channel to Amplifr. Gem force me to have some code for the channel. So I created app/logux/channels/prices.rb with:

module Channels
  class Prices < Channels::Base
  end
end

But gem start to write this response on subscription:

{
  "version": 0,
  "password": "secret",
  "commands": [
    [
      "action",
      1,
      {
        "nodeIds": [
          "380:TMt6iOHX"
        ]
      }
    ],
    [
      "action",
      2,
      {
        "nodeIds": [
          "380:TMt6iOHX"
        ]
      }
    ]
  ]
}

Seems like without initial_data, gem anyway send action command.

Wrong output on unkown channel

If Logux sends { type: 'logux/susbcribe', channel: 'unknown' }, Rails will answer:

Write to Logux response: ["unknownChannel","1554484116313 380:R7BNGAP5:Pjoz3bdE 0"]
Write to Logux response: ]

But Logux wait for [["unknownChannel", …]], array in array.

/cc @dsalahutdinov

Output sent to logux log with debug level, filter password

Logux add:: {
  "version": 0,
  "password": "xxxx",
  "commands": [
    [
      "action",
      {
        "type": "amplifr/autopilot/status",
        "status": "noPostsChecked",
        "projectId": 16484
      },
      {
        "clients": [
          "74205:UI40z-2U"
        ]
      }
    ]
  ]
}
Write to Logux response: ["processed","1543917265964 74205:UI40z-2U:RJZpH8Ly 0"]
Write to Logux response: ]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.