dailycred 0.1.461 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +2 -2
  3. data/README.md +43 -15
  4. data/Rakefile +2 -2
  5. data/app/controllers/sessions_controller.rb +1 -1
  6. data/app/views/sessions/info.html.erb +2 -2
  7. data/config/routes.rb +4 -4
  8. data/dailycred.gemspec +1 -1
  9. data/dummy-preauth/.gitignore +16 -0
  10. data/dummy-preauth/Gemfile +42 -0
  11. data/dummy-preauth/README.rdoc +28 -0
  12. data/dummy-preauth/Rakefile +6 -0
  13. data/dummy-preauth/app/assets/images/rails.png +0 -0
  14. data/dummy-preauth/app/assets/javascripts/application.js +16 -0
  15. data/{dummy/app/assets/javascripts/posts.js.coffee → dummy-preauth/app/assets/javascripts/welcome.js.coffee} +1 -1
  16. data/dummy-preauth/app/assets/stylesheets/application.css +13 -0
  17. data/{dummy/app/assets/stylesheets/posts.css.scss → dummy-preauth/app/assets/stylesheets/welcome.css.scss} +1 -1
  18. data/dummy-preauth/app/controllers/application_controller.rb +6 -0
  19. data/{dummy/app/mailers/.gitkeep → dummy-preauth/app/controllers/concerns/.keep} +0 -0
  20. data/dummy-preauth/app/controllers/sessions_controller.rb +34 -0
  21. data/dummy-preauth/app/controllers/users_controller.rb +30 -0
  22. data/dummy-preauth/app/controllers/welcome_controller.rb +9 -0
  23. data/dummy-preauth/app/helpers/application_helper.rb +2 -0
  24. data/dummy-preauth/app/helpers/sessions_helper.rb +2 -0
  25. data/dummy-preauth/app/helpers/users_helper.rb +2 -0
  26. data/dummy-preauth/app/helpers/welcome_helper.rb +2 -0
  27. data/{dummy/app/models/.gitkeep → dummy-preauth/app/mailers/.keep} +0 -0
  28. data/{dummy/lib/assets/.gitkeep → dummy-preauth/app/models/.keep} +0 -0
  29. data/{dummy/lib/tasks/.gitkeep → dummy-preauth/app/models/concerns/.keep} +0 -0
  30. data/dummy-preauth/app/models/user.rb +34 -0
  31. data/dummy-preauth/app/views/layouts/application.html.erb +14 -0
  32. data/dummy-preauth/app/views/sessions/new.html.erb +15 -0
  33. data/dummy-preauth/app/views/users/_form.html.erb +20 -0
  34. data/dummy-preauth/app/views/users/edit.html.erb +3 -0
  35. data/dummy-preauth/app/views/users/new.html.erb +5 -0
  36. data/dummy-preauth/app/views/welcome/index.html.erb +2 -0
  37. data/dummy-preauth/bin/bundle +3 -0
  38. data/dummy-preauth/bin/rails +4 -0
  39. data/dummy-preauth/bin/rake +4 -0
  40. data/dummy-preauth/config.ru +4 -0
  41. data/dummy-preauth/config/application.rb +22 -0
  42. data/dummy-preauth/config/boot.rb +4 -0
  43. data/dummy-preauth/config/database.yml +25 -0
  44. data/dummy-preauth/config/environment.rb +5 -0
  45. data/dummy-preauth/config/environments/development.rb +27 -0
  46. data/dummy-preauth/config/environments/production.rb +80 -0
  47. data/dummy-preauth/config/environments/test.rb +36 -0
  48. data/dummy-preauth/config/initializers/backtrace_silencers.rb +7 -0
  49. data/dummy-preauth/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/dummy-preauth/config/initializers/inflections.rb +16 -0
  51. data/dummy-preauth/config/initializers/mime_types.rb +5 -0
  52. data/dummy-preauth/config/initializers/omniauth.rb +9 -0
  53. data/dummy-preauth/config/initializers/secret_token.rb +12 -0
  54. data/dummy-preauth/config/initializers/session_store.rb +3 -0
  55. data/dummy-preauth/config/initializers/wrap_parameters.rb +14 -0
  56. data/dummy-preauth/config/locales/en.yml +23 -0
  57. data/dummy-preauth/config/routes.rb +57 -0
  58. data/dummy-preauth/db/migrate/20130423011519_create_users.rb +15 -0
  59. data/dummy-preauth/db/migrate/20130423011738_add_uuid_to_users.rb +5 -0
  60. data/dummy-preauth/db/schema.rb +26 -0
  61. data/dummy-preauth/db/seeds.rb +7 -0
  62. data/{dummy/log/.gitkeep → dummy-preauth/lib/assets/.keep} +0 -0
  63. data/dummy-preauth/lib/controller_authentication.rb +48 -0
  64. data/{dummy/test/fixtures/.gitkeep → dummy-preauth/lib/tasks/.keep} +0 -0
  65. data/{dummy/test/functional/.gitkeep → dummy-preauth/log/.keep} +0 -0
  66. data/dummy-preauth/public/404.html +27 -0
  67. data/dummy-preauth/public/422.html +26 -0
  68. data/dummy-preauth/public/500.html +26 -0
  69. data/{dummy/test/integration/.gitkeep → dummy-preauth/public/favicon.ico} +0 -0
  70. data/dummy-preauth/public/robots.txt +5 -0
  71. data/{dummy/test/unit/.gitkeep → dummy-preauth/test/controllers/.keep} +0 -0
  72. data/dummy-preauth/test/controllers/welcome_controller_test.rb +9 -0
  73. data/{dummy/vendor/assets/javascripts/.gitkeep → dummy-preauth/test/fixtures/.keep} +0 -0
  74. data/dummy-preauth/test/fixtures/users.yml +12 -0
  75. data/dummy-preauth/test/functional/sessions_controller_test.rb +22 -0
  76. data/dummy-preauth/test/functional/users_controller_test.rb +51 -0
  77. data/{dummy/vendor/assets/stylesheets/.gitkeep → dummy-preauth/test/helpers/.keep} +0 -0
  78. data/dummy-preauth/test/helpers/welcome_helper_test.rb +4 -0
  79. data/{dummy/vendor/plugins/.gitkeep → dummy-preauth/test/integration/.keep} +0 -0
  80. data/dummy-preauth/test/mailers/.keep +0 -0
  81. data/dummy-preauth/test/models/.keep +0 -0
  82. data/dummy-preauth/test/test_helper.rb +15 -0
  83. data/dummy-preauth/test/unit/user_test.rb +86 -0
  84. data/dummy-preauth/vendor/assets/javascripts/.keep +0 -0
  85. data/dummy-preauth/vendor/assets/stylesheets/.keep +0 -0
  86. data/dummy/.gitignore +3 -2
  87. data/dummy/Gemfile +14 -28
  88. data/dummy/README.rdoc +15 -248
  89. data/dummy/Rakefile +0 -1
  90. data/dummy/app/assets/javascripts/application.js +2 -1
  91. data/dummy/app/controllers/application_controller.rb +5 -4
  92. data/dummy/app/controllers/concerns/.keep +0 -0
  93. data/dummy/app/mailers/.keep +0 -0
  94. data/dummy/app/models/.keep +0 -0
  95. data/dummy/app/models/concerns/.keep +0 -0
  96. data/dummy/app/views/layouts/application.html.erb +2 -6
  97. data/dummy/bin/bundle +3 -0
  98. data/dummy/bin/rails +4 -0
  99. data/dummy/bin/rake +4 -0
  100. data/dummy/config/application.rb +2 -42
  101. data/dummy/config/boot.rb +0 -2
  102. data/dummy/config/environment.rb +2 -2
  103. data/dummy/config/environments/development.rb +9 -19
  104. data/dummy/config/environments/production.rb +40 -27
  105. data/dummy/config/environments/test.rb +12 -13
  106. data/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  107. data/dummy/config/initializers/inflections.rb +6 -5
  108. data/dummy/config/initializers/omniauth.rb +9 -2
  109. data/dummy/config/initializers/secret_token.rb +6 -1
  110. data/dummy/config/initializers/session_store.rb +1 -6
  111. data/dummy/config/initializers/wrap_parameters.rb +6 -6
  112. data/dummy/config/locales/en.yml +20 -2
  113. data/dummy/config/routes.rb +15 -26
  114. data/dummy/db/migrate/{20120925172903_create_users.rb → 20130417131939_create_users.rb} +7 -11
  115. data/dummy/db/schema.rb +9 -19
  116. data/dummy/lib/assets/.keep +0 -0
  117. data/dummy/lib/tasks/.keep +0 -0
  118. data/dummy/log/.keep +0 -0
  119. data/dummy/public/404.html +2 -1
  120. data/dummy/public/422.html +1 -1
  121. data/dummy/public/500.html +2 -1
  122. data/dummy/public/robots.txt +1 -1
  123. data/dummy/test/controllers/.keep +0 -0
  124. data/dummy/test/fixtures/.keep +0 -0
  125. data/dummy/test/helpers/.keep +0 -0
  126. data/dummy/test/integration/.keep +0 -0
  127. data/dummy/test/mailers/.keep +0 -0
  128. data/dummy/test/models/.keep +0 -0
  129. data/dummy/test/test_helper.rb +11 -58
  130. data/dummy/vendor/assets/javascripts/.keep +0 -0
  131. data/dummy/vendor/assets/stylesheets/.keep +0 -0
  132. data/lib/dailycred.rb +2 -2
  133. data/lib/dailycred/acts_as_dailycred.rb +4 -17
  134. data/lib/dailycred/client.rb +1 -0
  135. data/lib/dailycred/engine.rb +3 -2
  136. data/lib/dailycred/helper.rb +4 -4
  137. data/lib/dailycred/middleware.rb +5 -2
  138. data/lib/dailycred/version.rb +1 -1
  139. data/lib/generators/dailycred_generator.rb +17 -8
  140. data/lib/generators/templates/migration_create_user.rb +3 -9
  141. data/lib/omniauth/strategies/dailycred.rb +2 -0
  142. data/spec/helper_spec.rb +1 -3
  143. data/test/generator_test.rb +4 -3
  144. metadata +103 -52
  145. data/dummy/Guardfile +0 -31
  146. data/dummy/app/assets/stylesheets/scaffolds.css.scss +0 -69
  147. data/dummy/app/controllers/posts_controller.rb +0 -86
  148. data/dummy/app/helpers/posts_helper.rb +0 -2
  149. data/dummy/app/models/post.rb +0 -3
  150. data/dummy/app/views/posts/_form.html.erb +0 -21
  151. data/dummy/app/views/posts/edit.html.erb +0 -6
  152. data/dummy/app/views/posts/index.html.erb +0 -23
  153. data/dummy/app/views/posts/new.html.erb +0 -5
  154. data/dummy/app/views/posts/show.html.erb +0 -10
  155. data/dummy/db/migrate/20120926012555_create_posts.rb +0 -9
  156. data/dummy/db/migrate/20121002192037_update_users_2.rb +0 -70
  157. data/dummy/db/migrate/20121108192739_add_column_to_posts.rb +0 -5
  158. data/dummy/public/index.html +0 -241
  159. data/dummy/script/rails +0 -6
  160. data/dummy/test/fixtures/posts.yml +0 -7
  161. data/dummy/test/fixtures/users.yml +0 -3
  162. data/dummy/test/functional/posts_controller_test.rb +0 -51
  163. data/dummy/test/performance/browsing_test.rb +0 -12
  164. data/dummy/test/unit/helpers/posts_helper_test.rb +0 -4
  165. data/dummy/test/unit/post_test.rb +0 -7
  166. data/dummy/test/unit/user_test.rb +0 -77
  167. data/spec/omniauth/strategies/dailycred_spec.rb +0 -64
