mulberry_preview 0.0.2
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/MIT-LICENSE +20 -0
 - data/README.rdoc +3 -0
 - data/Rakefile +21 -0
 - data/app/assets/stylesheets/coderay.css +143 -0
 - data/app/controllers/preview_controller.rb +65 -0
 - data/app/views/layouts/coderay.html.erb +12 -0
 - data/app/views/preview/code.html.erb +1 -0
 - data/app/views/preview/download.html.erb +6 -0
 - data/config/mimes.yml +147 -0
 - data/config/routes.rb +7 -0
 - data/lib/mulberry_preview.rb +7 -0
 - data/lib/mulberry_preview/engine.rb +12 -0
 - data/lib/mulberry_preview/helper/action_view_extension.rb +28 -0
 - data/lib/mulberry_preview/railtie.rb +10 -0
 - data/lib/mulberry_preview/version.rb +3 -0
 - data/lib/tasks/mulberry_preview_tasks.rake +4 -0
 - metadata +95 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e2f90bbb7ff7bbf578405c51edc798b07ba89ab5
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 368fce015a0af866cd252a401f33e8cde0af1315
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9f0bc570bc1e9586a07ab09ad45377bf689c3a1c5171ba6391f3997fe20d0194bf9d4c60f29547223b9c5c60d65354c58cb226dbd97d114ac4bca245e84a996c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d5dfd51b4868ac72f0ca8b9b70b47b574d1b9a5c03e21f6027df46254f98d06166d5d06941fc68a594141d445828124acc3ef51e1cc0ce0579f1dc60e354c339
         
     | 
    
        data/MIT-LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright 2013 James Zhan
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 4 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 5 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 6 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 7 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 8 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 9 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 12 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 15 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 16 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 17 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 18 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 19 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 20 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.rdoc
    ADDED
    
    
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            begin
         
     | 
| 
      
 2 
     | 
    
         
            +
              require 'bundler/setup'
         
     | 
| 
      
 3 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 4 
     | 
    
         
            +
              puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
         
     | 
| 
      
 5 
     | 
    
         
            +
            end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require 'rdoc/task'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            RDoc::Task.new(:rdoc) do |rdoc|
         
     | 
| 
      
 10 
     | 
    
         
            +
              rdoc.rdoc_dir = 'rdoc'
         
     | 
| 
      
 11 
     | 
    
         
            +
              rdoc.title    = 'MulberryPreview'
         
     | 
| 
      
 12 
     | 
    
         
            +
              rdoc.options << '--line-numbers'
         
     | 
| 
      
 13 
     | 
    
         
            +
              rdoc.rdoc_files.include('README.rdoc')
         
     | 
| 
      
 14 
     | 
    
         
            +
              rdoc.rdoc_files.include('lib/**/*.rb')
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            Bundler::GemHelper.install_tasks
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,143 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            .CodeRay {
         
     | 
| 
      
 2 
     | 
    
         
            +
              background-color: #efefef;
         
     | 
| 
      
 3 
     | 
    
         
            +
              font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace;
         
     | 
| 
      
 4 
     | 
    
         
            +
              color: #000;
         
     | 
| 
      
 5 
     | 
    
         
            +
              margin-bottom: 14px;
         
     | 
| 
      
 6 
     | 
    
         
            +
            }
         
     | 
| 
      
 7 
     | 
    
         
            +
             
         
     | 
| 
      
 8 
     | 
    
         
            +
            .CodeRay pre {
         
     | 
| 
      
 9 
     | 
    
         
            +
              display: block;
         
     | 
| 
      
 10 
     | 
    
         
            +
              padding: 5px;
         
     | 
| 
      
 11 
     | 
    
         
            +
              margin: 0;
         
     | 
| 
      
 12 
     | 
    
         
            +
              font-size: 13px;
         
     | 
| 
      
 13 
     | 
    
         
            +
              line-height: 20px;
         
     | 
| 
      
 14 
     | 
    
         
            +
              word-break: break-all;
         
     | 
| 
      
 15 
     | 
    
         
            +
              word-wrap: break-word;
         
     | 
| 
      
 16 
     | 
    
         
            +
              white-space: pre;
         
     | 
| 
      
 17 
     | 
    
         
            +
              background-color: #fcfcfc;
         
     | 
| 
      
 18 
     | 
    
         
            +
              border: 1px solid #fcfcfc;
         
     | 
| 
      
 19 
     | 
    
         
            +
              -webkit-border-radius: 5px;
         
     | 
| 
      
 20 
     | 
    
         
            +
              -moz-border-radius: 5px;
         
     | 
| 
      
 21 
     | 
    
         
            +
              border-radius: 5px;
         
     | 
| 
      
 22 
     | 
    
         
            +
            }
         
     | 
| 
      
 23 
     | 
    
         
            +
             
         
     | 
| 
      
 24 
     | 
    
         
            +
            div.CodeRay { }
         
     | 
| 
      
 25 
     | 
    
         
            +
            span.CodeRay { white-space: pre; border: 0px; padding: 2px }
         
     | 
| 
      
 26 
     | 
    
         
            +
             
         
     | 
| 
      
 27 
     | 
    
         
            +
            table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px }
         
     | 
