prefixed_ids 0.1.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11c3803dce3921dff8333129c9cbfa8f34ad50463bda15e3517dd2cf74b17205
4
- data.tar.gz: f2a460deb4832039b85668764420150831a3f7b7c79cda9b233cf51907fa5bfe
3
+ metadata.gz: 38b6a59341fa7c4d02fdaba7f6eb738cdb5730a9aa6caca89ffb89bfa9dc4740
4
+ data.tar.gz: ae7de74cf643796ce5fdafe5e0b7d0db98cf60b761a52a960ad1122c14028b0a
5
5
  SHA512:
6
- metadata.gz: ef6760313ffd3a32edf92f4b87f6f9d63b8c9209308be4b0d7d6d54bc6f10b7f78fd31f9efe28e260025f3ef13e1837add383d920051564fbc443803c90400e1
7
- data.tar.gz: '01869ac0b8c994fed97c77df7f92adca5cb93a31a9ab09a1cda897eac8d60d8cf4d3960e556023c962de57981cc9cc2e9b41691335ed1a51f99d2c6f890f945a'
6
+ metadata.gz: 428331d371bbcc87c9d092297b315476ccd9e62548ff59efef59cb7a3574b256247f4dacf6c1edc3c2f72e553a742033493f51587af264707a77ca3d797cea9e
7
+ data.tar.gz: af9b8a1f596b9b6d1720e8ec71b267421d6c0df5fd661e0b3b76765d8606bb929e5bf2a2bbe81a9fd853290e4e1a844ca7d3a63ad25001da9d9eb9beb3a98c0b
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2021 Chris Oliver
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 CHANGED
@@ -1,28 +1,76 @@
1
- # PrefixedIds
1
+ <p align="center">
2
+ <h1>Prefixed IDs</h1>
3
+ </p>
2
4
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/prefixed_ids`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ ### 🆔 Friendly Prefixed IDs for your Ruby on Rails models
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
7
+ [![Build Status](https://github.com/excid3/prefixed_ids/workflows/Tests/badge.svg)](https://github.com/excid3/prefixed_ids/actions) [![Gem Version](https://badge.fury.io/rb/prefixed_ids.svg)](https://badge.fury.io/rb/prefixed_ids)
6
8
 
7
- ## Installation
9
+ Generate prefixed IDs for your models with a friendly prefix. For example:
8
10
 
11
+ ```ruby
12
+ user_12345abcd
13
+ acct_23lksjdg3
14
+ ```
15
+
16
+ Inspired by [Stripe's prefixed IDs](https://stripe.com/docs/api) in their API.
17
+
18
+ ## 🚀 Installation
9
19
  Add this line to your application's Gemfile:
10
20
 
11
21
  ```ruby
12
22
  gem 'prefixed_ids'
