rails_live 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/rails_live/application_controller.rb +5 -0
- data/config/routes.rb +6 -0
- data/lib/generators/USAGE +8 -0
- data/lib/generators/rails_live_generator.rb +6 -0
- data/lib/generators/templates/rails_live.rb +27 -0
- data/lib/rails/routes.rb +7 -0
- data/lib/rails_live/version.rb +1 -1
- data/lib/rails_live.rb +36 -2
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c93eec0ad8ef37f218e2bc2c7b14bce47764f65ca547ddc5c6e304b90b797d15
|
4
|
+
data.tar.gz: 785789ed97c191b4a8dd7b39b664bb4f5003102ff278634c2ee8d4b88fa64000
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbc8e57cf75af475a091185f8a512876b7065bfa61804c5405b5660587b47ac7871ea1eaba5682855a318d05a764ad1538abc5b26997dab80f1b087d210bb482
|
7
|
+
data.tar.gz: 39e6b9858192ea1e105a0e94ce7c9de872d83c880f4f949c33533359f5f31e808f6691bac3daa77915aa7ca5f906540817de357311f5a7e770ec188f96cbce15
|
@@ -1,5 +1,10 @@
|
|
1
1
|
module RailsLive
|
2
2
|
class ApplicationController < ActionController::Base
|
3
3
|
protect_from_forgery with: :exception
|
4
|
+
|
5
|
+
if RailsLive.http_basic_authentication_enabled
|
6
|
+
http_basic_authenticate_with name: RailsLive.http_basic_authentication_user_name,
|
7
|
+
password: RailsLive.http_basic_authentication_password
|
8
|
+
end
|
4
9
|
end
|
5
10
|
end
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
if Object.const_defined?('RailsLive')
|
2
|
+
RailsLive.setup do |config|
|
3
|
+
# # enabled or not
|
4
|
+
# config.enabled = Rails.env.development?
|
5
|
+
|
6
|
+
# # automatic engine routes mounting
|
7
|
+
# config.automatic_routes_mount = true
|
8
|
+
|
9
|
+
# # Enable http basic authentication
|
10
|
+
# config.http_basic_authentication_enabled = false
|
11
|
+
|
12
|
+
# # Enable http basic authentication
|
13
|
+
# config.http_basic_authentication_user_name = 'rails_db'
|
14
|
+
|
15
|
+
# # Enable http basic authentication
|
16
|
+
# config.http_basic_authentication_password = 'passw0))rd'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
unless defined?(RailsLive)
|
21
|
+
module RailsLive
|
22
|
+
def RailsLive.notify(*options)
|
23
|
+
# do nothing
|
24
|
+
# gem is not added, so just keep work
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/rails/routes.rb
ADDED
data/lib/rails_live/version.rb
CHANGED
data/lib/rails_live.rb
CHANGED
@@ -1,8 +1,28 @@
|
|
1
|
-
require "rails_live/engine"
|
2
|
-
|
3
1
|
module RailsLive
|
4
2
|
|
3
|
+
# is enabled?
|
4
|
+
mattr_accessor :enabled
|
5
|
+
@@enabled = true
|
6
|
+
|
7
|
+
# automatic engine routes mouting
|
8
|
+
mattr_accessor :automatic_routes_mount
|
9
|
+
@@automatic_routes_mount = true
|
10
|
+
|
11
|
+
# Enable http basic authentication
|
12
|
+
mattr_accessor :http_basic_authentication_enabled
|
13
|
+
@@http_basic_authentication_enabled = false
|
14
|
+
|
15
|
+
# Enable http basic authentication
|
16
|
+
mattr_accessor :http_basic_authentication_user_name
|
17
|
+
@@http_basic_authentication_user_name = 'rails_live'
|
18
|
+
|
19
|
+
# Enable http basic authentication
|
20
|
+
mattr_accessor :http_basic_authentication_password
|
21
|
+
@@http_basic_authentication_password = 'passw0))rd'
|
22
|
+
|
5
23
|
def RailsLive.notify(message:, tags: [], user: {}, category: nil, datetime: Time.now)
|
24
|
+
return unless enabled
|
25
|
+
|
6
26
|
ActionCable.server.broadcast 'updates_channel',
|
7
27
|
message: message,
|
8
28
|
tags: tags,
|
@@ -11,4 +31,18 @@ module RailsLive
|
|
11
31
|
datetime: datetime.strftime('%H:%M:%S')
|
12
32
|
end
|
13
33
|
|
34
|
+
def self.setup
|
35
|
+
yield(self)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.use_default_configuration!
|
39
|
+
self.enabled = true
|
40
|
+
self.http_basic_authentication_enabled = false
|
41
|
+
self.automatic_routes_mount = true
|
42
|
+
end
|
43
|
+
|
14
44
|
end
|
45
|
+
|
46
|
+
require "rails_live/engine"
|
47
|
+
require "rails/routes"
|
48
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_live
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
@@ -182,6 +182,10 @@ files:
|
|
182
182
|
- app/views/rails_live/shared/_header.html.erb
|
183
183
|
- app/views/rails_live/stream/index.html.erb
|
184
184
|
- config/routes.rb
|
185
|
+
- lib/generators/USAGE
|
186
|
+
- lib/generators/rails_live_generator.rb
|
187
|
+
- lib/generators/templates/rails_live.rb
|
188
|
+
- lib/rails/routes.rb
|
185
189
|
- lib/rails_live.rb
|
186
190
|
- lib/rails_live/engine.rb
|
187
191
|
- lib/rails_live/railtie.rb
|