mconnell-generators 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/.gitignore +2 -0
  2. data/CHANGELOG +43 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.rdoc +46 -0
  5. data/Rakefile +17 -0
  6. data/TODO +11 -0
  7. data/bin/rubaidh_rails +11 -0
  8. data/generators.gemspec +59 -0
  9. data/generators/rubaidh_controller/USAGE +31 -0
  10. data/generators/rubaidh_controller/rubaidh_controller_generator.rb +40 -0
  11. data/generators/rubaidh_controller/templates/controller.rb +17 -0
  12. data/generators/rubaidh_controller/templates/controller_spec.rb +29 -0
  13. data/generators/rubaidh_controller/templates/view.html.erb +17 -0
  14. data/generators/rubaidh_helper/USAGE +23 -0
  15. data/generators/rubaidh_helper/rubaidh_helper_generator.rb +27 -0
  16. data/generators/rubaidh_helper/templates/helper.rb +12 -0
  17. data/generators/rubaidh_helper/templates/helper_spec.rb +14 -0
  18. data/generators/rubaidh_layout/rubaidh_layout_generator.rb +27 -0
  19. data/generators/rubaidh_layout/templates/base.css +334 -0
  20. data/generators/rubaidh_layout/templates/layout.html.erb +36 -0
  21. data/generators/rubaidh_layout/templates/style.css +321 -0
  22. data/generators/rubaidh_model/USAGE +25 -0
  23. data/generators/rubaidh_model/rubaidh_model_generator.rb +29 -0
  24. data/generators/rubaidh_model/templates/migration.rb +25 -0
  25. data/generators/rubaidh_model/templates/model.rb +15 -0
  26. data/generators/rubaidh_model/templates/model_exemplar.rb +13 -0
  27. data/generators/rubaidh_model/templates/model_spec.rb +31 -0
  28. data/generators/rubaidh_named_base.rb +31 -0
  29. data/generators/rubaidh_scaffold/USAGE +29 -0
  30. data/generators/rubaidh_scaffold/rubaidh_scaffold_generator.rb +90 -0
  31. data/generators/rubaidh_scaffold/templates/controller.rb +76 -0
  32. data/generators/rubaidh_scaffold/templates/controller_spec.rb +251 -0
  33. data/generators/rubaidh_scaffold/templates/partial_form.html.erb +13 -0
  34. data/generators/rubaidh_scaffold/templates/partial_layout.html.erb +13 -0
  35. data/generators/rubaidh_scaffold/templates/partial_model.html.erb +8 -0
  36. data/generators/rubaidh_scaffold/templates/routing_spec.rb +73 -0
  37. data/generators/rubaidh_scaffold/templates/view_edit.html.erb +10 -0
  38. data/generators/rubaidh_scaffold/templates/view_index.html.erb +10 -0
  39. data/generators/rubaidh_scaffold/templates/view_new.html.erb +9 -0
  40. data/generators/rubaidh_scaffold/templates/view_show.html.erb +17 -0
  41. data/templates/rubaidh.rb +115 -0
  42. metadata +113 -0
