cuco 0.1.6 → 0.1.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31def49df321911a40f1bf5c30d7bb27fc55097ef64657232f8071f0f9bda0d5
4
- data.tar.gz: 2b45c83b68ae3a6da95b5ac7337492024e52fbf4debb8ccb22bc14cc61ea287c
3
+ metadata.gz: 170a17c7fb9c122b0308d11cd3d1da6a9af94a1fb6ec3ff5a7d1c73545f3a125
4
+ data.tar.gz: e2a66d97e7ce648d003b24cd55314765c88deae7ba064e5ead72100b5d332afd
5
5
  SHA512:
6
- metadata.gz: 387b95adfe0f8fa20a5bf87b9d35694cbdef925aac1f5288f20c65f2807790caca324917ec1337eea34e45986001e6b8b2d2669a551928f1c67ad95b62b965f9
7
- data.tar.gz: e87e8ae29203dcbca596e9b11149923463ca7914ef5bc4fce3fd7b11f2101d5d22af63e580231340ce64906c52a1e9f1e2ee70b15238ca195d3053ad41a0c661
6
+ metadata.gz: a96e3539b23c5cc3805f2640e0423b7eccd6e4db658dae160c36da20d9241561d493cc7707b4f1e624870aff232212dc52a7aea6b5c1288ba293d0fa414c964e
7
+ data.tar.gz: 21be157050b093ca131478fe9ab93b5076d3b94bee7aaaf06fbb93ddf6f6f5b2a041b78db88cc77797d5e31c0e4bd4d3d7875f1e99246ab24c82ce2e876a76d9
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2024-2025 Dittmar Krall (www.matiq.com)
1
+ Copyright (c) 2024-2026 Dittmar Krall (www.matiq.com)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -83,5 +83,5 @@ See directory _scripts_ for samples.
83
83
  * gem watchr
84
84
  * gem observr (a follow-up of gem watchr)
85
85
 
86
- Copyright (c) 2024-2025 Dittmar Krall (www.matiq.com),
86
+ Copyright (c) 2024-2026 Dittmar Krall (www.matiq.com),
87
87
  released under the [MIT license](https://opensource.org/licenses/MIT).
@@ -17,8 +17,8 @@ class Controller
17
17
 
18
18
  @listener.start
19
19
  puts "*** Listen started" if debug
20
- # sleep # fails with Ruby 4.0.0
21
- sleep 24 * 60 * 60
20
+ sleep # fails with Ruby 4.0.0
21
+ # sleep 24 * 60 * 60
22
22
  end
23
23
 
24
24
  def stop
data/lib/cuco/version.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module Cuco
2
- VERSION = "0.1.6" # 2025-12-28
2
+ VERSION = "0.1.8" # 2026-04-07
3
+ # VERSION = "0.1.6" # 2025-12-28
3
4
  # VERSION = "0.1.5" # 2025-12-28
4
5
  # VERSION = "0.1.4" # 2025-06-21
5
6
  # VERSION = "0.1.3" # 2025-05-28
@@ -1,5 +1,7 @@
1
1
  module Cuco
2
- VERSION = "0.1.5" # 2025-12-28
2
+ VERSION = "0.1.7" # 2026-04-07
3
+ # VERSION = "0.1.6" # 2025-12-28
4
+ # VERSION = "0.1.5" # 2025-12-28
3
5
  # VERSION = "0.1.4" # 2025-06-21
4
6
  # VERSION = "0.1.3" # 2025-05-28
5
7
  # VERSION = "0.1.2" # 2024-05-21
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dittmar Krall
@@ -91,12 +91,9 @@ files:
91
91
  - MIT-LICENSE
92
92
  - README.md
93
93
  - bin/cuco
94
- - bin/cuco.bak
95
94
  - lib/cuco/controller.rb
96
- - lib/cuco/controller.rb.bak
97
95
  - lib/cuco/cuco.rb
98
96
  - lib/cuco/script.rb
99
- - lib/cuco/script.rb.bak
100
97
  - lib/cuco/version.rb
101
98
  - lib/cuco/version.rb.bak
102
99
  homepage: http://www.matiq.de
@@ -117,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
114
  - !ruby/object:Gem::Version
118
115
  version: '0'
119
116
  requirements: []
120
- rubygems_version: 4.0.3
117
+ rubygems_version: 4.0.6
121
118
  specification_version: 4
122
119
  summary: A file watcher
123
120
  test_files: []
data/bin/cuco.bak DELETED
@@ -1,20 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- lib = File.expand_path("../lib/", __dir__)
4
- $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
5
-
6
- require "cuco/version"
7
- require "cuco/cuco"
8
- require "cuco/controller"
9
- require "micro-optparse"
10
-
11
- options = Parser.new do |p|
12
- p.banner = "Usage: cuco [options] [.watchr] # a file watcher"
13
- p.version = "cuco #{Cuco::VERSION}"
14
- p.option :debug, "Debugging output", default: false
15
- end.process!
16
-
17
- G.init(options, ARGV)
18
-
19
- G.script = Script.new File.read(G.scriptname)
20
- Controller.instance.run
@@ -1,66 +0,0 @@
1
- require "listen"
2
- require "singleton"
3
- require "cuco/cuco"
4
- require "cuco/script"
5
-
6
- class Controller
7
- include Singleton
8
-
9
- attr_reader :listener
10
-
11
- def run
12
- puts "*** Controller.run" if debug
13
- @listener = Listen.to(".") do |modified, added, removed|
14
- run_files(modified, :modified)
15
- run_files(added, :added)
16
- end
17
-
18
- @listener.start
19
- puts "*** Listen started" if debug
20
- sleep
21
- end
22
-
23
- def stop
24
- puts "*** Controller.stop" if debug
25
- @listener&.stop
26
- G.script = nil
27
- @listener = nil
28
- end
29
-
30
- def run_files(files, type)
31
- puts "*** Controller.run_files(#{files}, #{type})" if debug
32
- if files.include?(G.scriptname)
33
- G.script = Script.new File.read(G.scriptname)
34
- return
35
- end
36
-
37
- files.map! { |filename| filename[G.pwd_length + 1..] }
38
- files.each { |filename| file_run(filename, type) }
39
- end
40
-
41
- def file_run(pattern, type = nil)
42
- puts "*** file_run(#{pattern}, #{type})" if debug
43
- rules = find_rules(pattern, type)
44
- rules.each { |rule| match_run(rule, pattern) }
45
- end
46
-
47
- private
48
-
49
- def find_rules(pattern, type)
50
- puts "*** find_rules(#{pattern}, #{type})" if debug
51
- G.script.__rules.reverse.select { |rule|
52
- pattern.match(rule.pattern) &&
53
- (rule.event_type.nil? || rule.event_type == type)
54
- }
55
- end
56
-
57
- def match_run(rule, pattern)
58
- md = pattern.match(rule.pattern)
59
- puts "*** match_run #{rule}" if debug
60
- rule.proc.call(md) if md
61
- end
62
-
63
- def debug
64
- G.options[:debug]
65
- end
66
- end
@@ -1,16 +0,0 @@
1
- class Script
2
- attr_accessor :__rules
3
-
4
- def initialize(str)
5
- @__rules = []
6
-
7
- instance_eval str
8
- end
9
-
10
- def watch(pattern, type = nil, &block)
11
- @__rules << Rule.new(pattern, type, block)
12
- end
13
- end
14
-
15
- # $ sudo sh -c "echo fs.inotify.max_user_watches=524288 >> /etc/sysctl.conf"
16
- # $ sudo sysctl -p