ez 1.3.0 → 1.5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +8 -14
  4. data/lib/ez.rb +11 -17
  5. data/lib/ez/domain_modeler.rb +6 -2
  6. data/lib/ez/model.rb +1 -11
  7. data/lib/ez/schema_modifier.rb +25 -15
  8. data/lib/ez/version.rb +1 -1
  9. data/lib/tasks/ez_tasks.rake +2 -2
  10. metadata +4 -39
  11. data/lib/ez/apis.rb +0 -26
  12. data/lib/ez/controller.rb +0 -19
  13. data/lib/ez/dispatcher.rb +0 -28
  14. data/lib/ez/mapper.rb +0 -22
  15. data/lib/ez/view_helpers.rb +0 -18
  16. data/lib/generators/ez/resource/USAGE +0 -35
  17. data/lib/generators/ez/resource/migration.rb +0 -15
  18. data/lib/generators/ez/resource/resource_generator.rb +0 -143
  19. data/lib/generators/ez/resource/templates/bootstrapped/edit.html.erb +0 -26
  20. data/lib/generators/ez/resource/templates/bootstrapped/index.html.erb +0 -42
  21. data/lib/generators/ez/resource/templates/bootstrapped/new.html.erb +0 -26
  22. data/lib/generators/ez/resource/templates/bootstrapped/show.html.erb +0 -11
  23. data/lib/generators/ez/resource/templates/controller.rb +0 -70
  24. data/lib/generators/ez/resource/templates/dried/_form.html.erb +0 -13
  25. data/lib/generators/ez/resource/templates/dried/bootstrapped/_form.html.erb +0 -21
  26. data/lib/generators/ez/resource/templates/dried/bootstrapped/edit.html.erb +0 -5
  27. data/lib/generators/ez/resource/templates/dried/bootstrapped/index.html.erb +0 -42
  28. data/lib/generators/ez/resource/templates/dried/bootstrapped/new.html.erb +0 -5
  29. data/lib/generators/ez/resource/templates/dried/bootstrapped/show.html.erb +0 -11
  30. data/lib/generators/ez/resource/templates/dried/controller.rb +0 -72
  31. data/lib/generators/ez/resource/templates/dried/edit.html.erb +0 -3
  32. data/lib/generators/ez/resource/templates/dried/index.html.erb +0 -40
  33. data/lib/generators/ez/resource/templates/dried/new.html.erb +0 -3
  34. data/lib/generators/ez/resource/templates/dried/show.html.erb +0 -9
  35. data/lib/generators/ez/resource/templates/edit.html.erb +0 -24
  36. data/lib/generators/ez/resource/templates/index.html.erb +0 -40
  37. data/lib/generators/ez/resource/templates/migration.rb +0 -15
  38. data/lib/generators/ez/resource/templates/model.rb +0 -2
  39. data/lib/generators/ez/resource/templates/new.html.erb +0 -22
  40. data/lib/generators/ez/resource/templates/show.html.erb +0 -9
  41. data/lib/generators/ez/style/USAGE +0 -31
  42. data/lib/generators/ez/style/style_generator.rb +0 -34
  43. data/lib/generators/ez/style/templates/layout.html.erb +0 -66
  44. data/lib/generators/ez/user/templates/user_controller.rb +0 -68
  45. data/lib/generators/ez/user/user_generator.rb +0 -91
  46. data/lib/generators/ez/views/USAGE +0 -33
