textrepo 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +18 -0
- data/CHANGELOG.md +16 -1
- data/{LICENSE.txt → LICENSE} +6 -6
- data/README.md +2 -1
- data/examples/rbnotes/lib/rbnotes/commands.rb +1 -7
- data/examples/rbnotes/lib/rbnotes/commands/import.rb +2 -2
- data/examples/rbnotes/lib/rbnotes/commands/list.rb +1 -1
- data/lib/textrepo/file_system_repository.rb +7 -3
- data/lib/textrepo/timestamp.rb +1 -1
- data/lib/textrepo/version.rb +1 -1
- metadata +5 -5
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e4c8bee5a07bd1bd578fa838c0897358a7436c76246e672f555b7cc88540323
|
4
|
+
data.tar.gz: 2e7894038fdf7d8e3ffde5993d37d83b574861195e4df1bbc3494bae26937dc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc3ada372e37db9a400c69c7fc5cbfbb59fb2e54878cc5d51e51f31ae6769fd79ef6e4871e1a27c1f3901442aae4c3e683722fa957a4a714f96bdbbf133693b5
|
7
|
+
data.tar.gz: 11b86ca186db89e6c68909be0dfd0a1fc1b27203fec77bad6f6b3a93f69328eff83b7796a458eb4e8a9c6fad0febed554571f828eea68c7a1c9cf582d64bcfce
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: Build
|
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/CHANGELOG.md
CHANGED
@@ -5,7 +5,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
|
-
|
8
|
+
|
9
|
+
## [0.5.9] - 2021-05-25
|
10
|
+
### Fixed
|
11
|
+
- Fix issue #54: add check argument in some methods.
|
12
|
+
- Fix issue #52: remove trailing spaces.
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
- Update copyright year in `LICENSE`. (#53)
|
16
|
+
- Use GitHub/Actions instead of Travis-CI.
|
17
|
+
|
18
|
+
## [0.5.8] - 2021-03-23
|
19
|
+
### Add
|
20
|
+
- Add a section to describe about **text** into `README.md`.
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
- Fix issue #49: Timestamp.parse_s will cause a crash.
|
9
24
|
|
10
25
|
## [0.5.7] - 2020-11-16
|
11
26
|
### Fixed
|
data/{LICENSE.txt → LICENSE}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2020 mnbi
|
3
|
+
Copyright (c) 2020, 2021 mnbi
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
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
|
-
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Textrepo
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://github.com/mnbi/textrepo/workflows/Build/badge.svg)](https://github.com/mnbi/textrepo/actions?query=workflow%3A"Build")
|
4
|
+
[![CodeFactor](https://www.codefactor.io/repository/github/mnbi/textrepo/badge)](https://www.codefactor.io/repository/github/mnbi/textrepo)
|
4
5
|
|
5
6
|
Textrepo is a repository to store a note with a timestamp. Each note
|
6
7
|
in the repository operates with the associated timestamp.
|
@@ -43,14 +43,8 @@ USAGE
|
|
43
43
|
def execute(_, conf)
|
44
44
|
name = conf[:repository_name]
|
45
45
|
base = conf[:repository_base]
|
46
|
-
type = conf[:repository_type]
|
47
46
|
|
48
|
-
puts
|
49
|
-
when :file_system
|
50
|
-
"#{base}/#{name}"
|
51
|
-
else
|
52
|
-
"#{base}/#{name}"
|
53
|
-
end
|
47
|
+
puts "#{base}/#{name}"
|
54
48
|
end
|
55
49
|
end
|
56
50
|
|
@@ -17,7 +17,7 @@ module Rbnotes
|
|
17
17
|
begin
|
18
18
|
repo.create(stamp, content)
|
19
19
|
break # success to create a note
|
20
|
-
rescue Textrepo::DuplicateTimestampError =>
|
20
|
+
rescue Textrepo::DuplicateTimestampError => _
|
21
21
|
puts "A text with the timestamp [%s] has been already exists" \
|
22
22
|
" in the repository." % stamp
|
23
23
|
|
@@ -38,7 +38,7 @@ module Rbnotes
|
|
38
38
|
puts "Try to create a note again with a new " \
|
39
39
|
"timestamp [%s]." % stamp
|
40
40
|
end
|
41
|
-
rescue Textrepo::EmptyTextError =>
|
41
|
+
rescue Textrepo::EmptyTextError => _
|
42
42
|
puts "... aborted."
|
43
43
|
puts "The specified file is empyt."
|
44
44
|
exit 1 # error
|
@@ -36,7 +36,7 @@ module Rbnotes
|
|
36
36
|
prefix = '# '
|
37
37
|
subject = prefix + subject.lstrip if subject[0, 2] != prefix
|
38
38
|
|
39
|
-
ts_part = "#{timestamp_str} "[0..(TIMESTAMP_STR_MAX_WIDTH - 1)]
|
39
|
+
ts_part = "#{timestamp_str} "[0..(TIMESTAMP_STR_MAX_WIDTH - 1)]
|
40
40
|
sj_part = truncate_str(subject, subject_width)
|
41
41
|
|
42
42
|
ts_part + delimiter + sj_part
|
@@ -62,7 +62,7 @@ module Textrepo
|
|
62
62
|
#
|
63
63
|
# The root path of the repository looks like the following:
|
64
64
|
# - conf[:repository_base]/conf[:repository_name]
|
65
|
-
#
|
65
|
+
#
|
66
66
|
# Default values are set when `:repository_name` and `:default_extname`
|
67
67
|
# were not defined in `conf`.
|
68
68
|
#
|
@@ -89,7 +89,7 @@ module Textrepo
|
|
89
89
|
super
|
90
90
|
base = conf[:repository_base]
|
91
91
|
@name ||= FAVORITE_REPOSITORY_NAME
|
92
|
-
@path = File.expand_path(
|
92
|
+
@path = File.expand_path(name, base)
|
93
93
|
FileUtils.mkdir_p(@path)
|
94
94
|
@extname = conf[:default_extname] || FAVORITE_EXTNAME
|
95
95
|
@searcher = find_searcher(conf[:searcher])
|
@@ -181,9 +181,12 @@ module Textrepo
|
|
181
181
|
# entries(String = nil) -> Array of Timestamp instances
|
182
182
|
|
183
183
|
def entries(stamp_pattern = nil)
|
184
|
+
size = stamp_pattern.to_s.size
|
185
|
+
return [] if size > 0 and !(/\A[\d_]+\Z/ === stamp_pattern)
|
186
|
+
|
184
187
|
results = []
|
185
188
|
|
186
|
-
case
|
189
|
+
case size
|
187
190
|
when "yyyymoddhhmiss_lll".size
|
188
191
|
stamp = Timestamp.parse_s(stamp_pattern)
|
189
192
|
if exist?(stamp)
|
@@ -315,6 +318,7 @@ module Textrepo
|
|
315
318
|
# one file.
|
316
319
|
|
317
320
|
def invoke_searcher_for_entries(searcher, pattern, entries)
|
321
|
+
return [] if entries.empty?
|
318
322
|
output = []
|
319
323
|
|
320
324
|
if entries.size > LIMIT_OF_FILES
|
data/lib/textrepo/timestamp.rb
CHANGED
data/lib/textrepo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textrepo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mnbi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -32,11 +32,11 @@ executables: []
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
+
- ".github/workflows/main.yml"
|
35
36
|
- ".gitignore"
|
36
|
-
- ".travis.yml"
|
37
37
|
- CHANGELOG.md
|
38
38
|
- Gemfile
|
39
|
-
- LICENSE
|
39
|
+
- LICENSE
|
40
40
|
- README.md
|
41
41
|
- Rakefile
|
42
42
|
- bin/console
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
|
-
rubygems_version: 3.2.
|
80
|
+
rubygems_version: 3.2.15
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: A repository to store text with timestamp.
|