grimen-dry_scaffold 0.1.1 → 0.1.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.
data/README.textile
CHANGED
@@ -46,24 +46,24 @@ Quick and dirty; Formtastic makes your form views cleaner, and your life as a Ra
|
|
46
46
|
|
47
47
|
h4. Default HAML (without Formtastic):
|
48
48
|
|
49
|
-
<pre>- form_for(
|
49
|
+
<pre>- form_for(@duck) do |f|
|
50
50
|
= f.error_messages
|
51
51
|
%ul
|
52
52
|
%li
|
53
|
-
= f.label :
|
54
|
-
= f.text_field :
|
53
|
+
= f.label :name, 'Name'
|
54
|
+
= f.text_field :name
|
55
55
|
%li
|
56
|
-
= f.label :
|
57
|
-
= f.
|
56
|
+
= f.label :about, 'About'
|
57
|
+
= f.text_area :about
|
58
58
|
%p.buttons
|
59
59
|
= f.submit 'Create'</pre>
|
60
60
|
|
61
61
|
h4. Formtastic + HAML:
|
62
62
|
|
63
|
-
<pre>- semantic_form_for(@
|
63
|
+
<pre>- semantic_form_for(@duck) do |f|
|
64
64
|
- f.inputs do
|
65
|
-
= f.input :
|
66
|
-
= f.input :
|
65
|
+
= f.input :name
|
66
|
+
= f.input :about
|
67
67
|
- f.buttons do
|
68
68
|
= f.commit_button 'Create'</pre>
|
69
69
|
|
@@ -1,8 +1,12 @@
|
|
1
1
|
NAME
|
2
|
-
dry_scaffold - A Rails scaffold generator that generates DRYer, cleaner, and more useful code.
|
2
|
+
dry_scaffold a.k.a. dscaffold - A Rails scaffold generator that generates DRYer, cleaner, and more useful code.
|
3
3
|
|
4
4
|
DESCRIPTION
|
5
5
|
A replacement for the Rails scaffold generator that generates code that most people end up deleting or rewriting anyway because of the unusable code. The scaffold concept is powerful, but it has more potential than generating messy and almost useless code. The goal with dry_scaffold is to generate DRY, beautiful, and standards compliant code based on common patterns without adding a lot of magic.
|
6
6
|
|
7
7
|
EXAMPLE
|
8
|
-
./script/generate dry_scaffold ModelName [attribute:type attribute:type] [_actions:new,create,...] [_formats:html,json,...] [--skip-pagination] [--skip-resourceful] [--skip-formtastic] [--skip-views] [--skip-helpers] [--skip-tests] [--include-layout]
|
8
|
+
./script/generate dry_scaffold ModelName [attribute:type attribute:type] [_actions:new,create,...] [_formats:html,json,...] [--skip-pagination] [--skip-resourceful] [--skip-formtastic] [--skip-views] [--skip-helpers] [--skip-tests] [--include-layout]
|
9
|
+
|
10
|
+
...or the shortcut version:
|
11
|
+
|
12
|
+
./script/generate dscaffold ModelName [attribute:type attribute:type] [_actions:new,create,...] [_formats:html,json,...] [--skip-pagination] [--skip-resourceful] [--skip-formtastic] [--skip-views] [--skip-helpers] [--skip-tests] [--include-layout]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'dry_scaffold', 'dry_scaffold_generator')
|
2
|
+
|
3
|
+
class DscaffoldGenerator < DryScaffoldGenerator
|
4
|
+
|
5
|
+
def initialize(runtime_args, runtime_options = {})
|
6
|
+
super
|
7
|
+
# Make Rails look for templates within generator "dry_scaffold" path
|
8
|
+
@source_root = options[:source] || File.join(spec.path, '..', 'dry_scaffold', 'templates')
|
9
|
+
end
|
10
|
+
|
11
|
+
def usage_message
|
12
|
+
File.read(File.join(spec.path, '..', 'dry_scaffold', 'USAGE')) rescue ''
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
data/tasks/dry_scaffold.rake
CHANGED
@@ -7,32 +7,50 @@ namespace :dry_scaffold do
|
|
7
7
|
|
8
8
|
namespace :dependencies do
|
9
9
|
|
10
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'setup_helper')
|
11
|
+
include SetupHelper
|
12
|
+
|
10
13
|
GEMS = [:haml, :will_paginate, :'josevalim-inherited_resources', :'justinfrench-formtastic'].freeze
|
11
14
|
PLUGINS = [].freeze
|
12
15
|
|
13
16
|
puts "---------------------------------------"
|
14
|
-
puts "
|
17
|
+
puts " Dependencies"
|
15
18
|
puts "---------------------------------------"
|
16
19
|
|
17
20
|
desc "Install dependencies for fully advantage of this generator."
|
21
|
+
puts "Installing gems..."
|
18
22
|
task :install => :environment do
|
19
|
-
|
20
|
-
GEMS.
|
21
|
-
puts
|
23
|
+
# Install gems
|
24
|
+
unless GEMS.empty?
|
25
|
+
puts "GEMS: #{GEMS.to_sentence}"
|
26
|
+
GEMS.each do |gem|
|
27
|
+
puts `sudo gem install #{gem} --no-ri`
|
28
|
+
end
|
22
29
|
end
|
23
30
|
|
24
|
-
|
25
|
-
PLUGINS.
|
26
|
-
puts
|
31
|
+
# Install plugins
|
32
|
+
unless PLUGINS.empty?
|
33
|
+
puts "PLUGINS: #{PLUGINS.to_sentence}"
|
34
|
+
puts "Installing plugins..."
|
35
|
+
PLUGINS.each do |plugin|
|
36
|
+
puts `./script/plugin install #{plugin}`
|
37
|
+
end
|
27
38
|
end
|
28
39
|
|
29
|
-
|
30
|
-
|
40
|
+
# Setup HAML - if missing
|
41
|
+
unless File.directory?(File.join(Rails.root, 'vendor', 'plugins', 'haml'))
|
42
|
+
puts "Initializing HAML for this project..."
|
43
|
+
puts `haml --rails #{Rails.root}`
|
44
|
+
end
|
45
|
+
|
46
|
+
# Add gems to Rails environment with gems - if missing
|
47
|
+
config_gems File.join(Rails.root, 'config', 'environment.rb'), GEMS
|
31
48
|
|
32
49
|
puts "---------------------------------------"
|
33
50
|
puts " Configuration"
|
34
51
|
puts "---------------------------------------"
|
35
|
-
puts "
|
52
|
+
puts "Adding configuration..."
|
53
|
+
puts "File 'config/environments/development.rb' now contains (added automatically):"
|
36
54
|
GEMS.each do |gem|
|
37
55
|
gem_info = gem.to_s.split('-')
|
38
56
|
if gem_info.size > 1
|
@@ -44,7 +62,7 @@ namespace :dry_scaffold do
|
|
44
62
|
puts " config.gem '#{gem_lib}'"
|
45
63
|
end
|
46
64
|
end
|
47
|
-
puts "
|
65
|
+
puts "---------------------------------------"
|
48
66
|
end
|
49
67
|
|
50
68
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grimen-dry_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Grimfelt
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-29 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -54,7 +54,9 @@ files:
|
|
54
54
|
- generators/dry_scaffold/templates/view_layout.html.haml
|
55
55
|
- generators/dry_scaffold/templates/view_new.html.haml
|
56
56
|
- generators/dry_scaffold/templates/view_show.html.haml
|
57
|
-
- generators/USAGE
|
57
|
+
- generators/dry_scaffold/USAGE
|
58
|
+
- generators/dscaffold
|
59
|
+
- generators/dscaffold/dscaffold_generator.rb
|
58
60
|
- rails/init.rb
|
59
61
|
- tasks/dry_scaffold.rake
|
60
62
|
has_rdoc: true
|