13
23
  ```
14
24
 
15
- And then execute:
25
+ ## 📝 Usage
26
+
27
+ Add `has_prefix_id :my_prefix` to your models to autogenerate prefixed IDs.
28
+
29
+ ```ruby
30
+ class User < ApplicationRecord
31
+ has_prefix_id :user
32
+ end
33
+ ```
34
+
35
+ This will generate a value like `user_1234abcd`.
16
36
 
17
- $ bundle install
37
+ To query using the prefixed ID, simply you can use either `find` or `find_by_prefixed_id`:
18
38
 
19
- Or install it yourself as:
39
+ ```ruby
40
+ User.find("user_5vJjbzXq9KrLEMm32iAnOP0xGDYk6dpe")
41
+ User.find_by_prefix_id("user_5vJjbzXq9KrLEMm32iAnOP0xGDYk6dpe")
42
+ ```
20
43
 
21
- $ gem install prefixed_ids
44
+ We also override `to_param` by default so it'll be used in URLs automatically.
22
45
 
23
- ## Usage
46
+ To disable find and to_param overrides, simply pass in the options:
24
47
 
25
- TODO: Write usage instructions here
48
+ ```ruby
49
+ class User < ApplicationRecord
50
+ has_prefix_id :user, override_find: false, override_param: false
51
+ end
52
+ ```
53
+
54
+ ### Generic lookup
55
+
56
+ Imagine you have a prefixed ID but you don't know which model it belongs to.
57
+
58
+ ```ruby
59
+ PrefixedIds.find("user_5vJjbzXq9KrLEMm3")
60
+ #=> #<User>
61
+ PrefixedIds.find("acct_2iAnOP0xGDYk6dpe")
62
+ #=> #<Account>
63
+ ```
64
+
65
+ ### Customizing
66
+
67
+ You can customize the prefix, length, and attribute name for PrefixedIds.
68
+
69
+ ```ruby
70
+ class Account < ApplicationRecord
71
+ has_prefix_id :acct, minimum_length: 32, override_find: false, to_param: false
72
+ end
73
+ ```
26
74
 
27
75
  ## Development
28
76
 
@@ -30,11 +78,11 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
30
78
 
31
79
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
80
 
33
- ## Contributing
81
+ ## 🙏 Contributing
34
82
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/prefixed_ids. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/prefixed_ids/blob/master/CODE_OF_CONDUCT.md).
83
+ Bug reports and pull requests are welcome on GitHub at https://github.com/excid3/prefixed_ids. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/prefixed_ids/blob/master/CODE_OF_CONDUCT.md).
36
84
 
37
- ## License
85
+ ## 📝 License
38
86
 
39
87
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
88
 
data/Rakefile CHANGED
@@ -1,12 +1,18 @@
1
- # frozen_string_literal: true
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"
2
7
 
3
8
  require "bundler/gem_tasks"
9
+
4
10
  require "rake/testtask"
5
11
 
6
12
  Rake::TestTask.new(:test) do |t|
7
13
  t.libs << "test"
8
- t.libs << "lib"
9
- t.test_files = FileList["test/**/*_test.rb"]
14
+ t.pattern = "test/**/*_test.rb"
15
+ t.verbose = false
10
16
  end
11
17
 
12
18
  task default: :test
data/lib/prefixed_ids.rb CHANGED
@@ -1,8 +1,97 @@
1
- # frozen_string_literal: true
1
+ require "prefixed_ids/version"
2
+ require "prefixed_ids/engine"
2
3
 
3
- require_relative "prefixed_ids/version"
4
+ require "hashids"
4
5
 
5
6
  module PrefixedIds
6
7
  class Error < StandardError; end
7
- # Your code goes here...
8
+
9
+ autoload :PrefixId, "prefixed_ids/prefix_id"
10
+
11
+ mattr_accessor :delimiter, default: "_"
12
+ mattr_accessor :alphabet, default: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
13
+ mattr_accessor :minimum_length, default: 24
14
+
15
+ mattr_accessor :models, default: {}
16
+
17
+ def self.find(prefix_id)
18
+ prefix, _ = split_id(prefix_id)
19
+ models.fetch(prefix).find_by_prefix_id(prefix_id)
20
+ rescue KeyError
21
+ raise Error, "Unable to find model with prefix `#{prefix}`. Available prefixes are: #{models.keys.join(", ")}"
22
+ end
23
+
24
+ # Splits a prefixed ID into its prefix and ID
25
+ def self.split_id(prefix_id, delimiter = PrefixedIds.delimiter)
26
+ prefix, _, id = prefix_id.to_s.rpartition(delimiter)
27
+ [prefix, id]
28
+ end
29
+
30
+ # Adds `has_prefix_id` method
31
+ module Rails
32
+ extend ActiveSupport::Concern
33
+
34
+ included do
35
+ class_attribute :_prefix_id
36
+ end
37
+
38
+ class_methods do
39
+ def has_prefix_id(prefix, override_find: true, override_param: true, **options)
40
+ include Attribute
41
+ include Finder if override_find
42
+ include ToParam if override_param
43
+ self._prefix_id = PrefixId.new(self, prefix, **options)
44
+
45
+ # Register with PrefixedIds to support PrefixedIds#find
46
+ PrefixedIds.models[prefix.to_s] = self
47
+ end
48
+ end
49
+ end
50
+
51
+ # Included when a module uses `has_prefix_id`
52
+ module Attribute
53
+ extend ActiveSupport::Concern
54
+
55
+ class_methods do
56
+ def find_by_prefix_id(id)
57
+ find_by(id: _prefix_id.decode(id))
58
+ end
59
+
60
+ def find_by_prefix_id!(id)
61
+ find_by!(id: _prefix_id.decode(id))
62
+ end
63
+ end
64
+
65
+ def prefix_id
66
+ self.class._prefix_id.encode(id)
67
+ end
68
+ end
69
+
70
+ module Finder
71
+ extend ActiveSupport::Concern
72
+
73
+ class_methods do
74
+ def find(*ids)
75
+ super(*ids.map { |id| _prefix_id.decode(id, fallback: true) })
76
+ end
77
+
78
+ def relation
79
+ super.tap { |r| r.extend ClassMethods }
80
+ end
81
+
82
+ def has_many(*args, &block)
83
+ options = args.extract_options!
84
+ options[:extend] = Array(options[:extend]).push(ClassMethods)
85
+ super(*args, **options, &block)
86
+ end
87
+ end
88
+ end
89
+
90
+ module ToParam
91
+ extend ActiveSupport::Concern
92
+
93
+ def to_param
94
+ _prefix_id.encode(id)
95
+ end
96
+ end
8
97
  end