@@ -0,0 +1,86 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ def new_user(attributes = {})
5
+ attributes[:username] ||= 'foo'
6
+ attributes[:email] ||= 'foo@example.com'
7
+ attributes[:password] ||= 'abc123'
8
+ attributes[:password_confirmation] ||= attributes[:password]
9
+ user = User.new(attributes)
10
+ user.valid? # run validations
11
+ user
12
+ end
13
+
14
+ def setup
15
+ User.delete_all
16
+ end
17
+
18
+ def test_valid
19
+ assert new_user.valid?
20
+ end
21
+
22
+ def test_require_username
23
+ assert_equal ["can't be blank"], new_user(:username => '').errors[:username]
24
+ end
25
+
26
+ def test_require_password
27
+ assert_equal ["can't be blank"], new_user(:password => '').errors[:password]
28
+ end
29
+
30
+ def test_require_well_formed_email
31
+ assert_equal ["is invalid"], new_user(:email => 'foo@bar@example.com').errors[:email]
32
+ end
33
+
34
+ def test_validate_uniqueness_of_email
35
+ new_user(:email => 'bar@example.com').save!
36
+ assert_equal ["has already been taken"], new_user(:email => 'bar@example.com').errors[:email]
37
+ end
38
+
39
+ def test_validate_uniqueness_of_username
40
+ new_user(:username => 'uniquename').save!
41
+ assert_equal ["has already been taken"], new_user(:username => 'uniquename').errors[:username]
42
+ end
43
+
44
+ def test_validate_odd_characters_in_username
45
+ assert_equal ["should only contain letters, numbers, or .-_@"], new_user(:username => 'odd ^&(@)').errors[:username]
46
+ end
47
+
48
+ def test_validate_password_length
49
+ assert_equal ["is too short (minimum is 4 characters)"], new_user(:password => 'bad').errors[:password]
50
+ end
51
+
52
+ def test_require_matching_password_confirmation
53
+ assert_equal ["doesn't match confirmation"], new_user(:password_confirmation => 'nonmatching').errors[:password]
54
+ end
55
+
56
+ def test_generate_password_hash_and_salt_on_create
57
+ user = new_user
58
+ user.save!
59
+ assert user.password_hash
60
+ assert user.password_salt
61
+ end
62
+
63
+ def test_authenticate_by_username
64
+ User.delete_all
65
+ user = new_user(:username => 'foobar', :password => 'secret')
66
+ user.save!
67
+ assert_equal user, User.authenticate('foobar', 'secret')
68
+ end
69
+
70
+ def test_authenticate_by_email
71
+ User.delete_all
72
+ user = new_user(:email => 'foo@bar.com', :password => 'secret')
73
+ user.save!
74
+ assert_equal user, User.authenticate('foo@bar.com', 'secret')
75
+ end
76
+
77
+ def test_authenticate_bad_username
78
+ assert_nil User.authenticate('nonexisting', 'secret')
79
+ end
80
+
81
+ def test_authenticate_bad_password
82
+ User.delete_all
83
+ new_user(:username => 'foobar', :password => 'secret').save!
84
+ assert_nil User.authenticate('foobar', 'badpassword')
85
+ end
86
+ end
File without changes
File without changes
data/dummy/.gitignore CHANGED
@@ -2,13 +2,14 @@
2
2
  #
