rails_model_visualizer 0.1.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 +7 -0
 - data/.gitignore +11 -0
 - data/.rspec +2 -0
 - data/.travis.yml +5 -0
 - data/CODE_OF_CONDUCT.md +49 -0
 - data/Gemfile +4 -0
 - data/LICENSE.txt +21 -0
 - data/README.md +40 -0
 - data/Rakefile +6 -0
 - data/bin/console +14 -0
 - data/bin/setup +8 -0
 - data/docs/readme.md +70 -0
 - data/docs/wireframes/wireframe.png +0 -0
 - data/lib/rails_model_visualizer.rb +56 -0
 - data/lib/rails_model_visualizer/model.rb +139 -0
 - data/lib/rails_model_visualizer/templates.rb +109 -0
 - data/lib/rails_model_visualizer/version.rb +3 -0
 - data/rails_model_visualizer.gemspec +39 -0
 - metadata +137 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 74b719c6e52da8ef01549c4eeebffcaaa202924e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 3fe284d7fe93d667b3cb5d35a541a91c5047e638
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9a66c64b68359f34ec4a9d6aa854e41d6a6e38a4a804670b4c5bc5ef042268b65a95feddbfebf1b12db18ae54a0b09f541916eff156da0d0316846b59c5b23ee
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d2888fd5740789e4022289509ebe768d1dabbbbcae8401a1b7b748083060ac53206cf41a41f0446b9bbf5500d1311911ec0e550a6f76a58857ca2f502a76735f
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.rspec
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/CODE_OF_CONDUCT.md
    ADDED
    
    | 
         @@ -0,0 +1,49 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Contributor Code of Conduct
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            As contributors and maintainers of this project, and in the interest of
         
     | 
| 
      
 4 
     | 
    
         
            +
            fostering an open and welcoming community, we pledge to respect all people who
         
     | 
| 
      
 5 
     | 
    
         
            +
            contribute through reporting issues, posting feature requests, updating
         
     | 
| 
      
 6 
     | 
    
         
            +
            documentation, submitting pull requests or patches, and other activities.
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            We are committed to making participation in this project a harassment-free
         
     | 
| 
      
 9 
     | 
    
         
            +
            experience for everyone, regardless of level of experience, gender, gender
         
     | 
| 
      
 10 
     | 
    
         
            +
            identity and expression, sexual orientation, disability, personal appearance,
         
     | 
| 
      
 11 
     | 
    
         
            +
            body size, race, ethnicity, age, religion, or nationality.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            Examples of unacceptable behavior by participants include:
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            * The use of sexualized language or imagery
         
     | 
| 
      
 16 
     | 
    
         
            +
            * Personal attacks
         
     | 
| 
      
 17 
     | 
    
         
            +
            * Trolling or insulting/derogatory comments
         
     | 
| 
      
 18 
     | 
    
         
            +
            * Public or private harassment
         
     | 
| 
      
 19 
     | 
    
         
            +
            * Publishing other's private information, such as physical or electronic
         
     | 
| 
      
 20 
     | 
    
         
            +
              addresses, without explicit permission
         
     | 
| 
      
 21 
     | 
    
         
            +
            * Other unethical or unprofessional conduct
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            Project maintainers have the right and responsibility to remove, edit, or
         
     | 
| 
      
 24 
     | 
    
         
            +
            reject comments, commits, code, wiki edits, issues, and other contributions
         
     | 
| 
      
 25 
     | 
    
         
            +
            that are not aligned to this Code of Conduct, or to ban temporarily or
         
     | 
| 
      
 26 
     | 
    
         
            +
            permanently any contributor for other behaviors that they deem inappropriate,
         
     | 
| 
      
 27 
     | 
    
         
            +
            threatening, offensive, or harmful.
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            By adopting this Code of Conduct, project maintainers commit themselves to
         
     | 
| 
      
 30 
     | 
    
         
            +
            fairly and consistently applying these principles to every aspect of managing
         
     | 
| 
      
 31 
     | 
    
         
            +
            this project. Project maintainers who do not follow or enforce the Code of
         
     | 
