musicbrainz_ruby 0.0.5 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/.document +5 -0
  2. data/.gitignore +47 -15
  3. data/.idea/.name +1 -0
  4. data/.idea/.rakeTasks +7 -0
  5. data/.idea/codeStyleSettings.xml +13 -0
  6. data/.idea/dictionaries/j4k4x.xml +3 -0
  7. data/.idea/encodings.xml +5 -0
  8. data/.idea/inspectionProfiles/Project_Default.xml +11 -0
  9. data/.idea/inspectionProfiles/profiles_settings.xml +7 -0
  10. data/.idea/misc.xml +8 -0
  11. data/.idea/modules.xml +9 -0
  12. data/.idea/musicbrainz_ruby.iml +67 -0
  13. data/.idea/scopes/scope_settings.xml +5 -0
  14. data/.idea/vcs.xml +8 -0
  15. data/.idea/workspace.xml +675 -0
  16. data/.rspec +1 -0
  17. data/Gemfile +26 -6
  18. data/Gemfile.lock +173 -0
  19. data/{LICENSE → LICENSE.txt} +1 -3
  20. data/README.rdoc +19 -0
  21. data/Rakefile +58 -2
  22. data/VERSION +1 -0
  23. data/database.yml +20 -0
  24. data/features/musicbrainz_ruby.feature +16 -0
  25. data/features/releases/release_query.feature +19 -0
  26. data/features/step_definitions/MB/rails_steps.rb +121 -0
  27. data/features/step_definitions/MB/release_steps.rb/release_steps.rb +0 -0
  28. data/features/support/cukigem.rb +26 -0
  29. data/features/support/env.rb +19 -0
  30. data/lib/generators/music_brainz/install/initializer_generator.rb +5 -0
  31. data/lib/generators/music_brainz/install/install_generator.rb +14 -0
  32. data/lib/generators/music_brainz/install/templates/config/initializers/musicbrainz.rb.erb +47 -0
  33. data/lib/musicbrainz/artist.rb +59 -0
  34. data/lib/musicbrainz/base.rb +30 -3
  35. data/lib/musicbrainz/label.rb +4 -0
  36. data/lib/musicbrainz/query.rb +83 -0
  37. data/lib/musicbrainz/recording.rb +4 -0
  38. data/lib/musicbrainz/release.rb +77 -8
  39. data/lib/musicbrainz/release_group.rb +4 -0
  40. data/lib/musicbrainz/string.rb +47 -0
  41. data/lib/musicbrainz/work.rb +4 -0
  42. data/lib/musicbrainz_ruby.rb +19 -0
  43. data/log/test.log +0 -0
  44. data/musicbrainz_ruby.gemspec +194 -0
  45. data/report.html +478 -0
  46. data/spec/factories.rb +9 -0
  47. data/spec/musicbrainz_ruby_spec.rb +7 -0
  48. data/spec/spec_helper.rb +12 -0
  49. data/tmp/rails_app/.gitignore +15 -0
  50. data/tmp/rails_app/Gemfile +21 -0
  51. data/tmp/rails_app/Gemfile.lock +183 -0
  52. data/tmp/rails_app/README.rdoc +261 -0
  53. data/tmp/rails_app/Rakefile +7 -0
  54. data/tmp/rails_app/app/assets/images/rails.png +0 -0
  55. data/tmp/rails_app/app/assets/javascripts/application.js +15 -0
  56. data/tmp/rails_app/app/assets/javascripts/mmbrains.js.coffee +3 -0
  57. data/tmp/rails_app/app/assets/stylesheets/application.css +13 -0
  58. data/tmp/rails_app/app/assets/stylesheets/mmbrains.css.scss +3 -0
  59. data/tmp/rails_app/app/assets/stylesheets/scaffolds.css.scss +56 -0
  60. data/tmp/rails_app/app/controllers/application_controller.rb +2 -0
  61. data/tmp/rails_app/app/controllers/mmbrains_controller.rb +7 -0
  62. data/tmp/rails_app/app/controllers/models_controller.rb +10 -0
  63. data/tmp/rails_app/app/helpers/application_helper.rb +2 -0
  64. data/tmp/rails_app/app/helpers/mmbrains_helper.rb +2 -0
  65. data/tmp/rails_app/app/mailers/.gitkeep +0 -0
  66. data/tmp/rails_app/app/models/.gitkeep +0 -0
  67. data/tmp/rails_app/app/models/mmbrain.rb +3 -0
  68. data/tmp/rails_app/app/views/layouts/application.html.erb +14 -0
  69. data/tmp/rails_app/app/views/mmbrains/_form.html.erb +21 -0
  70. data/tmp/rails_app/app/views/mmbrains/edit.html.erb +6 -0
  71. data/tmp/rails_app/app/views/mmbrains/index.html.erb +1 -0
  72. data/tmp/rails_app/app/views/mmbrains/new.html.erb +5 -0
  73. data/tmp/rails_app/app/views/mmbrains/show.html.erb +10 -0
  74. data/tmp/rails_app/app/views/models/show.html.erb +1 -0
  75. data/tmp/rails_app/config.ru +4 -0
  76. data/tmp/rails_app/config/application.rb +62 -0
  77. data/tmp/rails_app/config/boot.rb +6 -0
  78. data/tmp/rails_app/config/database.yml +28 -0
  79. data/tmp/rails_app/config/environment.rb +5 -0
  80. data/tmp/rails_app/config/environments/development.rb +37 -0
  81. data/tmp/rails_app/config/environments/production.rb +67 -0
  82. data/tmp/rails_app/config/environments/test.rb +37 -0
  83. data/tmp/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  84. data/tmp/rails_app/config/initializers/inflections.rb +15 -0
  85. data/tmp/rails_app/config/initializers/mime_types.rb +5 -0
  86. data/tmp/rails_app/config/initializers/secret_token.rb +7 -0
  87. data/tmp/rails_app/config/initializers/session_store.rb +8 -0
  88. data/tmp/rails_app/config/initializers/wrap_parameters.rb +14 -0
  89. data/tmp/rails_app/config/locales/en.yml +5 -0
  90. data/tmp/rails_app/config/routes.rb +3 -0
  91. data/tmp/rails_app/db/migrate/20120630070553_create_mmbrains.rb +9 -0
  92. data/tmp/rails_app/db/seeds.rb +7 -0
  93. data/tmp/rails_app/lib/assets/.gitkeep +0 -0
  94. data/tmp/rails_app/lib/tasks/.gitkeep +0 -0
  95. data/tmp/rails_app/log/.gitkeep +0 -0
  96. data/tmp/rails_app/public/404.html +26 -0
  97. data/tmp/rails_app/public/422.html +26 -0
  98. data/tmp/rails_app/public/500.html +25 -0
  99. data/tmp/rails_app/public/favicon.ico +0 -0
  100. data/tmp/rails_app/public/index.html +241 -0
  101. data/tmp/rails_app/public/robots.txt +5 -0
  102. data/tmp/rails_app/script/rails +6 -0
  103. data/tmp/rails_app/test/fixtures/.gitkeep +0 -0
  104. data/tmp/rails_app/test/fixtures/mmbrains.yml +7 -0
  105. data/tmp/rails_app/test/functional/.gitkeep +0 -0
  106. data/tmp/rails_app/test/functional/mmbrains_controller_test.rb +49 -0
  107. data/tmp/rails_app/test/integration/.gitkeep +0 -0
  108. data/tmp/rails_app/test/performance/browsing_test.rb +12 -0
  109. data/tmp/rails_app/test/test_helper.rb +13 -0
  110. data/tmp/rails_app/test/unit/.gitkeep +0 -0
  111. data/tmp/rails_app/test/unit/helpers/mmbrains_helper_test.rb +4 -0
  112. data/tmp/rails_app/test/unit/mmbrain_test.rb +7 -0
  113. data/tmp/rails_app/vendor/assets/javascripts/.gitkeep +0 -0
  114. data/tmp/rails_app/vendor/assets/stylesheets/.gitkeep +0 -0
  115. data/tmp/rails_app/vendor/plugins/.gitkeep +0 -0
  116. metadata +350 -11
  117. data/README.md +0 -29
  118. data/lib/music_brainz.rb +0 -17
  119. data/lib/musicbrainz/version.rb +0 -3
  120. data/musicbrainz.gemspec +0 -21
