model_discovery 0.3.6 → 0.3.7
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 +4 -4
 - data/README.md +11 -1
 - data/lib/model_discovery/discovery.rb +6 -2
 - data/lib/model_discovery/version.rb +1 -1
 - metadata +23 -23
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 58a0ea0a5a6e50e09250402120c2fbac697413d7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5ee6b158a4fb8c0b41fc8b9d130da649ae0173a1
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0832614f72e6a4d1479af49ef743ac94298eb8df123a0e68c98020ebd9f1bd6013bb221334653d813380548a8a34dbdeac5ef66dfbb3f6d979cc5d17e7a553f5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: be964ad0bbf15f256e79e26ec636813ed5ad72b884927e7447c6fbe596bdc887c250f2c36efa8044a6149f20db7a803a4f14ad8ae4cdf6a26bfaa8415e3b6ebf
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -36,7 +36,7 @@ model_class = models[0].constantize 
     | 
|
| 
       36 
36 
     | 
    
         
             
            # It's like User.all
         
     | 
| 
       37 
37 
     | 
    
         
             
            model_class.all
         
     | 
| 
       38 
38 
     | 
    
         
             
            ```
         
     | 
| 
       39 
     | 
    
         
            -
            It's simple isn't it ? 
     | 
| 
      
 39 
     | 
    
         
            +
            It's simple isn't it ?
         
     | 
| 
       40 
40 
     | 
    
         
             
            ## Bugs
         
     | 
| 
       41 
41 
     | 
    
         
             
            If you find any bug or have any issue using this gem I'll be happy to know. Please file an issue in [Issue Tracker](https://github.com/Yellowen/model_discovery/issues)
         
     | 
| 
       42 
42 
     | 
    
         
             
            ## Contributing
         
     | 
| 
         @@ -46,3 +46,13 @@ If you find any bug or have any issue using this gem I'll be happy to know. Plea 
     | 
|
| 
       46 
46 
     | 
    
         
             
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
       47 
47 
     | 
    
         
             
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
       48 
48 
     | 
    
         
             
            5. Create new Pull Request
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            ## Credit
         
     | 
| 
      
 51 
     | 
    
         
            +
            
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            **Model Discovery**  is maintained and funded by Yellowen. Whenever a code snippet is borrowed or inspired by existing code, we try to credit the original developer/designer in our source code. Let us know if you think we have missed to do this.
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            # License
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            **Model Discovery** is Copyright © 2013-2015 Yellowen. It is free software, and may be redistributed under the terms specified in the LICENSE file.
         
     | 
| 
         @@ -3,7 +3,7 @@ module ModelDiscovery 
     | 
|
| 
       3 
3 
     | 
    
         
             
              # Create a list of current rails application tables or documents
         
     | 
| 
       4 
4 
     | 
    
         
             
              def self.build_table_list(without_habtm = true)
         
     | 
| 
       5 
5 
     | 
    
         
             
                # Get all gem by requiring them
         
     | 
| 
       6 
     | 
    
         
            -
                all_gems = Bundler. 
     | 
| 
      
 6 
     | 
    
         
            +
                all_gems = Bundler.load.dependencies
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                # Discover all model files in gem files and load them
         
     | 
| 
       9 
9 
     | 
    
         
             
                all_gems.each do |gem|
         
     | 
| 
         @@ -45,9 +45,13 @@ module ModelDiscovery 
     | 
|
| 
       45 
45 
     | 
    
         
             
                Dir["#{path}/app/models/**/*.rb"].each do |model_file|
         
     | 
| 
       46 
46 
     | 
    
         
             
                  puts "File matched: \t#{model_file}"
         
     | 
| 
       47 
47 
     | 
    
         
             
                  begin
         
     | 
| 
       48 
     | 
    
         
            -
                     
     | 
| 
      
 48 
     | 
    
         
            +
                    require model_file
         
     | 
| 
       49 
49 
     | 
    
         
             
                  rescue ActiveSupport::Concern::MultipleIncludedBlocks => e
         
     | 
| 
       50 
50 
     | 
    
         
             
                    puts "[Ignored]: ActiveSupport::Concern::MultipleIncludedBlocks on #{model_file}"
         
     | 
| 
      
 51 
     | 
    
         
            +
                  rescue ArgumentError => e
         
     | 
| 
      
 52 
     | 
    
         
            +
                    if e.to_s.ends_with? 'another_enum'
         
     | 
| 
      
 53 
     | 
    
         
            +
                      puts "[Ignored]: 'enum' redifination ignored."
         
     | 
| 
      
 54 
     | 
    
         
            +
                    end
         
     | 
| 
       51 
55 
     | 
    
         
             
                  end
         
     | 
| 
       52 
56 
     | 
    
         
             
                end
         
     | 
| 
       53 
57 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: model_discovery
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Sameer Rahmani
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-04-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: railties
         
     | 
| 
         @@ -119,39 +119,39 @@ signing_key: 
     | 
|
| 
       119 
119 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       120 
120 
     | 
    
         
             
            summary: A fast solution to model detection in Ruby on Rails.
         
     | 
| 
       121 
121 
     | 
    
         
             
            test_files:
         
     | 
| 
       122 
     | 
    
         
            -
            - test/test_helper.rb
         
     | 
| 
       123 
     | 
    
         
            -
            - test/models/application_models_test.rb
         
     | 
| 
       124 
122 
     | 
    
         
             
            - test/integration/navigation_test.rb
         
     | 
| 
      
 123 
     | 
    
         
            +
            - test/models/application_models_test.rb
         
     | 
| 
       125 
124 
     | 
    
         
             
            - test/fixtures/application_models.yml
         
     | 
| 
       126 
125 
     | 
    
         
             
            - test/model_discovery_test.rb
         
     | 
| 
       127 
     | 
    
         
            -
            - test/ 
     | 
| 
      
 126 
     | 
    
         
            +
            - test/test_helper.rb
         
     | 
| 
      
 127 
     | 
    
         
            +
            - test/dummy/public/500.html
         
     | 
| 
      
 128 
     | 
    
         
            +
            - test/dummy/public/404.html
         
     | 
| 
      
 129 
     | 
    
         
            +
            - test/dummy/public/422.html
         
     | 
| 
      
 130 
     | 
    
         
            +
            - test/dummy/public/favicon.ico
         
     | 
| 
      
 131 
     | 
    
         
            +
            - test/dummy/config.ru
         
     | 
| 
      
 132 
     | 
    
         
            +
            - test/dummy/README.rdoc
         
     | 
| 
       128 
133 
     | 
    
         
             
            - test/dummy/app/views/layouts/application.html.erb
         
     | 
| 
       129 
     | 
    
         
            -
            - test/dummy/app/helpers/application_helper.rb
         
     | 
| 
       130 
134 
     | 
    
         
             
            - test/dummy/app/assets/javascripts/application.js
         
     | 
| 
       131 
135 
     | 
    
         
             
            - test/dummy/app/assets/stylesheets/application.css
         
     | 
| 
      
 136 
     | 
    
         
            +
            - test/dummy/app/controllers/application_controller.rb
         
     | 
| 
      
 137 
     | 
    
         
            +
            - test/dummy/app/helpers/application_helper.rb
         
     | 
| 
      
 138 
     | 
    
         
            +
            - test/dummy/Rakefile
         
     | 
| 
      
 139 
     | 
    
         
            +
            - test/dummy/bin/rake
         
     | 
| 
       132 
140 
     | 
    
         
             
            - test/dummy/bin/bundle
         
     | 
| 
       133 
141 
     | 
    
         
             
            - test/dummy/bin/rails
         
     | 
| 
       134 
     | 
    
         
            -
            - test/dummy/bin/rake
         
     | 
| 
       135 
     | 
    
         
            -
            - test/dummy/public/404.html
         
     | 
| 
       136 
     | 
    
         
            -
            - test/dummy/public/422.html
         
     | 
| 
       137 
     | 
    
         
            -
            - test/dummy/public/500.html
         
     | 
| 
       138 
     | 
    
         
            -
            - test/dummy/public/favicon.ico
         
     | 
| 
       139 
     | 
    
         
            -
            - test/dummy/config.ru
         
     | 
| 
       140 
142 
     | 
    
         
             
            - test/dummy/config/application.rb
         
     | 
| 
       141 
     | 
    
         
            -
            - test/dummy/config/environments/development.rb
         
     | 
| 
       142 
143 
     | 
    
         
             
            - test/dummy/config/environments/test.rb
         
     | 
| 
      
 144 
     | 
    
         
            +
            - test/dummy/config/environments/development.rb
         
     | 
| 
       143 
145 
     | 
    
         
             
            - test/dummy/config/environments/production.rb
         
     | 
| 
       144 
     | 
    
         
            -
            - test/dummy/config/ 
     | 
| 
       145 
     | 
    
         
            -
            - test/dummy/config/initializers/filter_parameter_logging.rb
         
     | 
| 
       146 
     | 
    
         
            -
            - test/dummy/config/initializers/secret_token.rb
         
     | 
| 
       147 
     | 
    
         
            -
            - test/dummy/config/initializers/session_store.rb
         
     | 
| 
       148 
     | 
    
         
            -
            - test/dummy/config/initializers/wrap_parameters.rb
         
     | 
| 
       149 
     | 
    
         
            -
            - test/dummy/config/initializers/mime_types.rb
         
     | 
| 
       150 
     | 
    
         
            -
            - test/dummy/config/initializers/inflections.rb
         
     | 
| 
      
 146 
     | 
    
         
            +
            - test/dummy/config/routes.rb
         
     | 
| 
       151 
147 
     | 
    
         
             
            - test/dummy/config/environment.rb
         
     | 
| 
       152 
148 
     | 
    
         
             
            - test/dummy/config/database.yml
         
     | 
| 
       153 
149 
     | 
    
         
             
            - test/dummy/config/locales/en.yml
         
     | 
| 
       154 
     | 
    
         
            -
            - test/dummy/config/routes.rb
         
     | 
| 
       155 
150 
     | 
    
         
             
            - test/dummy/config/boot.rb
         
     | 
| 
       156 
     | 
    
         
            -
            - test/dummy/ 
     | 
| 
       157 
     | 
    
         
            -
            - test/dummy/ 
     | 
| 
      
 151 
     | 
    
         
            +
            - test/dummy/config/initializers/session_store.rb
         
     | 
| 
      
 152 
     | 
    
         
            +
            - test/dummy/config/initializers/backtrace_silencers.rb
         
     | 
| 
      
 153 
     | 
    
         
            +
            - test/dummy/config/initializers/wrap_parameters.rb
         
     | 
| 
      
 154 
     | 
    
         
            +
            - test/dummy/config/initializers/inflections.rb
         
     | 
| 
      
 155 
     | 
    
         
            +
            - test/dummy/config/initializers/filter_parameter_logging.rb
         
     | 
| 
      
 156 
     | 
    
         
            +
            - test/dummy/config/initializers/mime_types.rb
         
     | 
| 
      
 157 
     | 
    
         
            +
            - test/dummy/config/initializers/secret_token.rb
         
     |