very_nifty_generators 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -147,7 +147,6 @@ module Nifty
147
147
  end
148
148
 
149
149
  def apply_rails_template
150
- puts rails_template.inspect
151
150
  apply rails_template if rails_template
152
151
  rescue Thor::Error, LoadError, Errno::ENOENT => e
153
152
  raise Error, "The template [#{rails_template}] could not be loaded. Error: #{e}"
@@ -1,3 +1,7 @@
1
1
  class ApplicationController < ActionController::Base
2
2
  protect_from_forgery
3
+
4
+ # public
5
+
6
+ # private
3
7
  end
@@ -29,9 +29,9 @@ module <%= app_const_base %>
29
29
  # g.orm :mongo_db
30
30
  # g.template_engine :erb
31
31
  # g.test_framework :rspec, :fixture => true
32
- # end
32
+ # end # config
33
33
 
34
34
  # Configure sensitive parameters which will be filtered from the log file.
35
- config.filter_parameters << :password
35
+ # config.filter_parameters << :password
36
36
  end
37
37
  end
@@ -0,0 +1,23 @@
1
+ # Needed by cucumber by default?
2
+ # SQLite version 3.x
3
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
4
+ development:
5
+ adapter: sqlite3
6
+ database: db/development.sqlite3
7
+ pool: 5
8
+ timeout: 5000
9
+
10
+ # Warning: The database defined as "test" will be erased and
11
+ # re-generated from your development database when you run "rake".
12
+ # Do not set this db to the same as development or production.
13
+ test:
14
+ adapter: sqlite3
15
+ database: db/test.sqlite3
16
+ pool: 5
17
+ timeout: 5000
18
+
19
+ production:
20
+ adapter: sqlite3
21
+ database: db/production.sqlite3
22
+ pool: 5
23
+ timeout: 5000
@@ -16,4 +16,6 @@
16
16
 
17
17
  # Don't care if the mailer can't send
18
18
  config.action_mailer.raise_delivery_errors = false
19
+
20
+ # configs:
19
21
  end
@@ -28,6 +28,8 @@
28
28
  # Disable delivery errors, bad email addresses will be ignored
29
29
  # config.action_mailer.raise_delivery_errors = false
30
30
 
31
+ # configs:
32
+
31
33
  # Enable threaded mode
32
34
  # config.threadsafe!
33
35
  end
@@ -26,4 +26,6 @@
26
26
  # This is necessary if your schema can't be completely dumped by the schema dumper,
27
27
  # like if you have constraints or database-specific column types
28
28
  # config.active_record.schema_format = :sql
29
+
30
+ # configs:
29
31
  end
@@ -5,3 +5,5 @@
5
5
  #
6
6
  # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
7
  # Mayor.create(:name => 'Daley', :city => cities.first)
8
+
9
+ # seed data:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: very_nifty_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristian Mandrup, dvyjones
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-30 00:00:00 +01:00
12
+ date: 2010-02-04 00:00:00 +01:00
13
13
  default_executable: nifty_scaffold
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -49,13 +49,13 @@ files:
49
49
  - lib/generators/nifty/app/USAGE
50
50
  - lib/generators/nifty/app/app_generator.rb
51
51
  - lib/generators/nifty/app/templates/Gemfile
52
- - lib/generators/nifty/app/templates/README
53
52
  - lib/generators/nifty/app/templates/Rakefile
54
53
  - lib/generators/nifty/app/templates/app/controllers/application_controller.rb
55
54
  - lib/generators/nifty/app/templates/app/helpers/application_helper.rb
56
55
  - lib/generators/nifty/app/templates/config.ru
57
56
  - lib/generators/nifty/app/templates/config/application.rb
58
57
  - lib/generators/nifty/app/templates/config/boot.rb
58
+ - lib/generators/nifty/app/templates/config/database.yml
59
59
  - lib/generators/nifty/app/templates/config/environment.rb
60
60
  - lib/generators/nifty/app/templates/config/environments/development.rb.tt
61
61
  - lib/generators/nifty/app/templates/config/environments/production.rb.tt
