rails_embed_editor 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
 - data/MIT-LICENSE +20 -0
 - data/README.rdoc +3 -0
 - data/Rakefile +34 -0
 - data/app/assets/javascripts/rails_embed_editor/application.coffee +59 -0
 - data/app/assets/stylesheets/rails_embed_editor/application.scss +66 -0
 - data/app/controllers/rails_embed_editor/application_controller.rb +4 -0
 - data/app/controllers/rails_embed_editor/editor_controller.rb +16 -0
 - data/app/helpers/rails_embed_editor/application_helper.rb +14 -0
 - data/app/views/layouts/rails_embed_editor/application.html.erb +14 -0
 - data/config/routes.rb +3 -0
 - data/lib/rails_embed_editor/config.rb +11 -0
 - data/lib/rails_embed_editor/editor_mode.rb +7 -0
 - data/lib/rails_embed_editor/engine.rb +10 -0
 - data/lib/rails_embed_editor/file_manager.rb +54 -0
 - data/lib/rails_embed_editor/version.rb +3 -0
 - data/lib/rails_embed_editor.rb +15 -0
 - data/lib/tasks/rails_embed_editor_tasks.rake +4 -0
 - data/test/controller/editor_controller_test.rb +34 -0
 - data/test/dummy/README.rdoc +28 -0
 - data/test/dummy/Rakefile +6 -0
 - data/test/dummy/app/assets/javascripts/application.js +13 -0
 - data/test/dummy/app/assets/stylesheets/application.css +13 -0
 - data/test/dummy/app/controllers/application_controller.rb +5 -0
 - data/test/dummy/app/helpers/application_helper.rb +2 -0
 - data/test/dummy/app/views/layouts/application.html.erb +14 -0
 - data/test/dummy/bin/bundle +3 -0
 - data/test/dummy/bin/rails +4 -0
 - data/test/dummy/bin/rake +4 -0
 - data/test/dummy/config/application.rb +23 -0
 - data/test/dummy/config/boot.rb +5 -0
 - data/test/dummy/config/database.yml +25 -0
 - data/test/dummy/config/environment.rb +5 -0
 - data/test/dummy/config/environments/development.rb +29 -0
 - data/test/dummy/config/environments/production.rb +80 -0
 - data/test/dummy/config/environments/test.rb +36 -0
 - data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
 - data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
 - data/test/dummy/config/initializers/inflections.rb +16 -0
 - data/test/dummy/config/initializers/mime_types.rb +5 -0
 - data/test/dummy/config/initializers/secret_token.rb +12 -0
 - data/test/dummy/config/initializers/session_store.rb +3 -0
 - data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
 - data/test/dummy/config/locales/en.yml +23 -0
 - data/test/dummy/config/routes.rb +4 -0
 - data/test/dummy/config.ru +4 -0
 - data/test/dummy/db/test.sqlite3 +0 -0
 - data/test/dummy/log/development.log +0 -0
 - data/test/dummy/log/test.log +1143 -0
 - data/test/dummy/public/404.html +58 -0
 - data/test/dummy/public/422.html +58 -0
 - data/test/dummy/public/500.html +57 -0
 - data/test/dummy/public/favicon.ico +0 -0
 - data/test/integration/navigation_test.rb +10 -0
 - data/test/rails_embed_editor/config_test.rb +14 -0
 - data/test/rails_embed_editor/dumbfile.erb +13 -0
 - data/test/rails_embed_editor/file_manager_test.rb +51 -0
 - data/test/rails_embed_editor_test.rb +7 -0
 - data/test/test_helper.rb +19 -0
 - data/test/tmp/edit_test/dumbfile.erb +11 -0
 - metadata +208 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            !binary "U0hBMQ==":
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: !binary |-
         
     | 
| 
      
 4 
     | 
    
         
            +
                MTliNjU3ODNmZmIxYTk0YTkzYWU3NTI0NGQxZGRhYjU4YmIzNWUyNg==
         
     | 
| 
      
 5 
     | 
    
         
            +
              data.tar.gz: !binary |-
         
     | 
| 
      
 6 
     | 
    
         
            +
                YmFlNWMxYTdmYmY1MWVmYWY0OWM4YjBmYzA0MWM5NTM0MGZjNzNmYw==
         
     | 
