dirclass 0.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.
- data/Manifest +9 -0
- data/Rakefile +12 -0
- data/dirclass.gemspec +32 -0
- data/gem-public_cert.pem +20 -0
- data/lib/dirclass.rb +17 -0
- data/rakefile +12 -0
- data/tests/dirclass_tests.rb +37 -0
- data/tests/testdir/file_1.txt +0 -0
- data/tests/testdir/file_2.txt +0 -0
- data/tests/testdir/file_3.txt +0 -0
- data.tar.gz.sig +0 -0
- metadata +101 -0
- metadata.gz.sig +1 -0
    
        data/Manifest
    ADDED
    
    
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
            require 'rake'
         | 
| 3 | 
            +
            require 'echoe'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Echoe.new('dirclass', '0.0.1') do |p|
         | 
| 6 | 
            +
              p.description    = "A gem that extends the Dir class with a list method"
         | 
| 7 | 
            +
              p.url            = "http://github.com/johnvpetersen/dirclass"
         | 
| 8 | 
            +
              p.author         = "John V. Petersen"
         | 
| 9 | 
            +
              p.email          = "johnvpetersen @nospam@ gmail.com"
         | 
| 10 | 
            +
              p.ignore_pattern = ["tmp/*", "script/*"]
         | 
| 11 | 
            +
              p.development_dependencies = []
         | 
| 12 | 
            +
            end
         | 
    
        data/dirclass.gemspec
    ADDED
    
    | @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            # -*- encoding: utf-8 -*-
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Gem::Specification.new do |s|
         | 
| 4 | 
            +
              s.name = %q{dirclass}
         | 
| 5 | 
            +
              s.version = "0.0.1"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
         | 
| 8 | 
            +
              s.authors = ["John V. Petersen"]
         | 
| 9 | 
            +
              s.cert_chain = ["/Users/johnvpetersen/Projects/gem_certs/gem-public_cert.pem"]
         | 
| 10 | 
            +
              s.date = %q{2010-07-12}
         | 
| 11 | 
            +
              s.description = %q{A gem that extends the Dir class with a list method}
         | 
| 12 | 
            +
              s.email = %q{johnvpetersen @nospam@ gmail.com}
         | 
| 13 | 
            +
              s.extra_rdoc_files = ["lib/dirclass.rb"]
         | 
| 14 | 
            +
              s.files = ["Manifest", "gem-public_cert.pem", "lib/dirclass.rb", "rakefile", "tests/dirclass_tests.rb", "tests/testdir/file_1.txt", "tests/testdir/file_2.txt", "tests/testdir/file_3.txt", "Rakefile", "dirclass.gemspec"]
         | 
