Skip to content

Commit

Permalink
Merge branch 'release/0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhatherall committed Dec 7, 2023
2 parents ee7a120 + 7a04ba7 commit 021a35c
Show file tree
Hide file tree
Showing 15 changed files with 111 additions and 13 deletions.
10 changes: 10 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
inherit_gem:
standard: config/base.yml

AllCops:
NewCops: enable

require:
- rubocop-rspec
- standard
5 changes: 5 additions & 0 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# For available configuration options, see:
# https://github.com/testdouble/standard
ignore:
- "spec/dummy/**/*"
ruby_version: 2.6
6 changes: 6 additions & 0 deletions .standard_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Auto generated files with errors to ignore.
# Remove from this list as you refactor files.
---
ignore:
- app/controllers/cognito_idp_rails/sessions_controller.rb:
- Lint/NonLocalExitFromIterator
19 changes: 16 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
## [Unreleased]
# Changelog

## [0.1.0] - 2023-11-29
## [0.1.1](https://github.com/appercept/cognito_idp_rails/tree/0.1.1) (2023-12-07)

- Initial release
[Full Changelog](https://github.com/appercept/cognito_idp_rails/compare/v0.1.0...0.1.1)

**Merged pull requests:**

- fix: Define default Rake task [\#2](https://github.com/appercept/cognito_idp_rails/pull/2) ([rhatherall](https://github.com/rhatherall))
- doc: Correct installation documentation [\#1](https://github.com/appercept/cognito_idp_rails/pull/1) ([rhatherall](https://github.com/rhatherall))

## [v0.1.0](https://github.com/appercept/cognito_idp_rails/tree/v0.1.0) (2023-12-07)

[Full Changelog](https://github.com/appercept/cognito_idp_rails/compare/ee7a120d2cdd7c95858f72dfc3beb1ff5cd10449...v0.1.0)



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ gem "sprockets-rails"
gem "rspec-rails", "~> 6.1"

gem "standard", "~> 1.32"

gem "rubocop-rspec", "~> 2.25"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If bundler is not being used to manage dependencies, install the gem by executin

After adding the gem to your application, run the install generator:

$ rails generate cognito_idp:install
$ rails generate cognito_idp_rails:install

This generator will add `cognito_idp` to your routes and install an initializer at `config/initializers/cognito_idp.rb`.

Expand Down
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ load "rails/tasks/engine.rake"
load "rails/tasks/statistics.rake"

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

require "standard/rake"

task default: %i[spec standard]
27 changes: 27 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rake", "rake")
27 changes: 27 additions & 0 deletions bin/rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rubocop' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rubocop", "rubocop")
1 change: 1 addition & 0 deletions cognito_idp_rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Gem::Specification.new do |spec|
spec.summary = "Simple Rails integration for Amazon Cognito IdP (User Pools)"
spec.description = "Simple Rails integration for authentication through Amazon Cognito IdP (User Pools)"
spec.license = "MIT"
spec.required_ruby_version = ">= 2.6.0"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage
Expand Down
2 changes: 1 addition & 1 deletion lib/cognito_idp_rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CognitoIdpRails
VERSION = "0.1.0"
VERSION = "0.1.1"
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CognitoIdpRails.configure do |config|
config.domain = ENV["COGNITO_DOMAIN"]
config.on_valid_login = lambda do |token, user_info, session|
# 1. Find or create a user.
# user = User.where(identifier: user_info.sub).find_or_create do |user|
# user = User.where(identifier: user_info.sub).first_or_create do |user|
# user.email = user_info.email
# end

Expand Down
4 changes: 2 additions & 2 deletions spec/cognito_idp_rails/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
subject(:after_login_route) { configuration.after_login_route }

it "defaults to /" do
is_expected.to eq("/")
expect(subject).to eq("/")
end

context "when specified" do
Expand All @@ -25,7 +25,7 @@
subject(:after_logout_route) { configuration.after_logout_route }

it "defaults to /" do
is_expected.to eq("/")
expect(subject).to eq("/")
end

context "when specified" do
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/cognito_idp_rails/sessions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
get path

expect(client).to have_received(:get_token)
.with(grant_type: :authorization_code, code: code, redirect_uri:)
.with(grant_type: :authorization_code, code: code, redirect_uri: redirect_uri)
end

context "when a token is received" do
Expand Down
8 changes: 4 additions & 4 deletions spec/routing/mapper_extensions_spec.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
require "rails_helper"

RSpec.describe CognitoIdpRails::Routing::MapperExtensions, type: :routing do
it "defines cognito_idp method" do
expect(ActionDispatch::Routing::Mapper.new(ActionDispatch::Routing::RouteSet.new)).to respond_to(:cognito_idp)
end

before do
Rails.application.routes.draw do
cognito_idp
end
Rails.application.reload_routes!
end

it "defines cognito_idp method" do
expect(ActionDispatch::Routing::Mapper.new(ActionDispatch::Routing::RouteSet.new)).to respond_to(:cognito_idp)
end

it "adds login route" do
expect(Rails.application.routes.recognize_path("/login")).to match(controller: "cognito_idp_rails/sessions", action: "login")
end
Expand Down

0 comments on commit 021a35c

Please sign in to comment.