callforth 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/callforth.rb +8 -1
- data/lib/callforth/config_options.rb +9 -0
- data/lib/callforth/railtie.rb +17 -0
- data/lib/callforth/setup.rb +27 -0
- data/lib/callforth/version.rb +1 -1
- data/lib/generators/callforth/initializer/USAGE +8 -0
- data/lib/generators/callforth/initializer/initializer_generator.rb +13 -0
- data/lib/generators/callforth/initializer/templates/initializer.rb.erb +9 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c149e039cab30348bbfe6294da588f644d57fbdffc1277761f0e44d66eddc761
|
4
|
+
data.tar.gz: 75c0fde6f0988988090c6b91149eb635b0e23e0045e245dfbe1b1178ca3d97ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaeaa96d7f05f7e5995fdbf77453926f3eb27a8859e57f7901b944377ebd98dfec4b38816354c65983f462d696daef40525d05590a6b94f15e3fdc91c5c4f98a
|
7
|
+
data.tar.gz: '08ad737909628d29e761a41032202cfd89e02629e70a5835447e523f8b5c44cd3105211612c545e25358b64382566c5ef47a3dbb111729a4b52b80e9962c6944'
|
data/lib/callforth.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_support"
|
4
|
+
require "active_support/callbacks"
|
5
|
+
|
3
6
|
require "callforth/version"
|
7
|
+
require "callforth/config_options"
|
8
|
+
require "callforth/setup"
|
4
9
|
|
5
10
|
module Callforth
|
6
|
-
|
11
|
+
mattr_accessor :secret_key
|
7
12
|
end
|
13
|
+
|
14
|
+
require "callforth/railtie" if defined?(Rails)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/railtie"
|
4
|
+
|
5
|
+
module Callforth
|
6
|
+
class Railtie < Rails::Railtie
|
7
|
+
config.callforth = Callforth::ConfigOptions
|
8
|
+
|
9
|
+
config.after_initialize do |application|
|
10
|
+
if application.config.callforth.enabled
|
11
|
+
Callforth::Setup.for(application)
|
12
|
+
else
|
13
|
+
Callforth::Setup.clear
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Callforth
|
4
|
+
class Setup
|
5
|
+
class << self
|
6
|
+
def for(application)
|
7
|
+
callforth_config = application.config.callforth
|
8
|
+
|
9
|
+
setup_secret_key(callforth_config)
|
10
|
+
end
|
11
|
+
|
12
|
+
def clear
|
13
|
+
clear_secret_key
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def setup_secret_key(config)
|
19
|
+
Callforth.secret_key = config.secret_key.respond_to?(:call) ? config.secret_key.call : config.secret_key
|
20
|
+
end
|
21
|
+
|
22
|
+
def clear_secret_key
|
23
|
+
Callforth.secret_key = nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/callforth/version.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Callforth
|
4
|
+
module Generators
|
5
|
+
class InitializerGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
def create_initializer
|
9
|
+
template "initializer.rb.erb", File.join("config/initializers/callforth.rb")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
# When disabled, the secret key is not setup, so nothing can be encoded or decoded.
|
5
|
+
# config.callforth.enabled = true
|
6
|
+
|
7
|
+
# Callforth requires a secret key as part of the encoding/decoding process to secure and authorize callers.
|
8
|
+
# config.callforth.secret_key = -> { Rails.application.credentials.secret_key_base }
|
9
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: callforth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Garside
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Like a callback, except from an outside caller rather than a bound listener
|
14
14
|
email:
|
@@ -20,7 +20,13 @@ files:
|
|
20
20
|
- LICENSE.txt
|
21
21
|
- README.md
|
22
22
|
- lib/callforth.rb
|
23
|
+
- lib/callforth/config_options.rb
|
24
|
+
- lib/callforth/railtie.rb
|
25
|
+
- lib/callforth/setup.rb
|
23
26
|
- lib/callforth/version.rb
|
27
|
+
- lib/generators/callforth/initializer/USAGE
|
28
|
+
- lib/generators/callforth/initializer/initializer_generator.rb
|
29
|
+
- lib/generators/callforth/initializer/templates/initializer.rb.erb
|
24
30
|
homepage: https://www.freshly.com
|
25
31
|
licenses:
|
26
32
|
- MIT
|