clockker 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -4
- data/lib/clockker/version.rb +1 -1
- data/lib/clockker/watcher.rb +7 -4
- data/lib/clockker/white_black_list.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3089d570b9f0d1ad6335a44c1a4674c99b94e40
|
4
|
+
data.tar.gz: 82133e63ff5da97a15bcdee6bfcdf76503a62c9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b794a8121b1b8d2044337d2bf4c44831e7420dca280c19a790d5d849b818fc12266dcf4dce0c81cd4d45e3ef2a77de98ba9ddb58d778525752ddaca7446853d
|
7
|
+
data.tar.gz: 4a4aff4b8b7e5dbe55b3eaeb776bc367c62ab593d8ee0447593ba1df338de5e2515092e6e61dbaab3c83e9f3b753ff385484cb32a8104d2c823b549f6b864b04
|
data/README.md
CHANGED
@@ -65,14 +65,12 @@ Instead of using the command-line options, you can specify a default configurati
|
|
65
65
|
"blacklist": [
|
66
66
|
"/Users/paul/Library",
|
67
67
|
"/Users/paul/Pictures",
|
68
|
-
"/Users/paul/.dropbox"
|
69
|
-
"/tmp/",
|
70
|
-
"/log/",
|
71
|
-
"/logs/"
|
68
|
+
"/Users/paul/.dropbox"
|
72
69
|
]
|
73
70
|
}
|
74
71
|
```
|
75
72
|
|
73
|
+
Note: Version 0.1.0 is the Clockker configuration file version.
|
76
74
|
|
77
75
|
## Development
|
78
76
|
|
data/lib/clockker/version.rb
CHANGED
data/lib/clockker/watcher.rb
CHANGED
@@ -44,7 +44,11 @@ module Clockker
|
|
44
44
|
event_meta['events'].each do |event|
|
45
45
|
next if white_black_list.ignore?(event['path'])
|
46
46
|
count += 1
|
47
|
-
|
47
|
+
file_path = Pathname.new(event['path'])
|
48
|
+
dirs, name = file_path.split
|
49
|
+
last_dir = dirs.split[-1]
|
50
|
+
title = (last_dir + name).to_s
|
51
|
+
@submitter_queue << {touched_at: t, contents: file_path.to_s, meta_type: "file", metadata: {title: title, file_path: file_path.to_s}}
|
48
52
|
end
|
49
53
|
logger.debug "#{Time.now} checked #{event_meta['numEvents']} events and added #{count} to the submitter_queue"
|
50
54
|
end
|
@@ -84,8 +88,7 @@ module Clockker
|
|
84
88
|
id, visited_at, visit_time, title, url = row
|
85
89
|
visited_at = Time.parse(visited_at+"Z") # the time is already UTC; let's make doubly sure!
|
86
90
|
# TODO check the whitelisted domain regexes to see if we can submit this one.
|
87
|
-
|
88
|
-
@submitter_queue << {touched_at: visited_at, contents: url, type: "url", metadata: {title: title}}
|
91
|
+
@submitter_queue << {touched_at: visited_at, contents: url, meta_type: "url", metadata: {url: url, title: title}}
|
89
92
|
last_time = visit_time
|
90
93
|
end
|
91
94
|
|
@@ -133,7 +136,7 @@ module Clockker
|
|
133
136
|
end
|
134
137
|
|
135
138
|
begin
|
136
|
-
dev_data = {artifacts: @changeset.map{|c| {contents: c[:contents], touched_at: c[:touched_at].strftime("%Y-%m-%d %H:%M:%S"),
|
139
|
+
dev_data = {artifacts: @changeset.map{|c| {contents: c[:contents], touched_at: c[:touched_at].strftime("%Y-%m-%d %H:%M:%S"), meta_type: c[:meta_type], metadata: c[:metadata], identifier: identifier, agent: Clockker.version}}}.to_json
|
137
140
|
|
138
141
|
# temporarily we're keeping the old data structure, until all of our APIs are up to date.
|
139
142
|
prod_data = @changeset.find_all{|c| c[:type] == "file"}
|
@@ -7,12 +7,21 @@ module Clockker
|
|
7
7
|
# blacklist_path should return an array of absolute paths that are to be ignored. Implicitly any path that isn't whitelisted is blacklisted; this method is only useful if it returns subpaths of whitelisted paths. i.e. /Users/paul/Documents is whitelisted, but /Users/paul/Documents/customers/Bell is blacklisted.
|
8
8
|
attr_accessor :whitelist, :blacklist
|
9
9
|
|
10
|
+
DEFAULT_BLACKLIST = [
|
11
|
+
"/tmp/",
|
12
|
+
"/log/",
|
13
|
+
"/logs/",
|
14
|
+
"/node_modules/",
|
15
|
+
"/dist/",
|
16
|
+
"/build/", "/_build/",
|
17
|
+
"/private/",
|
18
|
+
'\/\..+' # hide .* files
|
19
|
+
]
|
20
|
+
|
10
21
|
def initialize(clockker_config)
|
11
22
|
@whitelist = clockker_config.whitelist.map{|wl| Regexp.new(wl)}
|
12
23
|
@blacklist = clockker_config.blacklist.map{|bl| Regexp.new(bl)}
|
13
|
-
|
14
|
-
# hide .* files
|
15
|
-
@blacklist << /\/\..+/
|
24
|
+
@blacklist += DEFAULT_BLACKLIST.map{|bl| Regexp.new(bl)}
|
16
25
|
|
17
26
|
# Now set defaults in the absence of a config file
|
18
27
|
@whitelist ||= [ Regexp.new(Pathname.new(Dir.home).to_s) ]
|
@@ -26,6 +35,5 @@ module Clockker
|
|
26
35
|
return false if file_matches_whitelist
|
27
36
|
return true
|
28
37
|
end
|
29
|
-
|
30
38
|
end
|
31
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clockker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Doerwald
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb-fsevent
|