| 
      
 7 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 8 
     | 
    
         
            +
              metadata.gz: !binary |-
         
     | 
| 
      
 9 
     | 
    
         
            +
                NjA2OWI3YTk5Nzg1Y2RmNDZkODNkYWUxNzkzM2Y3MjUzMDEyMDk1ZjU4MTcx
         
     | 
| 
      
 10 
     | 
    
         
            +
                N2Y1MDhhNzY2NDdmMWM4YzVjN2M3ZDEyY2NhZDY2OTk0MmYxZWNiZWZlMTVl
         
     | 
| 
      
 11 
     | 
    
         
            +
                NTE4MWM0YmUyMjk2YjIxZGFhMjBiMGY2NWMzMjNiMTU3YjgyYmY=
         
     | 
| 
      
 12 
     | 
    
         
            +
              data.tar.gz: !binary |-
         
     | 
| 
      
 13 
     | 
    
         
            +
                YTliNDNhZDg0Y2IzOGQwM2NlM2RjNGViZGUxZTE3NjgxMGQ2ZDAzMzIzYTNh
         
     | 
| 
      
 14 
     | 
    
         
            +
                MjEyOGM4NzY0NTBjOWI4MjhhNjYzY2YzYjlhNDFlYjkzZmQxMzI3ZTA2NWUy
         
     | 
| 
      
 15 
     | 
    
         
            +
                MjJlYmZhMzY0NTEzNzYzNDI2YWNmZmNjMTI5MzBjY2YxYjgzOTM=
         
     | 
    
        data/MIT-LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright 2014 YOURNAME
         
     | 
| 
      
 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,34 @@ 
     | 
|
| 
      
 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    = 'RailsEmbedEditor'
         
     | 
| 
      
 12 
     | 
    
         
            +
              rdoc.options << '--line-numbers'
         
     | 
| 
      
 13 
     | 
    
         
            +
              rdoc.rdoc_files.include('README.rdoc')
         
     | 
| 
      
 14 
     | 
    
         
            +
              rdoc.rdoc_files.include('lib/**/*.rb')
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
         
     | 
| 
      
 18 
     | 
    
         
            +
            load 'rails/tasks/engine.rake'
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            Bundler::GemHelper.install_tasks
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            require 'rake/testtask'
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            Rake::TestTask.new(:test) do |t|
         
     | 
| 
      
 27 
     | 
    
         
            +
              t.libs << 'lib'
         
     | 
| 
      
 28 
     | 
    
         
            +
              t.libs << 'test'
         
     | 
| 
      
 29 
     | 
    
         
            +
              t.pattern = 'test/**/*_test.rb'
         
     | 
| 
      
 30 
     | 
    
         
            +
              t.verbose = false
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            task default: :test
         
     | 
| 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            #= require_tree .
         
     | 
| 
      
 3 
     | 
    
         
            +
            #= require ace/ace
         
     | 
| 
      
 4 
     | 
    
         
            +
            #= require ace/mode-ruby
         
     | 
| 
      
 5 
     | 
    
         
            +
            #= require ace/theme-monokai
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            $(document).ready () ->
         
     | 
| 
      
 8 
     | 
    
         
            +
              window.load_rails_embed_code_editor()
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            window.load_rails_embed_code_editor = () ->
         
     | 
| 
      
 12 
     | 
    
         
            +
              $('.rails_embed_code_editor').each () ->
         
     | 
| 
      
 13 
     | 
    
         
            +
                container = $(this)
         
     | 
| 
      
 14 
     | 
    
         
            +
                options = {
         
     | 
| 
      
 15 
     | 
    
         
            +
                  theme: container.data('theme')
         
     | 
| 
      
 16 
     | 
    
         
            +
                  mode: container.data('mode')
         
     | 
| 
      
 17 
     | 
    
         
            +
                  filename: container.data('filename')
         
     | 
| 
      
 18 
     | 
    
         
            +
                  first_line: container.data('first-line')
         
     | 
| 
      
 19 
     | 
    
         
            +
                  last_line: container.data('last-line')
         
     | 
| 
      
 20 
     | 
    
         
            +
                  editormode: container.data('editormode')
         
     | 
| 
      
 21 
     | 
    
         
            +
                }
         
     | 
