netzke-testing 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -7
  3. data/README.md +3 -3
  4. data/app/controllers/netzke/testing_controller.rb +1 -1
  5. data/app/views/layouts/netzke/testing.html.erb +3 -3
  6. data/lib/netzke/testing/version.rb +1 -1
  7. data/netzke-testing.gemspec +5 -3
  8. metadata +36 -108
  9. data/.gitignore +0 -16
  10. data/app/assets/javascripts/netzke/.keep +0 -0
  11. data/app/controllers/.keep +0 -0
  12. data/app/helpers/.keep +0 -0
  13. data/app/mailers/.keep +0 -0
  14. data/app/models/.keep +0 -0
  15. data/app/views/.keep +0 -0
  16. data/config/routes.rb +0 -8
  17. data/spec/features/foo_spec.rb +0 -7
  18. data/spec/features/javascripts/foo.js.coffee +0 -6
  19. data/spec/rails_app/.gitignore +0 -15
  20. data/spec/rails_app/README.rdoc +0 -261
  21. data/spec/rails_app/Rakefile +0 -7
  22. data/spec/rails_app/app/assets/images/rails.png +0 -0
  23. data/spec/rails_app/app/assets/javascripts/application.js +0 -15
  24. data/spec/rails_app/app/assets/javascripts/custom.js +0 -0
  25. data/spec/rails_app/app/assets/stylesheets/application.css +0 -13
  26. data/spec/rails_app/app/components/foo.rb +0 -6
  27. data/spec/rails_app/app/controllers/application_controller.rb +0 -3
  28. data/spec/rails_app/app/helpers/application_helper.rb +0 -2
  29. data/spec/rails_app/app/mailers/.gitkeep +0 -0
  30. data/spec/rails_app/app/models/.gitkeep +0 -0
  31. data/spec/rails_app/app/views/layouts/application.html.erb +0 -14
  32. data/spec/rails_app/config.ru +0 -4
  33. data/spec/rails_app/config/application.rb +0 -64
  34. data/spec/rails_app/config/boot.rb +0 -7
  35. data/spec/rails_app/config/database.yml +0 -25
  36. data/spec/rails_app/config/environment.rb +0 -5
  37. data/spec/rails_app/config/environments/development.rb +0 -37
  38. data/spec/rails_app/config/environments/production.rb +0 -67
  39. data/spec/rails_app/config/environments/test.rb +0 -37
  40. data/spec/rails_app/config/initializers/backtrace_silencers.rb +0 -7
  41. data/spec/rails_app/config/initializers/inflections.rb +0 -15
  42. data/spec/rails_app/config/initializers/mime_types.rb +0 -5
  43. data/spec/rails_app/config/initializers/netzke_testing.rb +0 -4
  44. data/spec/rails_app/config/initializers/secret_token.rb +0 -7
  45. data/spec/rails_app/config/initializers/session_store.rb +0 -8
  46. data/spec/rails_app/config/initializers/wrap_parameters.rb +0 -14
  47. data/spec/rails_app/config/locales/en.yml +0 -5
  48. data/spec/rails_app/config/routes.rb +0 -3
  49. data/spec/rails_app/db/seeds.rb +0 -7
  50. data/spec/rails_app/lib/assets/.gitkeep +0 -0
  51. data/spec/rails_app/lib/tasks/.gitkeep +0 -0
  52. data/spec/rails_app/log/.gitkeep +0 -0
  53. data/spec/rails_app/public/404.html +0 -26
  54. data/spec/rails_app/public/422.html +0 -26
  55. data/spec/rails_app/public/500.html +0 -25
  56. data/spec/rails_app/public/favicon.ico +0 -0
  57. data/spec/rails_app/public/index.html +0 -241
  58. data/spec/rails_app/public/robots.txt +0 -5
  59. data/spec/rails_app/script/rails +0 -6
  60. data/spec/spec_helper.rb +0 -44
  61. data/spec/testing_controller_spec.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a57f735b798d64c118f3a386f7ab3fef66454819
4
- data.tar.gz: 3076bd4226c7657b042a563dfe430c5414416eda
3
+ metadata.gz: ea13495205fe05c1f7976b36cd34143f41200d2b
4
+ data.tar.gz: c354096fd07fdd06bf4389aa3d6cd9031c2fafda
5
5
  SHA512:
6
- metadata.gz: fbac6c232c487c5e5e8efda024a9f2feade3118b72646d4f6a472e456e18c73fca95148eadaf5c606cbb9fa1b4b258fbf69099c8635ccde896f46326717fd1cc
7
- data.tar.gz: c448e0147093e7e1e76e6c7f64b33a6ac0efb6908b2790b89d5f54260c46f904a73c2cb3d22e0701c0c2dc0108014f8bb7959d15e84b4ed2dfebb5268e6a1b76
6
+ metadata.gz: c06164d28a58334f0ce6547ae865497ce30cfacb5fa34ffb36bdb40c6de8b0129c74baea2840070c7ff3ae3f1822bd872eb9235f54d5bb96ee6c9b851c2162c9
7
+ data.tar.gz: 5156735b1704e0bed07d6d816b899f9f547a777fdf87db1df71df1abc1f7824624bcedec7921b18b32bd55fd69df15eaf26cdf4b4d1682f3c3643ee585907e2b
data/Gemfile CHANGED
@@ -1,10 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in netzke-testing.gemspec
4
3
  gemspec
5
-
6
- group :test do
7
- gem 'capybara'
8
- gem 'selenium-webdriver'
9
- gem 'netzke-core', '0.10.0.rc1'
10
- end
data/README.md CHANGED
@@ -111,11 +111,11 @@ You can explicitely specify a component to run the spec on (in order to override
111
111
 
112
112
  ## Requirements
113
113
 
114
- * Ruby >= 1.9.3
115
- * Rails >= 3.2.0
114
+ * Ruby >= 2.0.0
115
+ * Rails >= 4.2.0
116
116
 
117
117
  ---
118
- Copyright (c) 2014 [Max Gorin](https://twitter.com/uptomax), released under the MIT license (see LICENSE).
118
+ Copyright (c) 2015 [Max Gorin](https://twitter.com/uptomax), released under the MIT license (see LICENSE).
119
119
 
120
120
  **Note** that Ext JS is licensed [differently](http://www.sencha.com/products/extjs/license/), and you may need to
121
121
  purchase a commercial license in order to use it in your projects!
@@ -1,6 +1,6 @@
1
1
  require 'coffee-script'
2
2
 
3
- class Netzke::TestingController < ApplicationController
3
+ class Netzke::TestingController < ActionController::Base
4
4
  before_filter :set_locale
5
5
 
6
6
  def components
@@ -6,9 +6,9 @@
6
6
  <%= load_netzke %>
7
7
 
8
8
  <% if params[:spec] %>
9
- <%= javascript_include_tag "/assets/netzke/testing/expect/expect.js" %>
10
- <%= javascript_include_tag "/assets/netzke/testing/mocha/mocha.js" %>
11
- <%= stylesheet_link_tag "/assets/netzke/testing/mocha/mocha.css" %>
9
+ <%= javascript_include_tag "netzke/testing/expect/expect.js" %>
10
+ <%= javascript_include_tag "netzke/testing/mocha/mocha.js" %>
11
+ <%= stylesheet_link_tag "netzke/testing/mocha/mocha.css" %>
12
12
  <script>
13
13
  mocha.setup('bdd');
14
14
  mocha.setup({ignoreLeaks: true, slow: 500, timeout: 5000});
@@ -1,5 +1,5 @@
1
1
  module Netzke
2
2
  module Testing
3
- VERSION = "0.10.0"
3
+ VERSION = "0.11.0"
4
4
  end
5
5
  end
@@ -13,16 +13,18 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "http://netzke.org"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files`.split($/)
16
+ spec.files = Dir["{app,javascripts,lib,stylesheets,tasks}/**/*", "[A-Z]*", "init.rb"] - ["Gemfile.lock"]
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rails", "~> 3.2.0"
23
+ spec.add_development_dependency "rails", "~> 4.2.0"
24
24
  spec.add_development_dependency "sqlite3"
25
+ spec.add_development_dependency 'capybara'
26
+ spec.add_development_dependency 'selenium-webdriver'
25
27
  spec.add_development_dependency "rspec-rails"
26
28
  spec.add_development_dependency "coffee-script"
27
- spec.add_development_dependency 'netzke-core', '0.10.0.rc1'
29
+ spec.add_development_dependency 'netzke-core', '0.11.0'
28
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Gorin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.2.0
47
+ version: 4.2.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.2.0
54
+ version: 4.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: capybara
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: selenium-webdriver
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: rspec-rails
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +128,14 @@ dependencies:
100
128
  requirements:
101
129
  - - '='
102
130
  - !ruby/object:Gem::Version
103
- version: 0.10.0.rc1
131
+ version: 0.11.0
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
136
  - - '='
109
137
  - !ruby/object:Gem::Version
110
- version: 0.10.0.rc1
138
+ version: 0.11.0
111
139
  description: Provides help with developing and testing Netzke components
112
140
  email:
113
141
  - gorinme@gmail.com
@@ -115,12 +143,10 @@ executables: []
115
143
  extensions: []
116
144
  extra_rdoc_files: []
117
145
  files:
118
- - ".gitignore"
119
146
  - Gemfile
120
147
  - LICENSE.txt
121
148
  - README.md
122
149
  - Rakefile
123
- - app/assets/javascripts/netzke/.keep
124
150
  - app/assets/javascripts/netzke/testing/expect/expect.js
125
151
  - app/assets/javascripts/netzke/testing/helpers/actions.js.coffee
126
152
  - app/assets/javascripts/netzke/testing/helpers/expectations.js.coffee
@@ -129,68 +155,16 @@ files:
129
155
  - app/assets/javascripts/netzke/testing/helpers/queries.js.coffee
130
156
  - app/assets/javascripts/netzke/testing/mocha/mocha.js
131
157
  - app/assets/stylesheets/netzke/testing/mocha/mocha.css
132
- - app/controllers/.keep
133
158
  - app/controllers/netzke/testing_controller.rb
134
- - app/helpers/.keep
135
159
  - app/helpers/netzke_testing_helper.rb
136
- - app/mailers/.keep
137
- - app/models/.keep
138
- - app/views/.keep
139
160
  - app/views/layouts/netzke/testing.html.erb
140
161
  - app/views/netzke/index.html.erb
141
- - config/routes.rb
142
162
  - lib/netzke-testing.rb
143
163
  - lib/netzke/testing.rb
144
164
  - lib/netzke/testing/engine.rb
145
165
  - lib/netzke/testing/helpers.rb
146
166
  - lib/netzke/testing/version.rb
147
167
  - netzke-testing.gemspec
148
- - spec/features/foo_spec.rb
149
- - spec/features/javascripts/foo.js.coffee
150
- - spec/rails_app/.gitignore
151
- - spec/rails_app/README.rdoc
152
- - spec/rails_app/Rakefile
153
- - spec/rails_app/app/assets/images/rails.png
154
- - spec/rails_app/app/assets/javascripts/application.js
155
- - spec/rails_app/app/assets/javascripts/custom.js
156
- - spec/rails_app/app/assets/stylesheets/application.css
157
- - spec/rails_app/app/components/foo.rb
158
- - spec/rails_app/app/controllers/application_controller.rb
159
- - spec/rails_app/app/helpers/application_helper.rb
160
- - spec/rails_app/app/mailers/.gitkeep
161
- - spec/rails_app/app/models/.gitkeep
162
- - spec/rails_app/app/views/layouts/application.html.erb
163
- - spec/rails_app/config.ru
164
- - spec/rails_app/config/application.rb
165
- - spec/rails_app/config/boot.rb
166
- - spec/rails_app/config/database.yml
167
- - spec/rails_app/config/environment.rb
168
- - spec/rails_app/config/environments/development.rb
169
- - spec/rails_app/config/environments/production.rb
170
- - spec/rails_app/config/environments/test.rb
171
- - spec/rails_app/config/initializers/backtrace_silencers.rb
172
- - spec/rails_app/config/initializers/inflections.rb
173
- - spec/rails_app/config/initializers/mime_types.rb
174
- - spec/rails_app/config/initializers/netzke_testing.rb
175
- - spec/rails_app/config/initializers/secret_token.rb
176
- - spec/rails_app/config/initializers/session_store.rb
177
- - spec/rails_app/config/initializers/wrap_parameters.rb
178
- - spec/rails_app/config/locales/en.yml
179
- - spec/rails_app/config/routes.rb
180
- - spec/rails_app/db/development.sqlite3
181
- - spec/rails_app/db/seeds.rb
182
- - spec/rails_app/lib/assets/.gitkeep
183
- - spec/rails_app/lib/tasks/.gitkeep
184
- - spec/rails_app/log/.gitkeep
185
- - spec/rails_app/public/404.html
186
- - spec/rails_app/public/422.html
187
- - spec/rails_app/public/500.html
188
- - spec/rails_app/public/favicon.ico
189
- - spec/rails_app/public/index.html
190
- - spec/rails_app/public/robots.txt
191
- - spec/rails_app/script/rails
192
- - spec/spec_helper.rb
193
- - spec/testing_controller_spec.rb
194
168
  homepage: http://netzke.org
195
169
  licenses:
196
170
  - MIT
@@ -211,55 +185,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
185
  version: '0'
212
186
  requirements: []
213
187
  rubyforge_project:
214
- rubygems_version: 2.2.0
188
+ rubygems_version: 2.4.5
215
189
  signing_key:
216
190
  specification_version: 4
217
191
  summary: Testing helpers for Netzke applications and gems
218
- test_files:
219
- - spec/features/foo_spec.rb
220
- - spec/features/javascripts/foo.js.coffee
221
- - spec/rails_app/.gitignore
222
- - spec/rails_app/README.rdoc
223
- - spec/rails_app/Rakefile
224
- - spec/rails_app/app/assets/images/rails.png
225
- - spec/rails_app/app/assets/javascripts/application.js
226
- - spec/rails_app/app/assets/javascripts/custom.js
227
- - spec/rails_app/app/assets/stylesheets/application.css
228
- - spec/rails_app/app/components/foo.rb
229
- - spec/rails_app/app/controllers/application_controller.rb
230
- - spec/rails_app/app/helpers/application_helper.rb
231
- - spec/rails_app/app/mailers/.gitkeep
232
- - spec/rails_app/app/models/.gitkeep
233
- - spec/rails_app/app/views/layouts/application.html.erb
234
- - spec/rails_app/config.ru
235
- - spec/rails_app/config/application.rb
236
- - spec/rails_app/config/boot.rb
237
- - spec/rails_app/config/database.yml
238
- - spec/rails_app/config/environment.rb
239
- - spec/rails_app/config/environments/development.rb
240
- - spec/rails_app/config/environments/production.rb
241
- - spec/rails_app/config/environments/test.rb
242
- - spec/rails_app/config/initializers/backtrace_silencers.rb
243
- - spec/rails_app/config/initializers/inflections.rb
244
- - spec/rails_app/config/initializers/mime_types.rb
245
- - spec/rails_app/config/initializers/netzke_testing.rb
246
- - spec/rails_app/config/initializers/secret_token.rb
247
- - spec/rails_app/config/initializers/session_store.rb
248
- - spec/rails_app/config/initializers/wrap_parameters.rb
249
- - spec/rails_app/config/locales/en.yml
250
- - spec/rails_app/config/routes.rb
251
- - spec/rails_app/db/development.sqlite3
252
- - spec/rails_app/db/seeds.rb
253
- - spec/rails_app/lib/assets/.gitkeep
254
- - spec/rails_app/lib/tasks/.gitkeep
255
- - spec/rails_app/log/.gitkeep
256
- - spec/rails_app/public/404.html
257
- - spec/rails_app/public/422.html
258
- - spec/rails_app/public/500.html
259
- - spec/rails_app/public/favicon.ico
260
- - spec/rails_app/public/index.html
261
- - spec/rails_app/public/robots.txt
262
- - spec/rails_app/script/rails
263
- - spec/spec_helper.rb
264
- - spec/testing_controller_spec.rb
192
+ test_files: []
265
193
  has_rdoc:
data/.gitignore DELETED
@@ -1,16 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- spec/rails_app/public/extjs
16
- tmp
File without changes
File without changes
data/app/helpers/.keep DELETED
File without changes
data/app/mailers/.keep DELETED
File without changes
data/app/models/.keep DELETED
File without changes
data/app/views/.keep DELETED
File without changes
data/config/routes.rb DELETED
@@ -1,8 +0,0 @@
1
- Rails.application.routes.draw do
2
- # get "netzke_testing/components/:component", controller: :netzke_testing, action: :components
3
- # get "netzke_testing/specs"
4
- if Rails.env.test? || Rails.env.development?
5
- get 'netzke/components/:class' => 'netzke/testing#components', as: :netzke_components
6
- get 'netzke/specs/*name' => 'netzke/testing#specs', as: :netzke_specs
7
- end
8
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- feature "Foo", js: true do
4
- it 'runs JS specs' do
5
- run_mocha_spec "foo"
6
- end
7
- end
@@ -1,6 +0,0 @@
1
- describe 'Foo', ->
2
- afterEach (done) ->
3
- done()
4
-
5
- it 'shows as a panel with title "Test component"', ->
6
- expectToSee header "Test component"
@@ -1,15 +0,0 @@
1
- # See http://help.github.com/ignore-files/ for more about ignoring files.
2
- #
3
- # If you find yourself ignoring temporary files generated by your text editor
4
- # or operating system, you probably want to add a global ignore instead:
5
- # git config --global core.excludesfile ~/.gitignore_global
6
-
7
- # Ignore bundler config
8
- /.bundle
9
-
10
- # Ignore the default SQLite database.
11
- /db/*.sqlite3
12
-
13
- # Ignore all logfiles and tempfiles.
14
- /log/*.log
15
- /tmp
@@ -1,261 +0,0 @@
1
- == Welcome to Rails
2
-
3
- Rails is a web-application framework that includes everything needed to create
4
- database-backed web applications according to the Model-View-Control pattern.
5
-
6
- This pattern splits the view (also called the presentation) into "dumb"
7
- templates that are primarily responsible for inserting pre-built data in between
8
- HTML tags. The model contains the "smart" domain objects (such as Account,
9
- Product, Person, Post) that holds all the business logic and knows how to
10
- persist themselves to a database. The controller handles the incoming requests
11
- (such as Save New Account, Update Product, Show Post) by manipulating the model
12
- and directing data to the view.
13
-
14
- In Rails, the model is handled by what's called an object-relational mapping
15
- layer entitled Active Record. This layer allows you to present the data from
16
- database rows as objects and embellish these data objects with business logic
17
- methods. You can read more about Active Record in
18
- link:files/vendor/rails/activerecord/README.html.
19
-
20
- The controller and view are handled by the Action Pack, which handles both
21
- layers by its two parts: Action View and Action Controller. These two layers
22
- are bundled in a single package due to their heavy interdependence. This is
23
- unlike the relationship between the Active Record and Action Pack that is much
24
- more separate. Each of these packages can be used independently outside of
25
- Rails. You can read more about Action Pack in
26
- link:files/vendor/rails/actionpack/README.html.
27
-
28
-
29
- == Getting Started
30
-
31
- 1. At the command prompt, create a new Rails application:
32
- <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
-
34
- 2. Change directory to <tt>myapp</tt> and start the web server:
35
- <tt>cd myapp; rails server</tt> (run with --help for options)
36
-
37
- 3. Go to http://localhost:3000/ and you'll see:
38
- "Welcome aboard: You're riding Ruby on Rails!"
39
-
40
- 4. Follow the guidelines to start developing your application. You can find
41
- the following resources handy:
42
-
43
- * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
- * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
-
46
-
47
- == Debugging Rails
48
-
49
- Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
- will help you debug it and get it back on the rails.
51
-
52
- First area to check is the application log files. Have "tail -f" commands
53
- running on the server.log and development.log. Rails will automatically display
54
- debugging and runtime information to these files. Debugging info will also be
55
- shown in the browser on requests from 127.0.0.1.
56
-
57
- You can also log your own messages directly into the log file from your code
58
- using the Ruby logger class from inside your controllers. Example:
59
-
60
- class WeblogController < ActionController::Base
61
- def destroy
62
- @weblog = Weblog.find(params[:id])
63
- @weblog.destroy
64
- logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
- end
66
- end
67
-
68
- The result will be a message in your log file along the lines of:
69
-
70
- Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
-
72
- More information on how to use the logger is at http://www.ruby-doc.org/core/
73
-
74
- Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
- several books available online as well:
76
-
77
- * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
- * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
-
80
- These two books will bring you up to speed on the Ruby language and also on
81
- programming in general.
82
-
83
-
84
- == Debugger
85
-
86
- Debugger support is available through the debugger command when you start your
87
- Mongrel or WEBrick server with --debugger. This means that you can break out of
88
- execution at any point in the code, investigate and change the model, and then,
89
- resume execution! You need to install ruby-debug to run the server in debugging
90
- mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
-
92
- class WeblogController < ActionController::Base
93
- def index
94
- @posts = Post.all
95
- debugger
96
- end
97
- end
98
-
99
- So the controller will accept the action, run the first line, then present you
100
- with a IRB prompt in the server window. Here you can do things like:
101
-
102
- >> @posts.inspect
103
- => "[#<Post:0x14a6be8
104
- @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
- #<Post:0x14a6620
106
- @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
- >> @posts.first.title = "hello from a debugger"
108
- => "hello from a debugger"
109
-
110
- ...and even better, you can examine how your runtime objects actually work:
111
-
112
- >> f = @posts.first
113
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
- >> f.
115
- Display all 152 possibilities? (y or n)
116
-
117
- Finally, when you're ready to resume execution, you can enter "cont".
118
-
119
-
120
- == Console
121
-
122
- The console is a Ruby shell, which allows you to interact with your
123
- application's domain model. Here you'll have all parts of the application
124
- configured, just like it is when the application is running. You can inspect
125
- domain models, change values, and save to the database. Starting the script
126
- without arguments will launch it in the development environment.
127
-
128
- To start the console, run <tt>rails console</tt> from the application
129
- directory.
130
-
131
- Options:
132
-
133
- * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
- made to the database.
135
- * Passing an environment name as an argument will load the corresponding
136
- environment. Example: <tt>rails console production</tt>.
137
-
138
- To reload your controllers and models after launching the console run
139
- <tt>reload!</tt>
140
-
141
- More information about irb can be found at:
142
- link:http://www.rubycentral.org/pickaxe/irb.html
143
-
144
-
145
- == dbconsole
146
-
147
- You can go to the command line of your database directly through <tt>rails
148
- dbconsole</tt>. You would be connected to the database with the credentials
149
- defined in database.yml. Starting the script without arguments will connect you
150
- to the development database. Passing an argument will connect you to a different
151
- database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
- PostgreSQL and SQLite 3.
153
-
154
- == Description of Contents
155
-
156
- The default directory structure of a generated Ruby on Rails application:
157
-
158
- |-- app
159
- | |-- assets
160
- | | |-- images
161
- | | |-- javascripts
162
- | | `-- stylesheets
163
- | |-- controllers
164
- | |-- helpers
165
- | |-- mailers
166
- | |-- models
167
- | `-- views
168
- | `-- layouts
169
- |-- config
170
- | |-- environments
171
- | |-- initializers
172
- | `-- locales
173
- |-- db
174
- |-- doc
175
- |-- lib
176
- | |-- assets
177
- | `-- tasks
178
- |-- log
179
- |-- public
180
- |-- script
181
- |-- test
182
- | |-- fixtures
183
- | |-- functional
184
- | |-- integration
185
- | |-- performance
186
- | `-- unit
187
- |-- tmp
188
- | `-- cache
189
- | `-- assets
190
- `-- vendor
191
- |-- assets
192
- | |-- javascripts
193
- | `-- stylesheets
194
- `-- plugins
195
-
196
- app
197
- Holds all the code that's specific to this particular application.
198
-
199
- app/assets
200
- Contains subdirectories for images, stylesheets, and JavaScript files.
201
-
202
- app/controllers
203
- Holds controllers that should be named like weblogs_controller.rb for
204
- automated URL mapping. All controllers should descend from
205
- ApplicationController which itself descends from ActionController::Base.
206
-
207
- app/models
208
- Holds models that should be named like post.rb. Models descend from
209
- ActiveRecord::Base by default.
210
-
211
- app/views
212
- Holds the template files for the view that should be named like
213
- weblogs/index.html.erb for the WeblogsController#index action. All views use
214
- eRuby syntax by default.
215
-
216
- app/views/layouts
217
- Holds the template files for layouts to be used with views. This models the
218
- common header/footer method of wrapping views. In your views, define a layout
219
- using the <tt>layout :default</tt> and create a file named default.html.erb.
220
- Inside default.html.erb, call <% yield %> to render the view using this
221
- layout.
222
-
223
- app/helpers
224
- Holds view helpers that should be named like weblogs_helper.rb. These are
225
- generated for you automatically when using generators for controllers.
226
- Helpers can be used to wrap functionality for your views into methods.
227
-
228
- config
229
- Configuration files for the Rails environment, the routing map, the database,
230
- and other dependencies.
231
-
232
- db
233
- Contains the database schema in schema.rb. db/migrate contains all the
234
- sequence of Migrations for your schema.
235
-
236
- doc
237
- This directory is where your application documentation will be stored when
238
- generated using <tt>rake doc:app</tt>
239
-
240
- lib
241
- Application specific libraries. Basically, any kind of custom code that
242
- doesn't belong under controllers, models, or helpers. This directory is in
243
- the load path.
244
-
245
- public
246
- The directory available for the web server. Also contains the dispatchers and the
247
- default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
- server.
249
-
250
- script
251
- Helper scripts for automation and generation.
252
-
253
- test
254
- Unit and functional tests along with fixtures. When using the rails generate
255
- command, template test files will be generated for you and placed in this
256
- directory.
257
-
258
- vendor
259
- External libraries that the application depends on. Also includes the plugins
260
- subdirectory. If the app has frozen rails, those gems also go here, under
261
- vendor/rails/. This directory is in the load path.