@@ -0,0 +1,9 @@
1
+ FactoryGirl.define do
2
+ sequence(:mbid) {"#{SecureRandom.hex(8)}-#{SecureRandom.hex(4)}-#{SecureRandom.hex(4)}-#{SecureRandom.hex(4)}-#{SecureRandom.hex(12)}"}
3
+ sequence(:release_date) {Time.at(from + rand * (to.to_f - from.to_f))}
4
+
5
+ factory :release do
6
+ mbid
7
+ release_date
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "MusicbrainzRuby" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'musicbrainz_ruby'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
@@ -0,0 +1,15 @@
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
@@ -0,0 +1,21 @@
1
+
2
+ source 'https://rubygems.org'
3
+ gem 'rails', '3.2.6'
4
+ gem 'sqlite3'
5
+ group :assets do
6
+ gem 'sass-rails', '~> 3.2.3'
7
+ gem 'coffee-rails', '~> 3.2.1'
8
+ gem 'therubyracer', :platforms => :ruby
9
+ gem 'uglifier', '>= 1.0.3'
10
+ end
11
+ gem 'jquery-rails'
12
+
13
+ group :test do
14
+ gem "guard-rspec"
15
+ gem "factory_girl_rails", ">= 1.6.0"
16
+ gem "cucumber-rails", ">= 1.2.1"
17
+ gem "capybara", ">= 1.1.2"
18
+ gem "database_cleaner"
19
+ gem "launchy"
20
+ end
21
+ gem "musicbrainz_ruby","0.1.0",:path=>'/home/j4k4x/musicbrainz_ruby/pkg/'
@@ -0,0 +1,183 @@
1
+ PATH
2
+ remote: /home/j4k4x/musicbrainz_ruby/pkg
3
+ specs:
4
+ musicbrainz_ruby (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (3.2.6)
10
+ actionpack (= 3.2.6)
11
+ mail (~> 2.4.4)
12
+ actionpack (3.2.6)
13
+ activemodel (= 3.2.6)
14
+ activesupport (= 3.2.6)
15
+ builder (~> 3.0.0)
16
+ erubis (~> 2.7.0)
17
+ journey (~> 1.0.1)
18
+ rack (~> 1.4.0)
19
+ rack-cache (~> 1.2)
20
+ rack-test (~> 0.6.1)
21
+ sprockets (~> 2.1.3)
22
+ activemodel (3.2.6)
23
+ activesupport (= 3.2.6)
24
+ builder (~> 3.0.0)
25
+ activerecord (3.2.6)
26
+ activemodel (= 3.2.6)
27
+ activesupport (= 3.2.6)
28
+ arel (~> 3.0.2)
29
+ tzinfo (~> 0.3.29)
30
+ activeresource (3.2.6)
31
+ activemodel (= 3.2.6)
32
+ activesupport (= 3.2.6)
33
+ activesupport (3.2.6)
34
+ i18n (~> 0.6)
35
+ multi_json (~> 1.0)
36
+ addressable (2.2.8)
37
+ arel (3.0.2)
38
+ builder (3.0.0)
39
+ capybara (1.1.2)
40
+ mime-types (>= 1.16)
41
+ nokogiri (>= 1.3.3)
42
+ rack (>= 1.0.0)
43
+ rack-test (>= 0.5.4)
44
+ selenium-webdriver (~> 2.0)
45
+ xpath (~> 0.1.4)
46
+ childprocess (0.3.3)
47
+ ffi (~> 1.0.6)
48
+ coffee-rails (3.2.2)
49
+ coffee-script (>= 2.2.0)
50
+ railties (~> 3.2.0)
51
+ coffee-script (2.2.0)
52
+ coffee-script-source
53
+ execjs
54
+ coffee-script-source (1.3.3)
55
+ cucumber (1.2.1)
56
+ builder (>= 2.1.2)
57
+ diff-lcs (>= 1.1.3)
58
+ gherkin (~> 2.11.0)
59
+ json (>= 1.4.6)
60
+ cucumber-rails (1.3.0)
61
+ capybara (>= 1.1.2)
62
+ cucumber (>= 1.1.8)
63
+ nokogiri (>= 1.5.0)
64
+ database_cleaner (0.8.0)
65
+ diff-lcs (1.1.3)
66
+ erubis (2.7.0)
67
+ execjs (1.4.0)
68
+ multi_json (~> 1.0)
69
+ factory_girl (3.5.0)
70
+ activesupport (>= 3.0.0)
71
+ factory_girl_rails (3.5.0)
72
+ factory_girl (~> 3.5.0)
73
+ railties (>= 3.0.0)
74
+ ffi (1.0.11)
75
+ gherkin (2.11.1)
76
+ json (>= 1.4.6)
77
+ guard (1.2.1)
78
+ listen (>= 0.4.2)
79
+ thor (>= 0.14.6)
80
+ guard-rspec (1.1.0)
81
+ guard (>= 1.1)
82
+ hike (1.2.1)
83
+ i18n (0.6.0)
84
+ journey (1.0.4)
85
+ jquery-rails (2.0.2)
86
+ railties (>= 3.2.0, < 5.0)
87
+ thor (~> 0.14)
88
+ json (1.7.3)
89
+ launchy (2.1.0)
90
+ addressable (~> 2.2.6)
91
+ libv8 (3.3.10.4)
92
+ libwebsocket (0.1.3)
93
+ addressable
94
+ listen (0.4.7)
95
+ rb-fchange (~> 0.0.5)
96
+ rb-fsevent (~> 0.9.1)
97
+ rb-inotify (~> 0.8.8)
98
+ mail (2.4.4)
99
+ i18n (>= 0.4.0)
100
+ mime-types (~> 1.16)
101
+ treetop (~> 1.4.8)
102
+ mime-types (1.19)
103
+ multi_json (1.3.6)
104
+ nokogiri (1.5.5)
105
+ polyglot (0.3.3)
106
+ rack (1.4.1)
107
+ rack-cache (1.2)
108
+ rack (>= 0.4)
109
+ rack-ssl (1.3.2)
110
+ rack
111
+ rack-test (0.6.1)
112
+ rack (>= 1.0)
113
+ rails (3.2.6)
114
+ actionmailer (= 3.2.6)
115
+ actionpack (= 3.2.6)
116
+ activerecord (= 3.2.6)
117
+ activeresource (= 3.2.6)
118
+ activesupport (= 3.2.6)
119
+ bundler (~> 1.0)
120
+ railties (= 3.2.6)
121
+ railties (3.2.6)
122
+ actionpack (= 3.2.6)
123
+ activesupport (= 3.2.6)
124
+ rack-ssl (~> 1.3.2)
125
+ rake (>= 0.8.7)
126
+ rdoc (~> 3.4)
127
+ thor (>= 0.14.6, < 2.0)
128
+ rake (0.9.2.2)
129
+ rb-fchange (0.0.5)
130
+ ffi
131
+ rb-fsevent (0.9.1)
132
+ rb-inotify (0.8.8)
133
+ ffi (>= 0.5.0)
134
+ rdoc (3.12)
135
+ json (~> 1.4)
136
+ rubyzip (0.9.9)
137
+ sass (3.1.20)
138
+ sass-rails (3.2.5)
139
+ railties (~> 3.2.0)
140
+ sass (>= 3.1.10)
141
+ tilt (~> 1.3)
142
+ selenium-webdriver (2.24.0)
143
+ childprocess (>= 0.2.5)
144
+ libwebsocket (~> 0.1.3)
145
+ multi_json (~> 1.0)
146
+ rubyzip
147
+ sprockets (2.1.3)
148
+ hike (~> 1.2)
149
+ rack (~> 1.0)
150
+ tilt (~> 1.1, != 1.3.0)
151
+ sqlite3 (1.3.6)
152
+ therubyracer (0.10.1)
153
+ libv8 (~> 3.3.10)
154
+ thor (0.15.4)
155
+ tilt (1.3.3)
156
+ treetop (1.4.10)
157
+ polyglot
158
+ polyglot (>= 0.3.1)
159
+ tzinfo (0.3.33)
160
+ uglifier (1.2.6)
161
+ execjs (>= 0.3.0)
162
+ multi_json (~> 1.3)
163
+ xpath (0.1.4)
164
+ nokogiri (~> 1.3)
165
+
166
+ PLATFORMS
167
+ ruby
168
+
169
+ DEPENDENCIES
170
+ capybara (>= 1.1.2)
171
+ coffee-rails (~> 3.2.1)
172
+ cucumber-rails (>= 1.2.1)
173
+ database_cleaner
174
+ factory_girl_rails (>= 1.6.0)
175
+ guard-rspec
176
+ jquery-rails
177
+ launchy
178
+ musicbrainz_ruby (= 0.1.0)!
179
+ rails (= 3.2.6)
180
+ sass-rails (~> 3.2.3)
181
+ sqlite3
182
+ therubyracer
183
+ uglifier (>= 1.0.3)
@@ -0,0 +1,261 @@
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
+ | `-- 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.