rodauth 2.15.0 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3abad4574361365b90229229928b653d049ad73e2e366195e10bb8ee565de323
4
- data.tar.gz: 2fecb89ba5456f9aa8569eef019dbf7f9b7a3b7736b3da053ce15e5b4d67074c
3
+ metadata.gz: 03b165b6104e72c5c2ea6d76b3b0bf53380d4eacd90cbdab80b9fd655d80f1c4
4
+ data.tar.gz: af12c12c4bdf9aa47ffd0a34bd7df2858c006edcafa257e60ddd28c962d62630
5
5
  SHA512:
6
- metadata.gz: 9086a3f18f04da0184af7fcaaa3c474ae3560e7b9c1b6b526cbbd8239ca4f2f47f2a44fe4e8681e349c5bb78a6e3f7529b5bd296d62ad92e1a1ac9188122a4ab
7
- data.tar.gz: 2b67d509e6a0b0a61ca679f45238714b817d6eef1becb9e1ecfeab33d7e296d3f43ffa0a392d812981b8a3f096cbc868501c00f6661d1c72194cdfe0726ef842
6
+ metadata.gz: d11f3050e692d426c409a061c4f23489208618613868653a59fad982fd66b62ec4c9fe5b320b390f3789b5fc3d704d2d3ac99d9105bc54f9ee33dcfaa690dfd2
7
+ data.tar.gz: 811fb60b3f055d59866cf3b262ab197e8cf80a1ca7291724e756c58a99f1cdaddf994a73a500cdcff03f600fd1333e49cf3d1830cc9f10d01af641648c9fd930
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ === 2.16.0 (2021-08-23)
2
+
3
+ * Add Rodauth.lib for using Rodauth as a library (jeremyevans)
4
+
5
+ * Make internal_request feature work if the configuration uses only_json? true (janko) (#176)
6
+
1
7
  === 2.15.0 (2021-07-27)
2
8
 
3
9
  * Add path_class_methods feature, for getting paths/URLs using class methods (jeremyevans)
data/README.rdoc CHANGED
@@ -1073,6 +1073,27 @@ methods on that class to perform actions on behalf of a user. See the
1073
1073
  {internal request feature documentation}[rdoc-ref:doc/internal_request.rdoc]
1074
1074
  for details.
1075
1075
 
1076
+ == Using Rodauth as a Library
1077
+
1078
+ Rodauth was designed to serve as an authentication framework for Rack applications.
1079
+ However, Rodauth can be used purely as a library outside of a web application. You
1080
+ can do this by requiring +rodauth+, and using the +Rodauth.lib+ method to return
1081
+ a <tt>Rodauth::Auth</tt> subclass, which you can call methods on. You pass the
1082
+ +Rodauth.lib+ method an optional hash of Rodauth plugin options and a Rodauth
1083
+ configuration block:
1084
+
1085
+ require 'rodauth'
1086
+ rodauth = Rodauth.lib do
1087
+ enable :create_account, :change_password
1088
+ end
1089
+ rodauth.create_account(login: 'foo@example.com', password: '...')
1090
+ rodauth.change_password(account_id: 24601, password: '...')
1091
+
1092
+ This supports builds on top of the internal_request support (it implicitly loads
1093
+ the internal_request feature before processing the configuration block), and
1094
+ allows the use of Rodauth in non-web applications. Note that you still have to
1095
+ setup a Sequel::Database connection for Rodauth to use for data storage.
1096
+
1076
1097
  === With Multiple Configurations
1077
1098
 
1078
1099
  Rodauth supports using multiple rodauth configurations in the same
@@ -0,0 +1,20 @@
1
+ = New Features
2
+
3
+ * Rodauth.lib has been added for using Rodauth purely as a library,
4
+ useful in non-web applications:
5
+
6
+ require 'rodauth'
7
+ rodauth = Rodauth.lib do
8
+ enable :create_account, :change_password
9
+ end
10
+ rodauth.create_account(login: 'foo@example.com', password: '...')
11
+ rodauth.change_password(account_id: 24601, password: '...')
12
+
13
+ This is built on top of the internal_request feature, and works by
14
+ creating a Roda application with the rodauth plugin, and returning
15
+ the related Rodauth::Auth class.
16
+
17
+ = Other Improvements
18
+
19
+ * The internal_request feature now works correctly for configurations
20
+ where only_json? is set to true.
@@ -92,6 +92,10 @@ module Rodauth
92
92
  @internal_request_return_value
93
93
  end
94
94
 
95
+ def only_json?
96
+ false
97
+ end
98
+
95
99
  private
96
100
 
97
101
  def internal_request?
@@ -6,7 +6,7 @@ module Rodauth
6
6
  MAJOR = 2
7
7
 
8
8
  # The minor version of Rodauth, updated for new feature releases of Rodauth.
9
- MINOR = 15
9
+ MINOR = 16
10
10
 
11
11
  # The patch version of Rodauth, updated only for bug fixes from the last
12
12
  # feature release.
data/lib/rodauth.rb CHANGED
@@ -3,6 +3,17 @@
3
3
  require 'securerandom'
4
4
 
5
5
  module Rodauth
6
+ def self.lib(opts={}, &block)
7
+ require 'roda'
8
+ c = Class.new(Roda)
9
+ c.plugin(:rodauth, opts) do
10
+ enable :internal_request
11
+ instance_exec(&block)
12
+ end
13
+ c.freeze
14
+ c.rodauth
15
+ end
16
+
6
17
  def self.load_dependencies(app, opts={})
7
18
  json_opt = opts.fetch(:json, app.opts[:rodauth_json])
8
19
  if json_opt
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.0
4
+ version: 2.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-27 00:00:00.000000000 Z
11
+ date: 2021-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -329,6 +329,7 @@ extra_rdoc_files:
329
329
  - doc/release_notes/2.13.0.txt
330
330
  - doc/release_notes/2.14.0.txt
331
331
  - doc/release_notes/2.15.0.txt
332
+ - doc/release_notes/2.16.0.txt
332
333
  - doc/release_notes/2.2.0.txt
333
334
  - doc/release_notes/2.3.0.txt
334
335
  - doc/release_notes/2.4.0.txt
@@ -429,6 +430,7 @@ files:
429
430
  - doc/release_notes/2.13.0.txt
430
431
  - doc/release_notes/2.14.0.txt
431
432
  - doc/release_notes/2.15.0.txt
433
+ - doc/release_notes/2.16.0.txt
432
434
  - doc/release_notes/2.2.0.txt
433
435
  - doc/release_notes/2.3.0.txt
434
436
  - doc/release_notes/2.4.0.txt