grimen-dry_scaffold 0.1.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.
- data/MIT-LICENSE +20 -0
- data/README.textile +303 -0
- data/Rakefile +47 -0
- data/TODO.textile +12 -0
- data/generators/USAGE +8 -0
- data/generators/dry_scaffold/dry_scaffold_generator.rb +250 -0
- data/generators/dry_scaffold/templates/controller_inherited_resources.rb +40 -0
- data/generators/dry_scaffold/templates/controller_standard.rb +242 -0
- data/generators/dry_scaffold/templates/controller_test_standard.rb +84 -0
- data/generators/dry_scaffold/templates/helper_standard.rb +3 -0
- data/generators/dry_scaffold/templates/helper_test_standard.rb +5 -0
- data/generators/dry_scaffold/templates/prototypes/controller_inherited_resources.rb +23 -0
- data/generators/dry_scaffold/templates/prototypes/controller_standard.rb +132 -0
- data/generators/dry_scaffold/templates/prototypes/controller_test_standard.rb +64 -0
- data/generators/dry_scaffold/templates/prototypes/helper_standard.rb +3 -0
- data/generators/dry_scaffold/templates/prototypes/helper_test_standard.rb +5 -0
- data/generators/dry_scaffold/templates/prototypes/layout.html.haml +19 -0
- data/generators/dry_scaffold/templates/prototypes/view__form.html.haml +3 -0
- data/generators/dry_scaffold/templates/prototypes/view__item.html.haml +9 -0
- data/generators/dry_scaffold/templates/prototypes/view_edit.html.haml +10 -0
- data/generators/dry_scaffold/templates/prototypes/view_index.html.haml +17 -0
- data/generators/dry_scaffold/templates/prototypes/view_new.html.haml +10 -0
- data/generators/dry_scaffold/templates/prototypes/view_show.html.haml +13 -0
- data/generators/dry_scaffold/templates/view__form.html.haml +13 -0
- data/generators/dry_scaffold/templates/view__item.html.haml +10 -0
- data/generators/dry_scaffold/templates/view_edit.html.haml +18 -0
- data/generators/dry_scaffold/templates/view_index.html.haml +20 -0
- data/generators/dry_scaffold/templates/view_layout.html.haml +19 -0
- data/generators/dry_scaffold/templates/view_new.html.haml +18 -0
- data/generators/dry_scaffold/templates/view_show.html.haml +13 -0
- data/rails/init.rb +3 -0
- data/tasks/dry_scaffold.rake +51 -0
- metadata +88 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
%h1.heading
|
2
|
+
= "Editing <%= singular_name %> %s" % @<%= singular_name %>.id
|
3
|
+
|
4
|
+
<% if options[:formtastic] -%>
|
5
|
+
- semantic_form_for(@<%= singular_name %>) do |form|
|
6
|
+
= render 'form', :form => form
|
7
|
+
- form.buttons do
|
8
|
+
= form.commit_button 'Update'
|
9
|
+
<% else -%>
|
10
|
+
- form_for(@<%= singular_name %>) do |form|
|
11
|
+
= form.error_messages
|
12
|
+
= render 'form', :form => form
|
13
|
+
%p.buttons
|
14
|
+
= form.submit 'Update'
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
%p.actions
|
18
|
+
= link_to 'Cancel', <%= collection_name %>_url
|
@@ -0,0 +1,20 @@
|
|
1
|
+
%h1.heading
|
2
|
+
= "<%= plural_name.humanize %>"
|
3
|
+
|
4
|
+
%p.actions
|
5
|
+
= link_to 'New <%= singular_name.humanize %>', new_<%= singular_name %>_url
|
6
|
+
|
7
|
+
%table
|
8
|
+
%thead.header
|
9
|
+
%tr
|
10
|
+
<% attributes.each do |attribute| -%>
|
11
|
+
%th.<%= attribute.name %>= '<%= attribute.name.humanize %>'
|
12
|
+
<% end -%>
|
13
|
+
%th.actions= 'Actions'
|
14
|
+
%tbody.items.<%= plural_name %>
|
15
|
+
- @<%= collection_name -%>.each do |<%= singular_name %>|
|
16
|
+
= render 'item', :<%= singular_name %> => <%= singular_name %>
|
17
|
+
|
18
|
+
<% if options[:pagination] -%>
|
19
|
+
= will_paginate(@<%= collection_name %>)
|
20
|
+
<% end -%>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
!!! 1.1
|
2
|
+
|
3
|
+
%html{html_attrs(I18n.locale)}
|
4
|
+
%head
|
5
|
+
%title= "#{controller.controller_name.humanize}: #{controller.action_name}"
|
6
|
+
|
7
|
+
= stylesheet_link_tag 'screen', :media => 'screen, projection'
|
8
|
+
= stylesheet_link_tag 'print', :media => 'print'
|
9
|
+
/[if IE]
|
10
|
+
= stylesheet_link_tag 'ie', :media => 'screen, projection'
|
11
|
+
= stylesheet_link_tag 'scaffold' if File.exist?(stylesheet_path('scaffold').gsub(/\?.+/, ''))
|
12
|
+
|
13
|
+
= javascript_include_tag :defaults
|
14
|
+
|
15
|
+
%body{:id => "#{controller.controller_name}_#{controller.action_name}", :class => "#{controller.controller_name}_controller #{controller.action_name}_action"}
|
16
|
+
|
17
|
+
%p.flash{:style => 'color: green'}= flash[:notice]
|
18
|
+
|
19
|
+
= yield
|
@@ -0,0 +1,18 @@
|
|
1
|
+
%h1.heading
|
2
|
+
= 'New <%= singular_name.humanize %>'
|
3
|
+
|
4
|
+
<% if options[:formtastic] -%>
|
5
|
+
- semantic_form_for(@<%= singular_name %>) do |form|
|
6
|
+
= render 'form', :form => form
|
7
|
+
- form.buttons do
|
8
|
+
= form.commit_button 'Create'
|
9
|
+
<% else -%>
|
10
|
+
- form_for(@<%= singular_name %>) do |form|
|
11
|
+
= form.error_messages
|
12
|
+
= render 'form', :form => form
|
13
|
+
%p.buttons
|
14
|
+
= form.submit 'Create'
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
%p.actions
|
18
|
+
= link_to 'Cancel', <%= collection_name %>_url
|
@@ -0,0 +1,13 @@
|
|
1
|
+
%h1.heading
|
2
|
+
= "Resource %s" % @<%= singular_name %>.id
|
3
|
+
|
4
|
+
- content_tag_for(:dl, @<%= singular_name %>) do
|
5
|
+
<% attributes.each do |attribute| -%>
|
6
|
+
%dt.label= '<%= attribute.name.humanize %>'
|
7
|
+
%dd.<%= attribute.name -%>= h @<%= singular_name %>.try(:<%= attribute.name %>)
|
8
|
+
<% end -%>
|
9
|
+
|
10
|
+
%p.actions
|
11
|
+
= link_to 'Edit', edit_<%= singular_name %>_url(@<%= singular_name %>)
|
12
|
+
|
|
13
|
+
= link_to 'Index', <%= collection_name %>_url
|
data/rails/init.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
namespace :dry_scaffold do
|
2
|
+
|
3
|
+
desc "Setup for this plugin/gem."
|
4
|
+
task :setup => :environment do
|
5
|
+
Rake::Task['dry_scaffold:dependencies:install'].invoke
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :dependencies do
|
9
|
+
|
10
|
+
GEMS = [:haml, :will_paginate, :'josevalim-inherited_resources', :'justinfrench-formtastic'].freeze
|
11
|
+
PLUGINS = [].freeze
|
12
|
+
|
13
|
+
puts "---------------------------------------"
|
14
|
+
puts " Setup"
|
15
|
+
puts "---------------------------------------"
|
16
|
+
|
17
|
+
desc "Install dependencies for fully advantage of this generator."
|
18
|
+
task :install => :environment do
|
19
|
+
puts "GEMS: #{GEMS.to_sentence}" unless GEMS.empty?
|
20
|
+
GEMS.each do |gem|
|
21
|
+
puts `sudo gem install #{gem}`
|
22
|
+
end
|
23
|
+
|
24
|
+
puts "PLUGINS: #{PLUGINS.to_sentence}" unless PLUGINS.empty?
|
25
|
+
PLUGINS.each do |plugin|
|
26
|
+
puts `./script/plugin install #{plugin}`
|
27
|
+
end
|
28
|
+
|
29
|
+
puts "Setup HAML for this project..."
|
30
|
+
#puts `haml --rails .`
|
31
|
+
|
32
|
+
puts "---------------------------------------"
|
33
|
+
puts " Configuration"
|
34
|
+
puts "---------------------------------------"
|
35
|
+
puts "Update your environment config: 'config/environments/development.rb' <<<"
|
36
|
+
GEMS.each do |gem|
|
37
|
+
gem_info = gem.to_s.split('-')
|
38
|
+
if gem_info.size > 1
|
39
|
+
gem_owner = gem_info[0]
|
40
|
+
gem_lib = gem_info[1]
|
41
|
+
puts " config.gem '#{gem_owner}-#{gem_lib}', :lib => '#{gem_lib}'"
|
42
|
+
else
|
43
|
+
gem_lib = gem_info[0]
|
44
|
+
puts " config.gem '#{gem_lib}'"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
puts "<<<"
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: grimen-dry_scaffold
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jonas Grimfelt
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-04-28 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A DRYer scaffold generator for Rails. Generates dry semantic and standards compliant views, and dry RESTful controllers.
|
17
|
+
email: grimen@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.textile
|
24
|
+
files:
|
25
|
+
- MIT-LICENSE
|
26
|
+
- README.textile
|
27
|
+
- TODO.textile
|
28
|
+
- Rakefile
|
29
|
+
- generators/dry_scaffold
|
30
|
+
- generators/dry_scaffold/dry_scaffold_generator.rb
|
31
|
+
- generators/dry_scaffold/templates
|
32
|
+
- generators/dry_scaffold/templates/controller_inherited_resources.rb
|
33
|
+
- generators/dry_scaffold/templates/controller_standard.rb
|
34
|
+
- generators/dry_scaffold/templates/controller_test_standard.rb
|
35
|
+
- generators/dry_scaffold/templates/helper_standard.rb
|
36
|
+
- generators/dry_scaffold/templates/helper_test_standard.rb
|
37
|
+
- generators/dry_scaffold/templates/prototypes
|
38
|
+
- generators/dry_scaffold/templates/prototypes/controller_inherited_resources.rb
|
39
|
+
- generators/dry_scaffold/templates/prototypes/controller_standard.rb
|
40
|
+
- generators/dry_scaffold/templates/prototypes/controller_test_standard.rb
|
41
|
+
- generators/dry_scaffold/templates/prototypes/helper_standard.rb
|
42
|
+
- generators/dry_scaffold/templates/prototypes/helper_test_standard.rb
|
43
|
+
- generators/dry_scaffold/templates/prototypes/layout.html.haml
|
44
|
+
- generators/dry_scaffold/templates/prototypes/view__form.html.haml
|
45
|
+
- generators/dry_scaffold/templates/prototypes/view__item.html.haml
|
46
|
+
- generators/dry_scaffold/templates/prototypes/view_edit.html.haml
|
47
|
+
- generators/dry_scaffold/templates/prototypes/view_index.html.haml
|
48
|
+
- generators/dry_scaffold/templates/prototypes/view_new.html.haml
|
49
|
+
- generators/dry_scaffold/templates/prototypes/view_show.html.haml
|
50
|
+
- generators/dry_scaffold/templates/view__form.html.haml
|
51
|
+
- generators/dry_scaffold/templates/view__item.html.haml
|
52
|
+
- generators/dry_scaffold/templates/view_edit.html.haml
|
53
|
+
- generators/dry_scaffold/templates/view_index.html.haml
|
54
|
+
- generators/dry_scaffold/templates/view_layout.html.haml
|
55
|
+
- generators/dry_scaffold/templates/view_new.html.haml
|
56
|
+
- generators/dry_scaffold/templates/view_show.html.haml
|
57
|
+
- generators/USAGE
|
58
|
+
- rails/init.rb
|
59
|
+
- tasks/dry_scaffold.rake
|
60
|
+
has_rdoc: true
|
61
|
+
homepage: http://github.com/grimen/dry_scaffold/tree/master
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options:
|
64
|
+
- --inline-source
|
65
|
+
- --charset=UTF-8
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
version:
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
version:
|
80
|
+
requirements: []
|
81
|
+
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 1.2.0
|
84
|
+
signing_key:
|
85
|
+
specification_version: 3
|
86
|
+
summary: A DRYer scaffold generator for Rails. Generates dry semantic and standards compliant views, and dry RESTful controllers.
|
87
|
+
test_files: []
|
88
|
+
|