chook 1.1.5 → 1.1.9

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +6 -0
  3. data/LICENSE.txt +5 -3
  4. data/bin/chook-server +7 -25
  5. data/data/chook.conf.example +24 -0
  6. data/data/sample_handlers/RestAPIOperation-executable +6 -24
  7. data/data/sample_handlers/RestAPIOperation.rb +6 -24
  8. data/data/sample_handlers/SmartGroupComputerMembershipChange-executable +6 -23
  9. data/data/sample_handlers/SmartGroupComputerMembershipChange.rb +6 -24
  10. data/lib/chook/configuration.rb +14 -26
  11. data/lib/chook/event/handled_event/handlers.rb +3 -21
  12. data/lib/chook/event/handled_event.rb +7 -24
  13. data/lib/chook/event/handled_event_logger.rb +6 -24
  14. data/lib/chook/event/test_event.rb +21 -30
  15. data/lib/chook/event.rb +6 -25
  16. data/lib/chook/event_handling.rb +6 -24
  17. data/lib/chook/event_testing.rb +6 -24
  18. data/lib/chook/foundation.rb +6 -24
  19. data/lib/chook/handled_events.rb +6 -24
  20. data/lib/chook/handled_subjects.rb +6 -24
  21. data/lib/chook/procs.rb +19 -27
  22. data/lib/chook/server/auth.rb +19 -26
  23. data/lib/chook/server/log.rb +11 -25
  24. data/lib/chook/server/public/css/chook.css +10 -0
  25. data/lib/chook/server/routes/handle_by_name.rb +7 -25
  26. data/lib/chook/server/routes/handle_webhook_event.rb +7 -25
  27. data/lib/chook/server/routes/handlers.rb +6 -24
  28. data/lib/chook/server/routes/home.rb +7 -27
  29. data/lib/chook/server/routes/log.rb +6 -24
  30. data/lib/chook/server/routes/login_logout.rb +6 -25
  31. data/lib/chook/server/routes.rb +11 -29
  32. data/lib/chook/server/views/layout.haml +32 -7
  33. data/lib/chook/server.rb +8 -24
  34. data/lib/chook/subject/computer.rb +14 -32
  35. data/lib/chook/subject/dep_device.rb +13 -31
  36. data/lib/chook/subject/handled_subject.rb +6 -24
  37. data/lib/chook/subject/jss.rb +10 -28
  38. data/lib/chook/subject/mobile_device.rb +12 -30
  39. data/lib/chook/subject/patch_software_title_update.rb +6 -24
  40. data/lib/chook/subject/policy_finished.rb +6 -24
  41. data/lib/chook/subject/push.rb +8 -26
  42. data/lib/chook/subject/rest_api_operation.rb +11 -29
  43. data/lib/chook/subject/scep_challenge.rb +6 -24
  44. data/lib/chook/subject/smart_group.rb +7 -25
  45. data/lib/chook/subject/test_subject.rb +23 -39
  46. data/lib/chook/subject.rb +6 -24
  47. data/lib/chook/test_events.rb +6 -24
  48. data/lib/chook/test_subjects.rb +6 -24
  49. data/lib/chook/version.rb +8 -27
  50. data/lib/chook.rb +6 -24
  51. metadata +11 -12
  52. data/lib/chook/server/public/imgs/ChookLogoAlMcWhiggin.png +0 -0
