w2tags 0.9.3 → 0.9.5

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 (64) hide show
  1. data/COPYING +340 -340
  2. data/LICENSE +6 -6
  3. data/MIT-LICENSE +18 -18
  4. data/Manifest.txt +28 -25
  5. data/README.rdoc +27 -21
  6. data/Rakefile +1 -1
  7. data/VERSION +1 -1
  8. data/bin/w2tags +173 -143
  9. data/doc/History.rdoc +88 -0
  10. data/hot/erb.hot +18 -156
  11. data/hot/erb_base.hot +164 -0
  12. data/hot/html.hot +30 -31
  13. data/hot/rails/scaffold.hot +15 -15
  14. data/hot/vm.hot +8 -8
  15. data/hot/vm2.hot +34 -34
  16. data/hot/vm_crud.hot +34 -34
  17. data/hot/vm_popup.hot +74 -74
  18. data/lib/tags2w.rb +263 -0
  19. data/lib/w2tags/block/block_hot.rb +37 -0
  20. data/lib/w2tags/block/plain_text.rb +57 -57
  21. data/lib/w2tags/block/remark.rb +37 -37
  22. data/lib/w2tags/block/sass.rb +68 -66
  23. data/lib/w2tags/merb_hook.rb +15 -15
  24. data/lib/w2tags/parser.rb +17 -8
  25. data/lib/w2tags/rails_hook.rb +15 -15
  26. data/lib/w2tags/sinatra_hook.rb +74 -50
  27. data/lib/w2tags.rb +100 -100
  28. data/plugins/{/w2tags/ → w2tags}/README +2 -2
  29. data/plugins/{/w2tags//generators//w2scaffold/ → w2tags/generators/w2scaffold}/USAGE +29 -29
  30. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/controller.rb +85 -85
  31. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/functional_test.rb +45 -45
  32. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/helper.rb +2 -2
  33. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/helper_test.rb +4 -4
  34. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/layout.html.erb +17 -17
  35. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/style.css +54 -54
  36. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_edit.html.erb +17 -17
  37. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_edit.html.w2erb +16 -16
  38. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_index.html.erb +23 -23
  39. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_index.html.w2erb +13 -13
  40. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_new.html.erb +16 -16
  41. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_new.html.w2erb +15 -15
  42. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_show.html.erb +9 -9
  43. data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_show.html.w2erb +8 -8
  44. data/plugins/{/w2tags//generators//w2scaffold/ → w2tags/generators/w2scaffold}/w2scaffold_generator.rb +106 -106
  45. data/plugins/{/w2tags/ → w2tags}/install.rb +0 -0
  46. data/tasks/ann.rake +81 -81
  47. data/tasks/bones.rake +21 -21
  48. data/tasks/gem.rake +126 -126
  49. data/tasks/git.rake +41 -41
  50. data/tasks/manifest.rake +49 -49
  51. data/tasks/notes.rake +28 -28
  52. data/tasks/post_load.rake +39 -39
  53. data/tasks/rdoc.rake +51 -51
  54. data/tasks/rubyforge.rake +57 -57
  55. data/tasks/setup.rb +268 -268
  56. data/tasks/spec.rake +55 -55
  57. data/tasks/svn.rake +48 -48
  58. data/tasks/test.rake +38 -38
  59. data/test/vars.hot +30 -30
  60. data/test/w2tags_basic_usability.rb +187 -187
  61. data/test/w2tags_enlightning.rb +42 -42
  62. data/test/w2tags_hot.rb +85 -85
  63. data/test/w2tags_hot_var.rb +115 -115
  64. metadata +28 -30
@@ -1,9 +1,9 @@
1
- <% for attribute in attributes -%>
2
- %p
3
- %b <%= attribute.column.human_name %>:
4
- = h @<%= singular_name %>.<%= attribute.name %>
5
-
6
- <% end -%>
7
-
8
- = link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>)
1
+ <% for attribute in attributes -%>
2
+ %p
3
+ %b <%= attribute.column.human_name %>:
4
+ = h @<%= singular_name %>.<%= attribute.name %>
5
+
6
+ <% end -%>
7
+
8
+ = link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>)
9
9
  = link_to 'Back', <%= plural_name %>_path
