rails_options 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +16 -0
- data/Rakefile +18 -0
- data/app/models/rails_options/application_record.rb +5 -0
- data/app/models/rails_options/option.rb +15 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20220316133202_create_rails_options_options.rb +11 -0
- data/lib/generators/install/USAGE +8 -0
- data/lib/generators/install/install_generator.rb +9 -0
- data/lib/rails_options/engine.rb +5 -0
- data/lib/rails_options/version.rb +3 -0
- data/lib/rails_options.rb +6 -0
- data/lib/tasks/rails_options_tasks.rake +4 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e0ef2ddbf381db5c9accfec5a6ca700f1782f0bf051819cb52cd4e1eed59b52a
|
4
|
+
data.tar.gz: 68ef872fbd4d394a240c376d4c1cf1ab3ee09620311baedf12211be60056f160
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2ee6330e396c5a52fa833cc5a3b294a2834f22f8fda5dabeae7d410afd801a52449a16cbf03fbbf6559c2399db07031e6df4b3cb969ef4c5bebac9326f810796
|
7
|
+
data.tar.gz: f6405d248047bd370f3b1f20c2751ed199b18d1f43d5a194147ce4cce4a3e6d8ed997fe651267984277644160a91dc5a882c934dad2ea3617edea5aa7f441ea0
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2022 afeiship
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# rails_options
|
2
|
+
> Rails options.
|
3
|
+
|
4
|
+
## installation
|
5
|
+
```shell
|
6
|
+
# add to Gemfile
|
7
|
+
gem 'rails_options'
|
8
|
+
# install
|
9
|
+
gem install rails_options
|
10
|
+
```
|
11
|
+
|
12
|
+
## usage
|
13
|
+
```shell
|
14
|
+
# add migrations to app/db/migrations directory
|
15
|
+
rails g rails_options:install
|
16
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
4
|
+
load "rails/tasks/engine.rake"
|
5
|
+
|
6
|
+
load "rails/tasks/statistics.rake"
|
7
|
+
|
8
|
+
require "bundler/gem_tasks"
|
9
|
+
|
10
|
+
require "rake/testtask"
|
11
|
+
|
12
|
+
Rake::TestTask.new(:test) do |t|
|
13
|
+
t.libs << 'test'
|
14
|
+
t.pattern = 'test/**/*_test.rb'
|
15
|
+
t.verbose = false
|
16
|
+
end
|
17
|
+
|
18
|
+
task default: :test
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module RailsOptions
|
2
|
+
class Option < ApplicationRecord
|
3
|
+
before_save :generate_slug
|
4
|
+
validates_uniqueness_of :slug
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def generate_slug
|
9
|
+
self.slug ||= loop do
|
10
|
+
random_slug = SecureRandom.hex(10).slice(0, 6)
|
11
|
+
break random_slug unless self.class.exists?(slug: random_slug)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/config/routes.rb
ADDED
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_options
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- afeiship
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 6.1.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 6.1.5
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- 1290657123@qq.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- app/models/rails_options/application_record.rb
|
38
|
+
- app/models/rails_options/option.rb
|
39
|
+
- config/routes.rb
|
40
|
+
- db/migrate/20220316133202_create_rails_options_options.rb
|
41
|
+
- lib/generators/install/USAGE
|
42
|
+
- lib/generators/install/install_generator.rb
|
43
|
+
- lib/rails_options.rb
|
44
|
+
- lib/rails_options/engine.rb
|
45
|
+
- lib/rails_options/version.rb
|
46
|
+
- lib/tasks/rails_options_tasks.rake
|
47
|
+
homepage: https://github.com/afeiship/rails_options
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.0.3
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Summary of RailsJwtAdmin.
|
70
|
+
test_files: []
|