rack-change-password-url 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fbeb94677e12c8cc859d9befd8481634ca0286dccb4f19d6135cf76ddbc7d47
4
- data.tar.gz: '04839d68e11629e7901fdb1165d18010d5dd7650962197d88ca9b7346614a2a7'
3
+ metadata.gz: 3d5da9d59471aac38b5d545a91b32f295da5d1d7cab0ccfd86304614dcf7124a
4
+ data.tar.gz: c95514de39242039e57904578086a248b3d2900438a9d0352499877b0921efc4
5
5
  SHA512:
6
- metadata.gz: 52609e3749794ce3791b062ff2ce02058bbf3f039b4a7baf21498db130f9d3f30d7c055b8ab97bdb907b0cb3bb4428b6178b09f32a59b109697fc6c953b96fa4
7
- data.tar.gz: 1e3e045fb59334ba75ef3daf66beb3da54ebb1ed60c9075135f19aba261347430fd5bd575ab4f78cfef55b02ffbb9f6d58680dbe1d4075b71db75219b8b690cd
6
+ metadata.gz: 0b68611139614472d2a2a63dec8b5aa45da4816ac4848f1a77627a516555c601f811d5283f16205e1920982d08d52f402eb5fdac18301da1df810c11abf7f598
7
+ data.tar.gz: cb9709685fb70b85377428ed637be61a2c2141ab77ce9a221648a38f9c2ca26024af36beb60b0fbd50d81c8ed348b2240c591e368ae8f65ec34038e33fcd1afe
data/README.md CHANGED
@@ -21,18 +21,19 @@ If bundler is not being used to manage dependencies, install the gem by executin
21
21
  ```ruby
22
22
  require "rack/change-password-url"
23
23
 
24
- use Rack::ChangePasswordUrl::Middleware, redirect_path: 'your-redirect-path'
24
+ Rack::ChangePasswordUrl.configure do |config|
25
+ config.redirect_path = 'your-redirect-path'
26
+ end
27
+
28
+ use Rack::ChangePasswordUrl::Middleware
25
29
  ```
26
30
 
27
31
  ### For Rails App
28
32
 
29
33
  ```ruby
30
- # config/application.rb
31
- module MyApp
32
- class Application < Rails::Application
33
- ...
34
- config.rack_change_password_url.redirect_path = 'your-redirect-path'
35
- end
34
+ # config/initializers/change_password_url.rb
35
+ Rack::ChangePasswordUrl.configure do |config|
36
+ config.redirect_path = 'your-redirect-path'
36
37
  end
37
38
  ```
38
39
 