@@ -1,106 +1,106 @@
1
- class W2scaffoldGenerator < Rails::Generator::NamedBase
2
- default_options :skip_timestamps => false, :skip_migration => false, :force_plural => false
3
-
4
- attr_reader :controller_name,
5
- :controller_class_path,
6
- :controller_file_path,
7
- :controller_class_nesting,
8
- :controller_class_nesting_depth,
9
- :controller_class_name,
10
- :controller_underscore_name,
11
- :controller_singular_name,
12
- :controller_plural_name
13
- alias_method :controller_file_name, :controller_underscore_name
14
- alias_method :controller_table_name, :controller_plural_name
15
-
16
- def initialize(runtime_args, runtime_options = {})
17
- super
18
-
19
- if @name == @name.pluralize && !options[:force_plural]
20
- logger.warning "Plural version of the model detected, using singularized version. Override with --force-plural."
21
- @name = @name.singularize
22
- end
23
-
24
- @controller_name = @name.pluralize
25
-
26
- base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
27
- @controller_class_name_without_nesting, @controller_underscore_name, @controller_plural_name = inflect_names(base_name)
28
- @controller_singular_name=base_name.singularize
29
- if @controller_class_nesting.empty?
30
- @controller_class_name = @controller_class_name_without_nesting
31
- else
32
- @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
33
- end
34
- end
35
-
36
- def manifest
37
- record do |m|
38
- # Check for class naming collisions.
39
- m.class_collisions("#{controller_class_name}Controller", "#{controller_class_name}Helper")
40
- m.class_collisions(class_name)
41
-
42
- # Controller, helper, views, test and stylesheets directories.
43
- m.directory(File.join('app/models', class_path))
44
- m.directory(File.join('app/controllers', controller_class_path))
45
- m.directory(File.join('app/helpers', controller_class_path))
46
- m.directory(File.join('app/views', controller_class_path, controller_file_name))
47
- m.directory(File.join('app/views/layouts', controller_class_path))
48
- m.directory(File.join('test/functional', controller_class_path))
49
- m.directory(File.join('test/unit', class_path))
50
- m.directory(File.join('test/unit/helpers', class_path))
51
- m.directory(File.join('public/stylesheets', class_path))
52
-
53
- for action in scaffold_views
54
- m.template(
55
- "view_#{action}.html.erb",
56
- File.join('app/views', controller_class_path, controller_file_name, "#{action}.html.erb")
57
- )
58
- m.template(
59
- "view_#{action}.html.w2erb",
60
- File.join('app/views', controller_class_path, controller_file_name, "#{action}.html.w2erb")
61
- )
62
- end
63
-
64
- # Layout and stylesheet.
65
- m.template('layout.html.erb', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb"))
66
- m.template('style.css', 'public/stylesheets/scaffold.css')
67
-
68
- m.template(
69
- 'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
70
- )
71
-
72
- m.template('functional_test.rb', File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
73
- m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
74
- m.template('helper_test.rb', File.join('test/unit/helpers', controller_class_path, "#{controller_file_name}_helper_test.rb"))
75
-
76
- m.route_resources controller_file_name
77
-
78
- m.dependency 'model', [name] + @args, :collision => :skip
79
- end
80
- end
81
-
82
- protected
83
- # Override with your own usage banner.
84
- def banner
85
- "Usage: #{$0} scaffold ModelName [field:type, field:type]"
86
- end
87
-
88
- def add_options!(opt)
89
- opt.separator ''
90
- opt.separator 'Options:'
91
- opt.on("--skip-timestamps",
92
- "Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
93
- opt.on("--skip-migration",
94
- "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
95
- opt.on("--force-plural",
96
- "Forces the generation of a plural ModelName") { |v| options[:force_plural] = v }
97
- end
98
-
99
- def scaffold_views
100
- %w[ index show new edit ]
101
- end
102
-
103
- def model_name
104
- class_name.demodulize
105
- end
106
- end
1
+ class W2scaffoldGenerator < Rails::Generator::NamedBase
2
+ default_options :skip_timestamps => false, :skip_migration => false, :force_plural => false
3
+
4
+ attr_reader :controller_name,
5
+ :controller_class_path,
6
+ :controller_file_path,
7
+ :controller_class_nesting,
8
+ :controller_class_nesting_depth,
9
+ :controller_class_name,
10
+ :controller_underscore_name,
11
+ :controller_singular_name,
12
+ :controller_plural_name
13
+ alias_method :controller_file_name, :controller_underscore_name
14
+ alias_method :controller_table_name, :controller_plural_name
15
+
16
+ def initialize(runtime_args, runtime_options = {})
17
+ super
18
+
19
+ if @name == @name.pluralize && !options[:force_plural]
20
+ logger.warning "Plural version of the model detected, using singularized version. Override with --force-plural."
21
+ @name = @name.singularize
22
+ end
23
+
24
+ @controller_name = @name.pluralize
25
+
26
+ base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
27
+ @controller_class_name_without_nesting, @controller_underscore_name, @controller_plural_name = inflect_names(base_name)
28
+ @controller_singular_name=base_name.singularize
29
+ if @controller_class_nesting.empty?
30
+ @controller_class_name = @controller_class_name_without_nesting
31
+ else
32
+ @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
33
+ end
34
+ end
35
+
36
+ def manifest
37
+ record do |m|
38
+ # Check for class naming collisions.
39
+ m.class_collisions("#{controller_class_name}Controller", "#{controller_class_name}Helper")
40
+ m.class_collisions(class_name)
41
+
42
+ # Controller, helper, views, test and stylesheets directories.
43
+ m.directory(File.join('app/models', class_path))
44
+ m.directory(File.join('app/controllers', controller_class_path))
45
+ m.directory(File.join('app/helpers', controller_class_path))
46
+ m.directory(File.join('app/views', controller_class_path, controller_file_name))
47
+ m.directory(File.join('app/views/layouts', controller_class_path))
48
+ m.directory(File.join('test/functional', controller_class_path))
49
+ m.directory(File.join('test/unit', class_path))
50
+ m.directory(File.join('test/unit/helpers', class_path))
51
+ m.directory(File.join('public/stylesheets', class_path))
52
+
53
+ for action in scaffold_views
54
+ m.template(
55
+ "view_#{action}.html.erb",
56
+ File.join('app/views', controller_class_path, controller_file_name, "#{action}.html.erb")
57
+ )
58
+ m.template(
59
+ "view_#{action}.html.w2erb",
60
+ File.join('app/views', controller_class_path, controller_file_name, "#{action}.html.w2erb")
61
+ )
62
+ end
63
+
64
+ # Layout and stylesheet.
65
+ m.template('layout.html.erb', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb"))
66
+ m.template('style.css', 'public/stylesheets/scaffold.css')
67
+
68
+ m.template(
69
+ 'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
70
+ )
71
+
72
+ m.template('functional_test.rb', File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
73
+ m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
74
+ m.template('helper_test.rb', File.join('test/unit/helpers', controller_class_path, "#{controller_file_name}_helper_test.rb"))
75
+
76
+ m.route_resources controller_file_name
77
+
78
+ m.dependency 'model', [name] + @args, :collision => :skip
79
+ end
80
+ end
81
+
82
+ protected
83
+ # Override with your own usage banner.
84
+ def banner
85
+ "Usage: #{$0} scaffold ModelName [field:type, field:type]"
86
+ end
87
+
88
+ def add_options!(opt)
89
+ opt.separator ''
90
+ opt.separator 'Options:'
91
+ opt.on("--skip-timestamps",
92
+ "Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
93
+ opt.on("--skip-migration",
94
+ "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
95
+ opt.on("--force-plural",
96
+ "Forces the generation of a plural ModelName") { |v| options[:force_plural] = v }
97
+ end
98
+
99
+ def scaffold_views
100
+ %w[ index show new edit ]
101
+ end
102
+
103
+ def model_name
104
+ class_name.demodulize
105
+ end
106
+ end
File without changes
data/tasks/ann.rake CHANGED
@@ -1,81 +1,81 @@
1
- # $Id$
2
-
3
- begin
4
- require 'bones/smtp_tls'
5
- rescue LoadError
6
- require 'net/smtp'
7
- end
8
- require 'time'
9
-
10
- namespace :ann do
11
-
12
- # A prerequisites task that all other tasks depend upon
13
- task :prereqs
14
-
15
- file PROJ.ann.file do
16
- ann = PROJ.ann
17
- puts "Generating #{ann.file}"
18
- File.open(ann.file,'w') do |fd|
19
- fd.puts("#{PROJ.name} version #{PROJ.version}")
20
- fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
21
- fd.puts(" #{PROJ.url}") if PROJ.url.valid?
22
- fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
23
- fd.puts
24
- fd.puts("== DESCRIPTION")
25
- fd.puts
26
- fd.puts(PROJ.description)
27
- fd.puts
28
- fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
29
- fd.puts
30
- ann.paragraphs.each do |p|
31
- fd.puts "== #{p.upcase}"
32
- fd.puts
33
- fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
34
- fd.puts
35
- end
36
- fd.puts ann.text if ann.text
37
- end
38
- end
39
-
40
- desc "Create an announcement file"
41
- task :announcement => ['ann:prereqs', PROJ.ann.file]
42
-
43
- desc "Send an email announcement"
44
- task :email => ['ann:prereqs', PROJ.ann.file] do
45
- ann = PROJ.ann
46
- from = ann.email[:from] || PROJ.email
47
- to = Array(ann.email[:to])
48
-
49
- ### build a mail header for RFC 822
50
- rfc822msg = "From: #{from}\n"
51
- rfc822msg << "To: #{to.join(',')}\n"
52
- rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
53
- rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
54
- rfc822msg << "\n"
55
- rfc822msg << "Date: #{Time.new.rfc822}\n"
56
- rfc822msg << "Message-Id: "
57
- rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
58
- rfc822msg << File.read(ann.file)
59
-
60
- params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
61
- ann.email[key]
62
- end
63
-
64
- params[3] = PROJ.email if params[3].nil?
65
-
66
- if params[4].nil?
67
- STDOUT.write "Please enter your e-mail password (#{params[3]}): "
68
- params[4] = STDIN.gets.chomp
69
- end
70
-
71
- ### send email
72
- Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
73
- end
74
- end # namespace :ann
75
-
76
- desc 'Alias to ann:announcement'
77
- task :ann => 'ann:announcement'
78
-
79
- CLOBBER << PROJ.ann.file
80
-
81
- # EOF
1
+ # $Id$
2
+
3
+ begin
4
+ require 'bones/smtp_tls'
5
+ rescue LoadError
6
+ require 'net/smtp'
7
+ end
8
+ require 'time'
9
+
10
+ namespace :ann do
11
+
12
+ # A prerequisites task that all other tasks depend upon
13
+ task :prereqs
14
+
15
+ file PROJ.ann.file do
16
+ ann = PROJ.ann
17
+ puts "Generating #{ann.file}"
18
+ File.open(ann.file,'w') do |fd|
19
+ fd.puts("#{PROJ.name} version #{PROJ.version}")
20
+ fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
21
+ fd.puts(" #{PROJ.url}") if PROJ.url.valid?
22
+ fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
23
+ fd.puts
24
+ fd.puts("== DESCRIPTION")
25
+ fd.puts
26
+ fd.puts(PROJ.description)
27
+ fd.puts
28
+ fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
29
+ fd.puts
30
+ ann.paragraphs.each do |p|
31
+ fd.puts "== #{p.upcase}"
32
+ fd.puts
33
+ fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
34
+ fd.puts
35
+ end
36
+ fd.puts ann.text if ann.text
37
+ end
38
+ end
39
+
40
+ desc "Create an announcement file"
41
+ task :announcement => ['ann:prereqs', PROJ.ann.file]
42
+
43
+ desc "Send an email announcement"
44
+ task :email => ['ann:prereqs', PROJ.ann.file] do
45
+ ann = PROJ.ann
46
+ from = ann.email[:from] || PROJ.email
47
+ to = Array(ann.email[:to])
48
+
49
+ ### build a mail header for RFC 822
50
+ rfc822msg = "From: #{from}\n"
51
+ rfc822msg << "To: #{to.join(',')}\n"
52
+ rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
53
+ rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
54
+ rfc822msg << "\n"
55
+ rfc822msg << "Date: #{Time.new.rfc822}\n"
56
+ rfc822msg << "Message-Id: "
57
+ rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
58
+ rfc822msg << File.read(ann.file)
59
+
60
+ params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
61
+ ann.email[key]
62
+ end
63
+
64
+ params[3] = PROJ.email if params[3].nil?
65
+
66
+ if params[4].nil?
67
+ STDOUT.write "Please enter your e-mail password (#{params[3]}): "
68
+ params[4] = STDIN.gets.chomp
69
+ end
70
+
71
+ ### send email
72
+ Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
73
+ end
74
+ end # namespace :ann
75
+
76
+ desc 'Alias to ann:announcement'
77
+ task :ann => 'ann:announcement'
78
+
79
+ CLOBBER << PROJ.ann.file
80
+
81
+ # EOF
data/tasks/bones.rake CHANGED
@@ -1,21 +1,21 @@
1
- # $Id$
2
-
3
- if HAVE_BONES
4
-
5
- namespace :bones do
6
-
7
- desc 'Show the PROJ open struct'
8
- task :debug do |t|
9
- atr = if t.application.top_level_tasks.length == 2
10
- t.application.top_level_tasks.pop
11
- end
12
-
13
- if atr then Bones::Debug.show_attr(PROJ, atr)
14
- else Bones::Debug.show PROJ end
15
- end
16
-
17
- end # namespace :bones
18
-
19
- end # HAVE_BONES
20
-
21
- # EOF
1
+ # $Id$
2
+
3
+ if HAVE_BONES
4
+
5
+ namespace :bones do
6
+
7
+ desc 'Show the PROJ open struct'
8
+ task :debug do |t|
9
+ atr = if t.application.top_level_tasks.length == 2
10
+ t.application.top_level_tasks.pop
11
+ end
12
+
13
+ if atr then Bones::Debug.show_attr(PROJ, atr)
14
+ else Bones::Debug.show PROJ end
15
+ end
16
+
17
+ end # namespace :bones
18
+
19
+ end # HAVE_BONES
20
+
21
+ # EOF