| 
      
 28 
     | 
    
         
            +
            table.CodeRay td {
         
     | 
| 
      
 29 
     | 
    
         
            +
              padding: 1em 0.5em;
         
     | 
| 
      
 30 
     | 
    
         
            +
              vertical-align: top;
         
     | 
| 
      
 31 
     | 
    
         
            +
            }
         
     | 
| 
      
 32 
     | 
    
         
            +
             
         
     | 
| 
      
 33 
     | 
    
         
            +
            .CodeRay .line-numbers, .CodeRay .no {
         
     | 
| 
      
 34 
     | 
    
         
            +
              background-color: #ECECEC;
         
     | 
| 
      
 35 
     | 
    
         
            +
              color: #AAA;
         
     | 
| 
      
 36 
     | 
    
         
            +
              text-align: right;
         
     | 
| 
      
 37 
     | 
    
         
            +
            }
         
     | 
| 
      
 38 
     | 
    
         
            +
             
         
     | 
| 
      
 39 
     | 
    
         
            +
            .CodeRay .line-numbers a {
         
     | 
| 
      
 40 
     | 
    
         
            +
              color: #AAA;
         
     | 
| 
      
 41 
     | 
    
         
            +
            }
         
     | 
| 
      
 42 
     | 
    
         
            +
             
         
     | 
| 
      
 43 
     | 
    
         
            +
            .CodeRay .line-numbers tt { font-weight: bold }
         
     | 
| 
      
 44 
     | 
    
         
            +
            .CodeRay .line-numbers .highlighted { color: red }
         
     | 
| 
      
 45 
     | 
    
         
            +
            .CodeRay .line { display: block; float: left; width: 100%; }
         
     | 
| 
      
 46 
     | 
    
         
            +
            .CodeRay span.line-numbers { padding: 0px 4px }
         
     | 
| 
      
 47 
     | 
    
         
            +
            .CodeRay .code { width: 100% }
         
     | 
| 
      
 48 
     | 
    
         
            +
             
         
     | 
| 
      
 49 
     | 
    
         
            +
            ol.CodeRay { font-size: 10pt }
         
     | 
| 
      
 50 
     | 
    
         
            +
            ol.CodeRay li { white-space: pre }
         
     | 
| 
      
 51 
     | 
    
         
            +
             
         
     | 
| 
      
 52 
     | 
    
         
            +
            .CodeRay .code pre { overflow: auto }
         
     | 
| 
      
 53 
     | 
    
         
            +
            .CodeRay .debug { color:white ! important; background:blue ! important; }
         
     | 
| 
      
 54 
     | 
    
         
            +
             
         
     | 
