filewatcher-access 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0b6bebd53589798949b382b9e6de2b8615f01c605a554e623e4b6942c5e01555
4
+ data.tar.gz: 9ff7e9a5b1b7ce2a2006a7455aa6fcb7d9caf88166ddd3c01f00fa5b222a7824
5
+ SHA512:
6
+ metadata.gz: 7a07db440f53185ccd621f365fd7def6133953df43ad4fa0dbacb3f8dead0e58fae260093a02cb90d2562b6f2b0c778e85d2828fe9b450c3147a5a7073ae5929
7
+ data.tar.gz: 93468a2425f841cee420833a95936a5dbf842bd43fbf341bc7dcf4188c7931c07779938e4a14884e4a1b6ed2cc73a28b733f2786eb41cdb9a764ccb4810e0c86
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## 1.0.0 (2022-09-09)
6
+
7
+ * Initial release.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Alexander Popov
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,66 @@
1
+ # Filewatcher Access
2
+
3
+ [![Cirrus CI - Base Branch Build Status](https://img.shields.io/cirrus/github/filewatcher/filewatcher-access?style=flat-square)](https://cirrus-ci.com/github/filewatcher/filewatcher-access)
4
+ [![Codecov branch](https://img.shields.io/codecov/c/github/filewatcher/filewatcher-access/main.svg?style=flat-square)](https://codecov.io/gh/filewatcher/filewatcher-access)
5
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/filewatcher/filewatcher-access.svg?style=flat-square)](https://codeclimate.com/github/filewatcher/filewatcher-access)
6
+ [![Depfu](https://img.shields.io/depfu/filewatcher/filewatcher-access?style=flat-square)](https://depfu.com/repos/github/filewatcher/filewatcher-access)
7
+ [![Inline docs](https://inch-ci.org/github/filewatcher/filewatcher-access.svg?branch=main)](https://inch-ci.org/github/filewatcher/filewatcher-access)
8
+ [![Gem](https://img.shields.io/gem/v/filewatcher-access.svg?style=flat-square)](https://rubygems.org/gems/filewatcher-access)
9
+ [![License](https://img.shields.io/github/license/filewatcher/filewatcher-access.svg?style=flat-square)](LICENSE.txt)
10
+
11
+ Add `access` event for Filewatcher (where it's supported).
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'filewatcher-access'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ ```shell
24
+ bundle install
25
+ ```
26
+
27
+ Or install it yourself as:
28
+
29
+ ```shell
30
+ gem install filewatcher-access
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ```ruby
36
+ require 'filewatcher/access'
37
+
38
+ Filewatcher.new('lib/').watch do |filename, event|
39
+ ## there will be `accessed` event
40
+ end
41
+ ```
42
+
43
+ Also you can use it with [CLI](https://github.com/filewatcher/filewatcher-cli):
44
+
45
+ ```sh
46
+ $ filewatcher -p access '**/*'
47
+ ```
48
+
49
+ ## Development
50
+
51
+ After checking out the repo, run `bundle install` to install dependencies.
52
+
53
+ Then, run `bundle exec rspec` to run the tests.
54
+
55
+ To install this gem onto your local machine, run `toys gem install`.
56
+
57
+ To release a new version, run `toys gem release %version%`.
58
+ See how it works [here](https://github.com/AlexWayfer/gem_toys#release).
59
+
60
+ ## Contributing
61
+
62
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/filewatcher/filewatcher-access).
63
+
64
+ ## License
65
+
66
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Filewatcher
4
+ module Access
5
+ VERSION = '1.0.0'
6
+ end
7
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'filewatcher'
4
+
5
+ require_relative 'access/version'
6
+
7
+ ## Redefine `Filewatcher::Snapshot` class
8
+ class Filewatcher
9
+ require 'filewatcher/snapshot'
10
+
11
+ class Snapshot
12
+ ## Redefine `Filewatcher::Snapshot::SnapshotFile` class
13
+ class SnapshotFile
14
+ extend(
15
+ Module.new do
16
+ def populate_stats(stats)
17
+ stats = super(stats) if defined?(super)
18
+ stats.insert(stats.index(:mtime) + 1, :atime)
19
+ end
20
+
21
+ def populate_subtractions(hash)
22
+ hash = super(hash) if defined?(super)
23
+ hash.to_a.insert(
24
+ hash.keys.index(:updated) + 1,
25
+ [:accessed, ->(other) { atime && atime > other.atime }]
26
+ )
27
+ end
28
+ end
29
+ )
30
+
31
+ attr_reader :atime
32
+ end
33
+ end
34
+
35
+ ## Check for just `CLI` can fail because of CLI gemspec requirement with only `constants`
36
+ if self::CLI.const_defined?(:Command, false)
37
+ self::CLI::Command.option %w[-a --access], :flag, 'react to access (read) events',
38
+ default: true
39
+ end
40
+ end
metadata ADDED
@@ -0,0 +1,242 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: filewatcher-access
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Alexander Popov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-09-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: filewatcher
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
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: filewatcher-cli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.9'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler-audit
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.9.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.9.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: gem_toys
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.12.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.12.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: toys
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.13.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.13.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.9'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.9'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.21.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.21.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov-cobertura
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '2.1'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '2.1'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 1.36.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 1.36.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop-performance
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '1.0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '1.0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rubocop-rspec
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '2.0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '2.0'
195
+ description: 'Add `access` event for Filewatcher (where it''s supported).
196
+
197
+ '
198
+ email:
199
+ - alex.wayfer@gmail.com
200
+ executables: []
201
+ extensions: []
202
+ extra_rdoc_files: []
203
+ files:
204
+ - CHANGELOG.md
205
+ - LICENSE.txt
206
+ - README.md
207
+ - lib/filewatcher/access.rb
208
+ - lib/filewatcher/access/version.rb
209
+ homepage: https://github.com/filewatcher/filewatcher-access
210
+ licenses:
211
+ - MIT
212
+ metadata:
213
+ bug_tracker_uri: https://github.com/filewatcher/filewatcher-access/issues
214
+ changelog_uri: https://github.com/filewatcher/filewatcher-access/blob/v1.0.0/CHANGELOG.md
215
+ documentation_uri: http://www.rubydoc.info/gems/filewatcher-access/1.0.0
216
+ homepage_uri: https://github.com/filewatcher/filewatcher-access
217
+ rubygems_mfa_required: 'true'
218
+ source_code_uri: https://github.com/filewatcher/filewatcher-access
219
+ wiki_uri: https://github.com/filewatcher/filewatcher-access/wiki
220
+ post_install_message:
221
+ rdoc_options: []
222
+ require_paths:
223
+ - lib
224
+ required_ruby_version: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - ">="
227
+ - !ruby/object:Gem::Version
228
+ version: '2.6'
229
+ - - "<"
230
+ - !ruby/object:Gem::Version
231
+ version: '4'
232
+ required_rubygems_version: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ requirements: []
238
+ rubygems_version: 3.3.7
239
+ signing_key:
240
+ specification_version: 4
241
+ summary: Add `access` event for Filewatcher (where it's supported)
242
+ test_files: []