wdm 0.1.1 → 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.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/LICENSE +1 -1
- data/README.md +26 -106
- data/ext/wdm/extconf.rb +4 -7
- data/ext/wdm/rb_change.c +5 -7
- data/ext/wdm/rb_monitor.c +26 -22
- data/ext/wdm/wdm.h +6 -8
- data.tar.gz.sig +0 -0
- metadata +35 -81
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: 7f5bc4036f1b56e0370c04974f657cd432f1d307bd99cc20ba810e50d6c57102
         | 
| 4 | 
            +
              data.tar.gz: e33f1f814957cdaa4b33a8487edeb3fbbef34ccb54c5bbf86441bba65f23a39c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8eeeda975721567490a22da0986dbf0724821521629b94401f74d14d87922051669c8dea18d4994210155d5df6ce634d2fb2f01f50ccc0eccf4753893dc8f23c
         | 
| 7 | 
            +
              data.tar.gz: 68b01dbf2b75454ccda41a98023626131ea93d525bc0affe98b4f813f813e3a40de7963f8bd7ca799116fdc523523ab74a9e78934e1a7132d3c84c01d168a48c
         | 
    
        checksums.yaml.gz.sig
    ADDED
    
    | Binary file | 
    
        data/LICENSE
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -4,15 +4,14 @@ Windows Directory Monitor (WDM) is a thread-safe ruby library which can be used | |
| 4 4 |  | 
| 5 5 | 
             
            It's mostly implemented in C and uses the Win32 API for a better performance.
         | 
| 6 6 |  | 
| 7 | 
            -
            **Important**: WDM only runs on ruby versions >= *1.9.2*! 
         | 
| 8 | 
            -
             | 
| 9 7 | 
             
            ## Installation
         | 
| 10 8 |  | 
| 11 9 | 
             
            If you are using Bundler, add the following line to your application's Gemfile:
         | 
| 12 10 |  | 
| 13 11 | 
             
                gem 'wdm'
         | 
| 14 12 |  | 
| 15 | 
            -
             | 
| 13 | 
            +
            Although wdm is only usable on Windows, it can be installed on Linux and Macos as well, so that no :platform option is necessary.
         | 
| 14 | 
            +
            Then execute:
         | 
| 16 15 |  | 
| 17 16 | 
             
                $ bundle
         | 
| 18 17 |  | 
| @@ -35,6 +34,7 @@ You can find a comparison of different ruby libraries for watching directory cha | |
| 35 34 | 
             
            To start watching directories, you need an instance of `WDM::Monitor`:
         | 
| 36 35 |  | 
| 37 36 | 
             
            ```ruby
         | 
| 37 | 
            +
            require "wdm"
         | 
| 38 38 | 
             
            monitor = WDM::Monitor.new
         | 
| 39 39 | 
             
            ```
         | 
| 40 40 |  | 
| @@ -57,103 +57,17 @@ monitor.watch('C:\Users\Maher\Desktop', :default, :directories) | |
| 57 57 |  | 
| 58 58 | 
             
            The supported options are:
         | 
| 59 59 |  | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
                  <td>
         | 
| 72 | 
            -
                    The default set of options for watching directories. It's a combination of the :files, :directories and the :last_write options.
         | 
| 73 | 
            -
                  </td>
         | 
| 74 | 
            -
                </tr>
         | 
| 75 | 
            -
                
         | 
| 76 | 
            -
                <tr>
         | 
| 77 | 
            -
                  <td>:files</td>
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                  <td>
         | 
| 80 | 
            -
                    Any file name change in the watched directory or subtree causes a change
         | 
| 81 | 
            -
                    notification wait operation to return. Changes include renaming, creating, or
         | 
| 82 | 
            -
                    deleting a file.
         | 
| 83 | 
            -
                  </td>
         | 
| 84 | 
            -
                </tr>
         | 
| 85 | 
            -
             | 
| 86 | 
            -
                <tr>
         | 
| 87 | 
            -
                  <td>:directories</td>
         | 
| 88 | 
            -
             | 
| 89 | 
            -
                  <td>
         | 
| 90 | 
            -
                    Any directory-name change in the watched directory or subtree causes a
         | 
| 91 | 
            -
                    change notification wait operation to return. Changes include creating or
         | 
| 92 | 
            -
                    deleting a directory.
         | 
| 93 | 
            -
                  </td>
         | 
| 94 | 
            -
                </tr>
         | 
| 95 | 
            -
             | 
| 96 | 
            -
                <tr>
         | 
| 97 | 
            -
                  <td>:attributes</td>
         | 
| 98 | 
            -
             | 
| 99 | 
            -
                  <td>
         | 
| 100 | 
            -
                    Any attribute change in the watched directory or subtree causes a change
         | 
| 101 | 
            -
                    notification wait operation to return.
         | 