| 
      
 55 
     | 
    
         
            +
            .CodeRay .annotation { color:#007 }
         
     | 
| 
      
 56 
     | 
    
         
            +
            .CodeRay .attribute-name { color:#f08 }
         
     | 
| 
      
 57 
     | 
    
         
            +
            .CodeRay .attribute-value { color:#700 }
         
     | 
| 
      
 58 
     | 
    
         
            +
            .CodeRay .binary { color:#509; font-weight:bold }
         
     | 
| 
      
 59 
     | 
    
         
            +
            .CodeRay .comment  { color:#998; font-style: italic;}
         
     | 
| 
      
 60 
     | 
    
         
            +
            .CodeRay .char { color:#04D }
         
     | 
| 
      
 61 
     | 
    
         
            +
            .CodeRay .char .content { color:#04D }
         
     | 
| 
      
 62 
     | 
    
         
            +
            .CodeRay .char .delimiter { color:#039 }
         
     | 
| 
      
 63 
     | 
    
         
            +
            .CodeRay .class { color:#458; font-weight:bold }
         
     | 
| 
      
 64 
     | 
    
         
            +
            .CodeRay .complex { color:#A08; font-weight:bold }
         
     | 
| 
      
 65 
     | 
    
         
            +
            .CodeRay .constant { color:teal; }
         
     | 
| 
      
 66 
     | 
    
         
            +
            .CodeRay .color { color:#0A0 }
         
     | 
| 
      
 67 
     | 
    
         
            +
            .CodeRay .class-variable { color:#369 }
         
     | 
| 
      
 68 
     | 
    
         
            +
            .CodeRay .decorator { color:#B0B; }
         
     | 
| 
      
 69 
     | 
    
         
            +
            .CodeRay .definition { color:#099; font-weight:bold }
         
     | 
| 
      
 70 
     | 
    
         
            +
            .CodeRay .directive { color:#088; font-weight:bold }
         
     | 
| 
      
 71 
     | 
    
         
            +
            .CodeRay .delimiter { color:black }
         
     | 
| 
      
 72 
     | 
    
         
            +
            .CodeRay .doc { color:#970 }
         
     | 
| 
      
 73 
     | 
    
         
            +
            .CodeRay .doctype { color:#34b }
         
     | 
| 
      
 74 
     | 
    
         
            +
            .CodeRay .doc-string { color:#D42; font-weight:bold }
         
     | 
| 
      
 75 
     | 
    
         
            +
            .CodeRay .escape  { color:#666; font-weight:bold }
         
     | 
| 
      
 76 
     | 
    
         
            +
            .CodeRay .entity { color:#800; font-weight:bold }
         
     | 
| 
      
 77 
     | 
    
         
            +
            .CodeRay .error { color:#F00; background-color:#FAA }
         
     | 
| 
      
 78 
     | 
    
         
            +
            .CodeRay .exception { color:#C00; font-weight:bold }
         
     | 
| 
      
 79 
     | 
    
         
            +
            .CodeRay .filename { color:#099; }
         
     | 
| 
      
 80 
     | 
    
         
            +
            .CodeRay .function { color:#900; font-weight:bold }
         
     | 
| 
      
 81 
     | 
    
         
            +
            .CodeRay .global-variable { color:teal; font-weight:bold }
         
     | 
| 
      
 82 
     | 
    
         
            +
            .CodeRay .hex { color:#058; font-weight:bold }
         
     | 
| 
      
 83 
     | 
    
         
            +
            .CodeRay .integer  { color:#099; }
         
     | 
| 
      
 84 
     | 
    
         
            +
            .CodeRay .include { color:#B44; font-weight:bold }
         
     | 
| 
      
 85 
     | 
    
         
            +
            .CodeRay .inline { color: black }
         
     | 
| 
      
 86 
     | 
    
         
            +
            .CodeRay .inline .inline { background: #ccc }
         
     | 
| 
      
 87 
     | 
    
         
            +
            .CodeRay .inline .inline .inline { background: #bbb }
         
     | 
| 
      
 88 
     | 
    
         
            +
            .CodeRay .inline .inline-delimiter { color: #D14; }
         
     | 
| 
      
 89 
     | 
    
         
            +
            .CodeRay .inline-delimiter { color: #D14; }
         
     | 
| 
      
 90 
     | 
    
         
            +
            .CodeRay .important { color:#f00; }
         
     | 
| 
      
 91 
     | 
    
         
            +
            .CodeRay .interpreted { color:#B2B; font-weight:bold }
         
     | 
| 
      
 92 
     | 
    
         
            +
            .CodeRay .instance-variable { color:teal }
         
     | 
| 
      
 93 
     | 
    
         
            +
            .CodeRay .label { color:#970; font-weight:bold }
         
     | 
| 
      
 94 
     | 
    
         
            +
            .CodeRay .local-variable { color:#963 }
         
     | 
| 
      
 95 
     | 
    
         
            +
            .CodeRay .octal { color:#40E; font-weight:bold }
         
     | 
| 
      
 96 
     | 
    
         
            +
            .CodeRay .operator { }
         
     | 
| 
      
 97 
     | 
    
         
            +
            .CodeRay .predefined-constant {  font-weight:bold }
         
     | 
| 
      
 98 
     | 
    
         
            +
            .CodeRay .predefined { color:#369; font-weight:bold }
         
     | 
| 
      
 99 
     | 
    
         
            +
            .CodeRay .preprocessor { color:#579; }
         
     | 
| 
      
 100 
     | 
    
         
            +
            .CodeRay .pseudo-class { color:#00C; font-weight:bold }
         
     | 
| 
      
 101 
     | 
    
         
            +
            .CodeRay .predefined-type { color:#074; font-weight:bold }
         
     | 
| 
      
 102 
     | 
    
         
            +
            .CodeRay .reserved, .keyword  { color:#000; font-weight:bold }
         
     | 
| 
      
 103 
     | 
    
         
            +
             
         
     | 
| 
      
 104 
     | 
    
         
            +
            .CodeRay .key { color: #808; }
         
     | 
| 
      
 105 
     | 
    
         
            +
            .CodeRay .key .delimiter { color: #606; }
         
     | 
| 
      
 106 
     | 
    
         
            +
            .CodeRay .key .char { color: #80f; }
         
     | 
| 
      
 107 
     | 
    
         
            +
            .CodeRay .value { color: #088; }
         
     | 
| 
      
 108 
     | 
    
         
            +
             
         
     | 
| 
      
 109 
     | 
    
         
            +
            .CodeRay .regexp { background-color:#fff0ff }
         
     | 
| 
      
 110 
     | 
    
         
            +
            .CodeRay .regexp .content { color:#808 }
         
     | 
| 
      
 111 
     | 
    
         
            +
            .CodeRay .regexp .delimiter { color:#404 }
         
     | 
| 
      
 112 
     | 
    
         
            +
            .CodeRay .regexp .modifier { color:#C2C }
         
     | 
| 
      
 113 
     | 
    
         
            +
            .CodeRay .regexp .function  { color:#404; font-weight: bold }
         
     | 
| 
      
 114 
     | 
    
         
            +
             
         
     | 
| 
      
 115 
     | 
    
         
            +
            .CodeRay .string { color: #D20; }
         
     | 
| 
      
 116 
     | 
    
         
            +
            .CodeRay .string .string { }
         
     | 
| 
      
 117 
     | 
    
         
            +
            .CodeRay .string .string .string { background-color:#ffd0d0 }
         
     | 
| 
      
 118 
     | 
    
         
            +
            .CodeRay .string .content { color: #D14; }
         
     | 
| 
      
 119 
     | 
    
         
            +
            .CodeRay .string .char { color: #D14; }
         
     | 
| 
      
 120 
     | 
    
         
            +
            .CodeRay .string .delimiter { color: #D14; }
         
     | 
| 
      
 121 
     | 
    
         
            +
             
         
     | 
| 
      
 122 
     | 
    
         
            +
            .CodeRay .shell { color:#D14 }
         
     | 
| 
      
 123 
     | 
    
         
            +
            .CodeRay .shell .content { }
         
     | 
| 
      
 124 
     | 
    
         
            +
            .CodeRay .shell .delimiter { color:#D14 }
         
     | 
| 
      
 125 
     | 
    
         
            +
             
         
     | 
| 
      
 126 
     | 
    
         
            +
            .CodeRay .symbol { color:#990073 }
         
     | 
| 
      
 127 
     | 
    
         
            +
            .CodeRay .symbol .content { color:#A60 }
         
     | 
| 
      
 128 
     | 
    
         
            +
            .CodeRay .symbol .delimiter { color:#630 }
         
     | 
| 
      
 129 
     | 
    
         
            +
             
         
     | 
| 
      
 130 
     | 
    
         
            +
            .CodeRay .tag { color:#070 }
         
     | 
| 
      
 131 
     | 
    
         
            +
            .CodeRay .tag-special { color:#D70; font-weight:bold }
         
     | 
| 
      
 132 
     | 
    
         
            +
            .CodeRay .type { color:#339; font-weight:bold }
         
     | 
| 
      
 133 
     | 
    
         
            +
            .CodeRay .variable  { color:#036 }
         
     | 
| 
      
 134 
     | 
    
         
            +
             
         
     | 
| 
      
 135 
     | 
    
         
            +
            .CodeRay .insert { background: #afa; }
         
     | 
| 
      
 136 
     | 
    
         
            +
            .CodeRay .delete { background: #faa; }
         
     | 
| 
      
 137 
     | 
    
         
            +
            .CodeRay .change { color: #aaf; background: #007; }
         
     | 
| 
      
 138 
     | 
    
         
            +
            .CodeRay .head { color: #f8f; background: #505 }
         
     | 
| 
      
 139 
     | 
    
         
            +
             
         
     | 
| 
      
 140 
     | 
    
         
            +
            .CodeRay .insert .insert { color: #080; font-weight:bold }
         
     | 
| 
      
 141 
     | 
    
         
            +
            .CodeRay .delete .delete { color: #800; font-weight:bold }
         
     | 
| 
      
 142 
     | 
    
         
            +
            .CodeRay .change .change { color: #66f; }
         
     | 
| 
      
 143 
     | 
    
         
            +
            .CodeRay .head .head { color: #f4f; }
         
     | 
| 
         @@ -0,0 +1,65 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class PreviewController < ActionController::Base
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              Languages = [:ruby, :python, :java, :js, :scss, :sass, :haml, :json, 
         
     | 
| 
      
 4 
     | 
    
         
            +
                :go, :sql, :yaml, :c, :coffee, :properties]  
         
     | 
| 
      
 5 
     | 
    
         
            +
              
         
     | 
| 
      
 6 
     | 
    
         
            +
              def index
         
     | 
| 
      
 7 
     | 
    
         
            +
                clazz, id = params[:type].classify.constantize, params[:id] 
         
     | 
| 
      
 8 
     | 
    
         
            +
                r = clazz.find(id)
         
     | 
| 
      
 9 
     | 
    
         
            +
                type, ext = r.content_type[/^[^\/]+/].to_sym, r.content_type[/(?<=\/)(x-)?(.+)/, 2].to_sym
         
     | 
| 
      
 10 
     | 
    
         
            +
                if Languages.include?(ext)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @code = CodeRay.scan(r.content, ext).div(:line_numbers => :table, :css => :class)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  render 'code', layout: 'coderay'
         
     | 
| 
      
 13 
     | 
    
         
            +
                elsif [:pdf, :html].include?(ext)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  render_native(r.content, r.content_type)
         
     | 
| 
      
 15 
     | 
    
         
            +
                else
         
     | 
| 
      
 16 
     | 
    
         
            +
                  case type
         
     | 
| 
      
 17 
     | 
    
         
            +
                  when :text
         
     | 
| 
      
 18 
     | 
    
         
            +
                    render_native(r.content, 'text/plain')
         
     | 
| 
      
 19 
     | 
    
         
            +
                  when :image
         
     | 
| 
      
 20 
     | 
    
         
            +
                    render_native(r.content, r.content_type)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  else
         
     | 
| 
      
 22 
     | 
    
         
            +
                    @resource = r
         
     | 
| 
      
 23 
     | 
    
         
            +
                    render 'download', layout: 'coderay'
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
              
         
     | 
| 
      
 28 
     | 
    
         
            +
              def open
         
     | 
| 
      
 29 
     | 
    
         
            +
                case RUBY_PLATFORM
         
     | 
| 
      
 30 
     | 
    
         
            +
                when /darwin/i
         
     | 
| 
      
 31 
     | 
    
         
            +
                  open_osx_file
         
     | 
| 
      
 32 
     | 
    
         
            +
                when /linux/i
         
     | 
| 
      
 33 
     | 
    
         
            +
                  open_linux_file
         
     | 
| 
      
 34 
     | 
    
         
            +
                when /cygwin|mswin|mingw|bccwin|wince|emx/
         
     | 
| 
      
 35 
     | 
    
         
            +
                  open_windows_file
         
     | 
| 
      
 36 
     | 
    
         
            +
                else
         
     | 
| 
      
 37 
     | 
    
         
            +
                  #other
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
                head :no_content
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
              
         
     | 
| 
      
 42 
     | 
    
         
            +
              def download
         
     | 
| 
      
 43 
     | 
    
         
            +
                clazz, id = params[:type].classify.constantize, params[:id] 
         
     | 
| 
      
 44 
     | 
    
         
            +
                r = clazz.find(id)
         
     | 
| 
      
 45 
     | 
    
         
            +
                render_native(r.content, r.content_type)
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
              
         
     | 
| 
      
 48 
     | 
    
         
            +
              private
         
     | 
| 
      
 49 
     | 
    
         
            +
                def open_osx_file
         
     | 
| 
      
 50 
     | 
    
         
            +
                  path = params[:path]
         
     | 
| 
      
 51 
     | 
    
         
            +
                  app = 'Preview'
         
     | 
| 
      
 52 
     | 
    
         
            +
                  if /^text\/.+$/ =~ params[:mime]
         
     | 
| 
      
 53 
     | 
    
         
            +
                    app = 'TextMate'
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
                  system %Q{open -a #{app} "#{path}"}
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
                
         
     | 
| 
      
 58 
     | 
    
         
            +
                def render_native(content, content_type)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  response.headers['Cache-Control'] = "public, max-age=#{12.hours.to_i}"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  response.headers['Content-Type'] = content_type
         
     | 
| 
      
 61 
     | 
    
         
            +
                  response.headers['Content-Disposition'] = 'inline'
         
     | 
| 
      
 62 
     | 
    
         
            +
                  render text: content, content_type: content_type
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
              
         
     | 
| 
      
 65 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <%=raw @code %>
         
     | 
    
        data/config/mimes.yml
    ADDED
    
    | 
         @@ -0,0 +1,147 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            iso:  application/x-iso9660-image
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            doc:  application/msword
         
     | 
| 
      
 4 
     | 
    
         
            +
            dot:  application/msword
         
     | 
| 
      
 5 
     | 
    
         
            +
            dot:  application/msword
         
     | 
| 
      
 6 
     | 
    
         
            +
            docx: application/msword
         
     | 
| 
      
 7 
     | 
    
         
            +
            dot:  application/msword
         
     | 
| 
      
 8 
     | 
    
         
            +
            xls:  application/vnd.ms-excel
         
     | 
| 
      
 9 
     | 
    
         
            +
            xlt:  application/vnd.ms-excel
         
     | 
| 
      
 10 
     | 
    
         
            +
            xla:  application/vnd.ms-excel
         
     | 
| 
      
 11 
     | 
    
         
            +
            xlsx: application/vnd.ms-excel
         
     | 
| 
      
 12 
     | 
    
         
            +
            ppt:  application/vnd.ms-powerpoint
         
     | 
| 
      
 13 
     | 
    
         
            +
            pot:  application/vnd.ms-powerpoint
         
     | 
| 
      
 14 
     | 
    
         
            +
            pps:  application/vnd.ms-powerpoint
         
     | 
| 
      
 15 
     | 
    
         
            +
            ppa:  application/vnd.ms-powerpoint
         
     | 
| 
      
 16 
     | 
    
         
            +
            pptx: application/vnd.ms-powerpoint
         
     | 
| 
      
 17 
     | 
    
         
            +
            wps:  application/kswps
         
     | 
| 
      
 18 
     | 
    
         
            +
            pdf:  application/pdf
         
     | 
| 
      
 19 
     | 
    
         
            +
            djvu: application/vnd.djvu
         
     | 
| 
      
 20 
     | 
    
         
            +
            pdg:  application/vnd.pdg
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            key:  application/vnd.apple.keynote
         
     | 
| 
      
 23 
     | 
    
         
            +
            keynode:  application/vnd.apple.keynote
         
     | 
| 
      
 24 
     | 
    
         
            +
            pages:  application/vnd.apple.pages
         
     | 
| 
      
 25 
     | 
    
         
            +
            numbers:  application/vnd.apple.numbers
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            xmind:  application/vnd.xmind.workbook
         
     | 
| 
      
 28 
     | 
    
         
            +
            graffle:  application/x-omnigraffle
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            rar:  application/x-rar-compressed
         
     | 
| 
      
 31 
     | 
    
         
            +
            exe:  application/x-msdownload
         
     | 
| 
      
 32 
     | 
    
         
            +
            bat:  application/x-msdownload
         
     | 
| 
      
 33 
     | 
    
         
            +
            dll:  application/x-msdownload
         
     | 
| 
      
 34 
     | 
    
         
            +
            com:  application/x-msdownload
         
     | 
| 
      
 35 
     | 
    
         
            +
            msi:  application/x-msdownload
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            swf:  application/x-shockwave-flash
         
     | 
| 
      
 38 
     | 
    
         
            +
            rm:   application/vnd.rn-realmedia
         
     | 
| 
      
 39 
     | 
    
         
            +
            rmvb: application/vnd.rn-realmedia
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            bin:  application/octet-stream
         
     | 
| 
      
 42 
     | 
    
         
            +
            dms:	application/octet-stream
         
     | 
| 
      
 43 
     | 
    
         
            +
            lrf:	application/octet-stream
         
     | 
| 
      
 44 
     | 
    
         
            +
            mar:	application/octet-stream
         
     | 
| 
      
 45 
     | 
    
         
            +
            so:	  application/octet-stream
         
     | 
| 
      
 46 
     | 
    
         
            +
            dist:	application/octet-stream
         
     | 
| 
      
 47 
     | 
    
         
            +
            distz:  application/octet-stream
         
     | 
| 
      
 48 
     | 
    
         
            +
            pkg:	application/octet-stream
         
     | 
| 
      
 49 
     | 
    
         
            +
            bpk:	application/octet-stream
         
     | 
| 
      
 50 
     | 
    
         
            +
            dump:	application/octet-stream
         
     | 
| 
      
 51 
     | 
    
         
            +
            elc:	application/octet-stream
         
     | 
| 
      
 52 
     | 
    
         
            +
            deploy: application/octet-stream
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            epub: application/epub+zip
         
     | 
| 
      
 55 
     | 
    
         
            +
            mobi: application/x-mobi
         
     | 
| 
      
 56 
     | 
    
         
            +
            azw3: application/x-azw3
         
     | 
| 
      
 57 
     | 
    
         
            +
            azw:  application/x-azw
         
     | 
| 
      
 58 
     | 
    
         
            +
            chm:  application/x-chm
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            sh:   application/x-sh
         
     | 
| 
      
 61 
     | 
    
         
            +
            csh:  application/x-csh
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            jar:  application/java-archive	
         
     | 
| 
      
 64 
     | 
    
         
            +
            sar:  application/java-archive	
         
     | 
| 
      
 65 
     | 
    
         
            +
            war:  application/java-archive	
         
     | 
| 
      
 66 
     | 
    
         
            +
            ear:  application/java-archive	
         
     | 
| 
      
 67 
     | 
    
         
            +
            ser:  application/java-serialized-object	
         
     | 
| 
      
 68 
     | 
    
         
            +
            class:  application/x-java-class
         
     | 
| 
      
 69 
     | 
    
         
            +
            jad:  text/vnd.sun.j2me.app-descriptor	
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            opml: text/x-opml
         
     | 
| 
      
 72 
     | 
    
         
            +
            nfo:  text/x-nfo
         
     | 
| 
      
 73 
     | 
    
         
            +
            vcs:  text/x-vcalendar
         
     | 
| 
      
 74 
     | 
    
         
            +
            vcf:  text/x-vcard
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            yml: text/x-yaml
         
     | 
| 
      
 77 
     | 
    
         
            +
            yaml: text/x-yaml
         
     | 
| 
      
 78 
     | 
    
         
            +
            properties: text/x-properties
         
     | 
| 
      
 79 
     | 
    
         
            +
            asm:  text/x-asm
         
     | 
| 
      
 80 
     | 
    
         
            +
            s:    text/x-asm
         
     | 
| 
      
 81 
     | 
    
         
            +
            c:    text/x-c
         
     | 
| 
      
 82 
     | 
    
         
            +
            cc:   text/x-c
         
     | 
| 
      
 83 
     | 
    
         
            +
            cxx:  text/x-c
         
     | 
| 
      
 84 
     | 
    
         
            +
            cpp:  text/x-c
         
     | 
| 
      
 85 
     | 
    
         
            +
            h:    text/x-c
         
     | 
| 
      
 86 
     | 
    
         
            +
            hh:   text/x-c
         
     | 
| 
      
 87 
     | 
    
         
            +
            dic:  text/x-c
         
     | 
| 
      
 88 
     | 
    
         
            +
            f:    text/x-fortran
         
     | 
| 
      
 89 
     | 
    
         
            +
            for:  text/x-fortran
         
     | 
| 
      
 90 
     | 
    
         
            +
            f77:  text/x-fortran
         
     | 
| 
      
 91 
     | 
    
         
            +
            f90:  text/x-fortran
         
     | 
| 
      
 92 
     | 
    
         
            +
            java: text/x-java
         
     | 
| 
      
 93 
     | 
    
         
            +
            p:    text/x-pascal
         
     | 
| 
      
 94 
     | 
    
         
            +
            pas:  text/x-pascal
         
     | 
| 
      
 95 
     | 
    
         
            +
            rb:   text/x-ruby
         
     | 
| 
      
 96 
     | 
    
         
            +
            rake: text/x-ruby
         
     | 
| 
      
 97 
     | 
    
         
            +
            ru:   text/x-ruby
         
     | 
| 
      
 98 
     | 
    
         
            +
            py:   text/x-python
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
            md: text/x-markdown
         
     | 
| 
      
 101 
     | 
    
         
            +
            markdown: text/x-markdown
         
     | 
| 
      
 102 
     | 
    
         
            +
            ftl: text/x-freemarker
         
     | 
| 
      
 103 
     | 
    
         
            +
            vm: text/x-velocity
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
            htm:  text/html
         
     | 
| 
      
 106 
     | 
    
         
            +
            text: text/plain
         
     | 
| 
      
 107 
     | 
    
         
            +
            conf: text/plain
         
     | 
| 
      
 108 
     | 
    
         
            +
            def:  text/plain 
         
     | 
| 
      
 109 
     | 
    
         
            +
            list: text/plain
         
     | 
| 
      
 110 
     | 
    
         
            +
            log:  text/plain
         
     | 
| 
      
 111 
     | 
    
         
            +
            ini:  text/plain
         
     | 
| 
      
 112 
     | 
    
         
            +
            m:    text/plain
         
     | 
| 
      
 113 
     | 
    
         
            +
            plist: text/plain
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
            mp3:  audio/mpeg3
         
     | 
| 
      
 116 
     | 
    
         
            +
            midi: audio/midi
         
     | 
| 
      
 117 
     | 
    
         
            +
            wma:  audio/x-ms-wma
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
            mp4:  video/mp4	
         
     | 
| 
      
 120 
     | 
    
         
            +
            mp4v: video/mp4	
         
     | 
| 
      
 121 
     | 
    
         
            +
            mpg4: video/mp4	
         
     | 
| 
      
 122 
     | 
    
         
            +
            mpeg: video/mpeg
         
     | 
| 
      
 123 
     | 
    
         
            +
            mpg:  video/mpeg	
         
     | 
| 
      
 124 
     | 
    
         
            +
            mpe:  video/mpeg	
         
     | 
| 
      
 125 
     | 
    
         
            +
            m1v:  video/mpeg	
         
     | 
| 
      
 126 
     | 
    
         
            +
            m2v:  video/mpeg	
         
     | 
| 
      
 127 
     | 
    
         
            +
            webm: video/webm					
         
     | 
| 
      
 128 
     | 
    
         
            +
            f4v:  video/x-f4v					
         
     | 
| 
      
 129 
     | 
    
         
            +
            fli:  video/x-fli					
         
     | 
| 
      
 130 
     | 
    
         
            +
            flv:  video/x-flv					
         
     | 
| 
      
 131 
     | 
    
         
            +
            m4v:  video/x-m4v					
         
     | 
| 
      
 132 
     | 
    
         
            +
            mkv:  video/x-matroska	
         
     | 
| 
      
 133 
     | 
    
         
            +
            mk3d: video/x-matroska
         
     | 
| 
      
 134 
     | 
    
         
            +
            mks:  video/x-matroska
         
     | 
| 
      
 135 
     | 
    
         
            +
            mng:  video/x-mng					
         
     | 
| 
      
 136 
     | 
    
         
            +
            asf:  video/x-ms-asf
         
     | 
| 
      
 137 
     | 
    
         
            +
            asx:  video/x-ms-asf					 
         
     | 
| 
      
 138 
     | 
    
         
            +
            vob:  video/x-ms-vob					
         
     | 
| 
      
 139 
     | 
    
         
            +
            wm:   video/x-ms-wm					
         
     | 
| 
      
 140 
     | 
    
         
            +
            wmv:  video/x-ms-wmv					
         
     | 
| 
      
 141 
     | 
    
         
            +
            wmx:  video/x-ms-wmx					
         
     | 
| 
      
 142 
     | 
    
         
            +
            wvx:  video/x-ms-wvx					
         
     | 
| 
      
 143 
     | 
    
         
            +
            avi:  video/x-msvideo
         
     | 
| 
      
 144 
     | 
    
         
            +
            smv:  video/x-smv
         
     | 
| 
      
 145 
     | 
    
         
            +
            movie:  video/x-sgi-movie
         
     | 
| 
      
 146 
     | 
    
         
            +
            mov:  video/quicktime
         
     | 
| 
      
 147 
     | 
    
         
            +
            moov: video/quicktime
         
     | 
    
        data/config/routes.rb
    ADDED
    
    
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module MulberryPreview
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Engine < ::Rails::Engine
         
     | 
| 
      
 3 
     | 
    
         
            +
                initializer "mimes" do |app|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  MIMES = YAML.load_file("#{self.class.root}/config/mimes.yml")
         
     | 
| 
      
 5 
     | 
    
         
            +
                  MIMES.each do|ext, mime|
         
     | 
| 
      
 6 
     | 
    
         
            +
                    Mime.fetch(ext) do|fallback|          
         
     | 
| 
      
 7 
     | 
    
         
            +
                      Mime::Type.register mime, ext
         
     | 
| 
      
 8 
     | 
    
         
            +
                    end  
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module MulberryPreview
         
     | 
| 
      
 2 
     | 
    
         
            +
              Languages = [:ruby, :python, :java, :js, :scss, :sass, :haml, :html, :json, :go, :sql, :yaml, :c, :coffee, :properties]
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              module ActionViewExtension
         
     | 
| 
      
 5 
     | 
    
         
            +
                def preview(r)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  type = r.content_type[/^[^\/]+/].to_sym
         
     | 
| 
      
 7 
     | 
    
         
            +
                  ext = r.content_type[/(?<=\/)(x-)?(.+)/, 2].to_sym
         
     | 
| 
      
 8 
     | 
    
         
            +
                  case type
         
     | 
| 
      
 9 
     | 
    
         
            +
                  when :text
         
     | 
| 
      
 10 
     | 
    
         
            +
                    if Languages.include?(ext)
         
     | 
| 
      
 11 
     | 
    
         
            +
                      raw CodeRay.scan(r.content, ext).div(:line_numbers => :table, :css => :class)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    else
         
     | 
| 
      
 13 
     | 
    
         
            +
                      raw "<div class=\"code\">#{r.content}</div>"
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end       
         
     | 
| 
      
 15 
     | 
    
         
            +
                  when :image
         
     | 
| 
      
 16 
     | 
    
         
            +
                    raw "<img src=\"#{preview_path(r.class, r.id)}\" class=\"img-thumbnail\" />"
         
     | 
| 
      
 17 
     | 
    
         
            +
                  when :application
         
     | 
| 
      
 18 
     | 
    
         
            +
                    if :pdf == ext
         
     | 
| 
      
 19 
     | 
    
         
            +
                      raw "<iframe src=\"#{preview_path(r.class, r.id)}\" width='860' height='800' border='0' style='border:none'></iframe>"
         
     | 
| 
      
 20 
     | 
    
         
            +
                    else
         
     | 
| 
      
 21 
     | 
    
         
            +
                      "#{r.content_type} => #{r}"
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
                  else
         
     | 
| 
      
 24 
     | 
    
         
            +
                    "Binary File [#{r}]" 
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module MulberryPreview
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Railtie < ::Rails::Railtie #:nodoc:
         
     | 
| 
      
 3 
     | 
    
         
            +
                initializer 'preview' do |app|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  require 'mulberry_preview/helper/action_view_extension'
         
     | 
| 
      
 5 
     | 
    
         
            +
                  ActiveSupport.on_load(:action_view) do
         
     | 
| 
      
 6 
     | 
    
         
            +
                    ::ActionView::Base.send :include, MulberryPreview::ActionViewExtension
         
     | 
| 
      
 7 
     | 
    
         
            +
                  end
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,95 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: mulberry_preview
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.2
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - James Zhan
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-08-23 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: rails
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '4.1'
         
     | 
| 
      
 20 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 21 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 22 
     | 
    
         
            +
                    version: 4.1.0
         
     | 
| 
      
 23 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 24 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 25 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 29 
     | 
    
         
            +
                    version: '4.1'
         
     | 
| 
      
 30 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 31 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 32 
     | 
    
         
            +
                    version: 4.1.0
         
     | 
| 
      
 33 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 34 
     | 
    
         
            +
              name: sqlite3
         
     | 
| 
      
 35 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 36 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 37 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 38 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 39 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 40 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 41 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 42 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 43 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 44 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 45 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 46 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 47 
     | 
    
         
            +
            description: Can preview files and format the view.
         
     | 
| 
      
 48 
     | 
    
         
            +
            email:
         
     | 
| 
      
 49 
     | 
    
         
            +
            - zhiqiangzhan@gmail.com
         
     | 
| 
      
 50 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 51 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 52 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 53 
     | 
    
         
            +
            files:
         
     | 
| 
      
 54 
     | 
    
         
            +
            - MIT-LICENSE
         
     | 
| 
      
 55 
     | 
    
         
            +
            - README.rdoc
         
     | 
| 
      
 56 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 57 
     | 
    
         
            +
            - app/assets/stylesheets/coderay.css
         
     | 
| 
      
 58 
     | 
    
         
            +
            - app/controllers/preview_controller.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - app/views/layouts/coderay.html.erb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - app/views/preview/code.html.erb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - app/views/preview/download.html.erb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - config/mimes.yml
         
     | 
| 
      
 63 
     | 
    
         
            +
            - config/routes.rb
         
     | 
| 
      
 64 
     | 
    
         
            +
            - lib/mulberry_preview.rb
         
     | 
| 
      
 65 
     | 
    
         
            +
            - lib/mulberry_preview/engine.rb
         
     | 
| 
      
 66 
     | 
    
         
            +
            - lib/mulberry_preview/helper/action_view_extension.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - lib/mulberry_preview/railtie.rb
         
     | 
| 
      
 68 
     | 
    
         
            +
            - lib/mulberry_preview/version.rb
         
     | 
| 
      
 69 
     | 
    
         
            +
            - lib/tasks/mulberry_preview_tasks.rake
         
     | 
| 
      
 70 
     | 
    
         
            +
            homepage: https://github.com/jameszhan/mulberry_preview
         
     | 
| 
      
 71 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 72 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 73 
     | 
    
         
            +
            - GPL-2
         
     | 
| 
      
 74 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 75 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 76 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 77 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 78 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 79 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 80 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 81 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 82 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 83 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 84 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 86 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 87 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 88 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 89 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 90 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 91 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
      
 92 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 93 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 94 
     | 
    
         
            +
            summary: Can preview files.
         
     | 
| 
      
 95 
     | 
    
         
            +
            test_files: []
         
     |