nite-owl 0.1.0 → 0.1.1

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
- SHA1:
3
- metadata.gz: 98012eb7fa0d83d070a5ea27e9a802124506d3f8
4
- data.tar.gz: 68149cdad3bcb5156e72318ad43b0354be15f63f
2
+ SHA256:
3
+ metadata.gz: 3a3649b8b6453251b7ca5984b8b0896148d9ae880c81b0116b4d7f04273095d2
4
+ data.tar.gz: ff19a62f39d06ed591d35036b76baadaaac913ad6ac720648610cb17464c84d3
5
5
  SHA512:
6
- metadata.gz: cbba57bfcd8f61d35a1bacb5d80c4cb2b520af292688d01e2f6def2a6d10095b4eb3b8b9f41b92abdb5d98760ca09251550190b252a53ad95b1ee4e7a8491414
7
- data.tar.gz: 1ec829878b577acc16a501a0d75a494223bb1a71c69aa380b5b8a6268e0ad8a26871ab0d8767ab8a3b1177dc3dbc356575faff35b12fae7f671f928e06489d07
6
+ metadata.gz: 703dfaaf1ca8644a403d9f6b403947c7aec2fbba50cc5e9b5693d7326397cf5b0163ae66a3c73fdb9cc0fb844210bf558e9ab01a5c00e4b863f0285ab3c8dc7b
7
+ data.tar.gz: cf657f175616690be9748bdf6c2e0f892ce6f8c1d65fbdf1bb954c340134a4b841189294aca69522a2dceadf2b1f61938f86a3bfb18d8188a325fa62369b6d48
File without changes
data/README.md CHANGED
@@ -11,8 +11,8 @@ To install just run this command:
11
11
 
12
12
  ## Usage
13
13
 
14
- Create Niteowl configuration file inside a directory you want to watch over and the run nite-owl.
15
- See example Niteowl configuration file.
14
+ Create Niteowl.rb configuration file inside a directory you want to watch over and the run nite-owl.
15
+ See example Niteowl.rb configuration file.
16
16
 
17
17
  ## Development
18
18
 
@@ -1,10 +1,57 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "nite/owl"
3
+ require "nite/owl/version"
4
+ require "optparse"
3
5
 
4
- if ARGV.empty?
5
- Nite::Owl::NiteOwl.instance.watch(Dir.pwd)
6
+ options = {}
7
+ OptionParser.new do |opts|
8
+ opts.banner = "Usage: nite-owl [options] [dir]"
9
+
10
+ opts.on("-d", "--daemon", "Run as daemon") do |v|
11
+ options[:daemon] = true
12
+ end
13
+
14
+ opts.on("-l", "--log FILE", "Log file") do |f|
15
+ options[:log] = File.expand_path(f)
16
+ end
17
+
18
+ opts.on("-v", "--version", "Print version") do |v|
19
+ puts "nite-owl v#{Nite::Owl::VERSION}"
20
+ exit
21
+ end
22
+ end.parse!
23
+
24
+ if ARGV.length > 1 then
25
+ STDERR.puts "multiple directories are not supported"
26
+ exit 1
27
+ end
28
+
29
+ dir = ARGV.last
30
+ if dir == nil then
31
+ dir = Dir.pwd
32
+ end
33
+
34
+ unless File.directory?(dir) then
35
+ STDERR.puts "#{dir} is not a valid directory path"
36
+ exit 1
37
+ end
38
+
39
+ if options[:log] then
40
+ $stdout.reopen(options[:log], "w")
41
+ $stdout.sync = true
42
+ $stderr.reopen($stdout)
43
+ end
44
+
45
+ dir = File.expand_path(dir)
46
+
47
+ if STDIN.tty? then
48
+ Nite::Owl::NiteOwl.instance.watch(dir)
6
49
  else
7
- Nite::Owl::NiteOwl.instance.watch(ARGV[0])
50
+ Nite::Owl::NiteOwl.instance.eval_watch(dir, STDIN.read)
51
+ end
52
+
53
+ if options[:daemon] then
54
+ Process.daemon(nochdir=true,noclose=true)
8
55
  end
9
56
 
10
57
  Nite::Owl::NiteOwl.instance.start
@@ -446,13 +446,27 @@ module Nite
446
446
 
447
447
  def watch(dir)
448
448
  Dir.chdir dir
449
- if File.file?("Niteowl") && File.readable?("Niteowl")
450
- load "Niteowl"
451
- else
452
- puts "No Niteowl file found in: #{dir}"
449
+ file = "Niteowl"
450
+ unless File.file?(file) && File.readable?(file)
451
+ file = "Niteowl.rb"
452
+ end
453
+ unless File.file?(file) && File.readable?(file)
454
+ puts "No Niteowl[.rb] file found in: #{dir}"
455
+ exit 1
456
+ end
457
+ load file
458
+ if @actions.empty?
459
+ puts "No actions configured in Niteowl file: #{dir}/#{file}"
460
+ exit 1
453
461
  end
462
+ end
463
+
464
+ def eval_watch(dir, code)
465
+ Dir.chdir dir
466
+ eval(code)
454
467
  if @actions.empty?
455
- puts "No actions configured"
468
+ puts "No actions configured in STDIN input stream"
469
+ exit 1
456
470
  end
457
471
  end
458
472
 
@@ -1,5 +1,5 @@
1
1
  module Nite
2
2
  module Owl
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["d.geurkov@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Linux/OSX File System Events Watcher.}
13
- spec.description = %q{Linux/OSX File System Events Watcher.}
13
+ spec.description = %q{Linux/OSX File System Events Watcher with minimal dependencies and simple Ruby DSL based configuration.}
14
14
  spec.homepage = "https://github.com/troydm/nite-owl"
15
15
  spec.license = "MIT"
16
16
 
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency "rb-fsevent", "~> 0.10", ">= 0.10.2"
25
25
  spec.add_dependency "rb-inotify", "~> 0.9", ">= 0.9.10"
26
- spec.add_development_dependency "bundler", "~> 1.16"
27
- spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "bundler", "~> 2.0"
27
+ spec.add_development_dependency "rake", "~> 12.3.3"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nite-owl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Geurkov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-02 00:00:00.000000000 Z
11
+ date: 2020-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb-fsevent
@@ -56,28 +56,28 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.16'
59
+ version: '2.0'
60
60
  type: :development
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '1.16'
66
+ version: '2.0'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: rake
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: '10.0'
73
+ version: 12.3.3
74
74
  type: :development
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: '10.0'
80
+ version: 12.3.3
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rspec
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -92,7 +92,8 @@ dependencies:
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
94
  version: '3.0'
95
- description: Linux/OSX File System Events Watcher.
95
+ description: Linux/OSX File System Events Watcher with minimal dependencies and simple
96
+ Ruby DSL based configuration.
96
97
  email:
97
98
  - d.geurkov@gmail.com
98
99
  executables:
@@ -105,7 +106,7 @@ files:
105
106
  - ".travis.yml"
106
107
  - Gemfile
107
108
  - LICENSE.txt
108
- - Niteowl
109
+ - Niteowl.rb
109
110
  - README.md
110
111
  - Rakefile
111
112
  - bin/console
@@ -134,8 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
135
  - !ruby/object:Gem::Version
135
136
  version: '0'
136
137
  requirements: []
137
- rubyforge_project:
138
- rubygems_version: 2.5.2.1
138
+ rubygems_version: 3.1.4
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Linux/OSX File System Events Watcher.