@@ -0,0 +1,13 @@
1
+ <%% form_for(<%= singular_name %>) do |f| %>
2
+ <%%= f.error_messages %>
3
+
4
+ <% for attribute in attributes -%>
5
+ <p>
6
+ <%%= f.label :<%= attribute.name %> %><br />
7
+ <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
8
+ </p>
9
+ <% end -%>
10
+ <p>
11
+ <%%= f.submit <%= singular_name %>.new_record? ? "Create" : "Update" %>
12
+ </p>
13
+ <%% end %>
@@ -0,0 +1,13 @@
1
+ <table>
2
+ <thead>
3
+ <tr>
4
+ <% for attribute in attributes -%>
5
+ <th><%= attribute.column.human_name %></th>
6
+ <% end -%>
7
+ <th colspan="3">Actions</th>
8
+ </tr>
9
+ </thead>
10
+ <tbody>
11
+ <%%= yield %>
12
+ </tbody>
13
+ </table>
@@ -0,0 +1,8 @@
1
+ <tr>
2
+ <% for attribute in attributes -%>
3
+ <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
4
+ <% end -%>
5
+ <td><%%= link_to 'Show', <%= singular_name %> %></td>
6
+ <td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
7
+ <td><%%= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
8
+ </tr>
@@ -0,0 +1,73 @@
1
+ # <%= class_name %> Controller Spec
2
+ #
3
+ # Created on <%= Time.now.to_s :long %> by <%= user_full_name %> as part
4
+ # of the "<%= project_name %>" project.
5
+ #
6
+ #--
7
+ # Copyright (c) 2006-<%= Time.now.year %> Rubaidh Ltd. All rights reserved.
8
+ # See LICENSE in the top level source code folder for permissions.
9
+ #++
10
+
11
+ require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
12
+
13
+ describe <%= controller_class_name %>Controller do
14
+ describe "route generation" do
15
+ it "should map #index" do
16
+ route_for(:controller => "<%= table_name %>", :action => "index").should == "/<%= table_name %>"
17
+ end
18
+
19
+ it "should map #new" do
20
+ route_for(:controller => "<%= table_name %>", :action => "new").should == "/<%= table_name %>/new"
21
+ end
22
+
23
+ it "should map #create" do
24
+ route_for(:controller => "<%= table_name %>", :action => "create").should == { :path => "/<%= table_name %>", :method => :post }
25
+ end
26
+
27
+ it "should map #show" do
28
+ route_for(:controller => "<%= table_name %>", :action => "show", :id => "1").should == "/<%= table_name %>/1"
29
+ end
30
+
31
+ it "should map #edit" do
32
+ route_for(:controller => "<%= table_name %>", :action => "edit", :id => "1").should == "/<%= table_name %>/1/edit"
33
+ end
34
+
35
+ it "should map #update" do
36
+ route_for(:controller => "<%= table_name %>", :action => "update", :id => "1").should == { :path => "/<%= table_name %>/1", :method => :put }
37
+ end
38
+
39
+ it "should map #destroy" do
40
+ route_for(:controller => "<%= table_name %>", :action => "destroy", :id => "1").should == { :path => "/<%= table_name %>/1", :method => :delete }
41
+ end
42
+ end
43
+
44
+ describe "route recognition" do
45
+ it "should generate params for #index" do
46
+ params_from(:get, "/<%= table_name %>").should == {:controller => "<%= table_name %>", :action => "index"}
47
+ end
48
+
49
+ it "should generate params for #new" do
50
+ params_from(:get, "/<%= table_name %>/new").should == {:controller => "<%= table_name %>", :action => "new"}
51
+ end
52
+
53
+ it "should generate params for #create" do
54
+ params_from(:post, "/<%= table_name %>").should == {:controller => "<%= table_name %>", :action => "create"}
55
+ end
56
+
57
+ it "should generate params for #show" do
58
+ params_from(:get, "/<%= table_name %>/1").should == {:controller => "<%= table_name %>", :action => "show", :id => "1"}
59
+ end
60
+
61
+ it "should generate params for #edit" do
62
+ params_from(:get, "/<%= table_name %>/1/edit").should == {:controller => "<%= table_name %>", :action => "edit", :id => "1"}
63
+ end
64
+
65
+ it "should generate params for #update" do
66
+ params_from(:put, "/<%= table_name %>/1").should == {:controller => "<%= table_name %>", :action => "update", :id => "1"}
67
+ end
68
+
69
+ it "should generate params for #destroy" do
70
+ params_from(:delete, "/<%= table_name %>/1").should == {:controller => "<%= table_name %>", :action => "destroy", :id => "1"}
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,10 @@
1
+ <div class="block">
2
+ <div class="content">
3
+ <h2 class="title">Editing <%= singular_name.humanize %></h2>
4
+ <div class="inner">
5
+ <%%= render :partial => 'form', :locals => { :<%= singular_name %> => @<%= singular_name %> } %>
6
+ <p><%%= link_to 'Show', @<%= singular_name %> %> |
7
+ <%%= link_to 'Back', <%= plural_name %>_path %></p>
8
+ </div>
9
+ </div>
10
+ </div>
@@ -0,0 +1,10 @@
1
+ <div class="block">
2
+ <div class="content">
3
+ <h2 class="title">Listing <%= plural_name.humanize %></h2>
4
+ <div class="inner">
5
+ <%%= render :partial => @<%= plural_name %>, :layout => '<%= plural_name %>' %>
6
+ <p><%%= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path %></p>
7
+ </div>
8
+ </div>
9
+ </div>
10
+
@@ -0,0 +1,9 @@
1
+ <div class="block">
2
+ <div class="content">
3
+ <h2 class="title">New <%= singular_name.humanize %></h2>
4
+ <div class="inner">
5
+ <%%= render :partial => 'form', :locals => { :<%= singular_name %> => @<%= singular_name %> } %>
6
+ <p><%%= link_to 'Back', <%= plural_name %>_path %></p>
7
+ </div>
8
+ </div>
9
+ </div>
@@ -0,0 +1,17 @@
1
+ <div class="block">
2
+ <div class="content">
3
+ <h2 class="title">Showing <%= singular_name.humanize %></h2>
4
+ <div class="inner">
5
+ <% attributes.each do |attribute| -%>
6
+ <dl>
7
+ <dt><%= attribute.column.human_name %></dt>
8
+ <dd><%%=h @<%= singular_name %>.<%= attribute.name %> %></dd>
9
+ </dl>
10
+
11
+ <% end -%>
12
+ <p><%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) %> |
13
+ <%%= link_to 'Back', <%= plural_name %>_path %></p>
14
+ </div>
15
+ </div>
16
+ </div>
17
+
@@ -0,0 +1,115 @@
1
+
2
+ git :init
3
+
4
+ # Have git ignore a pile of useless things.
5
+ file ".gitignore", <<-GITIGNORE
6
+ # Log files
7
+ /log/*.log
8
+
9
+ # Temporary files
10
+ /tmp
11
+
12
+ # Generated documentation
13
+ /doc/api
14
+ /doc/app
15
+ /doc/plugins
16
+
17
+ # RSpec test coverage
18
+ /coverage
19
+
20
+ # Pesky .DS_Store files from Mac OS X
21
+ .DS_Store
22
+
23
+ GITIGNORE
24
+
25
+ # Don't delete the log folder, thanks, git.
26
+ file "log/.keep", ""
27
+
28
+ git :add => '.'
29
+ git :commit => "-m 'Initial commit of application skeleton.'"
30
+
31
+ # Pull Rails in as a submodule
32
+ git :submodule => 'add git://github.com/rails/rails.git vendor/rails'
33
+ git :commit => '-m "Pull in Rails as a git submodule."'
34
+
35
+ # Update against the latest edge Rails
36
+ rake 'rails:update'
37
+ git :add => '.'
38
+ git :commit => '-m "Update Rails skeleton code to latest from edge Rails."'
39
+
40
+ # Pull in all our favourite testing tools.
41
+ plugin 'shoulda', :git => 'git://github.com/thoughtbot/shoulda.git', :submodule => true
42
+ plugin 'rspec', :git => 'git://github.com/dchelimsky/rspec.git', :submodule => true
43
+ plugin 'rspec-rails', :git => 'git://github.com/dchelimsky/rspec-rails.git', :submodule => true
44
+ plugin 'webrat', :git => 'git://github.com/brynary/webrat.git', :submodule => true
45
+ plugin 'object_daddy', :git => 'git://github.com/flogic/object_daddy.git', :submodule => true
46
+ generate 'rspec'
47
+ generate 'cucumber'
48
+ git :add => '.'
49
+ git :commit => "-m 'Pull in submodules, and install support, for RSpec testing tools.'"
50
+
51
+ # Remave the existing Test::Unit test suite code.
52
+ git :rm => "-rf test"
53
+ run "rm -rf test"
54
+ git :commit => "-m 'Remove Test::Unit test suite.'"
55
+
56
+ # Create the databases and an emtpy db schema for VC.
57
+ rake "db:create:all"
58
+ rake "db:migrate"
59
+ git :add => "db/schema.rb"
60
+ git :commit => "-m 'Create a blank database schema.'"
61
+
62
+ # GetExceptional Notifier for notification of production errors
63
+ plugin 'exceptional', :git => 'git://github.com/contrast/exceptional.git', :submodule => true
64
+ file 'config/exceptional.yml', <<-EXCEPTIONAL
65
+ # here are the settings that are common to all environments
66
+ common: &default_settings
67
+ # You must specify your Exceptional API key here.
68
+ api-key: API_KEY_GOES_HERE
69
+ # Exceptional creates a separate log file from your application's logs
70
+ # available levels are debug, info, warn, error, fatal
71
+ log-level: info
72
+ # The exceptional agent sends data via regular http by default
73
+ # Setting this value to true will send data over SSL, increasing security
74
+ # There will be an additional CPU overhead in encrypting the data, however
75
+ # as long as your deployment environment is not Passenger (mod_rails), this
76
+ # happens in the background so as not to incur a page wait for your users.
77
+ ssl: false
78
+
79
+ development:
80
+ <<: *default_settings
81
+ # Normally no reason to collect exceptions in development
82
+ # NOTE: for trial purposes you may want to enable exceptional in development
83
+ enabled: false
84
+
85
+ test:
86
+ <<: *default_settings
87
+ # No reason to collect exceptions when running tests by default
88
+ enabled: false
89
+
90
+ production:
91
+ <<: *default_settings
92
+ enabled: true
93
+
94
+ staging:
95
+ # It's common development practice to have a staging environment that closely
96
+ # mirrors production, by default catch errors in this environment too.
97
+ <<: *default_settings
98
+ enabled: true
99
+
100
+ EXCEPTIONAL
101
+
102
+ git :add => '.'
103
+ git :commit => "-m 'Incorporate Hoptoad exception notification support.'"
104
+
105
+ # Capistrano-ification
106
+ capify!
107
+ git :add => '.'
108
+ git :commit => "-m 'Capistrano configuration.'"
109
+
110
+ # Tidy up the public folder
111
+ git :rm => "public/index.html public/robots.txt public/favicon.ico public/images/rails.png"
112
+ git :commit => " -m 'Remove static files we will not need.'"
113
+
114
+ # And I think that'll do for now. What, you want me to automate the writing of
115
+ # the app too?! :-)
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mconnell-generators
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.6
5
+ platform: ruby
6
+ authors:
7
+ - Graeme Mathieson
8
+ - Mark ConnellRubaidh Ltd
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-03-17 00:00:00 -07:00
14
+ default_executable: rubaidh_rails
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rails
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 2.3.0
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: grit
28
+ type: :runtime
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.1
35
+ version:
36
+ description: Generators for building Ruby on Rails projects the Rubaidh Way
37
+ email: support@rubaidh.com
38
+ executables:
39
+ - rubaidh_rails
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - MIT-LICENSE
47
+ - Rakefile
48
+ - README.rdoc
49
+ - CHANGELOG
50
+ - TODO
51
+ - generators.gemspec
52
+ - bin/rubaidh_rails
53
+ - generators/rubaidh_controller/rubaidh_controller_generator.rb
54
+ - generators/rubaidh_controller/templates/controller.rb
55
+ - generators/rubaidh_controller/templates/controller_spec.rb
56
+ - generators/rubaidh_controller/templates/view.html.erb
57
+ - generators/rubaidh_controller/USAGE
58
+ - generators/rubaidh_helper/rubaidh_helper_generator.rb
59
+ - generators/rubaidh_helper/templates/helper.rb
60
+ - generators/rubaidh_helper/templates/helper_spec.rb
61
+ - generators/rubaidh_helper/USAGE
62
+ - generators/rubaidh_model/rubaidh_model_generator.rb
63
+ - generators/rubaidh_model/templates/migration.rb
64
+ - generators/rubaidh_model/templates/model.rb
65
+ - generators/rubaidh_model/templates/model_exemplar.rb
66
+ - generators/rubaidh_model/templates/model_spec.rb
67
+ - generators/rubaidh_model/USAGE
68
+ - generators/rubaidh_named_base.rb
69
+ - generators/rubaidh_scaffold/rubaidh_scaffold_generator.rb
70
+ - generators/rubaidh_scaffold/templates/controller.rb
71
+ - generators/rubaidh_scaffold/templates/controller_spec.rb
72
+ - generators/rubaidh_scaffold/templates/partial_form.html.erb
73
+ - generators/rubaidh_scaffold/templates/partial_layout.html.erb
74
+ - generators/rubaidh_scaffold/templates/partial_model.html.erb
75
+ - generators/rubaidh_scaffold/templates/routing_spec.rb
76
+ - generators/rubaidh_scaffold/templates/view_edit.html.erb
77
+ - generators/rubaidh_scaffold/templates/view_index.html.erb
78
+ - generators/rubaidh_scaffold/templates/view_new.html.erb
79
+ - generators/rubaidh_scaffold/templates/view_show.html.erb
80
+ - generators/rubaidh_scaffold/USAGE
81
+ - generators/rubaidh_layout/rubaidh_layout_generator.rb
82
+ - generators/rubaidh_layout/templates/base.css
83
+ - generators/rubaidh_layout/templates/style.css
84
+ - generators/rubaidh_layout/templates/layout.html.erb
85
+ - templates/rubaidh.rb
86
+ has_rdoc: false
87
+ homepage: http://rubaidh.com/portfolio/open-source
88
+ post_install_message:
89
+ rdoc_options: []
90
+
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ version:
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: "0"
104
+ version:
105
+ requirements: []
106
+
107
+ rubyforge_project: rubaidh
108
+ rubygems_version: 1.2.0
109
+ signing_key:
110
+ specification_version: 2
111
+ summary: "[Rails] Generators for building Ruby on Rails projects the Rubaidh Way"
112
+ test_files: []
113
+