| 
      
 22 
     | 
    
         
            +
                setup_editor(container[0], options)
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            setup_editor = (element, options) ->
         
     | 
| 
      
 26 
     | 
    
         
            +
              defaults = {
         
     | 
| 
      
 27 
     | 
    
         
            +
                theme: 'monokai'
         
     | 
| 
      
 28 
     | 
    
         
            +
                mode: 'ruby'
         
     | 
| 
      
 29 
     | 
    
         
            +
                firstLineNumber: 1
         
     | 
| 
      
 30 
     | 
    
         
            +
                editormode: 'readonly'
         
     | 
| 
      
 31 
     | 
    
         
            +
              }
         
     | 
| 
      
 32 
     | 
    
         
            +
              options = $.extend({}, defaults, options);
         
     | 
| 
      
 33 
     | 
    
         
            +
              editor = ace.edit(element)
         
     | 
| 
      
 34 
     | 
    
         
            +
              editor.commands.removeCommand('replace')
         
     | 
| 
      
 35 
     | 
    
         
            +
              editor.setTheme("ace/theme/" + options['theme']);
         
     | 
| 
      
 36 
     | 
    
         
            +
              editor.getSession().setMode("ace/mode/" + options['mode']);
         
     | 
| 
      
 37 
     | 
    
         
            +
              editor.setOption("firstLineNumber", options['first_line'])
         
     | 
| 
      
 38 
     | 
    
         
            +
              editor.setReadOnly(options['editormode'] != 'write')
         
     | 
| 
      
 39 
     | 
    
         
            +
              editor.setAutoScrollEditorIntoView();
         
     | 
| 
      
 40 
     | 
    
         
            +
              editor.setOption("maxLines", 40);
         
     | 
| 
      
 41 
     | 
    
         
            +
              editor.setOption("minLines", 5);
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              if options['editormode'] != 'readonly'
         
     | 
| 
      
 44 
     | 
    
         
            +
                options['last_line'] ?= options['firstLineNumber'] + editor.session.getLength()
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                button = $('<div><button class="rails_embed_code_editor_button">Save</button></div>').appendTo(element).children()
         
     | 
| 
      
 47 
     | 
    
         
            +
                button.text('Enable edit') if options['editormode'] == 'readwrite'
         
     | 
| 
      
 48 
     | 
    
         
            +
                button.click () ->
         
     | 
| 
      
 49 
     | 
    
         
            +
                  if options['editormode'] == 'readwrite'
         
     | 
| 
      
 50 
     | 
    
         
            +
                    button.text('Save')
         
     | 
| 
      
 51 
     | 
    
         
            +
                    editor.setReadOnly(false)
         
     | 
| 
      
 52 
     | 
    
         
            +
                  else
         
     | 
| 
      
 53 
     | 
    
         
            +
                    $.post('/rails_embed_editor/edit', {
         
     | 
| 
      
 54 
     | 
    
         
            +
                      content: editor.getValue()
         
     | 
| 
      
 55 
     | 
    
         
            +
                      first_line: options['first_line']
         
     | 
| 
      
 56 
     | 
    
         
            +
                      last_line: options['last_line']
         
     | 
| 
      
 57 
     | 
    
         
            +
                      filename: options['filename']
         
     | 
| 
      
 58 
     | 
    
         
            +
                    }).success (data) ->
         
     | 
| 
      
 59 
     | 
    
         
            +
                      console.log(data)
         
     | 