@@ -0,0 +1,9 @@
1
+ module PrefixedIds
2
+ class Engine < ::Rails::Engine
3
+ initializer "prefixed_ids.model" do
4
+ ActiveSupport.on_load(:active_record) do
5
+ include PrefixedIds::Rails
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,33 @@
1
+ module PrefixedIds
2
+ class PrefixId
3
+ attr_reader :hashids, :prefix
4
+
5
+ TOKEN = 123
6
+
7
+ def initialize(model, prefix, minimum_length: PrefixedIds.minimum_length, alphabet: PrefixedIds.alphabet, delimiter: PrefixedIds.delimiter, **options)
8
+ @prefix = prefix.to_s
9
+ @delimiter = delimiter.to_s
10
+ @hashids = Hashids.new(model.table_name, minimum_length, alphabet)
11
+ end
12
+
13
+ def encode(id)
14
+ @prefix + @delimiter + @hashids.encode(TOKEN, id)
15
+ end
16
+
17
+ # decode returns an array
18
+ def decode(id, fallback: false)
19
+ fallback_value = fallback ? id : nil
20
+ _, id_without_prefix = PrefixedIds.split_id(id, @delimiter)
21
+ decoded_hashid = @hashids.decode(id_without_prefix)
22
+ return fallback_value unless valid?(decoded_hashid)
23
+
24
+ decoded_hashid.last || fallback_value
25
+ end
26
+
27
+ private
28
+
29
+ def valid?(decoded_hashid)
30
+ decoded_hashid.size == 2 && decoded_hashid.first == TOKEN
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module PrefixedIds
4
- VERSION = "0.1.0"
2
+ VERSION = "1.2.2"
5
3
  end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :prefixed_ids do
3
+ # # Task goes here
4
+ # end
metadata CHANGED
@@ -1,15 +1,77 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prefixed_ids
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-17 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-05-03 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.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 6.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashids
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: 2.0.0
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.0
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: standardrb
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: appraisal
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
13
75
  description: Prefixed IDs generates IDs with friendly prefixes for your models
14
76
  email:
15
77
  - excid3@gmail.com
@@ -17,18 +79,14 @@ executables: []
17
79
  extensions: []
18
80
  extra_rdoc_files: []
19
81
  files:
20
- - ".github/workflows/main.yml"
21
- - ".gitignore"
22
- - CODE_OF_CONDUCT.md
23
- - Gemfile
24
- - LICENSE.txt
82
+ - MIT-LICENSE
25
83
  - README.md
26
84
  - Rakefile
27
- - bin/console
28
- - bin/setup
29
85
  - lib/prefixed_ids.rb
86
+ - lib/prefixed_ids/engine.rb
87
+ - lib/prefixed_ids/prefix_id.rb
30
88
  - lib/prefixed_ids/version.rb