@@ -1,5 +0,0 @@
1
- <div class="page-header">
2
- <h1>Editing <%= human_name.titleize %> #<%%= @<%= singular_table_name %>.id %></h1>
3
- </div>
4
-
5
- <%%= render 'form' %>
@@ -1,42 +0,0 @@
1
- <div class="page-header">
2
- <h1><%= plural_table_name.humanize %></h1>
3
- </div>
4
-
5
- <% if named_routes? -%>
6
- <p><%%= link_to 'Add a New <%= human_name.titleize %>', new_<%= singular_table_name %>_url, class: 'btn btn-primary' %></p>
7
- <% else -%>
8
- <p><%%= link_to 'Add a New <%= human_name.titleize %>', "/<%= plural_name %>/new", class: 'btn btn-primary' %></p>
9
- <% end -%>
10
-
11
- <table class="table table-hover">
12
- <thead>
13
- <tr>
14
- <% attributes.each do |attribute| -%>
15
- <th><%= attribute.human_name %></th>
16
- <% end -%>
17
- <th></th>
18
- <th></th>
19
- <th></th>
20
- </tr>
21
- </thead>
22
-
23
- <tbody>
24
- <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
25
- <tr>
26
- <% attributes.each do |attribute| -%>
27
- <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
28
- <% end -%>
29
- <% if named_routes? %>
30
- <td><%%= link_to '<i class="fa fa-search-plus"></i>'.html_safe, <%= singular_table_name %>_url(<%= singular_table_name %>), class: 'btn btn-primary' %></td>
31
- <td><%%= link_to '<i class="fa fa-edit"></i>'.html_safe, edit_<%= singular_table_name %>_url(<%= singular_table_name %>), class: 'btn btn-warning' %></td>
32
- <td><%%= link_to '<i class="fa fa-trash-o"></i>'.html_safe, <%= singular_table_name %>_url(<%= singular_table_name %>), method: 'delete', data: { confirm: "Do you really want to delete this <%= singular_table_name %>?" }, class: 'btn btn-danger' %></td>
33
- <% else %>
34
- <td><%%= link_to '<i class="fa fa-search-plus"></i>'.html_safe, "/<%= plural_name %>/#{<%= singular_table_name %>.id}", class: 'btn btn-primary' %></td>
35
- <td><%%= link_to '<i class="fa fa-edit"></i>'.html_safe, "/<%= plural_name %>/#{<%= singular_table_name %>.id}/edit", class: 'btn btn-warning' %></td>
36
- <td><%%= link_to '<i class="fa fa-trash-o"></i>'.html_safe, "/<%= plural_name %>/#{<%= singular_table_name %>.id}", method: 'delete', data: { confirm: "Do you really want to delete this <%= singular_table_name %>?" }, class: 'btn btn-danger' %></td>
37
- <% end %>
38
- </tr>
39
- <%% end %>
40
- </tbody>
41
- </table>
42
-
@@ -1,5 +0,0 @@
1
- <div class="page-header">
2
- <h1>New <%= human_name.titleize %></h1>
3
- </div>
4
-
5
- <%%= render 'form' %>
@@ -1,11 +0,0 @@
1
- <div class="page-header">
2
- <h1><%= human_name.titleize %> #<%%= @<%= singular_table_name %>.id %></h1>
3
- </div>
4
-
5
- <dl class="dl-horizontal">
6
- <% attributes.each do |attribute| -%>
7
- <dt><%= attribute.human_name %></dt>
8
- <dd><%%= @<%= singular_table_name %>.<%= attribute.name %> %></dd>
9
-
10
- <% end %>
11
- </dl>
@@ -1,72 +0,0 @@
1
- class <%= plural_name.camelize %>Controller < ApplicationController
2
-
3
- before_action :set_<%= singular_name.underscore %>, only: [:show, :edit, :update, :destroy]
4
-
5
- def index
6
- @<%= plural_name.underscore %> = <%= class_name %>.all
7
- end
8
-
9
- def show
10
- end
11
-
12
- def new
13
- @<%= singular_name.underscore %> = <%= class_name %>.new
14
- end
15
-
16
- def create
17
- @<%= singular_name.underscore %> = <%= class_name %>.new
18
- <% attributes.each do |attribute| -%>
19
- @<%= singular_name.underscore %>.<%= attribute.name %> = params[:<%= singular_name.underscore %>][:<%= attribute.name %>]
20
- <% end %>
21
- <% if named_routes? -%>
22
- if @<%= singular_name.underscore %>.save
23
- redirect_to <%= plural_name %>_url
24
- else
25
- render 'new'
26
- end
27
- <% else -%>
28
- if @<%= singular_name.underscore %>.save
29
- redirect_to "/<%= plural_name %>"
30
- else
31
- render 'new'
32
- end
33
- <% end -%>
34
- end
35
-
36
- def edit
37
- end
38
-
39
- def update
40
- <% attributes.each do |attribute| -%>
41
- @<%= singular_name.underscore %>.<%= attribute.name %> = params[:<%= singular_name.underscore %>][:<%= attribute.name %>]
42
- <% end %>
43
- <% if named_routes? -%>
44
- if @<%= singular_name.underscore %>.save
45
- redirect_to <%= plural_name %>_url
46
- else
47
- render 'new'
48
- end
49
- <% else -%>
50
- if @<%= singular_name.underscore %>.save
51
- redirect_to "/<%= plural_name %>"
52
- else
53
- render 'new'
54
- end
55
- <% end -%>
56
- end
57
-
58
- def destroy
59
- @<%= singular_name.underscore %>.destroy
60
- <% if named_routes? -%>
61
- redirect_to <%= plural_name %>_url
62
- <% else -%>
63
- redirect_to "/<%= plural_name %>"
64
- <% end -%>
65
- end
66
-
67
- private
68
-
69
- def set_<%= singular_name.underscore %>
70
- @<%= singular_name.underscore %> = <%= class_name %>.find(params[:id])
71
- end
72
- end
@@ -1,3 +0,0 @@
1
- <h1>Editing <%= human_name.titleize %> #<%%= @<%= singular_table_name %>.id %></h1>
2
-
3
- <%%= render 'form' %>
@@ -1,40 +0,0 @@
1
- <h1><%= plural_table_name.humanize %></h1>
2
-
3
- <% if named_routes? -%>
4
- <p><%%= link_to 'Add a New <%= human_name.titleize %>', new_<%= singular_table_name %>_url %></p>
5
- <% else -%>
6
- <p><%%= link_to 'Add a New <%= human_name.titleize %>', "/<%= plural_name %>/new" %></p>
7
- <% end -%>
8
-
9
- <table>
10
- <thead>
11
- <tr>
12
- <% attributes.each do |attribute| -%>
13
- <th><%= attribute.human_name %></th>
14
- <% end -%>
15
- <th></th>
16
- <th></th>
17
- <th></th>
18
- </tr>
19
- </thead>
20
-
21
- <tbody>
22
- <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
23
- <tr>
24
- <% attributes.each do |attribute| -%>
25
- <td><%%= <%= singular_table_name %>.<%= attribute.name %><%= "?" if attribute.type == :boolean %> %></td>
26
- <% end -%>
27
- <% if named_routes? %>
28
- <td><%%= link_to 'Show', <%= singular_table_name %>_url(<%= singular_table_name %>) %></td>
29
- <td><%%= link_to 'Edit', edit_<%= singular_table_name %>_url(<%= singular_table_name %>) %></td>
30
- <td><%%= link_to 'Destroy', <%= singular_table_name %>_url(<%= singular_table_name %>), method: 'delete', data: { confirm: "Do you really want to delete this <%= singular_table_name %>?" } %></td>
31
- <% else %>
32
- <td><%%= link_to 'Show', "/<%= plural_name %>/#{<%= singular_table_name %>.id}" %></td>
33
- <td><%%= link_to 'Edit', "/<%= plural_name %>/#{<%= singular_table_name %>.id}/edit" %></td>
34
- <td><%%= link_to 'Destroy', "/<%= plural_name %>/#{<%= singular_table_name %>.id}", method: 'delete', data: { confirm: "Do you really want to delete this <%= singular_table_name %>?" } %></td>
35
- <% end %>
36
- </tr>
37
- <%% end %>
38
- </tbody>
39
- </table>
40
-
@@ -1,3 +0,0 @@
1
- <h1>New <%= human_name.titleize %></h1>
2
-
3
- <%%= render 'form' %>
@@ -1,9 +0,0 @@
1
- <h1><%= human_name.titleize %> #<%%= @<%= singular_table_name %>.id %></h1>
2
-
3
- <% attributes.each do |attribute| -%>
4
- <p>
5
- <b><%= attribute.human_name %>:</b>
6
- <%%= @<%= singular_table_name %>.<%= attribute.name %> %>
7
- </p>
8
-
9
- <% end %>
@@ -1,24 +0,0 @@
1
- <h1>Editing <%= human_name.titleize %> #<%%= @<%= singular_table_name %>.id %></h1>
2
-
3
- <% if named_routes? -%>
4
- <%%= form_tag(<%= singular_table_name %>_url(@<%= singular_table_name %>), method: 'patch') do %>
5
- <% else -%>
6
- <%%= form_tag("/<%= plural_name %>/#{<%= singular_table_name %>.id}", method: 'patch') do %>
7
- <% end -%>
8
- <% attributes.each do |attribute| -%>
9
- <div>
10
- <%%= label_tag :<%= attribute.name %> %><br />
11
- <% if attribute.field_type == :date_select || attribute.field_type == :time_select || attribute.field_type == :datetime_select -%>
12
- <%%= text_field_tag :<%= attribute.name %>, @<%= singular_table_name %>.<%= attribute.name %> %>
13
- <% elsif attribute.field_type == :check_box -%>
14
- <%%= check_box_tag :<%= attribute.name %>, 1, @<%= singular_table_name %>.<%= attribute.name %>? %>
15
- <% else -%>
16
- <%%= <%= attribute.field_type %>_tag :<%= attribute.name %>, @<%= singular_table_name %>.<%= attribute.name %><%= "?" if attribute.type == :boolean %> %>
17
- <% end -%>
18
- </div>
19
-
20
- <% end -%>
21
- <div>
22
- <%%= submit_tag "Update <%= human_name.titleize %>" %>
23
- </div>
24
- <%% end %>
@@ -1,40 +0,0 @@
1
- <h1><%= plural_table_name.humanize %></h1>
2
-
3
- <% if named_routes? -%>
4
- <p><%%= link_to 'Add a New <%= human_name.titleize %>', new_<%= singular_table_name %>_url %></p>
5
- <% else -%>
6
- <p><%%= link_to 'Add a New <%= human_name.titleize %>', "/<%= plural_name %>/new" %></p>
7
- <% end -%>
8
-
9
- <table>
10
- <thead>
11
- <tr>
12
- <% attributes.each do |attribute| -%>
13
- <th><%= attribute.human_name %></th>
14
- <% end -%>
15
- <th></th>
16
- <th></th>
17
- <th></th>
18
- </tr>
19
- </thead>
20
-
21
- <tbody>
22
- <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
23
- <tr>
24
- <% attributes.each do |attribute| -%>
25
- <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
26
- <% end -%>
27
- <% if named_routes? -%>
28
- <td><%%= link_to 'Show', <%= singular_table_name %>_url(<%= singular_table_name %>) %></td>
29
- <td><%%= link_to 'Edit', edit_<%= singular_table_name %>_url(<%= singular_table_name %>) %></td>
30
- <td><%%= link_to 'Destroy', <%= singular_table_name %>_url(<%= singular_table_name %>), method: 'delete', data: { confirm: "Do you really want to delete this <%= singular_table_name %>?" } %></td>
31
- <% else -%>
32
- <td><%%= link_to 'Show', "/<%= plural_name %>/#{<%= singular_table_name %>.id}" %></td>
33
- <td><%%= link_to 'Edit', "/<%= plural_name %>/#{<%= singular_table_name %>.id}/edit" %></td>
34
- <td><%%= link_to 'Destroy', "/<%= plural_name %>/#{<%= singular_table_name %>.id}", method: 'delete', data: { confirm: "Do you really want to delete this <%= singular_table_name %>?" } %></td>
35
- <% end -%>
36
- </tr>
37
- <%% end %>
38
- </tbody>
39
- </table>
40
-
@@ -1,15 +0,0 @@
1
- class <%= migration_class_name %> < ActiveRecord::Migration
2
- def change
3
- create_table :<%= table_name %> do |t|
4
- <% attributes.each do |attribute| -%>
5
- t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
6
- <% end -%>
7
- <% if options[:timestamps] %>
8
- t.timestamps
9
- <% end -%>
10
- end
11
- <% attributes_with_index.each do |attribute| -%>
12
- add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
13
- <% end -%>
14
- end
15
- end
@@ -1,2 +0,0 @@
1
- class <%= singular_name.camelize %> < ActiveRecord::Base
2
- end
@@ -1,22 +0,0 @@
1
- <h1>New <%= human_name.titleize %></h1>
2
-
3
- <% if named_routes? -%>
4
- <%%= form_tag(<%= plural_name %>_url, method: 'post') do %>
5
- <% else -%>
6
- <%%= form_tag('/<%= plural_name %>', method: 'post') do %>
7
- <% end -%>
8
- <% attributes.each do |attribute| -%>
9
- <div>
10
- <%%= label_tag :<%= attribute.name %> %><br />
11
- <% if attribute.field_type == :date_select || attribute.field_type == :time_select || attribute.field_type == :datetime_select -%>
12
- <%%= text_field_tag :<%= attribute.name %> %>
13
- <% else -%>
14
- <%%= <%= attribute.field_type %>_tag :<%= attribute.name %> %>
15
- <% end -%>
16
- </div>
17
-
18
- <% end -%>
19
- <div>
20
- <%%= submit_tag "Create <%= human_name.titleize %>" %>
21
- </div>
22
- <%% end %>
@@ -1,9 +0,0 @@
1
- <h1><%= human_name.titleize %> #<%%= @<%= singular_table_name %>.id %></h1>
2
-
3
- <dl>
4
- <% attributes.each do |attribute| -%>
5
- <dt><%= attribute.human_name %></dt>
6
- <dd><%%= @<%= singular_table_name %>.<%= attribute.name %><%= "?" if attribute.type == :boolean %> %></dd>
7
-
8
- <% end -%>
9
- </dl>
@@ -1,31 +0,0 @@
1
- Description:
2
- Injects the Bootstrap framework, FontAwesome support, and a standard application layout template into your app.
3
-
4
- The application layout will provide a standard top navbar based on the models already in your application, with support for flash messages.
5
-
6
- Specify "default" as the THEME_NAME to use the default bootstrap theme. Or, provide a Bootswatch name instead.
7
-
8
-
9
- THEME_NAME can be one of:
10
- amelia, cerulian, cyborg, default, journal, geo, readable, simplex, slate, spacelab, spruce, superhero, united
11
-
12
- LAYOUT_FILE defaults to "application".
13
-
14
- WARNING: You will LOSE any modifications you've made to your application layout unless you specify a different filename with the --layout-file option.
15
-
16
- Examples:
17
- `rails generate starter:style default`
18
-
19
- Injects Bootstrap 3.0 into your CSS folder, adjusts your applications' css manifest, and replaces your application layout with a standard Bootstrap template and a navigation bar based on your models.
20
-
21
- `rails generate starter:style --no-navbar`
22
-
23
- Injects Bootstrap 3.0 into your CSS folder, adjusts your applications' css manifest, and replaces your application layout with a standard Bootstrap template.
24
-
25
- `rails generate starter:style united`
26
-
27
- Injects Bootstrap 3.0 into your CSS folder, adjusts your applications' css manifest, and replaces your application layout with the United bootswatch theme.
28
-
29
-
30
-
31
-
@@ -1,34 +0,0 @@
1
- module Starter
2
- class StyleGenerator < Rails::Generators::Base
3
- source_root File.expand_path('../templates', __FILE__)
4
-
5
- argument :theme_name, :type => :string#, :default => 'default'
6
-
7
- class_option :layout, :type => :boolean, :default => true, :desc => "Generate a new application layout."
8
- class_option :navbar, :type => :boolean, :default => true, :desc => "Generate a model-based navbar."
9
- argument :layout_file, :type => :string, :default => 'application', :desc => "Layout filename"
10
-
11
- def generate_layout
12
- if bootswatch_theme?
13
- log :insert, "Bootswatch theme '#{theme_name}'"
14
- else
15
- log :insert, 'Bootstrap CSS framework'
16
- end
17
- log :insert, 'FontAwesome support'
18
- template "layout.html.erb", "app/views/layouts/#{layout_file}.html.erb" if options[:layout]
19
- end
20
-
21
- protected
22
-
23
- def bootswatch_theme?
24
- if theme_name.present?
25
- (theme_name.downcase != 'default') && (theme_name.downcase != 'd')
26
- end
27
- end
28
-
29
- def app_tables
30
- ActiveRecord::Base.connection.tables - ['schema_migrations']
31
- end
32
-
33
- end
34
- end
@@ -1,66 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title><%= Rails.application.class.parent_name %></title>
6
-
7
- <% if bootswatch_theme? -%>
8
- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.0.2/<%= theme_name %>/bootstrap.min.css">
9
- <% else %>
10
- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
11
- <% end -%>
12
- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.2/css/font-awesome.min.css">
13
-
14
- <style>
15
- /* Only necessary if you are using navbar-fixed-top */
16
- body {
17
- padding-top: 50px;
18
- }
19
- </style>
20
-
21
- <%%= stylesheet_link_tag "application", :media => "all" %>
22
- <%%= javascript_include_tag "application" %>
23
- <%%= csrf_meta_tags %>
24
-
25
- <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
26
-
27
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
28
- </head>
29
- <body>
30
- <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
31
- <!-- Brand and toggle get grouped for better mobile display -->
32
- <div class="navbar-header">
33
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
34
- <span class="sr-only">Toggle navigation</span>
35
- <span class="icon-bar"></span>
36
- <span class="icon-bar"></span>
37
- <span class="icon-bar"></span>
38
- </button>
39
- <%%= link_to Rails.application.class.parent_name, root_url, :class => "navbar-brand" %>
40
- </div>
41
-
42
- <!-- Collect the nav links, forms, and other content for toggling -->
43
- <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
44
- <ul class="nav navbar-nav">
45
- <% if options[:navbar] -%>
46
- <% app_tables.each do |table_name| -%>
47
- <li><%%= link_to "<%= table_name.humanize.titleize %>", <%= table_name.pluralize %>_url %></li>
48
- <% end -%>
49
- <li><a href="#">About</a></li>
50
- <% end -%>
51
- </ul>
52
- </div><!-- /.navbar-collapse -->
53
- </nav>
54
-
55
- <div class="container">
56
- <%% if notice.present? %>
57
- <div class="alert alert-dismissable alert-success">
58
- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
59
- <%%= notice %>
60
- </div>
61
- <%% end %>
62
-
63
- <%%= yield %>
64
- </div>
65
- </body>
66
- </html>