hocus_pocus 0.2.0 → 0.2.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 +7 -0
 - data/Gemfile +1 -1
 - data/engines/generator/app/views/hocus_pocus/generator/generator/index.html.erb +2 -2
 - data/engines/generator/lib/hocus_pocus/generator/railtie.rb +1 -1
 - data/engines/recorder/lib/assets/javascripts/recorder.js.erb +13 -0
 - data/lib/hocus_pocus/config.rb +4 -12
 - data/lib/hocus_pocus/version.rb +1 -1
 - metadata +37 -58
 - data/engines/recorder/lib/assets/javascripts/recorder.js.coffee.erb +0 -10
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: edecd980d715c253b5c537d514126d6b47c8464a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: fd40e8fda64b5b518f428497484f422a3d082e76
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 565e4e6c0ae027437fad7b42457585d0f052bc992bbe08d9ef3fe8d7557805c372eef6c9814ab9a90d63bf9f00465afb001b7876932a347d308a57f204f7e246
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3e4ec870cb057bb87d3d5365b22baa4c00329032fe4b132b8bd03a0edd71f9932a6b1ff0c27994d460a4b89d999d79c83644d43b5dacece259611eeb40e5e4ea
         
     | 
    
        data/Gemfile
    CHANGED
    
    
| 
         @@ -4,7 +4,7 @@ 
     | 
|
| 
       4 
4 
     | 
    
         
             
                <%= javascript_include_tag 'application' %>
         
     | 
| 
       5 
5 
     | 
    
         
             
                <%= csrf_meta_tags %>
         
     | 
| 
       6 
6 
     | 
    
         
             
                <script type="text/javascript">
         
     | 
