windoo 1.0.1

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 (43) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES.md +9 -0
  3. data/LICENSE.txt +177 -0
  4. data/README.md +222 -0
  5. data/lib/windoo/base_classes/array_manager.rb +335 -0
  6. data/lib/windoo/base_classes/criteria_manager.rb +327 -0
  7. data/lib/windoo/base_classes/criterion.rb +226 -0
  8. data/lib/windoo/base_classes/json_object.rb +472 -0
  9. data/lib/windoo/configuration.rb +221 -0
  10. data/lib/windoo/connection/actions.rb +152 -0
  11. data/lib/windoo/connection/attributes.rb +156 -0
  12. data/lib/windoo/connection/connect.rb +402 -0
  13. data/lib/windoo/connection/constants.rb +55 -0
  14. data/lib/windoo/connection/token.rb +489 -0
  15. data/lib/windoo/connection.rb +92 -0
  16. data/lib/windoo/converters.rb +31 -0
  17. data/lib/windoo/exceptions.rb +34 -0
  18. data/lib/windoo/mixins/api_collection.rb +408 -0
  19. data/lib/windoo/mixins/constants.rb +43 -0
  20. data/lib/windoo/mixins/default_connection.rb +75 -0
  21. data/lib/windoo/mixins/immutable.rb +34 -0
  22. data/lib/windoo/mixins/loading.rb +38 -0
  23. data/lib/windoo/mixins/patch/component.rb +102 -0
  24. data/lib/windoo/mixins/software_title/extension_attribute.rb +106 -0
  25. data/lib/windoo/mixins/utility.rb +23 -0
  26. data/lib/windoo/objects/capability.rb +82 -0
  27. data/lib/windoo/objects/capability_manager.rb +52 -0
  28. data/lib/windoo/objects/component.rb +99 -0
  29. data/lib/windoo/objects/component_criteria_manager.rb +26 -0
  30. data/lib/windoo/objects/component_criterion.rb +66 -0
  31. data/lib/windoo/objects/extension_attribute.rb +149 -0
  32. data/lib/windoo/objects/kill_app.rb +92 -0
  33. data/lib/windoo/objects/kill_app_manager.rb +89 -0
  34. data/lib/windoo/objects/patch.rb +235 -0
  35. data/lib/windoo/objects/patch_manager.rb +240 -0
  36. data/lib/windoo/objects/requirement.rb +85 -0
  37. data/lib/windoo/objects/requirement_manager.rb +52 -0
  38. data/lib/windoo/objects/software_title.rb +407 -0
  39. data/lib/windoo/validate.rb +548 -0
  40. data/lib/windoo/version.rb +15 -0
  41. data/lib/windoo/zeitwerk_config.rb +158 -0
  42. data/lib/windoo.rb +56 -0
  43. metadata +141 -0