| 
         @@ -0,0 +1,66 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /*
         
     | 
| 
      
 2 
     | 
    
         
            +
             * This is a manifest file that'll be compiled into application.css, which will include all the files
         
     | 
| 
      
 3 
     | 
    
         
            +
             * listed below.
         
     | 
| 
      
 4 
     | 
    
         
            +
             *
         
     | 
| 
      
 5 
     | 
    
         
            +
             * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
         
     | 
| 
      
 6 
     | 
    
         
            +
             * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
         
     | 
| 
      
 7 
     | 
    
         
            +
             *
         
     | 
| 
      
 8 
     | 
    
         
            +
             * You're free to add application-wide styles to this file and they'll appear at the top of the
         
     | 
| 
      
 9 
     | 
    
         
            +
             * compiled file, but it's generally better to create a new file per style scope.
         
     | 
| 
      
 10 
     | 
    
         
            +
             *
         
     | 
| 
      
 11 
     | 
    
         
            +
             *= require_self
         
     | 
| 
      
 12 
     | 
    
         
            +
             *= require_tree .
         
     | 
| 
      
 13 
     | 
    
         
            +
             */
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            .rails_embed_code_editor {
         
     | 
| 
      
 16 
     | 
    
         
            +
              position: relative !important;
         
     | 
| 
      
 17 
     | 
    
         
            +
              border: 1px solid lightgray;
         
     | 
| 
      
 18 
     | 
    
         
            +
              margin: auto;
         
     | 
| 
      
 19 
     | 
    
         
            +
            }
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            button.rails_embed_code_editor_button {
         
     | 
| 
      
 22 
     | 
    
         
            +
              position: absolute;
         
     | 
| 
      
 23 
     | 
    
         
            +
              top: 5px;
         
     | 
| 
      
 24 
     | 
    
         
            +
              right: 5px;
         
     | 
| 
      
 25 
     | 
    
         
            +
              z-index: 1000;
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              -moz-box-shadow: inset 0px 1px 0px 0px #ffffff;
         
     | 
| 
      
 28 
     | 
    
         
            +
              -webkit-box-shadow: inset 0px 1px 0px 0px #ffffff;
         
     | 
| 
      
 29 
     | 
    
         
            +
              box-shadow: inset 0px 1px 0px 0px #ffffff;
         
     | 
| 
      
 30 
     | 
    
         
            +
              background-color: #ededed;
         
     | 
| 
      
 31 
     | 
    
         
            +
              -webkit-border-top-left-radius: 0px;
         
     | 
| 
      
 32 
     | 
    
         
            +
              -moz-border-radius-topleft: 0px;
         
     | 
| 
      
 33 
     | 
    
         
            +
              border-top-left-radius: 0px;
         
     | 
| 
      
 34 
     | 
    
         
            +
              -webkit-border-top-right-radius: 0px;
         
     | 
| 
      
 35 
     | 
    
         
            +
              -moz-border-radius-topright: 0px;
         
     | 
| 
      
 36 
     | 
    
         
            +
              border-top-right-radius: 0px;
         
     | 
| 
      
 37 
     | 
    
         
            +
              -webkit-border-bottom-right-radius: 0px;
         
     | 
| 
      
 38 
     | 
    
         
            +
              -moz-border-radius-bottomright: 0px;
         
     | 
| 
      
 39 
     | 
    
         
            +
              border-bottom-right-radius: 0px;
         
     | 
| 
      
 40 
     | 
    
         
            +
              -webkit-border-bottom-left-radius: 0px;
         
     | 
| 
      
 41 
     | 
    
         
            +
              -moz-border-radius-bottomleft: 0px;
         
     | 
| 
      
 42 
     | 
    
         
            +
              border-bottom-left-radius: 0px;
         
     | 
| 
      
 43 
     | 
    
         
            +
              text-indent: 0;
         
     | 
| 
      
 44 
     | 
    
         
            +
              border: 1px solid #dcdcdc;
         
     | 
| 
      
 45 
     | 
    
         
            +
              display: inline-block;
         
     | 
| 
      
 46 
     | 
    
         
            +
              color: #777777;
         
     | 
| 
      
 47 
     | 
    
         
            +
              font-family: Arial;
         
     | 
| 
      
 48 
     | 
    
         
            +
              font-size: 15px;
         
     | 
| 
      
 49 
     | 
    
         
            +
              font-weight: bold;
         
     | 
| 
      
 50 
     | 
    
         
            +
              font-style: normal;
         
     | 
| 
      
 51 
     | 
    
         
            +
              height: 40px;
         
     | 
| 
      
 52 
     | 
    
         
            +
              line-height: 40px;
         
     | 
| 
      
 53 
     | 
    
         
            +
              width: 100px;
         
     | 
| 
      
 54 
     | 
    
         
            +
              text-decoration: none;
         
     | 
| 
      
 55 
     | 
    
         
            +
              text-align: center;
         
     | 
| 
      
 56 
     | 
    
         
            +
              text-shadow: 1px 1px 0px #ffffff;
         
     | 
| 
      
 57 
     | 
    
         
            +
            }
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            button.rails_embed_code_editor_button:hover {
         
     | 
| 
      
 60 
     | 
    
         
            +
              background-color: #dfdfdf;
         
     | 
| 
      
 61 
     | 
    
         
            +
            }
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            button.rails_embed_code_editor_button:active {
         
     | 
| 
      
 64 
     | 
    
         
            +
              top: 6px;
         
     | 
| 
      
 65 
     | 
    
         
            +
              right: 5px;
         
     | 
| 
      
 66 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module RailsEmbedEditor
         
     | 
| 
      
 2 
     | 
    
         
            +
              class EditorController < ApplicationController
         
     | 
| 
      
 3 
     | 
    
         
            +
                def edit
         
     | 
| 
      
 4 
     | 
    
         
            +
                  filename = params[:filename]
         
     | 
| 
      
 5 
     | 
    
         
            +
                  text = params[:content]
         
     | 
| 
      
 6 
     | 
    
         
            +
                  if filename.nil? or text.nil?
         
     | 
| 
      
 7 
     | 
    
         
            +
                    render :json => {:success => false, :params => params.to_json}
         
     | 
| 
      
 8 
     | 
    
         
            +
                  else
         
     | 
| 
      
 9 
     | 
    
         
            +
                    manager = RailsEmbedEditor::FileManager.from_options(filename, params)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    manager.save_text text
         
     | 
| 
      
 11 
     | 
    
         
            +
                    render :json => {:success => true}
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module RailsEmbedEditor
         
     | 
| 
      
 2 
     | 
    
         
            +
              module ApplicationHelper
         
     | 
| 
      
 3 
     | 
    
         
            +
                def rails_embed_editor(filename, options ={})
         
     | 
| 
      
 4 
     | 
    
         
            +
                  options[:editormode] ||= RailsEmbedEditor::EditorMode::READ_ONLY
         
     | 
| 
      
 5 
     | 
    
         
            +
                  manager = RailsEmbedEditor::FileManager.from_options(filename, options)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  text = manager.read_text
         
     | 
| 
      
 7 
     | 
    
         
            +
                  first_line = manager.first_line
         
     | 
| 
      
 8 
     | 
    
         
            +
                  last_line = manager.last_line
         
     | 
| 
      
 9 
     | 
    
         
            +
                  content_tag('div', text, :class => 'rails_embed_code_editor',
         
     | 
| 
      
 10 
     | 
    
         
            +
                              'data-first-line' => first_line, 'data-last-line' => last_line, 'data-filename' => filename,
         
     | 
| 
      
 11 
     | 
    
         
            +
                              'data-editormode' => options[:editormode])
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <!DOCTYPE html>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <html>
         
     | 
| 
      
 3 
     | 
    
         
            +
            <head>
         
     | 
| 
      
 4 
     | 
    
         
            +
              <title>RailsEmbedEditor</title>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <%= stylesheet_link_tag    "rails_embed_editor/application", media: "all" %>
         
     | 
| 
      
 6 
     | 
    
         
            +
              <%= javascript_include_tag "rails_embed_editor/application" %>
         
     | 
| 
      
 7 
     | 
    
         
            +
              <%= csrf_meta_tags %>
         
     | 
| 
      
 8 
     | 
    
         
            +
            </head>
         
     | 
| 
      
 9 
     | 
    
         
            +
            <body>
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            <%= yield %>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            </body>
         
     | 
| 
      
 14 
     | 
    
         
            +
            </html>
         
     | 
    
        data/config/routes.rb
    ADDED
    
    
| 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module RailsEmbedEditor
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Engine < ::Rails::Engine
         
     | 
| 
      
 3 
     | 
    
         
            +
                #isolate_namespace RailsEmbedEditor
         
     | 
| 
      
 4 
     | 
    
         
            +
                initializer 'rails_embed_editor.action_controller' do |app|
         
     | 
| 
      
 5 
     | 
    
         
            +
                  ActiveSupport.on_load :action_controller do
         
     | 
| 
      
 6 
     | 
    
         
            +
                    helper RailsEmbedEditor::ApplicationHelper
         
     | 
| 
      
 7 
     | 
    
         
            +
                  end
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,54 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module RailsEmbedEditor
         
     | 
| 
      
 2 
     | 
    
         
            +
              class FileManager
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_accessor :first_line, :last_line
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                def initialize(filename, first_line = nil, last_line=nil)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @filename = filename
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @first_line = first_line
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @last_line = last_line
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def self.from_options(filename, options)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  if options[:first_line].nil?
         
     | 
| 
      
 13 
     | 
    
         
            +
                    from_around(filename, options[:line].to_i, options[:radius].to_i)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  else
         
     | 
| 
      
 15 
     | 
    
         
            +
                    RailsEmbedEditor::FileManager.new(filename, options[:first_line].to_i, options[:last_line].to_i)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def self.from_around(filename, line, radius=2)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  first_line = line - radius
         
     | 
| 
      
 21 
     | 
    
         
            +
                  last_line = line + radius
         
     | 
| 
      
 22 
     | 
    
         
            +
                  RailsEmbedEditor::FileManager.new(filename, first_line, last_line)
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                def read_lines
         
     | 
| 
      
 26 
     | 
    
         
            +
                  lines = []
         
     | 
| 
      
 27 
     | 
    
         
            +
                  File.open(@filename, 'r') do |f|
         
     | 
| 
      
 28 
     | 
    
         
            +
                    lines = f.readlines[@first_line-1...@last_line]
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  lines
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                def read_text
         
     | 
| 
      
 34 
     | 
    
         
            +
                  read_lines.join()
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                def save_text(text)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  save_lines(text.split(/\r?\n/).map { |x| "#{x}\n" })
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                def save_lines(lines)
         
     | 
| 
      
 42 
     | 
    
         
            +
                  all_lines = []
         
     | 
| 
      
 43 
     | 
    
         
            +
                  File.open(@filename, 'r') do |f|
         
     | 
| 
      
 44 
     | 
    
         
            +
                    all_lines = f.readlines
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
                  all_lines = all_lines[0...@first_line-1] + lines + all_lines[@last_line..-1]
         
     | 
| 
      
 47 
     | 
    
         
            +
                  File.open(@filename, 'w') do |f|
         
     | 
| 
      
 48 
     | 
    
         
            +
                    all_lines.each do |line|
         
     | 
| 
      
 49 
     | 
    
         
            +
                      f.write(line)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    end
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'ace/rails'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rails_embed_editor/engine'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'rails_embed_editor/config'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'rails_embed_editor/file_manager'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'rails_embed_editor/editor_mode'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            module RailsEmbedEditor
         
     | 
| 
      
 8 
     | 
    
         
            +
              def self.config(&block)
         
     | 
| 
      
 9 
     | 
    
         
            +
                if block_given?
         
     | 
| 
      
 10 
     | 
    
         
            +
                  block.call(RailsEmbedEditor::Config)
         
     | 
| 
      
 11 
     | 
    
         
            +
                else
         
     | 
| 
      
 12 
     | 
    
         
            +
                  RailsEmbedEditor::Config
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'test_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class EditorControllerTest < ActionController::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              tests RailsEmbedEditor::EditorController
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              def destination
         
     | 
| 
      
 7 
     | 
    
         
            +
                File.expand_path('../../tmp/edit_test', __FILE__)
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              def filename
         
     | 
| 
      
 11 
     | 
    
         
            +
                "#{destination}/dumbfile.erb"
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 15 
     | 
    
         
            +
                FileUtils.mkdir_p(File.dirname(filename))
         
     | 
| 
      
 16 
     | 
    
         
            +
                FileUtils.cp 'test/rails_embed_editor/dumbfile.erb', filename
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              test 'should not edit' do
         
     | 
| 
      
 21 
     | 
    
         
            +
                get :edit
         
     | 
| 
      
 22 
     | 
    
         
            +
                assert (not JSON.parse(@response.body)['success']), "Should return not success but returned #{@response.body}"
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              test 'should edit file' do
         
     | 
| 
      
 26 
     | 
    
         
            +
                first_line = 2
         
     | 
| 
      
 27 
     | 
    
         
            +
                last_line = 5
         
     | 
| 
      
 28 
     | 
    
         
            +
                text= 'Replace with some othe ansowmn content'
         
     | 
| 
      
 29 
     | 
    
         
            +
                get :edit, :filename => filename, :first_line => first_line, :last_line => last_line, :content => text
         
     | 
| 
      
 30 
     | 
    
         
            +
                assert(JSON.parse(@response.body)['success'], "Should return success but returned #{@response.body}")
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            == README
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            This README would normally document whatever steps are necessary to get the
         
     | 
| 
      
 4 
     | 
    
         
            +
            application up and running.
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Things you may want to cover:
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            * Ruby version
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            * System dependencies
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            * Configuration
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            * Database creation
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            * Database initialization
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            * How to run the test suite
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            * Services (job queues, cache servers, search engines, etc.)
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            * Deployment instructions
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            * ...
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            Please feel free to use a different markup language if you do not plan to run
         
     | 
| 
      
 28 
     | 
    
         
            +
            <tt>rake doc:app</tt>.
         
     | 
    
        data/test/dummy/Rakefile
    ADDED
    
    
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            // This is a manifest file that'll be compiled into application.js, which will include all the files
         
     | 
| 
      
 2 
     | 
    
         
            +
            // listed below.
         
     | 
| 
      
 3 
     | 
    
         
            +
            //
         
     | 
| 
      
 4 
     | 
    
         
            +
            // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
         
     | 
| 
      
 5 
     | 
    
         
            +
            // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
         
     | 
| 
      
 6 
     | 
    
         
            +
            //
         
     | 
| 
      
 7 
     | 
    
         
            +
            // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
         
     | 
| 
      
 8 
     | 
    
         
            +
            // compiled file.
         
     | 
| 
      
 9 
     | 
    
         
            +
            //
         
     | 
| 
      
 10 
     | 
    
         
            +
            // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
         
     | 
| 
      
 11 
     | 
    
         
            +
            // about supported directives.
         
     | 
| 
      
 12 
     | 
    
         
            +
            //
         
     | 
| 
      
 13 
     | 
    
         
            +
            //= require_tree .
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /*
         
     | 
| 
      
 2 
     | 
    
         
            +
             * This is a manifest file that'll be compiled into application.css, which will include all the files
         
     | 
| 
      
 3 
     | 
    
         
            +
             * listed below.
         
     | 
| 
      
 4 
     | 
    
         
            +
             *
         
     | 
| 
      
 5 
     | 
    
         
            +
             * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
         
     | 
| 
      
 6 
     | 
    
         
            +
             * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
         
     | 
| 
      
 7 
     | 
    
         
            +
             *
         
     | 
| 
      
 8 
     | 
    
         
            +
             * You're free to add application-wide styles to this file and they'll appear at the top of the
         
     | 
| 
      
 9 
     | 
    
         
            +
             * compiled file, but it's generally better to create a new file per style scope.
         
     | 
| 
      
 10 
     | 
    
         
            +
             *
         
     | 
| 
      
 11 
     | 
    
         
            +
             *= require_self
         
     | 
| 
      
 12 
     | 
    
         
            +
             *= require_tree .
         
     | 
| 
      
 13 
     | 
    
         
            +
             */
         
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <!DOCTYPE html>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <html>
         
     | 
| 
      
 3 
     | 
    
         
            +
            <head>
         
     | 
| 
      
 4 
     | 
    
         
            +
              <title>Dummy</title>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
         
     | 
| 
      
 6 
     | 
    
         
            +
              <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
         
     | 
| 
      
 7 
     | 
    
         
            +
              <%= csrf_meta_tags %>
         
     | 
| 
      
 8 
     | 
    
         
            +
            </head>
         
     | 
| 
      
 9 
     | 
    
         
            +
            <body>
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            <%= yield %>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            </body>
         
     | 
| 
      
 14 
     | 
    
         
            +
            </html>
         
     | 
    
        data/test/dummy/bin/rake
    ADDED
    
    
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path('../boot', __FILE__)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'rails/all'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Bundler.require(*Rails.groups)
         
     | 
| 
      
 6 
     | 
    
         
            +
            require "rails_embed_editor"
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            module Dummy
         
     | 
| 
      
 9 
     | 
    
         
            +
              class Application < Rails::Application
         
     | 
| 
      
 10 
     | 
    
         
            +
                # Settings in config/environments/* take precedence over those specified here.
         
     | 
| 
      
 11 
     | 
    
         
            +
                # Application configuration should go into files in config/initializers
         
     | 
| 
      
 12 
     | 
    
         
            +
                # -- all .rb files in that directory are automatically loaded.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
         
     | 
| 
      
 15 
     | 
    
         
            +
                # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
         
     | 
| 
      
 16 
     | 
    
         
            +
                # config.time_zone = 'Central Time (US & Canada)'
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
         
     | 
| 
      
 19 
     | 
    
         
            +
                # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
         
     | 
| 
      
 20 
     | 
    
         
            +
                # config.i18n.default_locale = :de
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # SQLite version 3.x
         
     | 
| 
      
 2 
     | 
    
         
            +
            #   gem install sqlite3
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            #   Ensure the SQLite 3 gem is defined in your Gemfile
         
     | 
| 
      
 5 
     | 
    
         
            +
            #   gem 'sqlite3'
         
     | 
| 
      
 6 
     | 
    
         
            +
            development:
         
     | 
| 
      
 7 
     | 
    
         
            +
              adapter: sqlite3
         
     | 
| 
      
 8 
     | 
    
         
            +
              database: db/development.sqlite3
         
     | 
| 
      
 9 
     | 
    
         
            +
              pool: 5
         
     | 
| 
      
 10 
     | 
    
         
            +
              timeout: 5000
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            # Warning: The database defined as "test" will be erased and
         
     | 
| 
      
 13 
     | 
    
         
            +
            # re-generated from your development database when you run "rake".
         
     | 
| 
      
 14 
     | 
    
         
            +
            # Do not set this db to the same as development or production.
         
     | 
| 
      
 15 
     | 
    
         
            +
            test:
         
     | 
| 
      
 16 
     | 
    
         
            +
              adapter: sqlite3
         
     | 
| 
      
 17 
     | 
    
         
            +
              database: db/test.sqlite3
         
     | 
| 
      
 18 
     | 
    
         
            +
              pool: 5
         
     | 
| 
      
 19 
     | 
    
         
            +
              timeout: 5000
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            production:
         
     | 
| 
      
 22 
     | 
    
         
            +
              adapter: sqlite3
         
     | 
| 
      
 23 
     | 
    
         
            +
              database: db/production.sqlite3
         
     | 
| 
      
 24 
     | 
    
         
            +
              pool: 5
         
     | 
| 
      
 25 
     | 
    
         
            +
              timeout: 5000
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Dummy::Application.configure do
         
     | 
| 
      
 2 
     | 
    
         
            +
              # Settings specified here will take precedence over those in config/application.rb.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              # In the development environment your application's code is reloaded on
         
     | 
| 
      
 5 
     | 
    
         
            +
              # every request. This slows down response time but is perfect for development
         
     | 
| 
      
 6 
     | 
    
         
            +
              # since you don't have to restart the web server when you make code changes.
         
     | 
| 
      
 7 
     | 
    
         
            +
              config.cache_classes = false
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              # Do not eager load code on boot.
         
     | 
| 
      
 10 
     | 
    
         
            +
              config.eager_load = false
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              # Show full error reports and disable caching.
         
     | 
| 
      
 13 
     | 
    
         
            +
              config.consider_all_requests_local       = true
         
     | 
| 
      
 14 
     | 
    
         
            +
              config.action_controller.perform_caching = false
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              # Don't care if the mailer can't send.
         
     | 
| 
      
 17 
     | 
    
         
            +
              config.action_mailer.raise_delivery_errors = false
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              # Print deprecation notices to the Rails logger.
         
     | 
| 
      
 20 
     | 
    
         
            +
              config.active_support.deprecation = :log
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              # Raise an error on page load if there are pending migrations
         
     | 
| 
      
 23 
     | 
    
         
            +
              config.active_record.migration_error = :page_load
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              # Debug mode disables concatenation and preprocessing of assets.
         
     | 
| 
      
 26 
     | 
    
         
            +
              # This option may cause significant delays in view rendering with a large
         
     | 
| 
      
 27 
     | 
    
         
            +
              # number of complex assets.
         
     | 
| 
      
 28 
     | 
    
         
            +
              config.assets.debug = true
         
     | 
| 
      
 29 
     | 
    
         
            +
            end
         
     |