devise-dynamoid 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7df38491b546e2ac7c84f333d2243030b8d2bd3c2d773a5b1aadfed4ca70be9c
4
+ data.tar.gz: 2b1a779b4af0fc5b941c9eb2ede565d7f26bb6191773c290e660c22131bd5501
5
+ SHA512:
6
+ metadata.gz: 1abff79947ce62c360c5b9aaa7ebdff8a4618cd4ba391ec19fc65764e28f26dc015119d4d35d75bf03cfbfb9ec0c68a1baff0fb6134f79e2d3773e139fb0236f
7
+ data.tar.gz: c131aa8cd7f4f53be73da358b3e35455d5a4a05cb9bd4ce94dd19c196d4676372ca7a4e0ade8811d0caad0735893158b8296ef60cbd1a230e28af5376361cb8c
@@ -0,0 +1,17 @@
1
+ name-template: 'v$NEXT_PATCH_VERSION'
2
+ categories:
3
+ - title: 'Features'
4
+ labels:
5
+ - 'feature'
6
+ - title: 'Fixes'
7
+ labels:
8
+ - 'fix'
9
+ - 'bug'
10
+ - title: 'Maintenance'
11
+ labels:
12
+ - 'documentation'
13
+ - 'security'
14
+ - 'devops'
15
+ change-template: '- $TITLE (#$NUMBER) @$AUTHOR '
16
+ template: |
17
+ $CHANGES
@@ -0,0 +1,13 @@
1
+ commitsOnly: true
2
+ types:
3
+ - feat
4
+ - fix
5
+ - docs
6
+ - style
7
+ - refactor
8
+ - perf
9
+ - test
10
+ - build
11
+ - ci
12
+ - chore
13
+ - revert
@@ -0,0 +1,13 @@
1
+ name: Release Drafter
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ jobs:
7
+ update_release_draft:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Release Drafter
11
+ uses: release-drafter/release-drafter@v5
12
+ env:
13
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,42 @@
1
+ name: Release
2
+ on:
3
+ release:
4
+ types:
5
+ - published
6
+ jobs:
7
+ release:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Checkout code
11
+ uses: actions/checkout@v2
12
+ - name: Set up Ruby 2.5
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.5.x
16
+ - name: Bundler Install
17
+ run: |
18
+ gem install bundler --no-document
19
+ bundle install --jobs 4 --retry 3
20
+ - name: Run RuboCop
21
+ run: bundle exec rubocop
22
+ - name: Publish to GitHub Package Registry
23
+ run: |
24
+ mkdir -p $HOME/.gem
25
+ touch $HOME/.gem/credentials
26
+ chmod 0600 $HOME/.gem/credentials
27
+ printf -- "---\n:github: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
28
+ gem build *.gemspec
29
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
30
+ env:
31
+ GEM_HOST_API_KEY: ${{ secrets.GITHUB_TOKEN }}
32
+ OWNER: say8425
33
+ - name: Publish to RubyGems
34
+ run: |
35
+ mkdir -p $HOME/.gem
36
+ touch $HOME/.gem/credentials
37
+ chmod 0600 $HOME/.gem/credentials
38
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
39
+ gem build *.gemspec
40
+ gem push *.gem
41
+ env:
42
+ GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
@@ -0,0 +1,24 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+ branches:
8
+ - master
9
+ jobs:
10
+ Rubocop:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v2
15
+ - name: Set up Ruby 2.5
16
+ uses: actions/setup-ruby@v1
17
+ with:
18
+ ruby-version: 2.5.x
19
+ - name: Bundler Install
20
+ run: |
21
+ gem install bundler --no-document
22
+ bundle install --jobs 4 --retry 3
23
+ - name: Run RuboCop
24
+ run: bundle exec rubocop
@@ -0,0 +1,63 @@
1
+ # rspec failure tracking
2
+ .rspec_status
3
+ ### Ruby template
4
+ *.gem
5
+ *.rbc
6
+ /.config
7
+ /coverage/
8
+ /InstalledFiles
9
+ /pkg/
10
+ /spec/reports/
11
+ /spec/examples.txt
12
+ /test/tmp/
13
+ /test/version_tmp/
14
+ /tmp/
15
+
16
+ # Used by dotenv library to load environment variables.
17
+ # .env
18
+
19
+ # Ignore Byebug command history file.
20
+ .byebug_history
21
+
22
+ ## Specific to RubyMotion:
23
+ .dat*
24
+ .repl_history
25
+ build/
26
+ *.bridgesupport
27
+ build-iPhoneOS/
28
+ build-iPhoneSimulator/
29
+
30
+ ## Specific to RubyMotion (use of CocoaPods):
31
+ #
32
+ # We recommend against adding the Pods directory to your .gitignore. However
33
+ # you should judge for yourself, the pros and cons are mentioned at:
34
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
35
+ #
36
+ # vendor/Pods/
37
+
38
+ ## Documentation cache and generated files:
39
+ /.yardoc/
40
+ /_yardoc/
41
+ /doc/
42
+ /rdoc/
43
+
44
+ ## Environment normalization:
45
+ /.bundle/
46
+ /vendor/bundle
47
+ /lib/bundler/man/
48
+
49
+ # for a library or gem, you might want to ignore these files since the code is
50
+ # intended to run in multiple environments; otherwise, check them in:
51
+ Gemfile.lock
52
+ .ruby-version
53
+ .ruby-gemset
54
+ .tool-versions
55
+
56
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
57
+ .rvmrc
58
+
59
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
60
+ # .rubocop-https?--*
61
+
62
+ ### JetBrains
63
+ .idea
@@ -0,0 +1,53 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+ Exclude:
4
+ - Rakefile
5
+ - config.ru
6
+ - bin/*
7
+ NewCops: enable
8
+ require:
9
+ - rubocop-performance
10
+ # Migration Files could be fit with other options by spacing
11
+ Layout/ExtraSpacing:
12
+ Exclude:
13
+ - db/migrate/*.rb
14
+ Layout/LineLength:
15
+ Max: 120
16
+ Exclude:
17
+ - config/initializers/devise.rb
18
+ # Devise layout config has proc variable not lintable.
19
+ Lint/AmbiguousBlockAssociation:
20
+ Exclude:
21
+ - config/initializers/devise.rb
22
+ Metrics/AbcSize:
23
+ Max: 50
24
+ Exclude:
25
+ - db/migrate/*.rb
26
+ # Environment and application config are essentially long.
27
+ Metrics/BlockLength:
28
+ Exclude:
29
+ - config/environments/*
30
+ - config/application.rb
31
+ - app/admin/*.rb
32
+ Metrics/ClassLength:
33
+ Max: 1500
34
+ Exclude:
35
+ - db/migrate/*.rb
36
+ Metrics/MethodLength:
37
+ Max: 120
38
+ Exclude:
39
+ - db/migrate/*.rb
40
+ Style/Documentation:
41
+ Enabled: false
42
+ # The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
43
+ Style/CommentAnnotation:
44
+ Enabled: false
45
+ Style/ClassAndModuleChildren:
46
+ Exclude:
47
+ - test/test_helper.rb
48
+ # We do not need to support Ruby 1.9, so this is good to use.
49
+ Style/SymbolArray:
50
+ Enabled: true
51
+ # Non English can be used for comment
52
+ Style/AsciiComments:
53
+ Enabled: false
File without changes
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Penguin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,51 @@
1
+ # Devise Dynamoid
2
+
3
+ Devise only support [couple of ORM](https://github.com/heartcombo/devise#other-orms), ActiveRecord (default) and Mongoid.
4
+ This gem make support Dynamoid ORM for Devise.
5
+
6
+ ## Install Devise Gem
7
+
8
+ First of all, you should install [Devise](https://github.com/heartcombo/devise) gem and run devise install generator command.
9
+ Please read [Getting Started](https://github.com/heartcombo/devise#getting-started) section from Devise.
10
+
11
+ ## Installation
12
+
13
+ Add 'devise-dynamoid' to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'devise'
17
+ gem 'devise-dynamoid'
18
+ ```
19
+
20
+ Execute bundler:
21
+
22
+ ```shell script
23
+ $ bundle
24
+ ```
25
+
26
+ Load and configure dynamoid for your devise ORM.
27
+ You can find this **ORM configuration** at `config/initializers/devise.rb:35`
28
+
29
+ ```ruby
30
+ # ==> ORM configuration
31
+ # Load and configure the ORM. Supports :active_record (default) and
32
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
33
+ # available as additional gems.
34
+ require 'devise/orm/dynamoid'
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ Run devise model generator.
40
+
41
+ ```shell script
42
+ $ rails generate dynamoid:devise MODEL
43
+ ```
44
+
45
+ ## Contributing
46
+
47
+ Bug reports and pull requests are welcome.
48
+
49
+ ## License
50
+
51
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "devise/dynamoid"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/devise/dynamoid/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'devise-dynamoid'
7
+ spec.version = Devise::Dynamoid::VERSION
8
+ spec.authors = ['Penguin']
9
+ spec.email = ['say8425@gmail.com']
10
+
11
+ spec.summary = 'Dynamoid ORM for Devise'
12
+ spec.description = 'Support Dynamoid ORM and generators for Devise'
13
+ spec.homepage = 'https://github.com/say8425/devise-dynamoid'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/say8425/devise-dynamoid'
19
+ spec.metadata['changelog_uri'] = 'https://github.com/say8425/devise-dynamoid/blob/master/CHANGELOG.md'
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = 'exe'
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ['lib']
29
+
30
+ spec.add_dependency 'devise', '~> 4'
31
+ spec.add_dependency 'orm_adapter-dynamoid', '~> 0.0.2'
32
+ spec.add_development_dependency 'rubocop', '~> 0.87.1'
33
+ spec.add_development_dependency 'rubocop-performance', '~> 1.7', '>= 1.7.0'
34
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'devise/dynamoid/version'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Devise
4
+ module Dynamoid
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'orm_adapter-dynamoid'
4
+
5
+ ActiveSupport.on_load(:dynamoid) do
6
+ Dynamoid::Document::ClassMethods.include Devise::Models
7
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/named_base'
4
+ require 'generators/devise/orm_helpers'
5
+
6
+ module Dynamoid
7
+ module Generators
8
+ class DeviseGenerator < Rails::Generators::NamedBase
9
+ include Devise::Generators::OrmHelpers
10
+
11
+ def generate_model
12
+ invoke 'dynamoid:model', [name] unless model_exists? && behavior == :invoke
13
+ end
14
+
15
+ def inject_field_types
16
+ inject_into_file model_path, migration_data, after: "include Dynamoid::Document\n" if model_exists?
17
+ end
18
+
19
+ def inject_devise_content
20
+ inject_into_file model_path, model_contents, after: "include Dynamoid::Document\n" if model_exists?
21
+ end
22
+
23
+ def migration_data
24
+ <<~RUBY
25
+ ## Database authenticatable
26
+ field :email, type: String, default: ""
27
+ field :encrypted_password, type: String, default: ""
28
+
29
+ ## Recoverable
30
+ field :reset_password_token, type: String
31
+ field :reset_password_sent_at, type: Time
32
+
33
+ ## Rememberable
34
+ field :remember_created_at, type: Time
35
+
36
+ ## Trackable
37
+ field :sign_in_count, type: Integer, default: 0
38
+ field :current_sign_in_at, type: Time
39
+ field :last_sign_in_at, type: Time
40
+ field :current_sign_in_ip, type: String
41
+ field :last_sign_in_ip, type: String
42
+
43
+ ## Confirmable
44
+ # field :confirmation_token, type: String
45
+ # field :confirmed_at, type: Time
46
+ # field :confirmation_sent_at, type: Time
47
+ # field :unconfirmed_email, type: String # Only if using reconfirmable
48
+
49
+ ## Lockable
50
+ # field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
51
+ # field :unlock_token, type: String # Only if unlock strategy is :email or :both
52
+ # field :locked_at, type: Time
53
+ RUBY
54
+ end
55
+ end
56
+ end
57
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devise-dynamoid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Penguin
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-07-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: devise
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: orm_adapter-dynamoid
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.87.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.87.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-performance
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 1.7.0
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '1.7'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 1.7.0
75
+ description: Support Dynamoid ORM and generators for Devise
76
+ email:
77
+ - say8425@gmail.com
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - ".github/release-drafter.yml"
83
+ - ".github/semantic.yml"
84
+ - ".github/workflows/release-drafter.yml"
85
+ - ".github/workflows/release.yml"
86
+ - ".github/workflows/test.yml"
87
+ - ".gitignore"
88
+ - ".rubocop.yml"
89
+ - CHANGELOG.md
90
+ - Gemfile
91
+ - LICENSE.txt
92
+ - README.md
93
+ - bin/console
94
+ - bin/setup
95
+ - devise-dynamoid.gemspec
96
+ - lib/devise/dynamoid.rb
97
+ - lib/devise/dynamoid/version.rb
98
+ - lib/devise/orm/dynamoid.rb
99
+ - lib/generators/dynamoid/devise_generator.rb
100
+ homepage: https://github.com/say8425/devise-dynamoid
101
+ licenses:
102
+ - MIT
103
+ metadata:
104
+ homepage_uri: https://github.com/say8425/devise-dynamoid
105
+ source_code_uri: https://github.com/say8425/devise-dynamoid
106
+ changelog_uri: https://github.com/say8425/devise-dynamoid/blob/master/CHANGELOG.md
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 2.3.0
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.7.6.2
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: Dynamoid ORM for Devise
127
+ test_files: []