@@ -1,27 +1,9 @@
1
- ### Copyright 2017 Pixar
2
-
3
- ###
4
- ### Licensed under the Apache License, Version 2.0 (the "Apache License")
5
- ### with the following modification; you may not use this file except in
6
- ### compliance with the Apache License and the following modification to it:
7
- ### Section 6. Trademarks. is deleted and replaced with:
8
- ###
9
- ### 6. Trademarks. This License does not grant permission to use the trade
10
- ### names, trademarks, service marks, or product names of the Licensor
11
- ### and its affiliates, except as required to comply with Section 4(c) of
12
- ### the License and to reproduce the content of the NOTICE file.
13
- ###
14
- ### You may obtain a copy of the Apache License at
15
- ###
16
- ### http://www.apache.org/licenses/LICENSE-2.0
17
- ###
18
- ### Unless required by applicable law or agreed to in writing, software
19
- ### distributed under the Apache License with the above modification is
20
- ### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
- ### KIND, either express or implied. See the Apache License for the specific
22
- ### language governing permissions and limitations under the Apache License.
23
- ###
24
- ###
1
+ # Copyright 2025 Pixar
2
+ #
3
+ # Licensed under the terms set forth in the LICENSE.txt file available at
4
+ # at the root of this project.
5
+ #
6
+ #
25
7
  Chook::Subject.classes[Chook::Subject::SCEP_CHALLENGE] = {
26
8
  targetDevice: {
27
9
  # validation: ,
@@ -1,27 +1,9 @@
1
- ### Copyright 2017 Pixar
2
-
3
- ###
4
- ### Licensed under the Apache License, Version 2.0 (the "Apache License")
5
- ### with the following modification; you may not use this file except in
6
- ### compliance with the Apache License and the following modification to it:
7
- ### Section 6. Trademarks. is deleted and replaced with:
8
- ###
9
- ### 6. Trademarks. This License does not grant permission to use the trade
10
- ### names, trademarks, service marks, or product names of the Licensor
11
- ### and its affiliates, except as required to comply with Section 4(c) of
12
- ### the License and to reproduce the content of the NOTICE file.
13
- ###
14
- ### You may obtain a copy of the Apache License at
15
- ###
16
- ### http://www.apache.org/licenses/LICENSE-2.0
17
- ###
18
- ### Unless required by applicable law or agreed to in writing, software
19
- ### distributed under the Apache License with the above modification is
20
- ### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
- ### KIND, either express or implied. See the Apache License for the specific
22
- ### language governing permissions and limitations under the Apache License.
23
- ###
24
- ###
1
+ # Copyright 2025 Pixar
2
+ #
3
+ # Licensed under the terms set forth in the LICENSE.txt file available at
4
+ # at the root of this project.
5
+ #
6
+ #
25
7
  Chook::Subject.classes[Chook::Subject::SMART_GROUP] = {
26
8
  name: {
27
9
  validation: String,
@@ -49,7 +31,7 @@ Chook::Subject.classes[Chook::Subject::SMART_GROUP] = {
49
31
  },
50
32
  computer: { # SmartGroupComputerMembershipChange == true, SmartGroupMobileDeviceMembershipChange == false
51
33
  validation: :boolean,
52
- randomizer: :bool,
34
+ randomizer: :bool
53
35
  # sampler: ,
54
36
  # api_object_attribute: :computer
55
37
  }
@@ -1,27 +1,9 @@
1
- ### Copyright 2017 Pixar
2
-
3
- ###
4
- ### Licensed under the Apache License, Version 2.0 (the "Apache License")
5
- ### with the following modification; you may not use this file except in
6
- ### compliance with the Apache License and the following modification to it:
7
- ### Section 6. Trademarks. is deleted and replaced with:
8
- ###
9
- ### 6. Trademarks. This License does not grant permission to use the trade
10
- ### names, trademarks, service marks, or product names of the Licensor
11
- ### and its affiliates, except as required to comply with Section 4(c) of
12
- ### the License and to reproduce the content of the NOTICE file.
13
- ###
14
- ### You may obtain a copy of the Apache License at
15
- ###
16
- ### http://www.apache.org/licenses/LICENSE-2.0
17
- ###
18
- ### Unless required by applicable law or agreed to in writing, software
19
- ### distributed under the Apache License with the above modification is
20
- ### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
- ### KIND, either express or implied. See the Apache License for the specific
22
- ### language governing permissions and limitations under the Apache License.
23
- ###
24
- ###
1
+ # Copyright 2025 Pixar
2
+ #
3
+ # Licensed under the terms set forth in the LICENSE.txt file available at
4
+ # at the root of this project.
5
+ #
6
+ #
25
7
 
26
8
  module Chook
27
9
 
@@ -48,6 +30,7 @@ module Chook
48
30
  attribs.each do |attrib, deets|
49
31
  # getter
50
32
  attr_reader attrib
33
+
51
34
  validator = deets[:validation]
52
35
 
53
36
  # setter with validator
@@ -57,7 +40,7 @@ module Chook
57
40
  elsif !validator.nil?
58
41
  raise "Invalid value for #{attrib}" unless Chook::Validators.send validator, new_val
59
42
  end
60
- instance_variable_set(('@' + attrib.to_s), new_val)
43
+ instance_variable_set('@' + attrib.to_s, new_val)
61
44
  end # end define method
62
45
  end # end do |attrib, deets|
63
46
  end # end new_class
@@ -72,7 +55,7 @@ module Chook
72
55
  # a random test subject,
73
56
  def self.random
74
57
  random_vals = {}
75
- Chook::Subject.classes[self.const_get NAME_CONSTANT].each do |attrib, deets|
58
+ Chook::Subject.classes[const_get NAME_CONSTANT].each do |attrib, deets|
76
59
  random_vals[attrib] = Chook::Randomizers.send deets[:randomizer] if deets[:randomizer]
77
60
  end # each do |attr_def|
78
61
  new random_vals
@@ -81,14 +64,14 @@ module Chook
81
64
  # a sampled test subject (real data from real JSS objects)
82
65
  # NOTE: a valid ruby-jss JSS::APIConnection must exist
83
66
  def self.sample(ids = 'random', api: JSS.api)
84
- classname = self.const_get Chook::Subject::NAME_CONSTANT
67
+ classname = const_get Chook::Subject::NAME_CONSTANT
85
68
  ids = [ids] if ids.is_a? Integer
86
69
  # !!Kernel.const_get('JSS::' + classname) rescue false
87
- if classname == 'PatchSoftwareTitleUpdated'
88
- all_ids = Chook::Samplers.all_patch_ids('blah', api: api)
89
- else
90
- all_ids = Kernel.const_get('JSS::' + classname).all_ids(api: api) # (api: api)
91
- end
70
+ all_ids = if classname == 'PatchSoftwareTitleUpdated'
71
+ Chook::Samplers.all_patch_ids('blah', api: api)
72
+ else
73
+ Kernel.const_get('JSS::' + classname).all_ids(api: api) # (api: api)
74
+ end
92
75
  ids = [all_ids.sample] if ids == 'random'
93
76
 
94
77
  ok = true
@@ -152,14 +135,15 @@ module Chook
152
135
  def json_hash
153
136
  # Verify that input is a child of TestSubjects, raise if not
154
137
  raise 'Invalid TestSubject' unless self.class.superclass == Chook::TestSubject
138
+
155
139
  test_subject_attributes = Chook::Subject.classes[self.class.to_s.split('::')[-1]]
156
140
  raw_hash_form = {}
157
141
  test_subject_attributes.each do |attribute, details|
158
- if details.keys.include? :to_json
159
- raw_hash_form[attribute] = send(attribute).send details[:to_json]
160
- else
161
- raw_hash_form[attribute] = instance_variable_get('@' + attribute.to_s)
162
- end
142
+ raw_hash_form[attribute] = if details.keys.include? :to_json
143
+ send(attribute).send details[:to_json]
144
+ else
145
+ instance_variable_get('@' + attribute.to_s)
146
+ end
163
147
  end # end test_subject_attributes.keys.each do |attribute, details|
164
148
  raw_hash_form
165
149
  end # end json_hash
@@ -183,10 +167,10 @@ module Chook
183
167
  if converter
184
168
  value = converter.is_a?(Symbol) ? value.send(converter) : converter.call(value)
185
169
  end # if converter
186
- instance_variable_set(('@' + key.to_s), value)
170
+ instance_variable_set('@' + key.to_s, value)
187
171
  end # each key value
188
172
  else
189
- attribs.keys.each { |key| instance_variable_set(('@' + key.to_s), nil) }
173
+ attribs.keys.each { |key| instance_variable_set('@' + key.to_s, nil) }
190
174
  end # if subject_data
191
175
  end # init
192
176
 
data/lib/chook/subject.rb CHANGED
@@ -1,27 +1,9 @@
1
- ### Copyright 2017 Pixar
2
-
3
- ###
4
- ### Licensed under the Apache License, Version 2.0 (the "Apache License")
5
- ### with the following modification; you may not use this file except in
6
- ### compliance with the Apache License and the following modification to it:
7
- ### Section 6. Trademarks. is deleted and replaced with:
8
- ###
9
- ### 6. Trademarks. This License does not grant permission to use the trade
10
- ### names, trademarks, service marks, or product names of the Licensor
11
- ### and its affiliates, except as required to comply with Section 4(c) of
12
- ### the License and to reproduce the content of the NOTICE file.
13
- ###
14
- ### You may obtain a copy of the Apache License at
15
- ###
16
- ### http://www.apache.org/licenses/LICENSE-2.0
17
- ###
18
- ### Unless required by applicable law or agreed to in writing, software
19
- ### distributed under the Apache License with the above modification is
20
- ### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
- ### KIND, either express or implied. See the Apache License for the specific
22
- ### language governing permissions and limitations under the Apache License.
23
- ###
24
- ###
1
+ # Copyright 2025 Pixar
2
+ #
3
+ # Licensed under the terms set forth in the LICENSE.txt file available at
4
+ # at the root of this project.
5
+ #
6
+ #
25
7
 
26
8
  module Chook
27
9
 
@@ -1,27 +1,9 @@
1
- ### Copyright 2017 Pixar
2
-
3
- ###
4
- ### Licensed under the Apache License, Version 2.0 (the "Apache License")
5
- ### with the following modification; you may not use this file except in
6
- ### compliance with the Apache License and the following modification to it:
7
- ### Section 6. Trademarks. is deleted and replaced with:
8
- ###
9
- ### 6. Trademarks. This License does not grant permission to use the trade
10
- ### names, trademarks, service marks, or product names of the Licensor
11
- ### and its affiliates, except as required to comply with Section 4(c) of
12
- ### the License and to reproduce the content of the NOTICE file.
13
- ###
14
- ### You may obtain a copy of the Apache License at
15
- ###
16
- ### http://www.apache.org/licenses/LICENSE-2.0
17
- ###
18
- ### Unless required by applicable law or agreed to in writing, software
19
- ### distributed under the Apache License with the above modification is
20
- ### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
- ### KIND, either express or implied. See the Apache License for the specific
22
- ### language governing permissions and limitations under the Apache License.
23
- ###
24
- ###
1
+ # Copyright 2025 Pixar
2
+ #
3
+ # Licensed under the terms set forth in the LICENSE.txt file available at
4
+ # at the root of this project.
5
+ #
6
+ #
25
7
 
26
8
  module Chook
27
9
 
@@ -1,27 +1,9 @@
1
- ### Copyright 2017 Pixar
2
-
3
- ###
4
- ### Licensed under the Apache License, Version 2.0 (the "Apache License")
5
- ### with the following modification; you may not use this file except in
6
- ### compliance with the Apache License and the following modification to it:
7
- ### Section 6. Trademarks. is deleted and replaced with:
8
- ###
9
- ### 6. Trademarks. This License does not grant permission to use the trade
10
- ### names, trademarks, service marks, or product names of the Licensor
11
- ### and its affiliates, except as required to comply with Section 4(c) of
12
- ### the License and to reproduce the content of the NOTICE file.
13
- ###
14
- ### You may obtain a copy of the Apache License at
15
- ###
16
- ### http://www.apache.org/licenses/LICENSE-2.0
17
- ###
18
- ### Unless required by applicable law or agreed to in writing, software
19
- ### distributed under the Apache License with the above modification is
20
- ### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
- ### KIND, either express or implied. See the Apache License for the specific
22
- ### language governing permissions and limitations under the Apache License.
23
- ###
24
- ###
1
+ # Copyright 2025 Pixar
2
+ #
3
+ # Licensed under the terms set forth in the LICENSE.txt file available at
4
+ # at the root of this project.
5
+ #
6
+ #
25
7
 
26
8
  module Chook
27
9
 
data/lib/chook/version.rb CHANGED
@@ -1,32 +1,13 @@
1
- ### Copyright 2017 Pixar
1
+ # Copyright 2025 Pixar
2
+ #
3
+ # Licensed under the terms set forth in the LICENSE.txt file available at
4
+ # at the root of this project.
5
+ #
6
+ #
2
7
 
3
- ###
4
- ### Licensed under the Apache License, Version 2.0 (the "Apache License")
5
- ### with the following modification; you may not use this file except in
6
- ### compliance with the Apache License and the following modification to it:
7
- ### Section 6. Trademarks. is deleted and replaced with:
8
- ###
9
- ### 6. Trademarks. This License does not grant permission to use the trade
10
- ### names, trademarks, service marks, or product names of the Licensor
11
- ### and its affiliates, except as required to comply with Section 4(c) of
12
- ### the License and to reproduce the content of the NOTICE file.
13
- ###
14
- ### You may obtain a copy of the Apache License at
15
- ###
16
- ### http://www.apache.org/licenses/LICENSE-2.0
17
- ###
18
- ### Unless required by applicable law or agreed to in writing, software
19
- ### distributed under the Apache License with the above modification is
20
- ### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
- ### KIND, either express or implied. See the Apache License for the specific
22
- ### language governing permissions and limitations under the Apache License.
23
- ###
24
- ###
25
-
26
- ###
27
8
  module Chook
28
9
 
29
- ### The version of the Chook framework
30
- VERSION = '1.1.5'.freeze
10
+ # The version of the Chook framework
11
+ VERSION = '1.1.9'.freeze
31
12
 
32
13
  end # module
data/lib/chook.rb CHANGED
@@ -1,27 +1,9 @@
1
- ### Copyright 2017 Pixar
2
-
3
- ###
4
- ### Licensed under the Apache License, Version 2.0 (the "Apache License")
5
- ### with the following modification; you may not use this file except in
6
- ### compliance with the Apache License and the following modification to it:
7
- ### Section 6. Trademarks. is deleted and replaced with:
8
- ###
9
- ### 6. Trademarks. This License does not grant permission to use the trade
10
- ### names, trademarks, service marks, or product names of the Licensor
11
- ### and its affiliates, except as required to comply with Section 4(c) of
12
- ### the License and to reproduce the content of the NOTICE file.
13
- ###
14
- ### You may obtain a copy of the Apache License at
15
- ###
16
- ### http://www.apache.org/licenses/LICENSE-2.0
17
- ###
18
- ### Unless required by applicable law or agreed to in writing, software
19
- ### distributed under the Apache License with the above modification is
20
- ### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
- ### KIND, either express or implied. See the Apache License for the specific
22
- ### language governing permissions and limitations under the Apache License.
23
- ###
24
- ###
1
+ # Copyright 2025 Pixar
2
+ #
3
+ # Licensed under the terms set forth in the LICENSE.txt file available at
4
+ # at the root of this project.
5
+ #
6
+ #
25
7
 
26
8
  # Requiring this file (require 'chook') will load the entire library
27
9
  # including event testing, event handling, and the server.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chook
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Lasell
@@ -9,62 +9,62 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-12-22 00:00:00.000000000 Z
12
+ date: 2025-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '2.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '2.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: sinatra-contrib
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '2.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '2.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: thin
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '1.7'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.7'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: haml
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '5.0'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '5.0'
70
70
  description: |2
@@ -128,7 +128,6 @@ files:
128
128
  - lib/chook/server/auth.rb
129
129
  - lib/chook/server/log.rb
130
130
  - lib/chook/server/public/css/chook.css
131
- - lib/chook/server/public/imgs/ChookLogoAlMcWhiggin.png
132
131
  - lib/chook/server/public/js/chook.js
133
132
  - lib/chook/server/public/js/logstream.js
134
133
  - lib/chook/server/routes.rb
@@ -183,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
182
  - !ruby/object:Gem::Version
184
183
  version: '0'
185
184
  requirements: []
186
- rubygems_version: 3.0.3
185
+ rubygems_version: 3.0.3.1
187
186
  signing_key:
188
187
  specification_version: 4
189
188
  summary: A Ruby framework for simulating and processing Jamf Pro Webhook Events