@@ -0,0 +1,158 @@
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
+ # frozen_string_literal: true
7
+
8
+ # Gems
9
+ ######
10
+ require 'pathname'
11
+ require 'zeitwerk'
12
+
13
+ # Windoo's Zeitwerk Config and processes
14
+ module WindooZeitwerkConfig
15
+
16
+ # touch this file to make zeitwerk and mixins send text to stderr as things load
17
+ # or get mixed in
18
+ VERBOSE_LOADING_FILE = Pathname.new('/tmp/windoo-verbose-loading')
19
+
20
+ # Or, set this ENV var to also make zeitverk and mixins send text to stderr
21
+ VERBOSE_LOADING_ENV = 'WINDOO_VERBOSE_LOADING'
22
+
23
+ # touch this file to make zeitwek eager-load everything when the gem is required.
24
+ EAGER_LOAD_FILE = Pathname.new('/tmp/windoo-zeitwerk-eager-load')
25
+
26
+ # Only look at the filesystem once.
27
+ def self.verbose_loading?
28
+ return @verbose_loading unless @verbose_loading.nil?
29
+
30
+ @verbose_loading = VERBOSE_LOADING_FILE.file?
31
+ @verbose_loading ||= ENV.include? VERBOSE_LOADING_ENV
32
+ @verbose_loading
33
+ end
34
+
35
+ # rubocop: disable Style/StderrPuts
36
+ def self.load_msg(msg)
37
+ $stderr.puts msg if verbose_loading?
38
+ end
39
+ # rubocop: enable Style/StderrPuts
40
+
41
+ # The loader object for Windoo
42
+ def self.loader
43
+ @loader
44
+ end
45
+
46
+ # Configure the Zeitwerk loader, See https://github.com/fxn/zeitwerk
47
+ # This all has to happen before the first 'module Windoo' declaration
48
+ def self.setup_zeitwerk_loader(zloader)
49
+ @loader = zloader
50
+
51
+ ##### Ingored Paths
52
+ ################################
53
+ #
54
+ # These should be ignored, some will be required directly
55
+ ###############################################
56
+
57
+ # Ignore this file
58
+ ####
59
+ loader.ignore __FILE__
60
+
61
+ # ignore files at the top level
62
+ ####
63
+ Pathname.new(__dir__).parent
64
+ # loader.ignore "#{top}/some_top_level_file.rb"
65
+
66
+ # ignore things that are manually loaded by our code
67
+ ####
68
+ loader.ignore "#{__dir__}/exceptions.rb"
69
+
70
+ ##### Collaped Paths
71
+ ################################
72
+ #
73
+ # these paths all define classes & modules directly below 'Jamf'
74
+ # If we didn't collapse them, then e.g.
75
+ # /jamf/api/base_classes/classic/group.rb
76
+ # would be expected to define
77
+ # Jamf::Api::BaseClasses::Classic::Group
78
+ # rather than what we want:
79
+ # Jamf::Group
80
+ ###################################################
81
+
82
+ loader.collapse("#{__dir__}/objects")
83
+
84
+ ##### Inflected Paths
85
+ ################################
86
+ #
87
+ # filenames => Constants, which don't adhere to zeitwerk's parsing standards.
88
+ #
89
+ # Mostly because the a filename like 'oapi_object' would be
90
+ # loaded by zeitwerk expecting it to define 'OapiObject', but it really
91
+ # defines 'OAPIObject'
92
+ ###############################################
93
+
94
+ loader.inflector.inflect 'json_object' => 'JSONObject'
95
+ loader.inflector.inflect 'api_collection' => 'APICollection'
96
+
97
+ ##### Callbacks
98
+ ################################
99
+
100
+ # callback for when a specific file/constant loads
101
+ # duplicate and uncomment this if desired to react to
102
+ # specific things loading
103
+ #####################################
104
+ # loader.on_load('Windoo::SomeClass') do |klass, abspath|
105
+ # load_msg "I just loaded #{klass} from #{abspath}"
106
+ # end
107
+
108
+ # callback for when anything loads
109
+ # - const_path is like "Windoo::SomeClass" or "Windoo::SomeClass::SOME_CONST_ARRY"
110
+ # - value is the value that constant contains after loading,
111
+ # e.g. the class Windoo::SomeClass for 'Windoo::SomeClass' or
112
+ # an Array for the constant "Windoo::SomeClass::SOME_CONST_ARRY"
113
+ # - abspath is the full path to the file where the constant was loaded from.
114
+ #####################################
115
+ loader.on_load do |const_path, value, abspath|
116
+ load_msg "Zeitwerk just loaded #{value.class} '#{const_path}' from:\n #{abspath}"
117
+
118
+ # Parse JSON_ATTRIBUTES into getters and setters for subclasses of
119
+ # JSONObject
120
+ #
121
+ # The class we just loaded must have this method and constant
122
+ # and the method must not have run already for the class or any superclass.
123
+ # This prevents running parse_oapi_properties again in subclasses that
124
+ # don't need to do that
125
+ if defined?(value::JSON_ATTRIBUTES)
126
+ parsed = value.parse_json_attributes
127
+ load_msg "Parsed JSON_ATTRIBUTES for #{value}" if parsed
128
+ end
129
+
130
+ # Generate the identifier list methods (.all_*) for subclasses of APIObject
131
+ # in the Classic API
132
+ # if value.is_a?(Class) && value.superclass == Jamf::APIObject
133
+
134
+ # done = value.define_identifier_list_methods
135
+ # load_msg "Defined identifier list methods for #{value}" if done
136
+ # end
137
+ end
138
+
139
+ # actually do the setup that was defined above
140
+ loader.setup
141
+ end # setup_zeitwerk_loader
142
+
143
+ # For testing the Zeitwrk Loader.
144
+ # Normally we want autoloading on demand,
145
+ # eager loading loads everything so we can see it
146
+ #
147
+ # To make this happen touch the file defined in ZEITWERK_EAGER_LOAD_FILE
148
+ # in jamf.rb
149
+ def self.eager_load_for_testing
150
+ return unless EAGER_LOAD_FILE.file?
151
+
152
+ loader.eager_load(force: true)
153
+ warn :loaded
154
+ # rescue Zeitwerk::NameError => e
155
+ # warn e.message
156
+ end
157
+
158
+ end # module ZeitwerkConfig
data/lib/windoo.rb ADDED
@@ -0,0 +1,56 @@
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
+
7
+ # frozen_string_literal: true
8
+
9
+ # Core Standard Libraries
10
+ ######
11
+ require 'English'
12
+ require 'time'
13
+
14
+ # Other gems
15
+ ######
16
+ require 'pixar-ruby-extensions'
17
+ require 'faraday' # >= 0.17.0
18
+
19
+ # Zeitwerk
20
+ ######
21
+
22
+ # Configure the Zeitwerk loader, See https://github.com/fxn/zeitwerk
23
+ # This also defines other methods related to loading
24
+ require 'windoo/zeitwerk_config'
25
+
26
+ # the `Zeitwerk::Loader.for_gem` creates the loader object, and must
27
+ # happen in this file, so we pass it into a method defined in
28
+ # zeitwerk_config
29
+ #
30
+ # BE CAREFUL - Do not load anything above here that
31
+ # defines the Windoo:: module namespace!
32
+ WindooZeitwerkConfig.setup_zeitwerk_loader Zeitwerk::Loader.for_gem
33
+
34
+ # Zeitwerk
35
+ ######
36
+
37
+ # Load windoo stuff here that we don't autoload with zeitwerk
38
+ require 'windoo/exceptions'
39
+
40
+ # The main module
41
+ module Windoo
42
+
43
+ extend Windoo::Mixins::Loading
44
+ include Windoo::Mixins::Constants
45
+ extend Windoo::Mixins::Utility
46
+ extend Windoo::Mixins::DefaultConnection
47
+
48
+ # the single instance of our configuration object
49
+ def self.config
50
+ Windoo::Configuration.instance
51
+ end
52
+
53
+ end # module Windoo
54
+
55
+ # testing zeitwerk loading, if the correct file is present
56
+ WindooZeitwerkConfig.eager_load_for_testing
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: windoo
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Chris Lasell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-09-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pixar-ruby-extensions
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: zeitwerk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.8'
55
+ description: 'Windoo provides a Ruby interface to the REST API of the [Jamf Title
56
+ Editor](https://docs.jamf.com/title-editor/documentation/About_Title_Editor.html),
57
+ formerly known as ''Kinobi''. The Title Editor is a ''patch source'' provided to
58
+ users of Jamf Pro that provides a way to manage macOS software titles and their
59
+ versions. Windoo allows ruby developers to interact with the Title Editor''s API
60
+ to automate tasks such as creating, updating, and managing patches and related resources.
61
+
62
+ '
63
+ email: windoo@pixar.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files:
67
+ - README.md
68
+ - LICENSE.txt
69
+ - CHANGES.md
70
+ files:
71
+ - CHANGES.md
72
+ - LICENSE.txt
73
+ - README.md
74
+ - lib/windoo.rb
75
+ - lib/windoo/base_classes/array_manager.rb
76
+ - lib/windoo/base_classes/criteria_manager.rb
77
+ - lib/windoo/base_classes/criterion.rb
78
+ - lib/windoo/base_classes/json_object.rb
79
+ - lib/windoo/configuration.rb
80
+ - lib/windoo/connection.rb
81
+ - lib/windoo/connection/actions.rb
82
+ - lib/windoo/connection/attributes.rb
83
+ - lib/windoo/connection/connect.rb
84
+ - lib/windoo/connection/constants.rb
85
+ - lib/windoo/connection/token.rb
86
+ - lib/windoo/converters.rb
87
+ - lib/windoo/exceptions.rb
88
+ - lib/windoo/mixins/api_collection.rb
89
+ - lib/windoo/mixins/constants.rb
90
+ - lib/windoo/mixins/default_connection.rb
91
+ - lib/windoo/mixins/immutable.rb
92
+ - lib/windoo/mixins/loading.rb
93
+ - lib/windoo/mixins/patch/component.rb
94
+ - lib/windoo/mixins/software_title/extension_attribute.rb
95
+ - lib/windoo/mixins/utility.rb
96
+ - lib/windoo/objects/capability.rb
97
+ - lib/windoo/objects/capability_manager.rb
98
+ - lib/windoo/objects/component.rb
99
+ - lib/windoo/objects/component_criteria_manager.rb
100
+ - lib/windoo/objects/component_criterion.rb
101
+ - lib/windoo/objects/extension_attribute.rb
102
+ - lib/windoo/objects/kill_app.rb
103
+ - lib/windoo/objects/kill_app_manager.rb
104
+ - lib/windoo/objects/patch.rb
105
+ - lib/windoo/objects/patch_manager.rb
106
+ - lib/windoo/objects/requirement.rb
107
+ - lib/windoo/objects/requirement_manager.rb
108
+ - lib/windoo/objects/software_title.rb
109
+ - lib/windoo/validate.rb
110
+ - lib/windoo/version.rb
111
+ - lib/windoo/zeitwerk_config.rb
112
+ homepage: https://github.com/PixarAnimationStudios/windoo
113
+ licenses:
114
+ - LicenseRef-LICENSE.txt
115
+ metadata: {}
116
+ post_install_message:
117
+ rdoc_options:
118
+ - "--title"
119
+ - Windoo
120
+ - "--line-numbers"
121
+ - "--main"
122
+ - README.md
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 2.6.3
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubygems_version: 3.3.11
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Ruby interface to the REST API of the Jamf Title Editor, formerly known as
140
+ Kinobi.
141
+ test_files: []