| 102 | 
            -
                  </td>
         | 
| 103 | 
            -
                </tr>
         | 
| 104 | 
            -
             | 
| 105 | 
            -
                <tr>
         | 
| 106 | 
            -
                  <td>:size</td>
         | 
| 107 | 
            -
             | 
| 108 | 
            -
                  <td>
         | 
| 109 | 
            -
                    Any file-size change in the watched directory or subtree causes a change
         | 
| 110 | 
            -
                    notification wait operation to return. The operating system detects a change in
         | 
| 111 | 
            -
                    file size only when the file is written to the disk. For operating systems that
         | 
| 112 | 
            -
                    use extensive caching, detection occurs only when the cache is sufficiently
         | 
| 113 | 
            -
                    flushed.
         | 
| 114 | 
            -
                  </td>
         | 
| 115 | 
            -
                </tr>
         | 
| 116 | 
            -
             | 
| 117 | 
            -
                <tr>
         | 
| 118 | 
            -
                  <td>:last_write</td>
         | 
| 119 | 
            -
             | 
| 120 | 
            -
                  <td>
         | 
| 121 | 
            -
                    Any change to the last write-time of files in the watched directory or
         | 
| 122 | 
            -
                    subtree causes a change notification wait operation to return. The operating
         | 
| 123 | 
            -
                    system detects a change to the last write-time only when the file is written to
         | 
| 124 | 
            -
                    the disk. For operating systems that use extensive caching, detection occurs
         | 
| 125 | 
            -
                    only when the cache is sufficiently flushed.
         | 
| 126 | 
            -
                  </td>
         | 
| 127 | 
            -
                </tr>
         | 
| 128 | 
            -
             | 
| 129 | 
            -
                <tr>
         | 
| 130 | 
            -
                  <td>:last_access</td>
         | 
| 131 | 
            -
             | 
| 132 | 
            -
                  <td>
         | 
| 133 | 
            -
                    Any change to the last access time of files in the watched directory or
         | 
| 134 | 
            -
                    subtree causes a change notification wait operation to return.
         | 
| 135 | 
            -
                  </td>
         | 
| 136 | 
            -
                </tr>
         | 
| 137 | 
            -
             | 
| 138 | 
            -
                <tr>
         | 
| 139 | 
            -
                  <td>:creation</td>
         | 
| 140 | 
            -
             | 
| 141 | 
            -
                  <td>
         | 
| 142 | 
            -
                    Any change to the creation time of files in the watched directory or subtree
         | 
| 143 | 
            -
                    causes a change notification wait operation to return.
         | 
| 144 | 
            -
                  </td>
         | 
| 145 | 
            -
                </tr>
         | 
| 146 | 
            -
             | 
| 147 | 
            -
                <tr>
         | 
| 148 | 
            -
                  <td>:security</td>
         | 
| 149 | 
            -
             | 
| 150 | 
            -
                  <td>
         | 
| 151 | 
            -
                    Any security-descriptor change in the watched directory or subtree causes a
         | 
| 152 | 
            -
                    change notification wait operation to return.
         | 
| 153 | 
            -
                  </td>
         | 
| 154 | 
            -
                </tr>
         | 
| 155 | 
            -
              </tbody>
         | 
| 156 | 
            -
            </table>
         | 
| 60 | 
            +
            | Value | Meaning |
         | 
| 61 | 
            +
            |-------|---------|
         | 
| 62 | 
            +
            | :default | The default set of options for watching directories. It's a combination of the :files, :directories and the :last_write options. |
         | 
| 63 | 
            +
            | :files | Any file name change in the watched directory or subtree causes a change notification wait operation to return. Changes include renaming, creating, or deleting a file. |
         | 
| 64 | 
            +
            | :directories | Any directory-name change in the watched directory or subtree causes a change notification wait operation to return. Changes include creating or deleting a directory. |
         | 
| 65 | 
            +
            | :attributes | Any attribute change in the watched directory or subtree causes a change notification wait operation to return. |
         | 
| 66 | 
            +
            | :size | Any file-size change in the watched directory or subtree causes a change notification wait operation to return. The operating system detects a change in file size only when the file is written to the disk. For operating systems that use extensive caching, detection occurs only when the cache is sufficiently flushed.|
         | 
| 67 | 
            +
            | :last_write | Any change to the last write-time of files in the watched directory or subtree causes a change notification wait operation to return. The operating system detects a change to the last write-time only when the file is written to the disk. For operating systems that use extensive caching, detection occurs only when the cache is sufficiently flushed. |
         | 
| 68 | 
            +
            | :last_access | Any change to the last access time of files in the watched directory or subtree causes a change notification wait operation to return. |
         | 
| 69 | 
            +
            | :creation | Any change to the creation time of files in the watched directory or subtree causes a change notification wait operation to return. |
         | 