@@ -1,216 +0,0 @@
1
- == Getting Started
2
-
3
- 1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
4
- and your application name. Ex: rails myapp
5
- 2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
6
- 3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
7
- 4. Follow the guidelines to start developing your application
8
-
9
-
10
- == Web Servers
11
-
12
- By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
13
- with a variety of other web servers.
14
-
15
- Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
16
- suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
17
- getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
18
- More info at: http://mongrel.rubyforge.org
19
-
20
- Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
21
- Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
22
- FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
23
-
24
- == Apache .htaccess example for FCGI/CGI
25
-
26
- # General Apache options
27
- AddHandler fastcgi-script .fcgi
28
- AddHandler cgi-script .cgi
29
- Options +FollowSymLinks +ExecCGI
30
-
31
- # If you don't want Rails to look in certain directories,
32
- # use the following rewrite rules so that Apache won't rewrite certain requests
33
- #
34
- # Example:
35
- # RewriteCond %{REQUEST_URI} ^/notrails.*
36
- # RewriteRule .* - [L]
37
-
38
- # Redirect all requests not available on the filesystem to Rails
39
- # By default the cgi dispatcher is used which is very slow
40
- #
41
- # For better performance replace the dispatcher with the fastcgi one
42
- #
43
- # Example:
44
- # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
45
- RewriteEngine On
46
-
47
- # If your Rails application is accessed via an Alias directive,
48
- # then you MUST also set the RewriteBase in this htaccess file.
49
- #
50
- # Example:
51
- # Alias /myrailsapp /path/to/myrailsapp/public
52
- # RewriteBase /myrailsapp
53
-
54
- RewriteRule ^$ index.html [QSA]
55
- RewriteRule ^([^.]+)$ $1.html [QSA]
56
- RewriteCond %{REQUEST_FILENAME} !-f
57
- RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
58
-
59
- # In case Rails experiences terminal errors
60
- # Instead of displaying this message you can supply a file here which will be rendered instead
61
- #
62
- # Example:
63
- # ErrorDocument 500 /500.html
64
-
65
- ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
66
-
67
-
68
- == Debugging Rails
69
-
70
- Sometimes your application goes wrong. Fortunately there are a lot of tools that
71
- will help you debug it and get it back on the rails.
72
-
73
- First area to check is the application log files. Have "tail -f" commands running
74
- on the server.log and development.log. Rails will automatically display debugging
75
- and runtime information to these files. Debugging info will also be shown in the
76
- browser on requests from 127.0.0.1.
77
-
78
- You can also log your own messages directly into the log file from your code using
79
- the Ruby logger class from inside your controllers. Example:
80
-
81
- class WeblogController < ActionController::Base
82
- def destroy
83
- @weblog = Weblog.find(params[:id])
84
- @weblog.destroy
85
- logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
86
- end
87
- end
88
-
89
- The result will be a message in your log file along the lines of:
90
-
91
- Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
92
-
93
- More information on how to use the logger is at http://www.ruby-doc.org/core/
94
-
95
- Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
96
-
97
- * The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
98
- * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
99
-
100
- These two online (and free) books will bring you up to speed on the Ruby language
101
- and also on programming in general.
102
-
103
-
104
- == Debugger
105
-
106
- Debugger support is available through the debugger command when you start your Mongrel or
107
- Webrick server with --debugger. This means that you can break out of execution at any point
108
- in the code, investigate and change the model, AND then resume execution!
109
- You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
110
- Example:
111
-
112
- class WeblogController < ActionController::Base
113
- def index
114
- @posts = Post.find(:all)
115
- debugger
116
- end
117
- end
118
-
119
- So the controller will accept the action, run the first line, then present you
120
- with a IRB prompt in the server window. Here you can do things like:
121
-
122
- >> @posts.inspect
123
- => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
124
- #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
125
- >> @posts.first.title = "hello from a debugger"
126
- => "hello from a debugger"
127
-
128
- ...and even better is that you can examine how your runtime objects actually work:
129
-
130
- >> f = @posts.first
131
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
132
- >> f.
133
- Display all 152 possibilities? (y or n)
134
-
135
- Finally, when you're ready to resume execution, you enter "cont"
136
-
137
-
138
- == Console
139
-
140
- You can interact with the domain model by starting the console through <tt>script/console</tt>.
141
- Here you'll have all parts of the application configured, just like it is when the
142
- application is running. You can inspect domain models, change values, and save to the
143
- database. Starting the script without arguments will launch it in the development environment.
144
- Passing an argument will specify a different environment, like <tt>script/console production</tt>.
145
-
146
- To reload your controllers and models after launching the console run <tt>reload!</tt>
147
-
148
- == dbconsole
149
-
150
- You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
151
- You would be connected to the database with the credentials defined in database.yml.
152
- Starting the script without arguments will connect you to the development database. Passing an
153
- argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
154
- Currently works for mysql, postgresql and sqlite.
155
-
156
- == Description of Contents
157
-
158
- app
159
- Holds all the code that's specific to this particular application.
160
-
161
- app/controllers
162
- Holds controllers that should be named like weblogs_controller.rb for
163
- automated URL mapping. All controllers should descend from ApplicationController
164
- which itself descends from ActionController::Base.
165
-
166
- app/models
167
- Holds models that should be named like post.rb.
168
- Most models will descend from ActiveRecord::Base.
169
-
170
- app/views
171
- Holds the template files for the view that should be named like
172
- weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
173
- syntax.
174
-
175
- app/views/layouts
176
- Holds the template files for layouts to be used with views. This models the common
177
- header/footer method of wrapping views. In your views, define a layout using the
178
- <tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
179
- call <% yield %> to render the view using this layout.
180
-
181
- app/helpers
182
- Holds view helpers that should be named like weblogs_helper.rb. These are generated
183
- for you automatically when using script/generate for controllers. Helpers can be used to
184
- wrap functionality for your views into methods.
185
-
186
- config
187
- Configuration files for the Rails environment, the routing map, the database, and other dependencies.
188
-
189
- db
190
- Contains the database schema in schema.rb. db/migrate contains all
191
- the sequence of Migrations for your schema.
192
-
193
- doc
194
- This directory is where your application documentation will be stored when generated
195
- using <tt>rake doc:app</tt>
196
-
197
- lib
198
- Application specific libraries. Basically, any kind of custom code that doesn't
199
- belong under controllers, models, or helpers. This directory is in the load path.
200
-
201
- public
202
- The directory available for the web server. Contains subdirectories for images, stylesheets,
203
- and javascripts. Also contains the dispatchers and the default HTML files. This should be
204
- set as the DOCUMENT_ROOT of your web server.
205
-
206
- script
207
- Helper scripts for automation and generation.
208
-
209
- test
210
- Unit and functional tests along with fixtures. When using the script/generate scripts, template
211
- test files will be generated for you and placed in this directory.
212
-
213
- vendor
214
- External libraries that the application depends on. Also includes the plugins subdirectory.
215
- If the app has frozen rails, those gems also go here, under vendor/rails/.
216
- This directory is in the load path.