| 15 | 
            +
              s.homepage = %q{http://github.com/johnvpetersen/dirclass}
         | 
| 16 | 
            +
              s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Dirclass"]
         | 
| 17 | 
            +
              s.require_paths = ["lib"]
         | 
| 18 | 
            +
              s.rubyforge_project = %q{dirclass}
         | 
| 19 | 
            +
              s.rubygems_version = %q{1.3.7}
         | 
| 20 | 
            +
              s.signing_key = %q{/Users/johnvpetersen/Projects/gem_certs/gem-private_key.pem}
         | 
| 21 | 
            +
              s.summary = %q{A gem that extends the Dir class with a list method}
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              if s.respond_to? :specification_version then
         | 
| 24 | 
            +
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 25 | 
            +
                s.specification_version = 3
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 28 | 
            +
                else
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
              else
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
            end
         | 
    
        data/gem-public_cert.pem
    ADDED
    
    | @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            -----BEGIN CERTIFICATE-----
         | 
| 2 | 
            +
            MIIDPDCCAiSgAwIBAgIBADANBgkqhkiG9w0BAQUFADBEMRYwFAYDVQQDDA1qb2hu
         | 
| 3 | 
            +
            dnBldGVyc2VuMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
         | 
| 4 | 
            +
            FgNjb20wHhcNMTAwNzEzMDAxOTEzWhcNMTEwNzEzMDAxOTEzWjBEMRYwFAYDVQQD
         | 
| 5 | 
            +
            DA1qb2hudnBldGVyc2VuMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJ
         | 
| 6 | 
            +
            k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCy0CgR
         | 
| 7 | 
            +
            SdqG4GLrgde6XBjsiHwWEJGN1GOgKoYfwD4hV7O2mhUtwncZmjyL9nP9NpyrK3Tt
         | 
| 8 | 
            +
            8sL3vQwxqbVyRU8vq5IIiykcHieP351CkvcPR0nSiLybqPdfC0OJWzuWn9O1uJIW
         | 
| 9 | 
            +
            ufuy3IcAWEkwcc0uGkKyBd9AKp7Nm/RxPbfQS8UvP5FT7dXq3DsVXFakjJ5JTmSI
         | 
| 10 | 
            +
            KtX7YfafcNLKv2GMWLlRmtAdKiwQrrqOD/QtzUl03pQNetNHzg/irBSyXW4PIbU9
         | 
| 11 | 
            +
            AbVT+XFGD7741cyuOD6MrjCWKj0OT67U21SkbK+hkwVm1HjOX+O0gbsKhckqBG1x
         | 
| 12 | 
            +
            TMGdJa1O2Sj9Ff6HAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0G
         | 
| 13 | 
            +
            A1UdDgQWBBRAGmccEepCwu2HGalhefMgFqFWqzANBgkqhkiG9w0BAQUFAAOCAQEA
         | 
| 14 | 
            +
            lt9DmUPJ34RuPrR+6yE0u//IbmLI70/Pq/f88fvHC00/402bwW9kyxZBhJWIEVcJ
         | 
| 15 | 
            +
            mIZPnAWxh9sjfLPt0zbY2a3qv7QJrklbxF6hnbpQspBPkSCGQXO1sxJ4c2BY5q3M
         | 
| 16 | 
            +
            GjJWPEwleaEvNIvIoFQbQEExtKtsbqML/G8I73MWWTCwxLR65mjkL5ZecyHcC6lq
         | 
| 17 | 
            +
            y6qhN+DUK8A2g6u1OHBkGl5e5tEHKkvrB5Otj1s05+t9o1XGpbHUcetk46ja+UYX
         | 
| 18 | 
            +
            znVzAwK/C4Wye9Y3CB7wcpfYESvTemJDDjLfjdihecBn6AmZ/8nUmxg5IXKLV609
         | 
| 19 | 
            +
            mpQ1ZS2oN+GzLEWqLReYoA==
         | 
| 20 | 
            +
            -----END CERTIFICATE-----
         | 
    
        data/lib/dirclass.rb
    ADDED
    
    | @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            class Dir
         | 
| 2 | 
            +
             | 
| 3 | 
            +
             def self.list( options = {} )
         | 
| 4 | 
            +
             | 
| 5 | 
            +
               options = { :directory => Dir.pwd(), :pattern => '*.*', :order => 'ASC' }.merge options
         | 
| 6 | 
            +
             | 
| 7 | 
            +
               files = []
         | 
| 8 | 
            +
             | 
| 9 | 
            +
               glob( File.join(options[:directory], options[:pattern])).each do |file|
         | 
| 10 | 
            +
                  files << {:file => File.split(file)[1], :date => File.stat(file).mtime}
         | 
| 11 | 
            +
               end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
               options[:order] == 'ASC' ? 
         | 
| 14 | 
            +
                 files.sort! {|a,b| a[:date] <=> b[:date]} : 
         | 
| 15 | 
            +
                   files.sort! {|a,b| b[:date] <=> a[:date]}
         | 
| 16 | 
            +
             end
         | 
| 17 | 
            +
            end
         | 
    
        data/rakefile
    ADDED
    
    | @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
            require 'rake'
         | 
| 3 | 
            +
            require 'echoe'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Echoe.new('dirclass', '0.0.1') do |p|
         | 
| 6 | 
            +
              p.description    = "A gem that extends the Dir class with a list method"
         | 
| 7 | 
            +
              p.url            = "http://github.com/johnvpetersen/dirclass"
         | 
| 8 | 
            +
              p.author         = "John V. Petersen"
         | 
| 9 | 
            +
              p.email          = "johnvpetersen @nospam@ gmail.com"
         | 
| 10 | 
            +
              p.ignore_pattern = ["tmp/*", "script/*"]
         | 
| 11 | 
            +
              p.development_dependencies = []
         | 
| 12 | 
            +
            end
         | 
| @@ -0,0 +1,37 @@ | |
| 1 | 
            +
            require 'test/unit'
         | 
| 2 | 
            +
            require 'lib/dirclass.rb'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            class MyFirstTest < Test::Unit::TestCase
         | 
| 5 | 
            +
              def test_ascending_sort
         | 
| 6 | 
            +
                 files = Dir.list :directory => 'tests/testdir'
         | 
| 7 | 
            +
                 assert_equal 3, files.count
         | 
| 8 | 
            +
                 assert_equal 'file_1.txt', files[0][:file]
         | 
| 9 | 
            +
                 assert_equal 'file_2.txt', files[1][:file]
         | 
| 10 | 
            +
                 assert_equal 'file_3.txt', files[2][:file]  
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
              
         | 
| 13 | 
            +
              def test_descending_sort
         | 
| 14 | 
            +
                files = Dir.list :directory => 'tests/testdir', :order=>'DESC'
         | 
| 15 | 
            +
                assert_equal 3, files.count
         | 
| 16 | 
            +
                assert_equal 'file_3.txt', files[0][:file]
         | 
| 17 | 
            +
                assert_equal 'file_2.txt', files[1][:file]
         | 
| 18 | 
            +
                assert_equal 'file_1.txt', files[2][:file]  
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
              
         | 
| 21 | 
            +
              def test_search_pattern
         | 
| 22 | 
            +
                files = Dir.list :directory => 'tests/testdir', :pattern => 'file_1.txt'
         | 
| 23 | 
            +
                assert_equal 1, files.count
         | 
| 24 | 
            +
                assert_equal 'file_1.txt', files[0][:file]
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                files = Dir.list :directory => 'tests/testdir', :pattern => 'file*.txt', :order => 'DESC'
         | 
| 27 | 
            +
                assert_equal 3, files.count
         | 
| 28 | 
            +
                assert_equal 'file_3.txt', files[0][:file]
         | 
| 29 | 
            +
                assert_equal 'file_2.txt', files[1][:file]
         | 
| 30 | 
            +
                assert_equal 'file_1.txt', files[2][:file]
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
              def test_no_files
         | 
| 34 | 
            +
                files = Dir.list :directory => 'tests/testdir', :pattern => 'FOOBAR'
         | 
| 35 | 
            +
                assert_equal 0, files.count
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
            end
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
    
        data.tar.gz.sig
    ADDED
    
    | Binary file | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,101 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 | 
            +
            name: dirclass
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              hash: 29
         | 
| 5 | 
            +
              prerelease: false
         | 
| 6 | 
            +
              segments: 
         | 
| 7 | 
            +
              - 0
         | 
| 8 | 
            +
              - 0
         | 
| 9 | 
            +
              - 1
         | 
| 10 | 
            +
              version: 0.0.1
         | 
| 11 | 
            +
            platform: ruby
         | 
| 12 | 
            +
            authors: 
         | 
| 13 | 
            +
            - John V. Petersen
         | 
| 14 | 
            +
            autorequire: 
         | 
| 15 | 
            +
            bindir: bin
         | 
| 16 | 
            +
            cert_chain: 
         | 
| 17 | 
            +
            - |
         | 
| 18 | 
            +
              -----BEGIN CERTIFICATE-----
         | 
| 19 | 
            +
              MIIDPDCCAiSgAwIBAgIBADANBgkqhkiG9w0BAQUFADBEMRYwFAYDVQQDDA1qb2hu
         | 
| 20 | 
            +
              dnBldGVyc2VuMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
         | 
| 21 | 
            +
              FgNjb20wHhcNMTAwNzEzMDAxOTEzWhcNMTEwNzEzMDAxOTEzWjBEMRYwFAYDVQQD
         | 
| 22 | 
            +
              DA1qb2hudnBldGVyc2VuMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJ
         | 
| 23 | 
            +
              k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCy0CgR
         | 
| 24 | 
            +
              SdqG4GLrgde6XBjsiHwWEJGN1GOgKoYfwD4hV7O2mhUtwncZmjyL9nP9NpyrK3Tt
         | 
| 25 | 
            +
              8sL3vQwxqbVyRU8vq5IIiykcHieP351CkvcPR0nSiLybqPdfC0OJWzuWn9O1uJIW
         | 
| 26 | 
            +
              ufuy3IcAWEkwcc0uGkKyBd9AKp7Nm/RxPbfQS8UvP5FT7dXq3DsVXFakjJ5JTmSI
         | 
| 27 | 
            +
              KtX7YfafcNLKv2GMWLlRmtAdKiwQrrqOD/QtzUl03pQNetNHzg/irBSyXW4PIbU9
         | 
| 28 | 
            +
              AbVT+XFGD7741cyuOD6MrjCWKj0OT67U21SkbK+hkwVm1HjOX+O0gbsKhckqBG1x
         | 
| 29 | 
            +
              TMGdJa1O2Sj9Ff6HAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0G
         | 
| 30 | 
            +
              A1UdDgQWBBRAGmccEepCwu2HGalhefMgFqFWqzANBgkqhkiG9w0BAQUFAAOCAQEA
         | 
| 31 | 
            +
              lt9DmUPJ34RuPrR+6yE0u//IbmLI70/Pq/f88fvHC00/402bwW9kyxZBhJWIEVcJ
         | 
| 32 | 
            +
              mIZPnAWxh9sjfLPt0zbY2a3qv7QJrklbxF6hnbpQspBPkSCGQXO1sxJ4c2BY5q3M
         | 
| 33 | 
            +
              GjJWPEwleaEvNIvIoFQbQEExtKtsbqML/G8I73MWWTCwxLR65mjkL5ZecyHcC6lq
         | 
| 34 | 
            +
              y6qhN+DUK8A2g6u1OHBkGl5e5tEHKkvrB5Otj1s05+t9o1XGpbHUcetk46ja+UYX
         | 
| 35 | 
            +
              znVzAwK/C4Wye9Y3CB7wcpfYESvTemJDDjLfjdihecBn6AmZ/8nUmxg5IXKLV609
         | 
| 36 | 
            +
              mpQ1ZS2oN+GzLEWqLReYoA==
         | 
| 37 | 
            +
              -----END CERTIFICATE-----
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            date: 2010-07-12 00:00:00 -04:00
         | 
| 40 | 
            +
            default_executable: 
         | 
| 41 | 
            +
            dependencies: []
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            description: A gem that extends the Dir class with a list method
         | 
| 44 | 
            +
            email: johnvpetersen @nospam@ gmail.com
         | 
| 45 | 
            +
            executables: []
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            extensions: []
         | 
| 48 | 
            +
             | 
| 49 | 
            +
            extra_rdoc_files: 
         | 
| 50 | 
            +
            - lib/dirclass.rb
         | 
| 51 | 
            +
            files: 
         | 
| 52 | 
            +
            - Manifest
         | 
| 53 | 
            +
            - gem-public_cert.pem
         | 
| 54 | 
            +
            - lib/dirclass.rb
         | 
| 55 | 
            +
            - rakefile
         | 
| 56 | 
            +
            - tests/dirclass_tests.rb
         | 
| 57 | 
            +
            - tests/testdir/file_1.txt
         | 
| 58 | 
            +
            - tests/testdir/file_2.txt
         | 
| 59 | 
            +
            - tests/testdir/file_3.txt
         | 
| 60 | 
            +
            - Rakefile
         | 
| 61 | 
            +
            - dirclass.gemspec
         | 
| 62 | 
            +
            has_rdoc: true
         | 
| 63 | 
            +
            homepage: http://github.com/johnvpetersen/dirclass
         | 
| 64 | 
            +
            licenses: []
         | 
| 65 | 
            +
             | 
| 66 | 
            +
            post_install_message: 
         | 
| 67 | 
            +
            rdoc_options: 
         | 
| 68 | 
            +
            - --line-numbers
         | 
| 69 | 
            +
            - --inline-source
         | 
| 70 | 
            +
            - --title
         | 
| 71 | 
            +
            - Dirclass
         | 
| 72 | 
            +
            require_paths: 
         | 
| 73 | 
            +
            - lib
         | 
| 74 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 75 | 
            +
              none: false
         | 
| 76 | 
            +
              requirements: 
         | 
| 77 | 
            +
              - - ">="
         | 
| 78 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 79 | 
            +
                  hash: 3
         | 
| 80 | 
            +
                  segments: 
         | 
| 81 | 
            +
                  - 0
         | 
| 82 | 
            +
                  version: "0"
         | 
| 83 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 84 | 
            +
              none: false
         | 
| 85 | 
            +
              requirements: 
         | 
| 86 | 
            +
              - - ">="
         | 
| 87 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 88 | 
            +
                  hash: 11
         | 
| 89 | 
            +
                  segments: 
         | 
| 90 | 
            +
                  - 1
         | 
| 91 | 
            +
                  - 2
         | 
| 92 | 
            +
                  version: "1.2"
         | 
| 93 | 
            +
            requirements: []
         | 
| 94 | 
            +
             | 
| 95 | 
            +
            rubyforge_project: dirclass
         | 
| 96 | 
            +
            rubygems_version: 1.3.7
         | 
| 97 | 
            +
            signing_key: 
         | 
| 98 | 
            +
            specification_version: 3
         | 
| 99 | 
            +
            summary: A gem that extends the Dir class with a list method
         | 
| 100 | 
            +
            test_files: []
         | 
| 101 | 
            +
             | 
    
        metadata.gz.sig
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            �o��Sc�,DŽ���:��W���n���nUDG�F�E��t����A��G������9pzu��~�d���ӗ�<?^��\1gS|�2?#sT���F�hP]J��{����-�V�@-
         |