data/examples/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem 'rack', '>= 2.2.3.1', '< 3.0.0'
6
+ gem 'rack-change-password-url'
7
+
8
+ gem 'puma'
@@ -0,0 +1,24 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ rack-change-password-url (0.1.0)
5
+ rack (>= 2.2.3.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ nio4r (2.5.8)
11
+ puma (6.0.0)
12
+ nio4r (~> 2.0)
13
+ rack (2.2.4)
14
+
15
+ PLATFORMS
16
+ ruby
17
+
18
+ DEPENDENCIES
19
+ puma
20
+ rack (>= 2.2.3.1, < 3.0.0)
21
+ rack-change-password-url!
22
+
23
+ BUNDLED WITH
24
+ 2.3.17
@@ -0,0 +1,19 @@
1
+ # Example: Rack App of Rack::ChangePasswordUrl
2
+ ## Usage
3
+ - Installation
4
+ ```sh
5
+ $ bundle install
6
+ ```
7
+
8
+ - Start Rack App
9
+ ```sh
10
+ $ bundle exec ruby config.ru
11
+ ```
12
+
13
+ - Check endpoint of a Well-Known URL for Changing Passwords.
14
+ ```sh
15
+ $ curl -I http://localhost:9292/.well-known/change-password
16
+ HTTP/1.1 302 Found
17
+ Location: /your-redirect-path
18
+ Content-Length: 0
19
+ ```
@@ -0,0 +1,20 @@
1
+ class App
2
+ def call(env)
3
+ [200, { "Content-Type" => "text/plain" }, ["HELLO WORLD!", "Hello"]]
4
+ end
5
+ end
6
+
7
+ require "rack"
8
+ require "rack/change-password-url"
9
+
10
+ app = Rack::Builder.new do
11
+ Rack::ChangePasswordUrl.configure do |config|
12
+ config.redirect_path = '/your-redirect-path'
13
+ end
14
+
15
+ use Rack::ChangePasswordUrl::Middleware
16
+ run App.new
17
+ end
18
+
19
+ require "rack/handler/puma"
20
+ Rack::Handler::Puma.run app
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Rack
4
4
  module ChangePasswordUrl
5
- class RailsOptions
5
+ class Configuration
6
6
  attr_accessor :redirect_path
7
7
  end
8
8
  end
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'configuration'
4
+
3
5
  module Rack
4
6
  module ChangePasswordUrl
5
7
  class Middleware
6
- def initialize(app, options={})
8
+ def initialize(app)
7
9
  @app = app
10
+ @config = Rack::ChangePasswordUrl.configuration
8
11
 
9
- @redirect_path = options[:redirect_path]
12
+ @redirect_path = @config.redirect_path
10
13
  end
11
14
 
12
15
  def call(env)
@@ -1,14 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'rails_options'
4
-
5
3
  module Rack
6
4
  module ChangePasswordUrl
7
5
  class Railtie < ::Rails::Railtie
8
- config.rack_change_password_url = RailsOptions.new
9
-
10
6
  initializer "rack-change-password-url.middleware" do |app|
11
- app.middleware.use Rack::ChangePasswordUrl::Middleware, { redirect_path: app.config.rack_change_password_url.redirect_path }
7
+ app.middleware.use Rack::ChangePasswordUrl::Middleware
12
8
  end
13
9
  end
14
10
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rack
4
4
  module ChangePasswordUrl
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "change-password-url/middleware"
4
+ require_relative "change-password-url/configuration"
4
5
  require_relative "change-password-url/version"
5
6
 
6
7
  require_relative 'change-password-url/railtie' if defined?(::Rails)
@@ -8,5 +9,15 @@ require_relative 'change-password-url/railtie' if defined?(::Rails)
8
9
  module Rack
9
10
  module ChangePasswordUrl
10
11
  class Error < StandardError; end
12
+
13
+ class << self
14
+ def configure
15
+ yield(configuration)
16
+ end
17
+
18
+ def configuration
19
+ @configuration ||= Configuration.new
20
+ end
21
+ end
11
22
  end
12
23
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "Provides endpoint of a Well-Known URL for Changing Passwords"
13
13
  spec.homepage = "https://github.com/taketo1113/rack-change-password-url"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.0"
15
+ spec.required_ruby_version = ">= 2.7.0"
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/taketo1113/rack-change-password-url"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-change-password-url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taketo Takashima
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-11 00:00:00.000000000 Z
11
+ date: 2022-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -78,10 +78,14 @@ files:
78
78
  - LICENSE.txt
79
79
  - README.md
80
80
  - Rakefile
81
+ - examples/Gemfile
82
+ - examples/Gemfile.lock
83
+ - examples/README.md
84
+ - examples/config.ru
81
85
  - lib/rack-change-password-url.rb
82
86
  - lib/rack/change-password-url.rb
87
+ - lib/rack/change-password-url/configuration.rb
83
88
  - lib/rack/change-password-url/middleware.rb
84
- - lib/rack/change-password-url/rails_options.rb
85
89
  - lib/rack/change-password-url/railtie.rb
86
90
  - lib/rack/change-password-url/version.rb
87
91
  - rack-change-password-url.gemspec
@@ -100,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
104
  requirements:
101
105
  - - ">="
102
106
  - !ruby/object:Gem::Version
103
- version: 2.6.0
107
+ version: 2.7.0
104
108
  required_rubygems_version: !ruby/object:Gem::Requirement
105
109
  requirements:
106
110
  - - ">="