visibilize 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +59 -0
- data/LICENSE.txt +21 -0
- data/README.md +193 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +9 -0
- data/lib/visibilize.rb +35 -0
- data/lib/visibilize/generator.rb +72 -0
- data/lib/visibilize/version.rb +3 -0
- data/visibilize.gemspec +33 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 84568a8140b7e27087461d5707673a258efad3d5dc8fdd5305eca9516398f8a3
|
4
|
+
data.tar.gz: 902201dd9774ab0f5e0b971f3125a4b9840193bff28cf0bacfa77fd618b7fa8d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4ddf68adcb0fa813ed29ed03553b8dd8cdb04cd369cc860d67ac33432c3003b236e0c24d89645a5b08599a613a533dfb773ba0240348118f38e1d9e0f57f1732
|
7
|
+
data.tar.gz: 1ca2048a188fa08798e2e637bb29b5a82d81be4f80fe50da3050e7284d3b76cf90cfd288aea4f898cfba5624513045a5174005cac0780fa20bc4d50aa7e964b0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at feapaydin@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
visibilize (0.1.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (6.0.3.2)
|
10
|
+
activesupport (= 6.0.3.2)
|
11
|
+
activerecord (6.0.3.2)
|
12
|
+
activemodel (= 6.0.3.2)
|
13
|
+
activesupport (= 6.0.3.2)
|
14
|
+
activesupport (6.0.3.2)
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
i18n (>= 0.7, < 2)
|
17
|
+
minitest (~> 5.1)
|
18
|
+
tzinfo (~> 1.1)
|
19
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
20
|
+
concurrent-ruby (1.1.7)
|
21
|
+
diff-lcs (1.3)
|
22
|
+
i18n (1.8.5)
|
23
|
+
concurrent-ruby (~> 1.0)
|
24
|
+
minitest (5.14.1)
|
25
|
+
mysql2 (0.5.3)
|
26
|
+
rake (12.3.3)
|
27
|
+
rspec (3.8.0)
|
28
|
+
rspec-core (~> 3.8.0)
|
29
|
+
rspec-expectations (~> 3.8.0)
|
30
|
+
rspec-mocks (~> 3.8.0)
|
31
|
+
rspec-core (3.8.2)
|
32
|
+
rspec-support (~> 3.8.0)
|
33
|
+
rspec-expectations (3.8.4)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.8.0)
|
36
|
+
rspec-mocks (3.8.1)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.8.0)
|
39
|
+
rspec-support (3.8.2)
|
40
|
+
thread_safe (0.3.6)
|
41
|
+
tzinfo (1.2.7)
|
42
|
+
thread_safe (~> 0.1)
|
43
|
+
yaml (0.1.0)
|
44
|
+
zeitwerk (2.4.0)
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
ruby
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
activerecord (~> 6.0)
|
51
|
+
bundler (~> 2.0)
|
52
|
+
mysql2 (~> 0.5.3)
|
53
|
+
rake (~> 12.3.3)
|
54
|
+
rspec (~> 3.0)
|
55
|
+
visibilize!
|
56
|
+
yaml (~> 0.1.0)
|
57
|
+
|
58
|
+
BUNDLED WITH
|
59
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Furkan Enes Apaydın
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,193 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
# Visibilize
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
Visibilize is a gem that automatically creates *friendly visible ID's* for *ActiveRecord* instances.
|
8
|
+
|
9
|
+
|
10
|
+
Whenever you need an ID that **can be exposed** to end-users or a custom identifier for your models, visibilize can help.
|
11
|
+
|
12
|
+
It:
|
13
|
+
- Can generate random `strings and integers` with `custom length` as identifier
|
14
|
+
- Can generate identifiers from `SecureRandom` methods like `uuid`, `hex` or `base64`
|
15
|
+
- Can be triggered from different `ActiveRecord callbacks` to suit your needs
|
16
|
+
- Can make the identifiers `unique` for each record
|
17
|
+
- Can create identifiers from provided `lambda` methods
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Add this line to your application's Gemfile:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
|
29
|
+
gem 'visibilize'
|
30
|
+
|
31
|
+
```
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
And then execute:
|
36
|
+
|
37
|
+
|
38
|
+
```
|
39
|
+
$ bundle
|
40
|
+
```
|
41
|
+
|
42
|
+
|
43
|
+
Or install it yourself as:
|
44
|
+
|
45
|
+
|
46
|
+
```
|
47
|
+
$ gem install visibilize
|
48
|
+
```
|
49
|
+
|
50
|
+
|
51
|
+
## Usage
|
52
|
+
|
53
|
+
### Creating Attribute
|
54
|
+
First you need to create an identifier column (attribute) for your ActiveRecord model, if not already exists.
|
55
|
+
|
56
|
+
Run the command to create a migration:
|
57
|
+
|
58
|
+
```
|
59
|
+
rails g migration AddVisibleIdToUsers visible_id
|
60
|
+
```
|
61
|
+
You can name the column however you like.
|
62
|
+
You should also set the column type according to format of the identifier. You can make it an integer if you want your visible id to be numeric, otherwise string should work for most cases.
|
63
|
+
|
64
|
+
Then run `rails db:migrate` to execute the migration. This will create the visible_id column in your table.
|
65
|
+
|
66
|
+
---
|
67
|
+
|
68
|
+
### Editing the Model
|
69
|
+
After the database is ready, open the `app/models/user.rb` file and call `visibilize`
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
class User < ActiveRecord::Base
|
73
|
+
visibilize
|
74
|
+
end
|
75
|
+
```
|
76
|
+
That's it.
|
77
|
+
Whenever a record is being created it will fill the visible_id column with random unique integers automatically.
|
78
|
+
|
79
|
+
You can retrieve records with usual ActiveRecord calls:
|
80
|
+
```ruby
|
81
|
+
User.find_by_visible_id(params[:id])
|
82
|
+
User.where(visible_id: params[:id]).first
|
83
|
+
User.find_by(visible_id: params[:id])
|
84
|
+
```
|
85
|
+
|
86
|
+
---
|
87
|
+
### Options
|
88
|
+
Visibilize can be customized with provided options:
|
89
|
+
```ruby
|
90
|
+
class User < ActiveRecord::Base
|
91
|
+
visibilize column: :serial_number, # The column that will be used to store idenitifer
|
92
|
+
type: :string, # Type/format of the created identifier
|
93
|
+
callback: :before_create, # ActiveRecord callback that ID will be created
|
94
|
+
length: 50,
|
95
|
+
unique: true
|
96
|
+
end
|
97
|
+
```
|
98
|
+
|
99
|
+
|
100
|
+
#### Type
|
101
|
+
Visibilize has its own generators for string and integer types. You can provide either `:string` or `:integer` as type. Bear in mind that random strings can also contain numbers inside them.
|
102
|
+
|
103
|
+
Both string and integer values are being generated with respect to length option.
|
104
|
+
|
105
|
+
The type also supports `SecureRandom` methods. For example:
|
106
|
+
```ruby
|
107
|
+
class User < ActiveRecord::Base
|
108
|
+
# The value will be generated from SecureRandom.uuid
|
109
|
+
# For more info about SecureRandom visit: https://apidock.com/ruby/SecureRandom
|
110
|
+
visibilize type: :uuid
|
111
|
+
end
|
112
|
+
```
|
113
|
+
The default type is `:integer`.
|
114
|
+
|
115
|
+
#### Length
|
116
|
+
The length specifies the length of the created string or integer. The `default length is 8`.
|
117
|
+
|
118
|
+
If you are calling a SecureRandom method with type, the length will be sent as an argument to that method (if expected).
|
119
|
+
Note that some SecureRandom methods does not use length parameter (like UUID, has fixed length 36) so visibilize option for length will be unnecessary.
|
120
|
+
|
121
|
+
|
122
|
+
#### Unique
|
123
|
+
It simply specifies whether the provided value must be non existent in previous records of the model.
|
124
|
+
By default this is set to `true`.
|
125
|
+
The uniqueness will be checked with a loop in plain ruby, not on the database.
|
126
|
+
```
|
127
|
+
! CAUTION !
|
128
|
+
If you're expecting the values to be unique,
|
129
|
+
you must consider the type and length of the generated identifier.
|
130
|
+
The next available ID must be easy to find,
|
131
|
+
otherwise the loop can be iterate for too long
|
132
|
+
or even infinitely if no ID is available.
|
133
|
+
```
|
134
|
+
|
135
|
+
|
136
|
+
#### Callback
|
137
|
+
ActiveRecord supports multiple callbacks for different actions. You can provide the name of the callback that visibilize will be executed. The default callback is `before_create`.
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
class User < ActiveRecord::Base
|
141
|
+
visibilize type: :uuid,
|
142
|
+
callback: :before_update
|
143
|
+
end
|
144
|
+
```
|
145
|
+
Note that visibilize **does not save** the record when it is called. You must save the generated value manually by calling `instance.save` whenever is fit, or use a callback that is just before the saving progress like `before_create`.
|
146
|
+
|
147
|
+
#### Lambda
|
148
|
+
You can provide a lambda method to generate a value by custom conditions.
|
149
|
+
If you provide a lambda, visibilize will automatically use it and skip its own generators.
|
150
|
+
```ruby
|
151
|
+
class User < ActiveRecord::Base
|
152
|
+
visibilize column: :token,
|
153
|
+
lambda: ->() {return Digest::MD5.hexdigest('foobar')}
|
154
|
+
end
|
155
|
+
```
|
156
|
+
Visibilize **cannot modify length** or **promise uniqueness** when using lambdas since the value will be generated from provided lambda method.
|
157
|
+
|
158
|
+
## Bugs
|
159
|
+
Please report any bugs by [creating issues on Github](https://github.com/FEApaydin/visibilize/issues).
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
## Contribution
|
164
|
+
|
165
|
+
### Setup
|
166
|
+
The tests are using ActiveRecord `6.0` which requires ruby `2.5.0` or further. The recommended ruby version is `2.7.0`. Make sure you have the correct Ruby version.
|
167
|
+
|
168
|
+
To install the gem requirements, run the command:
|
169
|
+
|
170
|
+
```
|
171
|
+
bin/setup
|
172
|
+
```
|
173
|
+
|
174
|
+
### Development
|
175
|
+
All of the core files of the gem is under `lib/` directory.
|
176
|
+
You can develop your own generators inside `lib/visibilize/generator.rb` .
|
177
|
+
If you name your generator method in the `generate_md5` format, it will automatically be available to use with `type: :md5` option.
|
178
|
+
|
179
|
+
### Testing
|
180
|
+
Visibilize uses `rspec` for testing.
|
181
|
+
Since the gem works on top of ActiveRecord, a database connection is required.
|
182
|
+
Create a database and enter the credentials to `spec/db/database.yaml`.
|
183
|
+
Then run:
|
184
|
+
```
|
185
|
+
bundle exec rspec
|
186
|
+
```
|
187
|
+
Rspec will automatically connect to the database, execute migrations for test tables and perform tests.
|
188
|
+
It destroys all of the records from previous tests but does not truncate or drop the database.
|
189
|
+
|
190
|
+
If somehow you cannot use migrations, there is a `spec/db/mysql.sql` file that contains plain SQL for creating the tables manually.
|
191
|
+
|
192
|
+
## License
|
193
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "visibilize"
|
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__)
|
data/bin/setup
ADDED
data/lib/visibilize.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require "visibilize/version"
|
2
|
+
require "visibilize/generator"
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
def visibilize(options={})
|
7
|
+
|
8
|
+
column = options[:column] || :visible_id
|
9
|
+
callback = options[:callback] || :before_create
|
10
|
+
type = options[:type] || :integer
|
11
|
+
unique = options[:unique] || true
|
12
|
+
length = options[:length] || 8
|
13
|
+
lamb = options[:lambda] || nil
|
14
|
+
|
15
|
+
# Define a method to fill the column with appropiate value
|
16
|
+
method_name="visibilize_#{column}"
|
17
|
+
define_method(method_name) do
|
18
|
+
|
19
|
+
raise "Visibilize Error: Attribute #{column} not found in #{self.class.name} instance." unless self.has_attribute?(column)
|
20
|
+
|
21
|
+
# Values are generated by VisibilizeGenerator class
|
22
|
+
value=lamb ? lamb.call : VisibilizeGenerator.get_value_for(type, self.class, column, length, unique)
|
23
|
+
|
24
|
+
write_attribute(column, value)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Create a callback to execute method
|
28
|
+
callback=callback.to_s.split('_')
|
29
|
+
set_callback callback[1].to_sym, callback[0].to_sym, method_name.to_sym
|
30
|
+
|
31
|
+
end
|
32
|
+
# end visibilize
|
33
|
+
|
34
|
+
|
35
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
module VisibilizeGenerator
|
4
|
+
|
5
|
+
class << self
|
6
|
+
|
7
|
+
def get_value_for(type, klass, column, length, unique)
|
8
|
+
method="generate_#{type}"
|
9
|
+
|
10
|
+
|
11
|
+
if self.respond_to?(method)
|
12
|
+
from=:generators
|
13
|
+
elsif SecureRandom.respond_to?(type)
|
14
|
+
from=:securerandom
|
15
|
+
else
|
16
|
+
raise "Visibilize Error: No generator defined for type #{type}. (Asked for column #{column} of #{klass.name})"
|
17
|
+
end
|
18
|
+
|
19
|
+
loop do
|
20
|
+
if from==:generators
|
21
|
+
generated=public_send(method, length)
|
22
|
+
elsif from==:securerandom
|
23
|
+
generated=generate_from_securerandom(type, length)
|
24
|
+
end
|
25
|
+
|
26
|
+
return generated if !unique || klass.where("#{column}='#{generated}'").empty?
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
# end get_value_for
|
31
|
+
|
32
|
+
|
33
|
+
#
|
34
|
+
# Generators
|
35
|
+
#
|
36
|
+
|
37
|
+
def generate_integer(length)
|
38
|
+
return rand(1...10) if length==1
|
39
|
+
|
40
|
+
min=10**(length-1) #1000
|
41
|
+
max=9*min + (min-1) #9999
|
42
|
+
rand(min...(max+1))
|
43
|
+
end
|
44
|
+
|
45
|
+
def generate_string(length)
|
46
|
+
available_chars=("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a
|
47
|
+
|
48
|
+
str=""
|
49
|
+
length.times do
|
50
|
+
str+=available_chars[rand(available_chars.size)].to_s
|
51
|
+
end
|
52
|
+
|
53
|
+
str
|
54
|
+
end
|
55
|
+
|
56
|
+
def generate_from_securerandom(type, length)
|
57
|
+
if SecureRandom.respond_to?(type)
|
58
|
+
begin
|
59
|
+
return SecureRandom.public_send(type, length)
|
60
|
+
rescue ArgumentError
|
61
|
+
return SecureRandom.public_send(type)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
return nil
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
end
|
70
|
+
# end static
|
71
|
+
|
72
|
+
end
|
data/visibilize.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "visibilize/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'visibilize'
|
7
|
+
spec.version = Visibilize::VERSION
|
8
|
+
spec.authors = ['Furkan Enes Apaydın']
|
9
|
+
spec.email = ['feapaydin@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = %q{Generate random friendly identifiers for ActiveRecord instances.}
|
12
|
+
spec.description = %q{Visibilize generates random friendly identifiers (visible_id) that can be exposed to end users for ActiveRecord models. }
|
13
|
+
spec.homepage = 'https://github.com/FEApaydin/visibilize'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = 'https://github.com/FEApaydin/visibilize'
|
18
|
+
spec.metadata["changelog_uri"] = 'https://github.com/FEApaydin/visibilize'
|
19
|
+
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = 'exe'
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
28
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
spec.add_development_dependency 'activerecord', '~> 6.0'
|
31
|
+
spec.add_development_dependency 'mysql2', '~> 0.5.3'
|
32
|
+
spec.add_development_dependency 'yaml', '~> 0.1.0'
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: visibilize
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Furkan Enes Apaydın
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 12.3.3
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 12.3.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activerecord
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '6.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '6.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mysql2
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.5.3
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.5.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yaml
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.1.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.1.0
|
97
|
+
description: 'Visibilize generates random friendly identifiers (visible_id) that can
|
98
|
+
be exposed to end users for ActiveRecord models. '
|
99
|
+
email:
|
100
|
+
- feapaydin@gmail.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- CODE_OF_CONDUCT.md
|
109
|
+
- Gemfile
|
110
|
+
- Gemfile.lock
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- bin/console
|
115
|
+
- bin/setup
|
116
|
+
- lib/visibilize.rb
|
117
|
+
- lib/visibilize/generator.rb
|
118
|
+
- lib/visibilize/version.rb
|
119
|
+
- visibilize.gemspec
|
120
|
+
homepage: https://github.com/FEApaydin/visibilize
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata:
|
124
|
+
homepage_uri: https://github.com/FEApaydin/visibilize
|
125
|
+
source_code_uri: https://github.com/FEApaydin/visibilize
|
126
|
+
changelog_uri: https://github.com/FEApaydin/visibilize
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubygems_version: 3.1.2
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Generate random friendly identifiers for ActiveRecord instances.
|
146
|
+
test_files: []
|