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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7404b361d1f21b145d39ff872ed9901c19f7944
4
- data.tar.gz: 7af9d8d18fdbfaf1779250f579a24fa8ef7e57c7
3
+ metadata.gz: b3089d570b9f0d1ad6335a44c1a4674c99b94e40
4
+ data.tar.gz: 82133e63ff5da97a15bcdee6bfcdf76503a62c9c
5
5
  SHA512:
6
- metadata.gz: 66432b991bcbd96026f1761bd87211afad2b626e47df12b9627367cb767574ea2eb34f255b58fca4e17c369970e4bcbd7b1327d95f8b0eb981283317d68c7bf8
7
- data.tar.gz: 69bd52efc272a2fa17ed05893e234b81a533d148548c5a1da5bb1afbd215d84b76fac85fb7adda1775cae0eefe5096ff38de45e084bff90cc106ea06b1e5ece6
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
 
@@ -1,5 +1,5 @@
1
1
  module Clockker
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
 
4
4
  def self.macos_version
5
5
  @mov ||= `sw_vers -productVersion`
@@ -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
- @submitter_queue << {touched_at: t, contents: event['path'], type: "file", metadata: {flags: event['flags'], id: event['id']}}
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
- logger.info " - #{visited_at} - #{url} - #{title}"
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"), type: c[:type], metadata: c[:metadata], identifier: identifier, agent: Clockker.version}}}.to_json
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.5
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 00:00:00.000000000 Z
11
+ date: 2018-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb-fsevent