filewatch 0.4.0 → 0.5.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.
- data/lib/filewatch/tail.rb +6 -1
- data/lib/filewatch/watch.rb +6 -1
- data/test/filewatch/tail.rb +17 -0
- metadata +20 -19
    
        data/lib/filewatch/tail.rb
    CHANGED
    
    
    
        data/lib/filewatch/watch.rb
    CHANGED
    
    | @@ -97,7 +97,8 @@ module FileWatch | |
| 97 97 | 
             
                public
         | 
| 98 98 | 
             
                def subscribe(stat_interval = 1, discover_interval = 5, &block)
         | 
| 99 99 | 
             
                  glob = 0
         | 
| 100 | 
            -
                   | 
| 100 | 
            +
                  @quit = false
         | 
| 101 | 
            +
                  while !@quit
         | 
| 101 102 | 
             
                    each(&block)
         | 
| 102 103 |  | 
| 103 104 | 
             
                    glob += 1
         | 
| @@ -147,5 +148,9 @@ module FileWatch | |
| 147 148 | 
             
                  end
         | 
| 148 149 | 
             
                end # def _discover_file
         | 
| 149 150 |  | 
| 151 | 
            +
                public
         | 
| 152 | 
            +
                def quit
         | 
| 153 | 
            +
                  @quit = true
         | 
| 154 | 
            +
                end # def quit
         | 
| 150 155 | 
             
              end # class Watch
         | 
| 151 156 | 
             
            end # module FileWatch
         | 
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            $:.unshift(File.join(File.dirname(__FILE__), "..", "..", "lib"))
         | 
| 2 | 
            +
            require "minitest/unit"
         | 
| 3 | 
            +
            require "minitest/autorun"
         | 
| 4 | 
            +
            require "filewatch/tail"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            class TailTest < MiniTest::Unit::TestCase
         | 
| 7 | 
            +
              def test_quit
         | 
| 8 | 
            +
                require "timeout"
         | 
| 9 | 
            +
                tail = FileWatch::Tail.new
         | 
| 10 | 
            +
                #Thread.new(tail) { |t| sleep(1); t.quit }
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                #Timeout.timeout(5) do
         | 
| 13 | 
            +
                  #tail.subscribe { |e| }
         | 
| 14 | 
            +
                #end
         | 
| 15 | 
            +
                tail.quit
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end # class TailTest
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: filewatch
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.5.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -10,7 +10,7 @@ authors: | |
| 10 10 | 
             
            autorequire: 
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date: 2012- | 
| 13 | 
            +
            date: 2012-10-02 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies: []
         | 
| 15 15 | 
             
            description: Watch files and directories in ruby. Also supports tailing and glob file
         | 
| 16 16 | 
             
              patterns.
         | 
| @@ -22,31 +22,32 @@ executables: | |
| 22 22 | 
             
            extensions: []
         | 
| 23 23 | 
             
            extra_rdoc_files: []
         | 
| 24 24 | 
             
            files:
         | 
| 25 | 
            -
            - lib/filewatch/watch.rb
         | 
| 26 25 | 
             
            - lib/filewatch/tail.rb
         | 
| 27 26 | 
             
            - lib/filewatch/buftok.rb
         | 
| 28 | 
            -
            -  | 
| 29 | 
            -
            - test/globtail/ | 
| 30 | 
            -
            - test/globtail/test5.data
         | 
| 31 | 
            -
            - test/globtail/Makefile
         | 
| 32 | 
            -
            - test/globtail/test9.sh
         | 
| 33 | 
            -
            - test/globtail/test7.sh
         | 
| 34 | 
            -
            - test/globtail/test4.data
         | 
| 35 | 
            -
            - test/globtail/test8.sh
         | 
| 27 | 
            +
            - lib/filewatch/watch.rb
         | 
| 28 | 
            +
            - test/globtail/test9.data
         | 
| 36 29 | 
             
            - test/globtail/test10.sh
         | 
| 37 | 
            -
            - test/globtail/test7.data
         | 
| 38 | 
            -
            - test/globtail/test2.data
         | 
| 39 30 | 
             
            - test/globtail/test3.sh
         | 
| 31 | 
            +
            - test/globtail/test8.sh
         | 
| 32 | 
            +
            - test/globtail/test6.sh
         | 
| 33 | 
            +
            - test/globtail/test4.data
         | 
| 34 | 
            +
            - test/globtail/framework.sh
         | 
| 35 | 
            +
            - test/globtail/Makefile
         | 
| 36 | 
            +
            - test/globtail/test5.data
         | 
| 40 37 | 
             
            - test/globtail/test6.data
         | 
| 38 | 
            +
            - test/globtail/test7.data
         | 
| 39 | 
            +
            - test/globtail/test2.data
         | 
| 40 | 
            +
            - test/globtail/test5.sh
         | 
| 41 | 
            +
            - test/globtail/test10.data
         | 
| 42 | 
            +
            - test/globtail/test8.data
         | 
| 41 43 | 
             
            - test/globtail/test1.sh
         | 
| 44 | 
            +
            - test/globtail/test4.sh
         | 
| 45 | 
            +
            - test/globtail/test3.data
         | 
| 42 46 | 
             
            - test/globtail/test1.data
         | 
| 43 | 
            -
            - test/globtail/ | 
| 44 | 
            -
            - test/globtail/framework.sh
         | 
| 47 | 
            +
            - test/globtail/test7.sh
         | 
| 45 48 | 
             
            - test/globtail/test2.sh
         | 
| 46 | 
            -
            - test/globtail/ | 
| 47 | 
            -
            - test/ | 
| 48 | 
            -
            - test/globtail/test5.sh
         | 
| 49 | 
            -
            - test/globtail/test6.sh
         | 
| 49 | 
            +
            - test/globtail/test9.sh
         | 
| 50 | 
            +
            - test/filewatch/tail.rb
         | 
| 50 51 | 
             
            - bin/globtail
         | 
| 51 52 | 
             
            homepage: https://github.com/jordansissel/ruby-filewatch
         | 
| 52 53 | 
             
            licenses: []
         |