31
- - prefixed_ids.gemspec
89
+ - lib/tasks/prefixed_ids_tasks.rake
32
90
  homepage: https://github.com/excid3/prefixed_ids
33
91
  licenses:
34
92
  - MIT
@@ -44,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
44
102
  requirements:
45
103
  - - ">="
46
104
  - !ruby/object:Gem::Version
47
- version: 2.3.0
105
+ version: '0'
48
106
  required_rubygems_version: !ruby/object:Gem::Requirement
49
107
  requirements:
50
108
  - - ">="
@@ -1,18 +0,0 @@
1
- name: Ruby
2
-
3
- on: [push,pull_request]
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v2
10
- - name: Set up Ruby
11
- uses: ruby/setup-ruby@v1
12
- with:
13
- ruby-version: 3.0.0
14
- - name: Run the default task
15
- run: |
16
- gem install bundler -v 2.2.3
17
- bundle install
18
- bundle exec rake
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
data/CODE_OF_CONDUCT.md DELETED
@@ -1,84 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
-
9
- ## Our Standards
10
-
11
- Examples of behavior that contributes to a positive environment for our community include:
12
-
13
- * Demonstrating empathy and kindness toward other people
14
- * Being respectful of differing opinions, viewpoints, and experiences
15
- * Giving and gracefully accepting constructive feedback
16
- * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
- * Focusing on what is best not just for us as individuals, but for the overall community
18
-
19
- Examples of unacceptable behavior include:
20
-
21
- * The use of sexualized language or imagery, and sexual attention or
22
- advances of any kind
23
- * Trolling, insulting or derogatory comments, and personal or political attacks
24
- * Public or private harassment
25
- * Publishing others' private information, such as a physical or email
26
- address, without their explicit permission
27
- * Other conduct which could reasonably be considered inappropriate in a
28
- professional setting
29
-
30
- ## Enforcement Responsibilities
31
-
32
- Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
-
34
- Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
-
36
- ## Scope
37
-
38
- This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
-
40
- ## Enforcement
41
-
42
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at excid3@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
-
44
- All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
-
46
- ## Enforcement Guidelines
47
-
48
- Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
-
50
- ### 1. Correction
51
-
52
- **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
-
54
- **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
-
56
- ### 2. Warning
57
-
58
- **Community Impact**: A violation through a single incident or series of actions.
59
-
60
- **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
-
62
- ### 3. Temporary Ban
63
-
64
- **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
-
66
- **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
-
68
- ### 4. Permanent Ban
69
-
70
- **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
-
72
- **Consequence**: A permanent ban from any sort of public interaction within the community.
73
-
74
- ## Attribution
75
-
76
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
- available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
-
79
- Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
-
81
- [homepage]: https://www.contributor-covenant.org
82
-
83
- For answers to common questions about this code of conduct, see the FAQ at
84
- https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Specify your gem's dependencies in prefixed_ids.gemspec
6
- gemspec
7
-
8
- gem "rake", "~> 13.0"
9
-
10
- gem "minitest", "~> 5.0"
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2021 Chris Oliver
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/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "prefixed_ids"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
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
data/prefixed_ids.gemspec DELETED
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/prefixed_ids/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "prefixed_ids"
7
- spec.version = PrefixedIds::VERSION
8
- spec.authors = ["Chris Oliver"]
9
- spec.email = ["excid3@gmail.com"]
10
-
11
- spec.summary = "Prefixed IDs generates IDs with friendly prefixes for your models"
12
- spec.description = "Prefixed IDs generates IDs with friendly prefixes for your models"
13
- spec.homepage = "https://github.com/excid3/prefixed_ids"
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/excid3/prefixed_ids"
19
- spec.metadata["changelog_uri"] = "https://github.com/excid3/prefixed_ids"
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{\A(?:test|spec|features)/}) }
25
- end
26
- spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
29
-
30
- # Uncomment to register a new dependency of your gem
31
- # spec.add_dependency "example-gem", "~> 1.0"
32
-
33
- # For more information and examples about making a new gem, checkout our
34
- # guide at: https://bundler.io/guides/creating_gem.html
35
- end