3
3
  # If you find yourself ignoring temporary files generated by your text editor
4
4
  # or operating system, you probably want to add a global ignore instead:
5
- # git config --global core.excludesfile ~/.gitignore_global
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
6
 
7
- # Ignore bundler config
7
+ # Ignore bundler config.
8
8
  /.bundle
9
9
 
10
10
  # Ignore the default SQLite database.
11
11
  /db/*.sqlite3
12
+ /db/*.sqlite3-journal
12
13
 
13
14
  # Ignore all logfiles and tempfiles.
14
15
  /log/*.log
data/dummy/Gemfile CHANGED
@@ -1,55 +1,41 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '3.2.8'
4
-
5
- # Bundle edge Rails instead:
6
- # gem 'rails', :git => 'git://github.com/rails/rails.git'
3
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4
+ gem 'rails', '4.0.0.beta1'
7
5
 
8
6
  gem 'sqlite3'
9
- gem 'dailycred', :path => '../'
7
+ gem 'omniauth_dailycred', path: '../../omniauth_dailycred'
8
+ gem 'dailycred', path: '../'
10
9
  gem 'awesome_print'
11
10
 
12
-
13
11
  # Gems used only for assets and not required
14
12
  # in production environments by default.
15
13
  group :assets do
16
- gem 'sass-rails', '~> 3.2.3'
17
- gem 'coffee-rails', '~> 3.2.1'
14
+ gem 'sass-rails', '~> 4.0.0.beta1'
15
+ gem 'coffee-rails', '~> 4.0.0.beta1'
18
16
 
19
17
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
20
- # gem 'therubyracer', :platforms => :ruby
18
+ # gem 'therubyracer', platforms: :ruby
21
19
 
22
20
  gem 'uglifier', '>= 1.0.3'
23
21
  end
24
22
 
25
23
  gem 'jquery-rails'
26
- gem 'factory_girl'
27
-
28
- gem 'quiet_assets', :group => :development
29
-
30
- group :test, :development do
31
- gem 'guard-test'
32
- gem 'rb-fsevent', '~> 0.9.1'
33
- gem 'guard'
34
- gem 'growl'
35
- gem 'guard-spork'
36
- gem 'ruby_gntp'
37
- gem 'spork-rails'
38
- gem 'spork-testunit'
39
- gem 'mocha'
40
- end
24
+
25
+ # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
26
+ gem 'turbolinks'
27
+
28
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
29
+ gem 'jbuilder', '~> 1.0.1'
41
30
 
42
31
  # To use ActiveModel has_secure_password
43
32
  # gem 'bcrypt-ruby', '~> 3.0.0'
44
33
 
45
- # To use Jbuilder templates for JSON
46
- # gem 'jbuilder'
47
-
48
34
  # Use unicorn as the app server
49
35
  # gem 'unicorn'
50
36
 
51
37
  # Deploy with Capistrano
52
- # gem 'capistrano'
38
+ # gem 'capistrano', group: :development
53
39
 
54
40
  # To use debugger
55
41
  # gem 'debugger'
data/dummy/README.rdoc CHANGED
@@ -1,261 +1,28 @@
1
- == Welcome to Rails
1
+ == README
2
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.
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
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.
6
+ Things you may want to cover:
13
7
 
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.
8
+ * Ruby version
19
9
 
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.
10
+ * System dependencies
27
11
 
12
+ * Configuration
28
13
 
29
- == Getting Started
14
+ * Database creation
30
15
 
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)
16
+ * Database initialization
33
17
 
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)
18
+ * How to run the test suite
36
19
 
37
- 3. Go to http://localhost:3000/ and you'll see:
38
- "Welcome aboard: You're riding Ruby on Rails!"
20
+ * Services (job queues, cache servers, search engines, etc.)
39
21
 
40
- 4. Follow the guidelines to start developing your application. You can find
41
- the following resources handy:
22
+ * Deployment instructions
42
23
 
43
- * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
- * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
24
+ * ...
45
25
 
46
26
 
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
- | `-- tasks
177
- |-- log
178
- |-- public
179
- |-- script
180
- |-- test
181
- | |-- fixtures
182
- | |-- functional
183
- | |-- integration
184
- | |-- performance
185
- | `-- unit
186
- |-- tmp
187
- | |-- cache
188
- | |-- pids
189
- | |-- sessions
190
- | `-- sockets
191
- `-- vendor
192
- |-- assets
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.
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.