| 
       7 
     | 
    
         
            -
                  $( 
     | 
| 
      
 7 
     | 
    
         
            +
                  $(document).on('click', '#add_attr_type', function() {
         
     | 
| 
       8 
8 
     | 
    
         
             
                      var i = $('#attr_type input').length;
         
     | 
| 
       9 
9 
     | 
    
         
             
                      $('#attr_type').append('<%= escape_javascript text_field_tag('attr[@]', '', :style => 'width: 50px') %>:<%= escape_javascript(type_select 'type[@]', :class => 'type') %>'.replace(/@/g, i));
         
     | 
| 
       10 
10 
     | 
    
         
             
                      $('#attr_' + i).focus();
         
     | 
| 
         @@ -13,7 +13,7 @@ 
     | 
|
| 
       13 
13 
     | 
    
         
             
              </head>
         
     | 
| 
       14 
14 
     | 
    
         
             
              <body>
         
     | 
| 
       15 
15 
     | 
    
         
             
                <h1>generate scaffold</h1>
         
     | 
| 
       16 
     | 
    
         
            -
                <%= form_tag scaffold_generator_path, :remote => true do %>
         
     | 
| 
      
 16 
     | 
    
         
            +
                <%= form_tag scaffold_generator_path, :remote => true, :id => 'generator_form' do %>
         
     | 
| 
       17 
17 
     | 
    
         
             
                  <% if @name.include? '_' %>
         
     | 
| 
       18 
18 
     | 
    
         
             
                    g scaffold
         
     | 
| 
       19 
19 
     | 
    
         
             
                    <%= select_tag :name, options_for_select([@name, @name.gsub('_', '/')]) %>
         
     | 
| 
         @@ -15,7 +15,7 @@ module HocusPocus 
     | 
|
| 
       15 
15 
     | 
    
         
             
                    ActiveSupport.on_load(:action_view) do
         
     | 
| 
       16 
16 
     | 
    
         
             
                      if HocusPocus.config.enable_generator
         
     | 
| 
       17 
17 
     | 
    
         
             
                        class ::ActionView::Base
         
     | 
| 
       18 
     | 
    
         
            -
                          def method_missing(method, args 
     | 
| 
      
 18 
     | 
    
         
            +
                          def method_missing(method, *args, &blk)
         
     | 
| 
       19 
19 
     | 
    
         
             
                            if method.to_s =~ /(new_|edit_)?(.*)(_path|_url)\z/
         
     | 
| 
       20 
20 
     | 
    
         
             
                              # to avoid DoubleRenderError
         
     | 
| 
       21 
21 
     | 
    
         
             
                              controller.instance_variable_set :@_response_body, nil
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            $(document).on('submit', 'form', function() {
         
     | 
| 
      
 2 
     | 
    
         
            +
              var scenario = ["  scenario 'GENERATED' do"];
         
     | 
| 
      
 3 
     | 
    
         
            +
              scenario.push("    visit '" + window.location.pathname + "'");
         
     | 
| 
      
 4 
     | 
    
         
            +
              $(this).find('input[type=text],input[type=email],input[type=url],input[type=number],input[type=search],textarea').each(function() {
         
     | 
| 
      
 5 
     | 
    
         
            +
                scenario.push("    fill_in '" + $(this).attr('id') + "', :with => '" + $(this).val() + "'");
         
     | 
| 
      
 6 
     | 
    
         
            +
              });
         
     | 
| 
      
 7 
     | 
    
         
            +
              $(this).find('select').each(function() {
         
     | 
| 
      
 8 
     | 
    
         
            +
                scenario.push("    select '" + $(this).children(':selected').text() + "', :from => '" + $(this).attr('id') + "'");
         
     | 
| 
      
 9 
     | 
    
         
            +
              });
         
     | 
| 
      
 10 
     | 
    
         
            +
              scenario.push("    click_button '" + $(this).find('input[type=submit]').val() + "'");
         
     | 
| 
      
 11 
     | 
    
         
            +
              $(this).append('<textarea id="<%= HocusPocus::Recorder::SPEC %>" name="<%= HocusPocus::Recorder::SPEC %>" style="height: 0px; width: 0px;" />');
         
     | 
| 
      
 12 
     | 
    
         
            +
              $('#<%= HocusPocus::Recorder::SPEC %>').val(scenario.join('\n'));
         
     | 
| 
      
 13 
     | 
    
         
            +
            })
         
     | 
    
        data/lib/hocus_pocus/config.rb
    CHANGED
    
    | 
         @@ -1,23 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'active_support/configurable'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module HocusPocus
         
     | 
| 
      
 4 
     | 
    
         
            +
              include ActiveSupport::Configurable
         
     | 
| 
      
 5 
     | 
    
         
            +
              config_accessor :enable_generator, :enable_editor, :enable_scenario_recorder, :enable_command_line
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       4 
7 
     | 
    
         
             
              # Configures global settings for HocusPocus
         
     | 
| 
       5 
8 
     | 
    
         
             
              #   HocusPocus.configure do |config|
         
     | 
| 
       6 
9 
     | 
    
         
             
              #     config.enable_generator = false
         
     | 
| 
       7 
10 
     | 
    
         
             
              #   end
         
     | 
| 
       8 
11 
     | 
    
         
             
              def self.configure(&block)
         
     | 
| 
       9 
     | 
    
         
            -
                yield  
     | 
| 
       10 
     | 
    
         
            -
              end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              # Global settings for HocusPocus
         
     | 
| 
       13 
     | 
    
         
            -
              def self.config
         
     | 
| 
       14 
     | 
    
         
            -
                @config
         
     | 
| 
       15 
     | 
    
         
            -
              end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
              # need a Class for 3.0
         
     | 
| 
       18 
     | 
    
         
            -
              class Configuration #:nodoc:
         
     | 
| 
       19 
     | 
    
         
            -
                include ActiveSupport::Configurable
         
     | 
| 
       20 
     | 
    
         
            -
                config_accessor :enable_generator, :enable_editor, :enable_scenario_recorder, :enable_command_line
         
     | 
| 
      
 12 
     | 
    
         
            +
                yield self
         
     | 
| 
       21 
13 
     | 
    
         
             
              end
         
     | 
| 
       22 
14 
     | 
    
         | 
| 
       23 
15 
     | 
    
         
             
              # this is ugly. why can't we pass the default value to config_accessor...?
         
     | 
    
        data/lib/hocus_pocus/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,48 +1,37 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            --- !ruby/object:Gem::Specification 
     | 
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: hocus_pocus
         
     | 
| 
       3 
     | 
    
         
            -
            version: !ruby/object:Gem::Version 
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 
         
     | 
| 
       6 
     | 
    
         
            -
              segments: 
         
     | 
| 
       7 
     | 
    
         
            -
              - 0
         
     | 
| 
       8 
     | 
    
         
            -
              - 2
         
     | 
| 
       9 
     | 
    
         
            -
              - 0
         
     | 
| 
       10 
     | 
    
         
            -
              version: 0.2.0
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.1
         
     | 
| 
       11 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
     | 
    
         
            -
            authors: 
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
       13 
7 
     | 
    
         
             
            - Akira Matsuda
         
     | 
| 
       14 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       15 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2013-07-16 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
       21 
14 
     | 
    
         
             
              name: nested_scaffold
         
     | 
| 
       22 
     | 
    
         
            -
               
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                 
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       27 
     | 
    
         
            -
                  - !ruby/object:Gem::Version 
         
     | 
| 
       28 
     | 
    
         
            -
                    hash: 27
         
     | 
| 
       29 
     | 
    
         
            -
                    segments: 
         
     | 
| 
       30 
     | 
    
         
            -
                    - 0
         
     | 
| 
       31 
     | 
    
         
            -
                    - 1
         
     | 
| 
       32 
     | 
    
         
            -
                    - 0
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
19 
     | 
    
         
             
                    version: 0.1.0
         
     | 
| 
       34 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
     | 
    
         
            -
               
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 0.1.0
         
     | 
| 
       36 
27 
     | 
    
         
             
            description: A magical Engine that casts a spell on your Rails 3.1 app
         
     | 
| 
       37 
     | 
    
         
            -
            email: 
     | 
| 
      
 28 
     | 
    
         
            +
            email:
         
     | 
| 
       38 
29 
     | 
    
         
             
            - ronnie@dio.jp
         
     | 
| 
       39 
30 
     | 
    
         
             
            executables: []
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
31 
     | 
    
         
             
            extensions: []
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
            extra_rdoc_files: 
         
     | 
| 
      
 32 
     | 
    
         
            +
            extra_rdoc_files:
         
     | 
| 
       44 
33 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       45 
     | 
    
         
            -
            files: 
     | 
| 
      
 34 
     | 
    
         
            +
            files:
         
     | 
| 
       46 
35 
     | 
    
         
             
            - .document
         
     | 
| 
       47 
36 
     | 
    
         
             
            - .gitignore
         
     | 
| 
       48 
37 
     | 
    
         
             
            - CHANGELOG
         
     | 
| 
         @@ -75,7 +64,7 @@ files: 
     | 
|
| 
       75 
64 
     | 
    
         
             
            - engines/recorder/app/views/hocus_pocus/recorder/recorder/destroy.js.erb
         
     | 
| 
       76 
65 
     | 
    
         
             
            - engines/recorder/app/views/hocus_pocus/recorder/recorder/index.js.erb
         
     | 
| 
       77 
66 
     | 
    
         
             
            - engines/recorder/config/routes.rb
         
     | 
| 
       78 
     | 
    
         
            -
            - engines/recorder/lib/assets/javascripts/recorder.js. 
     | 
| 
      
 67 
     | 
    
         
            +
            - engines/recorder/lib/assets/javascripts/recorder.js.erb
         
     | 
| 
       79 
68 
     | 
    
         
             
            - engines/recorder/lib/hocus_pocus/recorder/engine.rb
         
     | 
| 
       80 
69 
     | 
    
         
             
            - engines/recorder/lib/hocus_pocus/recorder/filter.rb
         
     | 
| 
       81 
70 
     | 
    
         
             
            - engines/recorder/lib/hocus_pocus/recorder/middleware.rb
         
     | 
| 
         @@ -94,43 +83,33 @@ files: 
     | 
|
| 
       94 
83 
     | 
    
         
             
            - test/helper.rb
         
     | 
| 
       95 
84 
     | 
    
         
             
            - test/test_hocus_pocus.rb
         
     | 
| 
       96 
85 
     | 
    
         
             
            homepage: https://github.com/amatsuda/hocus_pocus
         
     | 
| 
       97 
     | 
    
         
            -
            licenses: 
     | 
| 
      
 86 
     | 
    
         
            +
            licenses:
         
     | 
| 
       98 
87 
     | 
    
         
             
            - MIT
         
     | 
| 
      
 88 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       99 
89 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       100 
90 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
            require_paths: 
         
     | 
| 
      
 91 
     | 
    
         
            +
            require_paths:
         
     | 
| 
       103 
92 
     | 
    
         
             
            - lib
         
     | 
| 
       104 
93 
     | 
    
         
             
            - engines/generator/lib
         
     | 
| 
       105 
94 
     | 
    
         
             
            - engines/editor/lib
         
     | 
| 
       106 
95 
     | 
    
         
             
            - engines/recorder/lib
         
     | 
| 
       107 
96 
     | 
    
         
             
            - engines/command_line/lib
         
     | 
| 
       108 
     | 
    
         
            -
            required_ruby_version: !ruby/object:Gem::Requirement 
     | 
| 
       109 
     | 
    
         
            -
               
     | 
| 
       110 
     | 
    
         
            -
               
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
              none: false
         
     | 
| 
       119 
     | 
    
         
            -
              requirements: 
         
     | 
| 
       120 
     | 
    
         
            -
              - - ">="
         
     | 
| 
       121 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
         
     | 
| 
       122 
     | 
    
         
            -
                  hash: 3
         
     | 
| 
       123 
     | 
    
         
            -
                  segments: 
         
     | 
| 
       124 
     | 
    
         
            -
                  - 0
         
     | 
| 
       125 
     | 
    
         
            -
                  version: "0"
         
     | 
| 
      
 97 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 98 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 99 
     | 
    
         
            +
              - - '>='
         
     | 
| 
      
 100 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 101 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 102 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 103 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 104 
     | 
    
         
            +
              - - '>='
         
     | 
| 
      
 105 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 106 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       126 
107 
     | 
    
         
             
            requirements: []
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
108 
     | 
    
         
             
            rubyforge_project: hocus_pocus
         
     | 
| 
       129 
     | 
    
         
            -
            rubygems_version:  
     | 
| 
      
 109 
     | 
    
         
            +
            rubygems_version: 2.0.3
         
     | 
| 
       130 
110 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       131 
     | 
    
         
            -
            specification_version:  
     | 
| 
      
 111 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
       132 
112 
     | 
    
         
             
            summary: A magical Engine that casts a spell on your Rails 3.1 app
         
     | 
| 
       133 
     | 
    
         
            -
            test_files: 
     | 
| 
      
 113 
     | 
    
         
            +
            test_files:
         
     | 
| 
       134 
114 
     | 
    
         
             
            - test/helper.rb
         
     | 
| 
       135 
115 
     | 
    
         
             
            - test/test_hocus_pocus.rb
         
     | 
| 
       136 
     | 
    
         
            -
            has_rdoc: 
         
     | 
| 
         @@ -1,10 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            $('form').live 'submit', ->
         
     | 
| 
       2 
     | 
    
         
            -
              scenario = ["  scenario 'GENERATED' do"]
         
     | 
| 
       3 
     | 
    
         
            -
              scenario.push "    visit '#{window.location.pathname}'"
         
     | 
| 
       4 
     | 
    
         
            -
              $(this).find('input[type=text],input[type=email],input[type=url],input[type=number],input[type=search],textarea').each ->
         
     | 
| 
       5 
     | 
    
         
            -
                scenario.push "    fill_in '#{$(this).attr('id')}', :with => '#{$(this).val()}'"
         
     | 
| 
       6 
     | 
    
         
            -
              $(this).find('select').each ->
         
     | 
| 
       7 
     | 
    
         
            -
                scenario.push "    select '#{$(this).children(':selected').text()}', :from => '#{$(this).attr('id')}'"
         
     | 
| 
       8 
     | 
    
         
            -
              scenario.push "    click_button '#{$(this).find('input[type=submit]').val()}'"
         
     | 
| 
       9 
     | 
    
         
            -
              $(this).append '<textarea id="<%= HocusPocus::Recorder::SPEC %>" name="<%= HocusPocus::Recorder::SPEC %>" style="height: 0px; width: 0px;" />'
         
     | 
| 
       10 
     | 
    
         
            -
              $('#<%= HocusPocus::Recorder::SPEC %>').val(scenario.join('\n'))
         
     |