| 70 | 
            +
            | :security | Any security-descriptor change in the watched directory or subtree causes a change notification wait operation to return. |
         | 
| 157 71 |  | 
| 158 72 | 
             
            These options map to the filters that `ReadDirectoryChangesW` takes in its `dwNotifyFilter` parameter. You can find more info on the [docs page](http://msdn.microsoft.com/en-us/library/windows/desktop/aa365465.aspx) of `ReadDirectoryChangesW`. 
         | 
| 159 73 |  | 
| @@ -190,18 +104,24 @@ Download the source, then run the following: | |
| 190 104 |  | 
| 191 105 | 
             
            	$ bundle exec rake compile
         | 
| 192 106 |  | 
| 193 | 
            -
            To get debug messages, you need to enable them  | 
| 107 | 
            +
            To get debug messages, you need to enable them like so:
         | 
| 108 | 
            +
             | 
| 109 | 
            +
            	$ bundle exec rake clean compile -- --with-cflags=-DWDM_DEBUG_ENABLED=TRUE
         | 
| 110 | 
            +
             | 
| 111 | 
            +
            ### Execute the specs
         | 
| 194 112 |  | 
| 195 | 
            -
            	 | 
| 113 | 
            +
            	$ bundle exec rake spec
         | 
| 196 114 |  | 
| 197 115 | 
             
            ## Contributing
         | 
| 198 116 |  | 
| 199 117 | 
             
            1. Fork it
         | 
| 200 118 | 
             
            2. Create your feature branch (`git checkout -b my-new-feature`)
         | 
| 201 | 
            -
            3.  | 
| 202 | 
            -
            4.  | 
| 203 | 
            -
            5.  | 
| 119 | 
            +
            3. Add a spec for your change
         | 
| 120 | 
            +
            4. Commit your changes (`git commit -am 'Added some feature'`)
         | 
| 121 | 
            +
            5. Push to the branch (`git push origin my-new-feature`)
         | 
| 122 | 
            +
            6. Create new Pull Request
         | 
| 123 | 
            +
            7. Ensure CI runs green.
         | 
| 204 124 |  | 
| 205 125 | 
             
            ## Author
         | 
| 206 126 |  | 
| 207 | 
            -
            [Maher Sallam](https://github.com/Maher4Ever)
         | 
| 127 | 
            +
            [Maher Sallam](https://github.com/Maher4Ever)
         | 
    
        data/ext/wdm/extconf.rb
    CHANGED
    
    | @@ -16,13 +16,10 @@ def windows? | |
| 16 16 | 
             
            end
         | 
| 17 17 |  | 
| 18 18 | 
             
            if windows? and
         | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
               have_header("ruby.h")    and
         | 
| 22 | 
            -
               have_const('HAVE_RUBY_ENCODING_H')
         | 
| 19 | 
            +
              have_library("kernel32") and
         | 
| 20 | 
            +
              have_header("windows.h")
         | 
| 23 21 | 
             
            then
         | 
| 24 | 
            -
             | 
| 25 | 
            -
               generate_makefile()
         | 
| 22 | 
            +
              generate_makefile()
         | 
| 26 23 | 
             
            else
         | 
| 27 | 
            -
              generate_dummy_makefile() | 
| 24 | 
            +
              generate_dummy_makefile()
         | 
| 28 25 | 
             
            end
         | 
    
        data/ext/wdm/rb_change.c
    CHANGED
    
    | @@ -60,7 +60,7 @@ extract_absolute_path_from_notification(const LPWSTR base_dir, const PFILE_NOTIF | |
| 60 60 | 
             
                // Null-terminate the string
         | 
| 61 61 | 
             
                buffer[filename_len] = L'\0';
         | 
| 62 62 |  | 
| 63 | 
            -
                 | 
| 63 | 
            +
                WDM_DEBUG("change in: '%S'", buffer);
         | 
| 64 64 |  | 
| 65 65 | 
             
                absolute_filepath_len = wcslen(base_dir) + filename_len;
         | 
| 66 66 | 
             
                absolute_filepath = ALLOCA_N(WCHAR, absolute_filepath_len + 1); // 1 for NULL
         | 
| @@ -69,7 +69,7 @@ extract_absolute_path_from_notification(const LPWSTR base_dir, const PFILE_NOTIF | |
| 69 69 | 
             
                wcscat(absolute_filepath, base_dir);
         | 
| 70 70 | 
             
                wcscat(absolute_filepath, buffer);
         | 
| 71 71 |  | 
| 72 | 
            -
                 | 
| 72 | 
            +
                WDM_DEBUG("absolute path is: '%S'", absolute_filepath);
         | 
| 73 73 |  | 
| 74 74 | 
             
                _wsplitpath(buffer, NULL, NULL, file, ext);
         | 
| 75 75 |  | 
| @@ -78,7 +78,7 @@ extract_absolute_path_from_notification(const LPWSTR base_dir, const PFILE_NOTIF | |
| 78 78 | 
             
                if ( file[0] != L'\0' ) wcscat(filename, file);
         | 
| 79 79 | 
             
                if ( ext[0]  != L'\0' ) wcscat(filename, ext);
         | 
| 80 80 |  | 
| 81 | 
            -
                 | 
| 81 | 
            +
                WDM_DEBUG("filename: '%S'", filename);
         | 
| 82 82 |  | 
| 83 83 | 
             
                filename_len = wcslen(filename);
         | 
| 84 84 |  | 
| @@ -109,7 +109,7 @@ extract_absolute_path_from_notification(const LPWSTR base_dir, const PFILE_NOTIF | |
| 109 109 | 
             
                    if (GetLongPathNameW(unicode_absolute_filepath, absolute_long_filepath, WDM_MAX_WCHAR_LONG_PATH) != 0) {
         | 
| 110 110 | 
             
                        absolute_filepath = absolute_long_filepath + 4; // Skip first 4 pointers of "\\?\"
         | 
| 111 111 | 
             
                        absolute_filepath_len = wcslen(absolute_filepath);
         | 
| 112 | 
            -
                         | 
| 112 | 
            +
                        WDM_DEBUG("Short path converted to long: '%S'", absolute_filepath);
         | 
| 113 113 | 
             
                    }
         | 
| 114 114 | 
             
                    else {
         | 
| 115 115 | 
             
                        WDM_DEBUG("Can't convert short path to long: '%s'", rb_w32_strerror(GetLastError()));
         | 
| @@ -136,8 +136,6 @@ extract_absolute_path_from_notification(const LPWSTR base_dir, const PFILE_NOTIF | |
| 136 136 | 
             
                    multibyte_filepath_buffer_size - 1, // -1 because this func takes the chars count, not bytes count
         | 
| 137 137 | 
             
                    wdm_rb_enc_utf8);
         | 
| 138 138 |  | 
| 139 | 
            -
                OBJ_TAINT(path);
         | 
| 140 | 
            -
             | 
| 141 139 | 
             
                return path;
         | 
| 142 140 | 
             
            }
         | 
| 143 141 |  | 
| @@ -196,4 +194,4 @@ wdm_rb_change_init() | |
| 196 194 |  | 
| 197 195 | 
             
                rb_define_attr(cWDM_Change, "path", 1, 0);
         | 
| 198 196 | 
             
                rb_define_attr(cWDM_Change, "type", 1, 0);
         | 
| 199 | 
            -
            }
         | 
| 197 | 
            +
            }
         | 
    
        data/ext/wdm/rb_monitor.c
    CHANGED
    
    | @@ -50,7 +50,7 @@ static void CALLBACK handle_entry_change(DWORD, DWORD, LPOVERLAPPED); | |
| 50 50 | 
             
            static BOOL register_monitoring_entry(WDM_PEntry);
         | 
| 51 51 | 
             
            static DWORD WINAPI start_monitoring(LPVOID);
         | 
| 52 52 |  | 
| 53 | 
            -
            static  | 
| 53 | 
            +
            static void *wait_for_changes(void *);
         | 
| 54 54 | 
             
            static void process_changes(WDM_PQueue);
         | 
| 55 55 | 
             
            static void stop_monitoring(LPVOID);
         | 
| 56 56 | 
             
            static VALUE rb_monitor_run_bang(VALUE);
         | 
| @@ -99,6 +99,16 @@ monitor_free(LPVOID param) | |
| 99 99 | 
             
                wdm_monitor_free(monitor);
         | 
| 100 100 | 
             
            }
         | 
| 101 101 |  | 
| 102 | 
            +
            static const rb_data_type_t monitor_data_type = {
         | 
| 103 | 
            +
                .wrap_struct_name = "WDM::Monitor",
         | 
| 104 | 
            +
                .function = {
         | 
| 105 | 
            +
                    .dmark = monitor_mark,
         | 
| 106 | 
            +
                    .dfree = monitor_free,
         | 
| 107 | 
            +
                    .dsize = NULL,
         | 
| 108 | 
            +
                },
         | 
| 109 | 
            +
                .flags = 0
         | 
| 110 | 
            +
            };
         | 
| 111 | 
            +
             | 
| 102 112 | 
             
            static VALUE
         | 
| 103 113 | 
             
            rb_monitor_alloc(VALUE self)
         | 
| 104 114 | 
             
            {
         | 
| @@ -106,7 +116,7 @@ rb_monitor_alloc(VALUE self) | |
| 106 116 | 
             
                WDM_DEBUG("Allocating a new monitor object!");
         | 
| 107 117 | 
             
                WDM_DEBUG("--------------------------------");
         | 
| 108 118 |  | 
| 109 | 
            -
                return  | 
| 119 | 
            +
                return TypedData_Wrap_Struct(self, &monitor_data_type, wdm_monitor_new());
         | 
| 110 120 | 
             
            }
         | 
| 111 121 |  | 
| 112 122 | 
             
            static DWORD
         | 
| @@ -156,7 +166,7 @@ combined_watch(BOOL recursively, int argc, VALUE *argv, VALUE self) | |
| 156 166 | 
             
                // TODO: Maybe raise a more user-friendly error?
         | 
| 157 167 | 
             
                rb_need_block();
         | 
| 158 168 |  | 
| 159 | 
            -
                 | 
| 169 | 
            +
                TypedData_Get_Struct(self, WDM_Monitor, &monitor_data_type, monitor);
         | 
| 160 170 |  | 
| 161 171 | 
             
                EnterCriticalSection(&monitor->lock);
         | 
| 162 172 | 
             
                    running = monitor->running;
         | 
| @@ -196,7 +206,7 @@ combined_watch(BOOL recursively, int argc, VALUE *argv, VALUE self) | |
| 196 206 |  | 
| 197 207 | 
             
                MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(os_encoded_directory), -1, entry->user_data->dir, directory_letters_count);
         | 
| 198 208 |  | 
| 199 | 
            -
                 | 
| 209 | 
            +
                WDM_DEBUG("New path to watch: '%S'", entry->user_data->dir);
         | 
| 200 210 |  | 
| 201 211 | 
             
                entry->user_data->dir = wdm_utils_full_pathname(entry->user_data->dir);
         | 
| 202 212 |  | 
| @@ -234,7 +244,7 @@ combined_watch(BOOL recursively, int argc, VALUE *argv, VALUE self) | |
| 234 244 |  | 
| 235 245 | 
             
                wdm_monitor_update_head(monitor, entry);
         | 
| 236 246 |  | 
| 237 | 
            -
                 | 
| 247 | 
            +
                WDM_DEBUG("Watching directory: '%S'", entry->user_data->dir);
         | 
| 238 248 |  | 
| 239 249 | 
             
                return Qnil;
         | 
| 240 250 | 
             
            }
         | 
| @@ -278,7 +288,7 @@ handle_entry_change( | |
| 278 288 | 
             
                data_to_process = wdm_queue_item_new(WDM_QUEUE_ITEM_TYPE_DATA);
         | 
| 279 289 | 
             
                data_to_process->data = wdm_queue_item_data_new();
         | 
| 280 290 |  | 
| 281 | 
            -
                 | 
| 291 | 
            +
                WDM_DEBUG("Change detected in '%S'", param->entry->user_data->dir);
         | 
| 282 292 |  | 
| 283 293 | 
             
                data_to_process->data->user_data = param->entry->user_data;
         | 
| 284 294 |  | 
| @@ -367,14 +377,14 @@ start_monitoring(LPVOID param) | |
| 367 377 | 
             
                return 0;
         | 
| 368 378 | 
             
            }
         | 
| 369 379 |  | 
| 370 | 
            -
            static  | 
| 371 | 
            -
            wait_for_changes( | 
| 380 | 
            +
            static void *
         | 
| 381 | 
            +
            wait_for_changes(void *param)
         | 
| 372 382 | 
             
            {
         | 
| 373 | 
            -
                HANDLE process_event;
         | 
| 383 | 
            +
                HANDLE process_event = (HANDLE)param;
         | 
| 384 | 
            +
                VALUE rb_res;
         | 
| 374 385 |  | 
| 375 | 
            -
                 | 
| 376 | 
            -
             | 
| 377 | 
            -
                return WaitForSingleObject(process_event, INFINITE) == WAIT_OBJECT_0 ? Qtrue : Qfalse;
         | 
| 386 | 
            +
                rb_res = WaitForSingleObject(process_event, INFINITE) == WAIT_OBJECT_0 ? Qtrue : Qfalse;
         | 
| 387 | 
            +
                return (void *)rb_res;
         | 
| 378 388 | 
             
            }
         | 
| 379 389 |  | 
| 380 390 | 
             
            static void
         | 
| @@ -467,7 +477,7 @@ rb_monitor_run_bang(VALUE self) | |
| 467 477 |  | 
| 468 478 | 
             
                WDM_DEBUG("Running the monitor!");
         | 
| 469 479 |  | 
| 470 | 
            -
                 | 
| 480 | 
            +
                TypedData_Get_Struct(self, WDM_Monitor, &monitor_data_type, monitor);
         | 
| 471 481 | 
             
                already_running = FALSE;
         | 
| 472 482 |  | 
| 473 483 | 
             
                EnterCriticalSection(&monitor->lock);
         | 
| @@ -503,13 +513,7 @@ rb_monitor_run_bang(VALUE self) | |
| 503 513 |  | 
| 504 514 | 
             
                while ( monitor->running ) {
         | 
| 505 515 |  | 
| 506 | 
            -
                     | 
| 507 | 
            -
                    // to check if the replacement function is defined and use it if it's available.
         | 
| 508 | 
            -
                    #ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
         | 
| 509 | 
            -
                    waiting_succeeded = rb_thread_call_without_gvl(wait_for_changes, monitor->process_event, stop_monitoring, monitor);
         | 
| 510 | 
            -
                    #else
         | 
| 511 | 
            -
                    waiting_succeeded = rb_thread_blocking_region(wait_for_changes, monitor->process_event, stop_monitoring, monitor);
         | 
| 512 | 
            -
                    #endif
         | 
| 516 | 
            +
                    waiting_succeeded = (VALUE)rb_thread_call_without_gvl(wait_for_changes, monitor->process_event, stop_monitoring, monitor);
         | 
| 513 517 |  | 
| 514 518 | 
             
                    if ( waiting_succeeded == Qfalse ) {
         | 
| 515 519 | 
             
                        rb_raise(eWDM_Error, "Failed while waiting for a change in the watched directories!");
         | 
| @@ -535,7 +539,7 @@ rb_monitor_stop(VALUE self) | |
| 535 539 | 
             
            {
         | 
| 536 540 | 
             
                WDM_PMonitor monitor;
         | 
| 537 541 |  | 
| 538 | 
            -
                 | 
| 542 | 
            +
                TypedData_Get_Struct(self, WDM_Monitor, &monitor_data_type, monitor);
         | 
| 539 543 |  | 
| 540 544 | 
             
                stop_monitoring(monitor);
         | 
| 541 545 |  | 
| @@ -572,4 +576,4 @@ wdm_rb_monitor_init() | |
| 572 576 | 
             
                rb_define_method(cWDM_Monitor, "watch_recursively", RUBY_METHOD_FUNC(rb_monitor_watch_recursively), -1);
         | 
| 573 577 | 
             
                rb_define_method(cWDM_Monitor, "run!", RUBY_METHOD_FUNC(rb_monitor_run_bang), 0);
         | 
| 574 578 | 
             
                rb_define_method(cWDM_Monitor, "stop", RUBY_METHOD_FUNC(rb_monitor_stop), 0);
         | 
| 575 | 
            -
            }
         | 
| 579 | 
            +
            }
         | 
    
        data/ext/wdm/wdm.h
    CHANGED
    
    | @@ -3,7 +3,7 @@ | |
| 3 3 | 
             
            // Support Windows 2000 and later,
         | 
| 4 4 | 
             
            // this is needed for 'GetLongPathNameW' (both of the following defines)
         | 
| 5 5 | 
             
            #ifndef WINVER
         | 
| 6 | 
            -
            #define WINVER 0x0500 | 
| 6 | 
            +
            #define WINVER 0x0500
         | 
| 7 7 | 
             
            #endif
         | 
| 8 8 | 
             
            #ifndef _WIN32_WINNT
         | 
| 9 9 | 
             
            #define _WIN32_WINNT 0x0500
         | 
| @@ -14,13 +14,14 @@ | |
| 14 14 | 
             
            #define WIN32_LEAN_AND_MEAN
         | 
| 15 15 | 
             
            #endif
         | 
| 16 16 | 
             
            #ifndef VC_EXTRALEAN
         | 
| 17 | 
            -
            #define VC_EXTRALEAN | 
| 17 | 
            +
            #define VC_EXTRALEAN
         | 
| 18 18 | 
             
            #endif
         | 
| 19 19 |  | 
| 20 20 | 
             
            #include <Windows.h>
         | 
| 21 21 |  | 
| 22 22 | 
             
            #include <ruby.h>
         | 
| 23 23 | 
             
            #include <ruby/encoding.h>
         | 
| 24 | 
            +
            #include <ruby/thread.h>
         | 
| 24 25 |  | 
| 25 26 | 
             
            #ifndef WDM_H
         | 
| 26 27 | 
             
            #define WDM_H
         | 
| @@ -33,7 +34,9 @@ extern "C" { | |
| 33 34 | 
             
            // Constants
         | 
| 34 35 | 
             
            // ---------------------------------------------------------
         | 
| 35 36 |  | 
| 37 | 
            +
            #ifndef WDM_DEBUG_ENABLED
         | 
| 36 38 | 
             
            #define WDM_DEBUG_ENABLED FALSE
         | 
| 39 | 
            +
            #endif
         | 
| 37 40 |  | 
| 38 41 | 
             
            #define WDM_BUFFER_SIZE 16384 // 2^14 or 16Kb
         | 
| 39 42 |  | 
| @@ -48,13 +51,8 @@ extern "C" { | |
| 48 51 | 
             
            #if WDM_DEBUG_ENABLED == TRUE
         | 
| 49 52 | 
             
                #define WDM_DEBUG(str, ...) \
         | 
| 50 53 | 
             
                    fprintf(stderr, "[DEBUG] (%s@%d): " str "\n", __FILE__, __LINE__, ##__VA_ARGS__)
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                #define WDM_WDEBUG(str, ...) \
         | 
| 53 | 
            -
                    fwprintf(stderr, L"[DEBUG] (%S@%d): " str "\n", __FILE__, __LINE__, ##__VA_ARGS__)
         | 
| 54 | 
            -
             | 
| 55 54 | 
             
            #else
         | 
| 56 55 | 
             
                #define WDM_DEBUG(str, ...)
         | 
| 57 | 
            -
                #define WDM_WDEBUG(str, ...)
         | 
| 58 56 | 
             
            #endif
         | 
| 59 57 |  | 
| 60 58 | 
             
            // ----------------------------------------------------------
         | 
| @@ -79,4 +77,4 @@ void Init_wdm_ext(); | |
| 79 77 | 
             
            }
         | 
| 80 78 | 
             
            #endif // __cplusplus
         | 
| 81 79 |  | 
| 82 | 
            -
            #endif // WDM_H
         | 
| 80 | 
            +
            #endif // WDM_H
         | 
    
        data.tar.gz.sig
    ADDED
    
    | Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,90 +1,46 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: wdm
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Maher Sallam
         | 
| 8 | 
            -
             | 
| 8 | 
            +
            - Lars Kanis
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 | 
            -
            cert_chain: | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
               | 
| 15 | 
            -
               | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
               | 
| 21 | 
            -
               | 
| 22 | 
            -
               | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
               | 
| 29 | 
            -
               | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
               | 
| 35 | 
            -
               | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
                - - ">="
         | 
| 39 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: '0'
         | 
| 41 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name: guard-rspec
         | 
| 43 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            -
                requirements:
         | 
| 45 | 
            -
                - - ">="
         | 
| 46 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: '0'
         | 
| 48 | 
            -
              type: :development
         | 
| 49 | 
            -
              prerelease: false
         | 
| 50 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            -
                requirements:
         | 
| 52 | 
            -
                - - ">="
         | 
| 53 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: '0'
         | 
| 55 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            -
              name: guard-shell
         | 
| 57 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            -
                requirements:
         | 
| 59 | 
            -
                - - ">="
         | 
| 60 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version: '0'
         | 
| 62 | 
            -
              type: :development
         | 
| 63 | 
            -
              prerelease: false
         | 
| 64 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            -
                requirements:
         | 
| 66 | 
            -
                - - ">="
         | 
| 67 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                    version: '0'
         | 
| 69 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            -
              name: pry
         | 
| 71 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 | 
            -
                requirements:
         | 
| 73 | 
            -
                - - ">="
         | 
| 74 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version: '0'
         | 
| 76 | 
            -
              type: :development
         | 
| 77 | 
            -
              prerelease: false
         | 
| 78 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 | 
            -
                requirements:
         | 
| 80 | 
            -
                - - ">="
         | 
| 81 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version: '0'
         | 
| 10 | 
            +
            cert_chain:
         | 
| 11 | 
            +
            - |
         | 
| 12 | 
            +
              -----BEGIN CERTIFICATE-----
         | 
| 13 | 
            +
              MIIEBDCCAmygAwIBAgIBAzANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
         | 
| 14 | 
            +
              L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yNDAyMjgxOTMxNDdaFw0yNTAy
         | 
| 15 | 
            +
              MjcxOTMxNDdaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
         | 
| 16 | 
            +
              PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAwum6Y1KznfpzXOT/
         | 
| 17 | 
            +
              mZgJTBbxZuuZF49Fq3K0WA67YBzNlDv95qzSp7V/7Ek3NCcnT7G+2kSuhNo1FhdN
         | 
| 18 | 
            +
              eSDO/moYebZNAcu3iqLsuzuULXPLuoU0GsMnVMqV9DZPh7cQHE5EBZ7hlzDBK7k/
         | 
| 19 | 
            +
              8nBMvR0mHo77kIkapHc26UzVq/G0nKLfDsIHXVylto3PjzOumjG6GhmFN4r3cP6e
         | 
| 20 | 
            +
              SDfl1FSeRYVpt4kmQULz/zdSaOH3AjAq7PM2Z91iGwQvoUXMANH2v89OWjQO/NHe
         | 
| 21 | 
            +
              JMNDFsmHK/6Ji4Kk48Z3TyscHQnipAID5GhS1oD21/WePdj7GhmbF5gBzkV5uepd
         | 
| 22 | 
            +
              eJQPgWGwrQW/Z2oPjRuJrRofzWfrMWqbOahj9uth6WSxhNexUtbjk6P8emmXOJi5
         | 
| 23 | 
            +
              chQPnWX+N3Gj+jjYxqTFdwT7Mj3pv1VHa+aNUbqSPpvJeDyxRIuo9hvzDaBHb/Cg
         | 
| 24 | 
            +
              9qRVcm8a96n4t7y2lrX1oookY6bkBaxWOMtWlqIprq8JZXM9AgMBAAGjOTA3MAkG
         | 
| 25 | 
            +
              A1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQ4h1tIyvdUWtMI739xMzTR
         | 
| 26 | 
            +
              7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEArBmHSfnUyNWf3R1Fx0mMHloWGdcKn2D2
         | 
| 27 | 
            +
              BsqTApXU2nADiyppIqRq4b9e7hw342uzadSLkoQcEFOxThLRhAcijoWfQVBcsbV/
         | 
| 28 | 
            +
              ZsCY1qlUTIJuSWxaSyS4efUX+N4eMNyPM9oW/sphlWFo0DgI34Y9WB6HDzH+O71y
         | 
| 29 | 
            +
              R7PARke3f4kYnRJf5yRQLPDrH9UYt9KlBQm6l7XMtr5EMnQt0EfcmZEi9H4t/vS2
         | 
| 30 | 
            +
              haxvpFMdAKo4H46GBYNO96r6b74t++vgQSBTg/AFVwvRZwNSrPPcBfb4xxeEAhRR
         | 
| 31 | 
            +
              x+LU7feIH7lZ//3buiyD03gLAEtHXai0Y+/VfuWIpwYJAl2BO/tU7FS/dtbJq9oc
         | 
| 32 | 
            +
              dI36Yyzy+BrCM0WT4oCsagePNb97FaNhl4F6sM5JEPT0ZPxRx0i3G4TNNIYziVos
         | 
| 33 | 
            +
              5wFER6XhvvLDFAMh/jMg+s7Wd5SbSHgHNSUaUGVtdWkVPOer6oF0aLdZUR3CETkn
         | 
| 34 | 
            +
              5nWXZma/BUd3YgYA/Xumc6QQqIS4p7mr
         | 
| 35 | 
            +
              -----END CERTIFICATE-----
         | 
| 36 | 
            +
            date: 2024-08-04 00:00:00.000000000 Z
         | 
| 37 | 
            +
            dependencies: []
         | 
| 83 38 | 
             
            description: Windows Directory Monitor (WDM) is a library which can be used to monitor
         | 
| 84 39 | 
             
              directories for changes. It's mostly implemented in C and uses the Win32 API for
         | 
| 85 40 | 
             
              a better performance.
         | 
| 86 41 | 
             
            email:
         | 
| 87 42 | 
             
            - maher@sallam.me
         | 
| 43 | 
            +
            - lars@greiz-reinsdorf.de
         | 
| 88 44 | 
             
            executables: []
         | 
| 89 45 | 
             
            extensions:
         | 
| 90 46 | 
             
            - ext/wdm/extconf.rb
         | 
| @@ -114,9 +70,9 @@ files: | |
| 114 70 | 
             
            - ext/wdm/wdm.vcxproj.filters
         | 
| 115 71 | 
             
            - lib/wdm.rb
         | 
| 116 72 | 
             
            homepage: https://github.com/Maher4Ever/wdm
         | 
| 117 | 
            -
            licenses: | 
| 73 | 
            +
            licenses:
         | 
| 74 | 
            +
            - MIT
         | 
| 118 75 | 
             
            metadata: {}
         | 
| 119 | 
            -
            post_install_message: 
         | 
| 120 76 | 
             
            rdoc_options: []
         | 
| 121 77 | 
             
            require_paths:
         | 
| 122 78 | 
             
            - lib
         | 
| @@ -124,16 +80,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 124 80 | 
             
              requirements:
         | 
| 125 81 | 
             
              - - ">="
         | 
| 126 82 | 
             
                - !ruby/object:Gem::Version
         | 
| 127 | 
            -
                  version:  | 
| 83 | 
            +
                  version: '2.5'
         | 
| 128 84 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 129 85 | 
             
              requirements:
         | 
| 130 86 | 
             
              - - ">="
         | 
| 131 87 | 
             
                - !ruby/object:Gem::Version
         | 
| 132 88 | 
             
                  version: '0'
         | 
| 133 89 | 
             
            requirements: []
         | 
| 134 | 
            -
             | 
| 135 | 
            -
            rubygems_version: 2.4.5
         | 
| 136 | 
            -
            signing_key: 
         | 
| 90 | 
            +
            rubygems_version: 3.6.0.dev
         | 
| 137 91 | 
             
            specification_version: 4
         | 
| 138 92 | 
             
            summary: Windows Directory Monitor (WDM) is a threaded directories monitor for Windows.
         | 
| 139 93 | 
             
            test_files: []
         | 
    
        metadata.gz.sig
    ADDED
    
    | Binary file |