transitions_listener 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/ruby.yml +33 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +17 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +76 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/transitions_listener.rb +52 -0
- data/lib/transitions_listener/listener.rb +59 -0
- data/lib/transitions_listener/version.rb +5 -0
- data/transitions_listener.gemspec +38 -0
- metadata +134 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: cf5ad9460a9d232ee046520eb1e29b5d6a6f529571ba88d518e941dc5662abb5
|
|
4
|
+
data.tar.gz: be6081d137e8e47c995225f2e32951c0abd45d8c53b61ae180e75b1aa9ca5275
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 2de3e33e1d5a4684a99d23837c40ff2207ae6f4d0f3e267aed8c2de5197ff7948574748fee538828120eabee12bb10d03525c7e3c2607ed9d89494657da6f5ef
|
|
7
|
+
data.tar.gz: 842e02b54c22ed9439b7ba355ca08b3e9c13830e36eb651e42c4ac6008e6101b5b98bc6e692c3204d453891420237055fd161bd11133df2ea4b8c3e1768bb93e
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Ruby Gem
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
name: Tests and Code Style
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
- name: Set up Ruby 2.6
|
|
18
|
+
uses: actions/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: 2.6.x
|
|
21
|
+
|
|
22
|
+
- name: Install sqlite3
|
|
23
|
+
run: sudo apt-get install libsqlite3-dev
|
|
24
|
+
|
|
25
|
+
- name: Bundle install
|
|
26
|
+
run: |
|
|
27
|
+
gem install bundler
|
|
28
|
+
bundle install --jobs 4 --retry 3
|
|
29
|
+
- name: Tests (rspec)
|
|
30
|
+
run: |
|
|
31
|
+
bundle exec rspec
|
|
32
|
+
- name: Code style (Rubocop)
|
|
33
|
+
run: bundle exec rubocop
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# This is the configuration used to check the rubocop source code.
|
|
2
|
+
|
|
3
|
+
AllCops:
|
|
4
|
+
Exclude:
|
|
5
|
+
- 'Rakefile'
|
|
6
|
+
- 'bin/**/*'
|
|
7
|
+
- 'Gemfile'
|
|
8
|
+
|
|
9
|
+
Metrics/BlockLength:
|
|
10
|
+
Exclude:
|
|
11
|
+
- 'spec/**/*.rb'
|
|
12
|
+
|
|
13
|
+
Style/Documentation:
|
|
14
|
+
Enabled: false
|
|
15
|
+
|
|
16
|
+
Style/RescueStandardError:
|
|
17
|
+
EnforcedStyle: implicit
|
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 owenperedo@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,76 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
transitions_listener (0.1.0)
|
|
5
|
+
activerecord
|
|
6
|
+
activesupport
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
activemodel (5.2.4.2)
|
|
12
|
+
activesupport (= 5.2.4.2)
|
|
13
|
+
activerecord (5.2.4.2)
|
|
14
|
+
activemodel (= 5.2.4.2)
|
|
15
|
+
activesupport (= 5.2.4.2)
|
|
16
|
+
arel (>= 9.0)
|
|
17
|
+
activesupport (5.2.4.2)
|
|
18
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
19
|
+
i18n (>= 0.7, < 2)
|
|
20
|
+
minitest (~> 5.1)
|
|
21
|
+
tzinfo (~> 1.1)
|
|
22
|
+
arel (9.0.0)
|
|
23
|
+
ast (2.4.0)
|
|
24
|
+
concurrent-ruby (1.1.6)
|
|
25
|
+
diff-lcs (1.3)
|
|
26
|
+
i18n (1.8.2)
|
|
27
|
+
concurrent-ruby (~> 1.0)
|
|
28
|
+
jaro_winkler (1.5.4)
|
|
29
|
+
minitest (5.14.0)
|
|
30
|
+
parallel (1.19.1)
|
|
31
|
+
parser (2.7.1.1)
|
|
32
|
+
ast (~> 2.4.0)
|
|
33
|
+
rainbow (3.0.0)
|
|
34
|
+
rake (13.0.1)
|
|
35
|
+
rexml (3.2.4)
|
|
36
|
+
rspec (3.9.0)
|
|
37
|
+
rspec-core (~> 3.9.0)
|
|
38
|
+
rspec-expectations (~> 3.9.0)
|
|
39
|
+
rspec-mocks (~> 3.9.0)
|
|
40
|
+
rspec-core (3.9.1)
|
|
41
|
+
rspec-support (~> 3.9.1)
|
|
42
|
+
rspec-expectations (3.9.1)
|
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
44
|
+
rspec-support (~> 3.9.0)
|
|
45
|
+
rspec-mocks (3.9.1)
|
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
47
|
+
rspec-support (~> 3.9.0)
|
|
48
|
+
rspec-support (3.9.2)
|
|
49
|
+
rubocop (0.81.0)
|
|
50
|
+
jaro_winkler (~> 1.5.1)
|
|
51
|
+
parallel (~> 1.10)
|
|
52
|
+
parser (>= 2.7.0.1)
|
|
53
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
54
|
+
rexml
|
|
55
|
+
ruby-progressbar (~> 1.7)
|
|
56
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
57
|
+
ruby-progressbar (1.10.1)
|
|
58
|
+
sqlite3 (1.4.2)
|
|
59
|
+
thread_safe (0.3.6)
|
|
60
|
+
tzinfo (1.2.7)
|
|
61
|
+
thread_safe (~> 0.1)
|
|
62
|
+
unicode-display_width (1.7.0)
|
|
63
|
+
|
|
64
|
+
PLATFORMS
|
|
65
|
+
ruby
|
|
66
|
+
|
|
67
|
+
DEPENDENCIES
|
|
68
|
+
bundler
|
|
69
|
+
rake
|
|
70
|
+
rspec
|
|
71
|
+
rubocop
|
|
72
|
+
sqlite3
|
|
73
|
+
transitions_listener!
|
|
74
|
+
|
|
75
|
+
BUNDLED WITH
|
|
76
|
+
2.1.4
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Owen
|
|
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,67 @@
|
|
|
1
|
+
# TransitionsListener
|
|
2
|
+
|
|
3
|
+
This gem was inspired by [State Machine](https://github.com/pluginaweek/state_machine)
|
|
4
|
+
to listen all state transitions and make actions before and after the transition is saved.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem 'transitions_listener'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
And then execute: ```bundle install```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
```ruby
|
|
19
|
+
# == Schema Information
|
|
20
|
+
#
|
|
21
|
+
# Table name: articles
|
|
22
|
+
#
|
|
23
|
+
# id :bigint
|
|
24
|
+
# state :string
|
|
25
|
+
|
|
26
|
+
class Article < ActiveRecord::Base
|
|
27
|
+
include TransitionsListener
|
|
28
|
+
listen_transitions :state do
|
|
29
|
+
after_transition active: :inactive do |article, transition|
|
|
30
|
+
# article.send_inactive_email
|
|
31
|
+
end
|
|
32
|
+
before_transition any => :deleted do |article, transition|
|
|
33
|
+
# article.errors.add(:base, "not possible") if article.active_carts.any?
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
- ````listen_transitions(attr_name){block}```` permit to define state transitions listener for a specific model attribute
|
|
41
|
+
- ````before_transition(states){block}```` permit to listen transitions before the new state is saved (Before update)
|
|
42
|
+
- ````after_transition(states){block}```` permit to listen transitions after the new state was saved (After update)
|
|
43
|
+
|
|
44
|
+
States can be defined as the following:
|
|
45
|
+
- ```before_transition(any => any)``` block will be called when attr value is changed from any value to any value
|
|
46
|
+
- ```before_transition(any => :active)``` block will be called when attr value is changed from any value to :active
|
|
47
|
+
- ```before_transition(:active => any)``` block will be called when attr value is changed from :active value to any value
|
|
48
|
+
- ```before_transition(%i[active inactive] => %i[deleted cancelled])``` block will be called when attr value is changed from :active or inactive to :deleted or :cancelled
|
|
49
|
+
- ```before_transition(active: :inactive, inactive: :deleted)``` block will be called when attr value is changed from :active to :inactive or :inactive to :deleted
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
54
|
+
|
|
55
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
56
|
+
|
|
57
|
+
## Contributing
|
|
58
|
+
|
|
59
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/transitions_listener. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
64
|
+
|
|
65
|
+
## Code of Conduct
|
|
66
|
+
|
|
67
|
+
Everyone interacting in the TransitionsListener project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/transitions_listener/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "transitions_listener"
|
|
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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'transitions_listener/version'
|
|
4
|
+
require 'transitions_listener/listener'
|
|
5
|
+
|
|
6
|
+
module TransitionsListener
|
|
7
|
+
def self.included(base)
|
|
8
|
+
base.extend(ClassMethods)
|
|
9
|
+
base.class_eval do
|
|
10
|
+
before_update do
|
|
11
|
+
self.class.perform_transition_listeners(self, :before)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
after_update_commit do
|
|
15
|
+
self.class.perform_transition_listeners(self, :after)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
module ClassMethods
|
|
21
|
+
def listen_transitions(attr, &block)
|
|
22
|
+
transition_listeners(TransitionsListener::Listener.new(attr, &block))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def perform_transition_listeners(model, kind = :before)
|
|
26
|
+
transition_listeners.each do |listener|
|
|
27
|
+
c_transition = current_transition_for(model, listener.attr)
|
|
28
|
+
listener.filter_transitions(kind, c_transition).each do |transition|
|
|
29
|
+
transition[:block].call(model, c_transition.merge(transition))
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def transition_listeners(listener = nil)
|
|
37
|
+
@transition_listeners ||= []
|
|
38
|
+
@transition_listeners << listener if listener
|
|
39
|
+
@transition_listeners
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def current_transition_for(model, attr)
|
|
43
|
+
to = model.send(attr)
|
|
44
|
+
from = model.send("#{attr}_was")
|
|
45
|
+
unless model.changed?
|
|
46
|
+
previous = model.send("#{attr}_previous_change")
|
|
47
|
+
from = previous.nil? ? to : previous.first
|
|
48
|
+
end
|
|
49
|
+
{ from: from, to: to }
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TransitionsListener
|
|
4
|
+
class Listener
|
|
5
|
+
attr_accessor :attr
|
|
6
|
+
def initialize(attr, &block)
|
|
7
|
+
@attr = attr
|
|
8
|
+
instance_eval(&block)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def before_transition(states, &block)
|
|
12
|
+
before_transitions(states: states, block: block)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def after_transition(states, &block)
|
|
16
|
+
after_transitions(states: states, block: block)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def filter_transitions(kind, from:, to:)
|
|
20
|
+
transitions = kind == :before ? before_transitions : after_transitions
|
|
21
|
+
transitions.select do |transition|
|
|
22
|
+
match_states?(transition[:states], from, to)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def match_states?(states, from_state, to_state)
|
|
29
|
+
parse_states(states).any? do |t_from, t_to|
|
|
30
|
+
(t_from == [any] || t_from.include?(from_state.to_s)) &&
|
|
31
|
+
(t_to == [any] || t_to.include?(to_state.to_s))
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def any
|
|
36
|
+
'any_transition_key'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def before_transitions(transition = nil)
|
|
40
|
+
@before_transitions ||= []
|
|
41
|
+
@before_transitions << transition if transition
|
|
42
|
+
@before_transitions
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def after_transitions(transition = nil)
|
|
46
|
+
@after_transitions ||= []
|
|
47
|
+
@after_transitions << transition if transition
|
|
48
|
+
@after_transitions
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def parse_states(states)
|
|
52
|
+
states.map do |from, to|
|
|
53
|
+
from = [from] unless from.is_a? Array
|
|
54
|
+
to = [to] unless to.is_a? Array
|
|
55
|
+
[from.map(&:to_s), to.map(&:to_s)]
|
|
56
|
+
end.to_h
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'transitions_listener/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |spec|
|
|
8
|
+
spec.name = 'transitions_listener'
|
|
9
|
+
spec.version = TransitionsListener::VERSION
|
|
10
|
+
spec.authors = ['Owen']
|
|
11
|
+
spec.email = ['owenperedo@gmail.com']
|
|
12
|
+
|
|
13
|
+
spec.summary = 'Permit to listen all transition movements'
|
|
14
|
+
spec.description = spec.summary
|
|
15
|
+
spec.homepage = 'https://github.com/owen2345/transitions_listener'
|
|
16
|
+
spec.license = 'MIT'
|
|
17
|
+
|
|
18
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
19
|
+
|
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
21
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
|
22
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
|
23
|
+
|
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
spec.bindir = 'exe'
|
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
|
+
spec.require_paths = ['lib']
|
|
32
|
+
|
|
33
|
+
spec.add_dependency 'activerecord'
|
|
34
|
+
spec.add_dependency 'activesupport'
|
|
35
|
+
spec.add_development_dependency 'bundler'
|
|
36
|
+
spec.add_development_dependency 'rake'
|
|
37
|
+
spec.add_development_dependency 'rspec'
|
|
38
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: transitions_listener
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Owen
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-04-17 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: activerecord
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: activesupport
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: bundler
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rake
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rspec
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
description: Permit to listen all transition movements
|
|
84
|
+
email:
|
|
85
|
+
- owenperedo@gmail.com
|
|
86
|
+
executables: []
|
|
87
|
+
extensions: []
|
|
88
|
+
extra_rdoc_files: []
|
|
89
|
+
files:
|
|
90
|
+
- ".github/workflows/ruby.yml"
|
|
91
|
+
- ".gitignore"
|
|
92
|
+
- ".rspec"
|
|
93
|
+
- ".rubocop.yml"
|
|
94
|
+
- CODE_OF_CONDUCT.md
|
|
95
|
+
- Gemfile
|
|
96
|
+
- Gemfile.lock
|
|
97
|
+
- LICENSE.txt
|
|
98
|
+
- README.md
|
|
99
|
+
- Rakefile
|
|
100
|
+
- bin/console
|
|
101
|
+
- bin/setup
|
|
102
|
+
- lib/transitions_listener.rb
|
|
103
|
+
- lib/transitions_listener/listener.rb
|
|
104
|
+
- lib/transitions_listener/version.rb
|
|
105
|
+
- transitions_listener.gemspec
|
|
106
|
+
homepage: https://github.com/owen2345/transitions_listener
|
|
107
|
+
licenses:
|
|
108
|
+
- MIT
|
|
109
|
+
metadata:
|
|
110
|
+
allowed_push_host: https://rubygems.org
|
|
111
|
+
homepage_uri: https://github.com/owen2345/transitions_listener
|
|
112
|
+
source_code_uri: https://github.com/owen2345/transitions_listener
|
|
113
|
+
changelog_uri: https://github.com/owen2345/transitions_listener/blob/master/CHANGELOG.md
|
|
114
|
+
post_install_message:
|
|
115
|
+
rdoc_options: []
|
|
116
|
+
require_paths:
|
|
117
|
+
- lib
|
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
|
+
requirements:
|
|
120
|
+
- - ">="
|
|
121
|
+
- !ruby/object:Gem::Version
|
|
122
|
+
version: '0'
|
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
|
+
requirements:
|
|
125
|
+
- - ">="
|
|
126
|
+
- !ruby/object:Gem::Version
|
|
127
|
+
version: '0'
|
|
128
|
+
requirements: []
|
|
129
|
+
rubyforge_project:
|
|
130
|
+
rubygems_version: 2.7.7
|
|
131
|
+
signing_key:
|
|
132
|
+
specification_version: 4
|
|
133
|
+
summary: Permit to listen all transition movements
|
|
134
|
+
test_files: []
|