| 
      
 32 
     | 
    
         
            +
            Conduct may be permanently removed from the project team.
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            This code of conduct applies both within project spaces and in public spaces
         
     | 
| 
      
 35 
     | 
    
         
            +
            when an individual is representing the project or its community.
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            Instances of abusive, harassing, or otherwise unacceptable behavior may be
         
     | 
| 
      
 38 
     | 
    
         
            +
            reported by contacting a project maintainer at halil.coban@gmail.com. All
         
     | 
| 
      
 39 
     | 
    
         
            +
            complaints will be reviewed and investigated and will result in a response that
         
     | 
| 
      
 40 
     | 
    
         
            +
            is deemed necessary and appropriate to the circumstances. Maintainers are
         
     | 
| 
      
 41 
     | 
    
         
            +
            obligated to maintain confidentiality with regard to the reporter of an
         
     | 
| 
      
 42 
     | 
    
         
            +
            incident.
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            This Code of Conduct is adapted from the [Contributor Covenant][homepage],
         
     | 
| 
      
 45 
     | 
    
         
            +
            version 1.3.0, available at
         
     | 
| 
      
 46 
     | 
    
         
            +
            [http://contributor-covenant.org/version/1/3/0/][version]
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            [homepage]: http://contributor-covenant.org
         
     | 
| 
      
 49 
     | 
    
         
            +
            [version]: http://contributor-covenant.org/version/1/3/0/
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2016 Halil Coban
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in
         
     | 
| 
      
 13 
     | 
    
         
            +
            all copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
      
 21 
     | 
    
         
            +
            THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # RailsModelVisualizer
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_model_visualizer`. To experiment with that code, run `bin/console` for an interactive prompt.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            TODO: Delete this and the text above, and describe your gem
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 12 
     | 
    
         
            +
            gem 'rails_model_visualizer'
         
     | 
| 
      
 13 
     | 
    
         
            +
            ```
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                $ gem install rails_model_visualizer
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            TODO: Write usage instructions here
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ## Development
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails_model_visualizer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "rails_model_visualizer"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 11 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require "irb"
         
     | 
| 
      
 14 
     | 
    
         
            +
            IRB.start
         
     | 
    
        data/bin/setup
    ADDED
    
    
    
        data/docs/readme.md
    ADDED
    
    | 
         @@ -0,0 +1,70 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # RailsModelVisualizer
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            [Ruby Gems Link][link]
         
     | 
| 
      
 4 
     | 
    
         
            +
            [link]: http://www.example.com
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            ## Minimum Viable Product
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            RailsModelVisualizer is a ruby gem which will improve documentation of rails apps. Developers will be able to generate a diagram summarizing a rails app using RailsModelVisualizer. The diagram will show inheritance, AR associations, public and private methods, and instance variables of user-defined classes. By the end of week 11, this app will, at a minimum, satisfy the following criteria.
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            - [ ] Installing through command line with `gem install rails_model_visualizer`
         
     | 
| 
      
 11 
     | 
    
         
            +
            - [ ] Extracting user-defined methods and instance variables
         
     | 
| 
      
 12 
     | 
    
         
            +
            - [ ] Determining associations and inheritance between classes
         
     | 
| 
      
 13 
     | 
    
         
            +
            - [ ] Generating an interactive html output
         
     | 
| 
      
 14 
     | 
    
         
            +
            - [ ] Production readme
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            ## Wireframes
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            This gem will generate an html file consists of boxes styled with css.
         
     | 
| 
      
 19 
     | 
    
         
            +
            - Each box will correspond to a single ruby class.   
         
     | 
| 
      
 20 
     | 
    
         
            +
            - Boxes will consist of following sections
         
     | 
| 
      
 21 
     | 
    
         
            +
              - Instance variables: will list instance variables
         
     | 
| 
      
 22 
     | 
    
         
            +
              - Methods: will list user-defined public and private methods
         
     | 
| 
      
 23 
     | 
    
         
            +
                - method's source code will be shown on mouseover
         
     | 
| 
      
 24 
     | 
    
         
            +
              - Associations: will list AR associations
         
     | 
| 
      
 25 
     | 
    
         
            +
                - associated class will be shown on click
         
     | 
| 
      
 26 
     | 
    
         
            +
              - Inheritance: will list parent and child classes
         
     | 
| 
      
 27 
     | 
    
         
            +
                - child/parent class source code will be shown on click
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ## Technologies
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            The project will be implemented with the following technologies:
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            - `Ruby` for the gem development.
         
     | 
| 
      
 36 
     | 
    
         
            +
            - `CSS` for styling.
         
     | 
| 
      
 37 
     | 
    
         
            +
            - Possible `JavaScript and JQuery` for an interactive UI.
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            ## Implementation Timeline
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            ### Day 1
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            **Objective:** Developing a locally available version of the gem
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            - [ ] Read RubyGems documentation
         
     | 
| 
      
 46 
     | 
    
         
            +
            - [ ] Organize project structure/folders
         
     | 
| 
      
 47 
     | 
    
         
            +
            - [ ] Test installing gem (locally)
         
     | 
| 
      
 48 
     | 
    
         
            +
            - [ ] Extract classes from rails apps
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            ### Day 2
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            **Objective:** Extract information from ruby classes
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            - [ ] Scan .rb files found in Day 1 and extract public and private methods
         
     | 
| 
      
 55 
     | 
    
         
            +
            - [ ] Extract AR associations from `has_many`, `has_one`, and `belongs_to` methods.
         
     | 
| 
      
 56 
     | 
    
         
            +
            - [ ] Extract inheritance information from class definitions
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            ### Day 3
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            **Objective:** Generate html output
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            - [ ] Generate an HTML file as a diagram
         
     | 
| 
      
 63 
     | 
    
         
            +
            - [ ] Publish previously extracted information into the html file
         
     | 
| 
      
 64 
     | 
    
         
            +
            - [ ] Style using CSS (and JavaScript, JQuery)
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            ### Day 4
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            - [ ] Write tests
         
     | 
| 
      
 69 
     | 
    
         
            +
            - [ ] Write production readme
         
     | 
| 
      
 70 
     | 
    
         
            +
            - [ ] Push gem to RubyGems.org
         
     | 
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,56 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "rails_model_visualizer/version"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "rails_model_visualizer/templates"
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "rails_model_visualizer/model"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "launchy"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            class RMVisualizer
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def self.import_models
         
     | 
| 
      
 10 
     | 
    
         
            +
                if Rails.application
         
     | 
| 
      
 11 
     | 
    
         
            +
                  Rails.application.eager_load!
         
     | 
| 
      
 12 
     | 
    
         
            +
                  return ActiveRecord::Base.descendants.map do |rails_model|
         
     | 
| 
      
 13 
     | 
    
         
            +
                    Model.new(rails_model)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
                else
         
     | 
| 
      
 16 
     | 
    
         
            +
                  return []
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              def self.print_models
         
     | 
| 
      
 21 
     | 
    
         
            +
                superclasses = {}
         
     | 
| 
      
 22 
     | 
    
         
            +
                RMVisualizer.import_models.each do |m|
         
     | 
| 
      
 23 
     | 
    
         
            +
                  if superclasses[m.super_class]
         
     | 
| 
      
 24 
     | 
    
         
            +
                    superclasses[m.super_class] += m.to_div
         
     | 
| 
      
 25 
     | 
    
         
            +
                  else
         
     | 
| 
      
 26 
     | 
    
         
            +
                    superclasses[m.super_class] = m.to_div
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                body = ""
         
     | 
| 
      
 31 
     | 
    
         
            +
                superclasses.each do |superclass, model_div|
         
     | 
| 
      
 32 
     | 
    
         
            +
                  body += "<div class=\"superclass\">#{superclass}
         
     | 
| 
      
 33 
     | 
    
         
            +
                    #{model_div}
         
     | 
| 
      
 34 
     | 
    
         
            +
                  </div>"
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                File.open("output.html", 'w+') do |file|
         
     | 
| 
      
 38 
     | 
    
         
            +
                  file.write(RMVisualizer.html(body))
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                File.open("application.css", "w+") do |file|
         
     | 
| 
      
 42 
     | 
    
         
            +
                  file.write(RMVisualizer.css)
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                puts "output.html created at root folder"
         
     | 
| 
      
 46 
     | 
    
         
            +
                Launchy.open("./output.html")
         
     | 
| 
      
 47 
     | 
    
         
            +
                return nil
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,139 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Model
         
     | 
| 
      
 2 
     | 
    
         
            +
              attr_reader :name, :columns, :super_class
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              def initialize(rails_model)
         
     | 
| 
      
 5 
     | 
    
         
            +
                @name = rails_model.name
         
     | 
| 
      
 6 
     | 
    
         
            +
                @columns = rails_model.columns
         
     | 
| 
      
 7 
     | 
    
         
            +
                @rails_model = rails_model
         
     | 
| 
      
 8 
     | 
    
         
            +
                @super_class = @rails_model.superclass
         
     | 
| 
      
 9 
     | 
    
         
            +
                @children = @rails_model.descendants
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              def to_div
         
     | 
| 
      
 13 
     | 
    
         
            +
                columns = []
         
     | 
| 
      
 14 
     | 
    
         
            +
                @columns.each do |c|
         
     | 
| 
      
 15 
     | 
    
         
            +
                  columns.push(
         
     | 
| 
      
 16 
     | 
    
         
            +
                  "<div class=\"list-name\">#{c.name}
         
     | 
| 
      
 17 
     | 
    
         
            +
                  <div class=\"list-source\">#{c.sql_type}</div>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  </div>")
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                methods = []
         
     | 
| 
      
 22 
     | 
    
         
            +
                public_methods.each do |name, source_code|
         
     | 
| 
      
 23 
     | 
    
         
            +
                  methods.push(
         
     | 
| 
      
 24 
     | 
    
         
            +
                  "<div class=\"list-name\">#{name}
         
     | 
| 
      
 25 
     | 
    
         
            +
                  <div class=\"list-source\">#{source_code}</div>
         
     | 
| 
      
 26 
     | 
    
         
            +
                  </div>")
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                private_methods.each do |name, source_code|
         
     | 
| 
      
 30 
     | 
    
         
            +
                  methods.push(
         
     | 
| 
      
 31 
     | 
    
         
            +
                  "<div class=\"list-name\">#{name}
         
     | 
| 
      
 32 
     | 
    
         
            +
                  <div class=\"list-source\">#{source_code}</div>
         
     | 
| 
      
 33 
     | 
    
         
            +
                  </div>")
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                assoc_list = []
         
     | 
| 
      
 37 
     | 
    
         
            +
                associations.each do |assoc_name, value|
         
     | 
| 
      
 38 
     | 
    
         
            +
                  assoc_list.push(
         
     | 
| 
      
 39 
     | 
    
         
            +
                  "<div class=\"list-name\">#{value["type"]}: #{assoc_name}
         
     | 
| 
      
 40 
     | 
    
         
            +
                  <div class=\"list-source\">#{value["options"]}</div>
         
     | 
| 
      
 41 
     | 
    
         
            +
                  </div>")
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
                return (
         
     | 
| 
      
 44 
     | 
    
         
            +
                  "<div class=\"model\">
         
     | 
| 
      
 45 
     | 
    
         
            +
                    <h1>#{@name}</h1>
         
     | 
| 
      
 46 
     | 
    
         
            +
                    <div class=\"model-details\">
         
     | 
| 
      
 47 
     | 
    
         
            +
                      <ul>SQL Columns
         
     | 
| 
      
 48 
     | 
    
         
            +
                      #{columns.join("")}
         
     | 
| 
      
 49 
     | 
    
         
            +
                      </ul>
         
     | 
| 
      
 50 
     | 
    
         
            +
                      <ul>Methods
         
     | 
| 
      
 51 
     | 
    
         
            +
                      #{methods.join("")}
         
     | 
| 
      
 52 
     | 
    
         
            +
                      </ul>
         
     | 
| 
      
 53 
     | 
    
         
            +
                      <ul>Associations
         
     | 
| 
      
 54 
     | 
    
         
            +
                      #{assoc_list.join("")}
         
     | 
| 
      
 55 
     | 
    
         
            +
                      </ul>
         
     | 
| 
      
 56 
     | 
    
         
            +
                    </div>
         
     | 
| 
      
 57 
     | 
    
         
            +
                  </div>"
         
     | 
| 
      
 58 
     | 
    
         
            +
                )
         
     | 
| 
      
 59 
     | 
    
         
            +
              end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
              def source(model, method)
         
     | 
| 
      
 62 
     | 
    
         
            +
                m = method.to_sym
         
     | 
| 
      
 63 
     | 
    
         
            +
                @rails_model.new.method(m).source_location
         
     | 
| 
      
 64 
     | 
    
         
            +
              end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              def indent(string)
         
     | 
| 
      
 67 
     | 
    
         
            +
                indent = ">"
         
     | 
| 
      
 68 
     | 
    
         
            +
                string.each_char do |char|
         
     | 
| 
      
 69 
     | 
    
         
            +
                  break unless char == " "
         
     | 
| 
      
 70 
     | 
    
         
            +
                  indent += ">"
         
     | 
| 
      
 71 
     | 
    
         
            +
                end
         
     | 
| 
      
 72 
     | 
    
         
            +
                indent = indent[2..-1] if indent.length > 1
         
     | 
| 
      
 73 
     | 
    
         
            +
                indent + string
         
     | 
| 
      
 74 
     | 
    
         
            +
              end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
              def source_code(source_file, method)
         
     | 
| 
      
 77 
     | 
    
         
            +
                path, start_line = source_file
         
     | 
| 
      
 78 
     | 
    
         
            +
                source_code = []
         
     | 
| 
      
 79 
     | 
    
         
            +
                line_to_read = start_line - 1
         
     | 
| 
      
 80 
     | 
    
         
            +
                file = File.readlines(path)
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                while true
         
     | 
| 
      
 83 
     | 
    
         
            +
                  source_code.push(indent(file[line_to_read]))
         
     | 
| 
      
 84 
     | 
    
         
            +
                  break if file[line_to_read] == "  end\n"
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                  line_to_read += 1
         
     | 
| 
      
 87 
     | 
    
         
            +
                end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                source_code.join("<br>")
         
     | 
| 
      
 90 
     | 
    
         
            +
              end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
              def get_methods(type)
         
     | 
| 
      
 93 
     | 
    
         
            +
                filename = "#{@name.underscore}.rb"
         
     | 
| 
      
 94 
     | 
    
         
            +
                result = {};
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                @rails_model.new.method(type).call(false).each do |pm|
         
     | 
| 
      
 97 
     | 
    
         
            +
                  source_file = source(@rails_model, pm)
         
     | 
| 
      
 98 
     | 
    
         
            +
                  if source_file[0].include?(filename)
         
     | 
| 
      
 99 
     | 
    
         
            +
                    result[pm] = source_code(source_file, pm)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  end
         
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
                result
         
     | 
| 
      
 104 
     | 
    
         
            +
              end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
              def public_methods
         
     | 
| 
      
 107 
     | 
    
         
            +
                get_methods(:public_methods)
         
     | 
| 
      
 108 
     | 
    
         
            +
              end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
              def private_methods
         
     | 
| 
      
 111 
     | 
    
         
            +
                get_methods(:private_methods)
         
     | 
| 
      
 112 
     | 
    
         
            +
              end
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
              def associations
         
     | 
| 
      
 115 
     | 
    
         
            +
                assoc = {}
         
     | 
| 
      
 116 
     | 
    
         
            +
                @rails_model.reflections.each do |name, association|
         
     | 
| 
      
 117 
     | 
    
         
            +
                  if association.class.name.include?("HasManyReflection")
         
     | 
| 
      
 118 
     | 
    
         
            +
                    type = "has_many"
         
     | 
| 
      
 119 
     | 
    
         
            +
                  elsif association.class.name.include?("HasOneReflection")
         
     | 
| 
      
 120 
     | 
    
         
            +
                    type = "has_one"
         
     | 
| 
      
 121 
     | 
    
         
            +
                  elsif association.class.name.include?("BelongsToReflection")
         
     | 
| 
      
 122 
     | 
    
         
            +
                    type = "belongs_to"
         
     | 
| 
      
 123 
     | 
    
         
            +
                  else
         
     | 
| 
      
 124 
     | 
    
         
            +
                    type = "other"
         
     | 
| 
      
 125 
     | 
    
         
            +
                  end
         
     | 
| 
      
 126 
     | 
    
         
            +
                  options = []
         
     | 
| 
      
 127 
     | 
    
         
            +
                  association.options.each do |key, value|
         
     | 
| 
      
 128 
     | 
    
         
            +
                    options.push("#{key}: #{value}")
         
     | 
| 
      
 129 
     | 
    
         
            +
                  end
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                  assoc[association.name.to_s] = {"type" => type, "options" => options.join("\n") }
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
                end
         
     | 
| 
      
 134 
     | 
    
         
            +
                assoc
         
     | 
| 
      
 135 
     | 
    
         
            +
              end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,109 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class RMVisualizer
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              def self.css
         
     | 
| 
      
 4 
     | 
    
         
            +
                "html, body, h1, ul, li,
         
     | 
| 
      
 5 
     | 
    
         
            +
                button, div, h2, h3, p {
         
     | 
| 
      
 6 
     | 
    
         
            +
                  margin: 0;
         
     | 
| 
      
 7 
     | 
    
         
            +
                  padding: 0;
         
     | 
| 
      
 8 
     | 
    
         
            +
                  border: 0;
         
     | 
| 
      
 9 
     | 
    
         
            +
                  outline: 0;
         
     | 
| 
      
 10 
     | 
    
         
            +
                  font: inherit;
         
     | 
| 
      
 11 
     | 
    
         
            +
                  color: inherit;
         
     | 
| 
      
 12 
     | 
    
         
            +
                  text-align: inherit;
         
     | 
| 
      
 13 
     | 
    
         
            +
                  text-decoration: inherit;
         
     | 
| 
      
 14 
     | 
    
         
            +
                  vertical-align: inherit;
         
     | 
| 
      
 15 
     | 
    
         
            +
                  box-sizing: inherit;
         
     | 
| 
      
 16 
     | 
    
         
            +
                  background: transparent;
         
     | 
| 
      
 17 
     | 
    
         
            +
                }
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                body {
         
     | 
| 
      
 20 
     | 
    
         
            +
                    display: flex;
         
     | 
| 
      
 21 
     | 
    
         
            +
                    flex-direction: column
         
     | 
| 
      
 22 
     | 
    
         
            +
                }
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                ul {
         
     | 
| 
      
 25 
     | 
    
         
            +
                  list-style: none;
         
     | 
| 
      
 26 
     | 
    
         
            +
                  margin-top: 10px;
         
     | 
| 
      
 27 
     | 
    
         
            +
            /*       margin-right: 20px; */
         
     | 
| 
      
 28 
     | 
    
         
            +
                  font-size: 18px;
         
     | 
| 
      
 29 
     | 
    
         
            +
                  width: 350px;
         
     | 
| 
      
 30 
     | 
    
         
            +
                  font-size: 20px;
         
     | 
| 
      
 31 
     | 
    
         
            +
                }
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                ul li, .list-name {
         
     | 
| 
      
 34 
     | 
    
         
            +
                  text-decoration: none;
         
     | 
| 
      
 35 
     | 
    
         
            +
                  padding-top: 5px;
         
     | 
| 
      
 36 
     | 
    
         
            +
                  font-size: 16px;
         
     | 
| 
      
 37 
     | 
    
         
            +
                }
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                ul li:first-child, .list-name:first-child {
         
     | 
| 
      
 40 
     | 
    
         
            +
                    margin-top: 10px;
         
     | 
| 
      
 41 
     | 
    
         
            +
                }
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                .model {
         
     | 
| 
      
 44 
     | 
    
         
            +
                  border: 5px solid black;
         
     | 
| 
      
 45 
     | 
    
         
            +
                  margin: 10px;
         
     | 
| 
      
 46 
     | 
    
         
            +
                  padding: 10px;
         
     | 
| 
      
 47 
     | 
    
         
            +
                  color: white;
         
     | 
| 
      
 48 
     | 
    
         
            +
                  background-color: red;
         
     | 
| 
      
 49 
     | 
    
         
            +
                  padding: 20px;
         
     | 
| 
      
 50 
     | 
    
         
            +
                  text-align: center;
         
     | 
| 
      
 51 
     | 
    
         
            +
                }
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                h1 {
         
     | 
| 
      
 54 
     | 
    
         
            +
                 font-size: 40px;
         
     | 
| 
      
 55 
     | 
    
         
            +
                 text-align: center;
         
     | 
| 
      
 56 
     | 
    
         
            +
                }
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                .model-details {
         
     | 
| 
      
 59 
     | 
    
         
            +
                  display: flex;
         
     | 
| 
      
 60 
     | 
    
         
            +
                  justify-content: space-between;
         
     | 
| 
      
 61 
     | 
    
         
            +
                }
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                .list-source {
         
     | 
| 
      
 64 
     | 
    
         
            +
                  display: none;
         
     | 
| 
      
 65 
     | 
    
         
            +
                  position: absolute;
         
     | 
| 
      
 66 
     | 
    
         
            +
                  background-color: #ccc;
         
     | 
| 
      
 67 
     | 
    
         
            +
                  color: black;
         
     | 
| 
      
 68 
     | 
    
         
            +
                  z-index: 1;
         
     | 
| 
      
 69 
     | 
    
         
            +
                  left:150px;
         
     | 
| 
      
 70 
     | 
    
         
            +
                  padding: 5px;
         
     | 
| 
      
 71 
     | 
    
         
            +
                  border-radius: 3px;
         
     | 
| 
      
 72 
     | 
    
         
            +
                  text-align: left;
         
     | 
| 
      
 73 
     | 
    
         
            +
                }
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                .list-name:hover > div {
         
     | 
| 
      
 76 
     | 
    
         
            +
                  display: block;
         
     | 
| 
      
 77 
     | 
    
         
            +
                }
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                .list-name {
         
     | 
| 
      
 80 
     | 
    
         
            +
                  position: relative;
         
     | 
| 
      
 81 
     | 
    
         
            +
                  cursor: pointer;
         
     | 
| 
      
 82 
     | 
    
         
            +
                }
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                .superclass {
         
     | 
| 
      
 85 
     | 
    
         
            +
                   display flex;
         
     | 
| 
      
 86 
     | 
    
         
            +
                   border: 10px solid black;
         
     | 
| 
      
 87 
     | 
    
         
            +
                   text-align: center;
         
     | 
| 
      
 88 
     | 
    
         
            +
                   font-size: 40px;
         
     | 
| 
      
 89 
     | 
    
         
            +
                   padding: 10px;
         
     | 
| 
      
 90 
     | 
    
         
            +
                }"
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
              end
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
              def self.html(body)
         
     | 
| 
      
 95 
     | 
    
         
            +
                start = "<!DOCTYPE html>
         
     | 
| 
      
 96 
     | 
    
         
            +
                <html>
         
     | 
| 
      
 97 
     | 
    
         
            +
                  <head>
         
     | 
| 
      
 98 
     | 
    
         
            +
                    <meta charset=\"utf-8\">
         
     | 
| 
      
 99 
     | 
    
         
            +
                    <title>Rails Model Visualizer</title>
         
     | 
| 
      
 100 
     | 
    
         
            +
                    <link rel=\"stylesheet\" media=\"all\" href=\"./application.css\">
         
     | 
| 
      
 101 
     | 
    
         
            +
                  </head>
         
     | 
| 
      
 102 
     | 
    
         
            +
                  <body>"
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                finish = "</body> </html>"
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                return(start + body + finish)
         
     | 
| 
      
 107 
     | 
    
         
            +
              end
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,39 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 4 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'rails_model_visualizer/version'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.name          = "rails_model_visualizer"
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.version       = RMVisualizer::VERSION
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.authors       = ["Halil Coban"]
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.email         = ["halil.coban@gmail.com"]
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              spec.summary       = %q{RMVisualizer is a ruby gem that generates a diagram
         
     | 
| 
      
 14 
     | 
    
         
            +
                summarizing rails apps.}
         
     | 
| 
      
 15 
     | 
    
         
            +
              # spec.description   = %q{TODO: Write a longer description or delete this line.}
         
     | 
| 
      
 16 
     | 
    
         
            +
              # spec.homepage      = "TODO: Put your gem's website or public repo URL here."
         
     | 
| 
      
 17 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
         
     | 
| 
      
 20 
     | 
    
         
            +
              # to allow pushing to a single host or delete this section to allow pushing to any host.
         
     | 
| 
      
 21 
     | 
    
         
            +
              # if spec.respond_to?(:metadata)
         
     | 
| 
      
 22 
     | 
    
         
            +
              #   spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
         
     | 
| 
      
 23 
     | 
    
         
            +
              # else
         
     | 
| 
      
 24 
     | 
    
         
            +
              #   raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
         
     | 
| 
      
 25 
     | 
    
         
            +
              # end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 28 
     | 
    
         
            +
              spec.bindir        = "exe"
         
     | 
| 
      
 29 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
      
 30 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.12"
         
     | 
| 
      
 33 
     | 
    
         
            +
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
      
 34 
     | 
    
         
            +
              spec.add_development_dependency "rspec", "~> 3.0"
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              spec.add_runtime_dependency "rails", "~> 4.1"
         
     | 
| 
      
 37 
     | 
    
         
            +
              spec.add_runtime_dependency 'launchy', '~> 2.4', '>= 2.4.3'
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,137 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: rails_model_visualizer
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Halil Coban
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-09-23 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.12'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.12'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: rails
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '4.1'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '4.1'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: launchy
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '2.4'
         
     | 
| 
      
 76 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 77 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 78 
     | 
    
         
            +
                    version: 2.4.3
         
     | 
| 
      
 79 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 80 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 81 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 82 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 83 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 84 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 85 
     | 
    
         
            +
                    version: '2.4'
         
     | 
| 
      
 86 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 87 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 88 
     | 
    
         
            +
                    version: 2.4.3
         
     | 
| 
      
 89 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 90 
     | 
    
         
            +
            email:
         
     | 
| 
      
 91 
     | 
    
         
            +
            - halil.coban@gmail.com
         
     | 
| 
      
 92 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 93 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 94 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 95 
     | 
    
         
            +
            files:
         
     | 
| 
      
 96 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 97 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 98 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 99 
     | 
    
         
            +
            - CODE_OF_CONDUCT.md
         
     | 
| 
      
 100 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 101 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 102 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 103 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 104 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 105 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 106 
     | 
    
         
            +
            - docs/readme.md
         
     | 
| 
      
 107 
     | 
    
         
            +
            - docs/wireframes/wireframe.png
         
     | 
| 
      
 108 
     | 
    
         
            +
            - lib/rails_model_visualizer.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            - lib/rails_model_visualizer/model.rb
         
     | 
| 
      
 110 
     | 
    
         
            +
            - lib/rails_model_visualizer/templates.rb
         
     | 
| 
      
 111 
     | 
    
         
            +
            - lib/rails_model_visualizer/version.rb
         
     | 
| 
      
 112 
     | 
    
         
            +
            - rails_model_visualizer.gemspec
         
     | 
| 
      
 113 
     | 
    
         
            +
            homepage: 
         
     | 
| 
      
 114 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 115 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 116 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 117 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 118 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 119 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 120 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 121 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 122 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 123 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 124 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 125 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 126 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 127 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 128 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 129 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 130 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 131 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 132 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 133 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
      
 134 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 135 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 136 
     | 
    
         
            +
            summary: RMVisualizer is a ruby gem that generates a diagram summarizing rails apps.
         
     | 
| 
      
 137 
     | 
    
         
            +
            test_files: []
         
     |