effective_developer 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +31 -9
 - data/app/models/effective/code_writer.rb +218 -0
 - data/lib/effective_developer/version.rb +1 -1
 - data/lib/generators/effective/ability_generator.rb +78 -0
 - data/lib/generators/effective/controller_generator.rb +27 -9
 - data/lib/generators/effective/datatable_generator.rb +20 -2
 - data/lib/generators/effective/form_generator.rb +46 -0
 - data/lib/generators/effective/helpers.rb +94 -11
 - data/lib/generators/effective/menu_generator.rb +52 -0
 - data/lib/generators/effective/migration_generator.rb +16 -2
 - data/lib/generators/effective/model_generator.rb +23 -1
 - data/lib/generators/effective/route_generator.rb +58 -2
 - data/lib/generators/effective/scaffold_controller_generator.rb +51 -0
 - data/lib/generators/effective/scaffold_generator.rb +25 -52
 - data/lib/generators/effective/views_generator.rb +47 -0
 - data/lib/scaffolds/controllers/controller.rb +142 -0
 - data/lib/scaffolds/datatables/datatable.rb +18 -0
 - data/lib/scaffolds/forms/_form.html.haml +9 -0
 - data/lib/{generators/effective_developer/csv_importer.rb.erb → scaffolds/importers/csv_importer.rb} +0 -0
 - data/lib/scaffolds/models/model.rb +48 -0
 - data/lib/scaffolds/views/_resource.html.haml +7 -0
 - data/lib/scaffolds/views/edit.html.haml +3 -0
 - data/lib/scaffolds/views/index.html.haml +10 -0
 - data/lib/scaffolds/views/new.html.haml +3 -0
 - data/lib/scaffolds/views/show.html.haml +3 -0
 - data/lib/tasks/effective_csv_importer.rake +1 -1
 - metadata +18 -12
 - data/app/scaffolds/controllers/controller.rb +0 -13
 - data/app/scaffolds/datatables/datatable.rb +0 -14
 - data/app/scaffolds/models/model.rb +0 -15
 - data/app/scaffolds/views/_form.html.haml +0 -15
 - data/app/scaffolds/views/edit.html.haml +0 -7
 - data/app/scaffolds/views/index.html.haml +0 -25
 - data/app/scaffolds/views/new.html.haml +0 -5
 - data/app/scaffolds/views/show.html.haml +0 -11
 - data/lib/generators/effective/view_generator.rb +0 -40
 
| 
         @@ -1,25 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            %h1 Listing <%= plural_table_name %>
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            %table
         
     | 
| 
       4 
     | 
    
         
            -
              %thead
         
     | 
| 
       5 
     | 
    
         
            -
                %tr
         
     | 
| 
       6 
     | 
    
         
            -
            <% for attribute in attributes -%>
         
     | 
| 
       7 
     | 
    
         
            -
                  %th <%= attribute.human_name %>
         
     | 
| 
       8 
     | 
    
         
            -
            <% end -%>
         
     | 
| 
       9 
     | 
    
         
            -
                  %th
         
     | 
| 
       10 
     | 
    
         
            -
                  %th
         
     | 
| 
       11 
     | 
    
         
            -
                  %th
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
              %tbody
         
     | 
| 
       14 
     | 
    
         
            -
                - @<%= plural_table_name %>.each do |<%= singular_table_name %>|
         
     | 
| 
       15 
     | 
    
         
            -
                  %tr
         
     | 
| 
       16 
     | 
    
         
            -
            <% for attribute in attributes -%>
         
     | 
| 
       17 
     | 
    
         
            -
                    %td= <%= singular_table_name %>.<%= attribute.name %>
         
     | 
| 
       18 
     | 
    
         
            -
            <% end -%>
         
     | 
| 
       19 
     | 
    
         
            -
                    %td= link_to 'Show', <%= singular_table_name %>
         
     | 
| 
       20 
     | 
    
         
            -
                    %td= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>)
         
     | 
| 
       21 
     | 
    
         
            -
                    %td= link_to 'Destroy', <%= singular_table_name %>, method: :delete, data: { confirm: 'Are you sure?' }
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            %br
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
            = link_to 'New <%= human_name %>', new_<%= singular_table_name %>_path
         
     | 
| 
         @@ -1,11 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            %p#notice= notice
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            <% for attribute in attributes -%>
         
     | 
| 
       4 
     | 
    
         
            -
            %p
         
     | 
| 
       5 
     | 
    
         
            -
              %b <%= attribute.human_name %>:
         
     | 
| 
       6 
     | 
    
         
            -
              = @<%= singular_table_name %>.<%= attribute.name %>
         
     | 
| 
       7 
     | 
    
         
            -
            <% end -%>
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            = link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>)
         
     | 
| 
       10 
     | 
    
         
            -
            \|
         
     | 
| 
       11 
     | 
    
         
            -
            = link_to 'Back', <%= index_helper %>_path
         
     | 
| 
         @@ -1,40 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # rails generate effective:view NAME [index show] [options]
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            module Effective
         
     | 
| 
       4 
     | 
    
         
            -
              module Generators
         
     | 
| 
       5 
     | 
    
         
            -
                class ViewGenerator < Rails::Generators::NamedBase
         
     | 
| 
       6 
     | 
    
         
            -
                  include Helpers
         
     | 
| 
       7 
     | 
    
         
            -
                  source_root File.expand_path(('../' * 4) + 'app/scaffolds', __FILE__)
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                  desc 'Creates one or more views in your app/views folder.'
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                  argument :actions, type: :array, default: ['crud'], banner: 'index show'
         
     | 
| 
       12 
     | 
    
         
            -
                  class_option :attributes, type: :array, default: [], desc: 'Included form attributes, otherwise read from model'
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                  attr_accessor :attributes
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                  def initialize(args, *options)
         
     | 
| 
       17 
     | 
    
         
            -
                    if options.kind_of?(Array) && options.second.kind_of?(Hash)
         
     | 
| 
       18 
     | 
    
         
            -
                      self.attributes = options.second.delete(:attributes)
         
     | 
| 
       19 
     | 
    
         
            -
                    end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                    super
         
     | 
| 
       22 
     | 
    
         
            -
                  end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  def create_views
         
     | 
| 
       25 
     | 
    
         
            -
                    (invoked_actions & available_actions).each do |action|
         
     | 
| 
       26 
     | 
    
         
            -
                      filename = "#{action}.html.haml"
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                      template "views/#{filename}", File.join('app/views', file_path, filename)
         
     | 
| 
       29 
     | 
    
         
            -
                    end
         
     | 
| 
       30 
     | 
    
         
            -
                  end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                  protected
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                  def available_actions
         
     | 
| 
       35 
     | 
    
         
            -
                    %w(index new show edit)
         
     | 
| 
       36 
     | 
    
         
            -
                  end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                end
         
     | 
| 
       39 
     | 
    
         
            -
              end
         
     | 
| 
       40 
     | 
    
         
            -
            end
         
     |