rbnotes 0.4.1 → 0.4.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: '09f402dd55c244533d8f8ba3518df3d13cde1c5952efad94598f210a43a88c11'
4
- data.tar.gz: a824e8e2e33c1c1e67d2ff27ab22618d83aa7138a889db20d43f40491f6e1c82
3
+ metadata.gz: 7a43f87f2f4b03c9f8e27d06eb4fc426abb6dafbd420d5bbbcdb4ec2ea38d497
4
+ data.tar.gz: 0f9c060bfefde2e6c3f611d7d7e683fdd5ced20327b3ae6a3cbfcac39cdaf5a3
5
5
  SHA512:
6
- metadata.gz: e52be521f1d1502ca2d36fd6853203436e15c3f830e17ff509529b0b7f08a2fad26a264714d81732603e6f6dabe69c2d40bebdb400b306f4fba1218c86c2ac52
7
- data.tar.gz: c555b3b74717d45d18a6d63959356ff411457b2f3b47819ca53ecca38fc6de03a9e5d5839e622e5b65d3513c40dfe487b2649206697d075400c1121a61ea99d4
6
+ metadata.gz: e28ed07cde6f385945a9ed3b92ff6402b8ec2dcdd2a75f6d1d0a8e391a2bf5e000245d708903fa815ec5faecfb2cfc39034240ef83a44818bd9a9ccb39c326ed
7
+ data.tar.gz: 0e2a87a92c5b5a674d143c3d4461577976e5f62508d67ebbdb5202bfbc771c04aacaab520f8860e29429411f50677351f059e01a919e0836fc889b6285507fbd
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
  ## [Unreleased]
8
8
  Nothing to record here.
9
9
 
10
+ ## [0.4.2] - 2020-11-05
11
+ ### Added
12
+ - Add a feature to keep the timestamp in `update` command. (#44)
13
+
14
+ ### Changed
15
+ - Fix issue #45: hanging up of `add` command.
16
+
10
17
  ## [0.4.1] - 2020-11-04
11
18
  ### Added
12
19
  - Add a feature to accept a timestamp in `add` command. (#34)
data/Gemfile CHANGED
@@ -6,4 +6,4 @@ gemspec
6
6
  gem "rake", "~> 13.0"
7
7
  gem "minitest", "~> 5.0"
8
8
 
9
- gem 'textrepo', "~> 0.5"
9
+ gem 'textrepo', "~> 0.5.4"
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbnotes (0.4.1)
5
- textrepo (~> 0.5)
4
+ rbnotes (0.4.2)
5
+ textrepo (~> 0.5.4)
6
6
  unicode-display_width (~> 1.7)
7
7
 
8
8
  GEM
@@ -10,7 +10,7 @@ GEM
10
10
  specs:
11
11
  minitest (5.14.2)
12
12
  rake (13.0.1)
13
- textrepo (0.5.3)
13
+ textrepo (0.5.4)
14
14
  unicode-display_width (1.7.0)
15
15
 
16
16
  PLATFORMS
@@ -20,7 +20,7 @@ DEPENDENCIES
20
20
  minitest (~> 5.0)
21
21
  rake (~> 13.0)
22
22
  rbnotes!
23
- textrepo (~> 0.5)
23
+ textrepo (~> 0.5.4)
24
24
 
25
25
  BUNDLED WITH
26
26
  2.1.4
@@ -41,6 +41,7 @@ module Rbnotes::Commands
41
41
  @opts[:timestamp] = Textrepo::Timestamp.parse_s(stamp_str)
42
42
  else
43
43
  args.unshift(arg)
44
+ break
44
45
  end
45
46
  end
46
47
 
@@ -5,6 +5,9 @@ module Rbnotes::Commands
5
5
  # The timestamp associated with the note will be updated to new one,
6
6
  # which is generated while the command exection.
7
7
  #
8
+ # When "-k" (or "--keep") option is specified, the timestamp will
9
+ # remain unchanged.
10
+ #
8
11
  # A timestamp string must be specified as the only argument. It
9
12
  # must exactly match to the one of the target note in the
10
13
  # repository. When the given timestamp was not found, the command
@@ -32,6 +35,18 @@ module Rbnotes::Commands
32
35
  # "20201020112233" -> "20201021123400"
33
36
 
34
37
  def execute(args, conf)
38
+ @opts = {}
39
+ while args.size > 0
40
+ arg = args.shift
41
+ case arg
42
+ when "-k", "--keep"
43
+ @opts[:keep_timestamp] = true
44
+ else
45
+ args.unshift(arg)
46
+ break
47
+ end
48
+ end
49
+
35
50
  target_stamp = Rbnotes::Utils.read_timestamp(args)
36
51
  editor = find_editor(conf[:editor])
37
52
  repo = Textrepo.init(conf)
@@ -47,13 +62,18 @@ module Rbnotes::Commands
47
62
  text = File.readlines(tmpfile, :chomp => true)
48
63
 
49
64
  unless text.empty?
65
+ keep = @opts[:keep_timestamp] || false
50
66
  newstamp = nil
51
67
  begin
52
- newstamp = repo.update(target_stamp, text)
68
+ newstamp = repo.update(target_stamp, text, keep)
53
69
  rescue StandardError => e
54
70
  puts e.message
55
71
  else
56
- puts "Update the note [%s -> %s]" % [target_stamp, newstamp] unless target_stamp == newstamp
72
+ if keep
73
+ puts "Update the note content, the timestamp unchanged [%s]" % newstamp
74
+ else
75
+ puts "Update the note [%s -> %s]" % [target_stamp, newstamp] unless target_stamp == newstamp
76
+ end
57
77
  ensure
58
78
  # Don't forget to remove the temporary file.
59
79
  File.delete(tmpfile)
@@ -1,4 +1,4 @@
1
1
  module Rbnotes
2
- VERSION = "0.4.1"
3
- RELEASE = "2020-11-04"
2
+ VERSION = "0.4.2"
3
+ RELEASE = "2020-11-05"
4
4
  end
@@ -25,6 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib"]
27
27
 
28
- spec.add_dependency "textrepo", "~> 0.5"
28
+ spec.add_dependency "textrepo", "~> 0.5.4"
29
29
  spec.add_dependency "unicode-display_width", "~> 1.7"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbnotes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mnbi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-04 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: textrepo
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.5'
19
+ version: 0.5.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.5'
26
+ version: 0.5.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: unicode-display_width
29
29
  requirement: !ruby/object:Gem::Requirement