petasos 0.1.0 → 0.2.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/petasos/location.rb +38 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b1ffed36c52ec275b881ac07ff08b6dda3d4446ba8c2ab0b74266698044b7e6
4
- data.tar.gz: 3b42c94a62222b7f133c4fe0ed5caea15d1623bc49f1c953b07c9c7bf1fb64fe
3
+ metadata.gz: 0f8a7a7547d0f7abd9458a88a04c49a00e5b7b09a872d94727f47c39f4e9e941
4
+ data.tar.gz: 0a2ae19945687b6e4ca55c898d03ce2dca5c0e6da95ec6ab1d14f78f2a8026e6
5
5
  SHA512:
6
- metadata.gz: 93023bc9d2cad8a5be3bf800683264b7ef20247b3824c2191a6e75dc4c0c0a311b2c595dec10d1377b8e1e3152f1d141f7d5d9a39ea1d02b7c535014dada2adb
7
- data.tar.gz: 868e3587fc99dfd6a1cdc4b74d1ac5045d948f20b149bd7bb0294c72dfb2aa8d1afef0d6cd3a03ee1a11c02c4903b2fda2df818e076e336476126f34e7fdb1f6
6
+ metadata.gz: 23e7481f06bebcb2835342cee3afbb5fa18e0dce5e6401b03b2965cb5898ee7e225b7002622938e9aba45919ea88d0ab4d3c1abd582c591231ee90c0d1203584
7
+ data.tar.gz: 97ad57afb7f8447919379d405952c810fd04a7c480a7aa1a215adc2f83779815ef5298be5ac7b7042d2bd1f07afe1f63d3c391c5fc208de3c74abd7915abeed4
@@ -35,7 +35,40 @@ class Petasos::Location
35
35
  create_file_export_list(pool, new_files.to_a) if new_files.length > 0
36
36
  end
37
37
 
38
- # this is where the "after_seen" hooks would run
38
+ # "after_seen" hooks
39
+ if File.file?("petasos_after-seen.rb")
40
+ require "./petasos_after-seen"
41
+ # after seen for all files
42
+ if defined?(after_seen_all)
43
+ new_files.each do |file|
44
+ after_seen_all(file)
45
+ end
46
+ end
47
+
48
+ # after seen for every file in this location
49
+ location_hook = "after_seen_#{methodize(config["name"])}"
50
+ if eval("defined?(#{location_hook})")
51
+ new_files.each do |file|
52
+ eval("#{location_hook}(\"#{file}\")")
53
+ end
54
+ end
55
+
56
+ # after seen for every file in this pool
57
+ pool_hook = "after_seen_#{methodize(pool["name"])}"
58
+ if eval("defined?(#{pool_hook})")
59
+ new_files.each do |file|
60
+ eval("#{pool_hook}(\"#{file}\")")
61
+ end
62
+ end
63
+
64
+ # after seen for every file in this pool in this location
65
+ location_and_pool_hook = "after_seen_#{methodize(config["name"])}_#{methodize(pool["name"])}"
66
+ if eval("defined?(#{location_and_pool_hook})")
67
+ new_files.each do |file|
68
+ eval("#{location_and_pool_hook}(\"#{file}\")")
69
+ end
70
+ end
71
+ end
39
72
 
40
73
  # update list of seen files
41
74
  update_seen_pool_files(pool, seen_pool_files + new_files)
@@ -114,4 +147,8 @@ class Petasos::Location
114
147
  YAML.dump(content, out)
115
148
  end
116
149
  end
150
+
151
+ def methodize(phrase)
152
+ phrase.gsub("-", "_")
153
+ end
117
154
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: petasos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Myers