exlibris-aleph 0.1.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/README.md +89 -0
  2. data/Rakefile +2 -4
  3. data/lib/exlibris-aleph.rb +8 -21
  4. data/lib/exlibris/aleph.rb +13 -0
  5. data/lib/exlibris/aleph/abstract.rb +28 -0
  6. data/lib/exlibris/aleph/config.rb +78 -0
  7. data/lib/exlibris/aleph/patron.rb +71 -56
  8. data/lib/exlibris/aleph/record.rb +34 -40
  9. data/lib/exlibris/aleph/rest/base.rb +56 -0
  10. data/lib/exlibris/aleph/tab_helper.rb +84 -99
  11. data/lib/exlibris/aleph/{config/config_base.rb → tabs_parser/base.rb} +2 -2
  12. data/lib/exlibris/aleph/{config → tabs_parser}/pc_tab_exp_field_extended.rb +2 -2
  13. data/lib/exlibris/aleph/{config/config_by_sub_library.rb → tabs_parser/sub_library.rb} +2 -2
  14. data/lib/exlibris/aleph/{config → tabs_parser}/tab15_by_item_process_status.rb +2 -2
  15. data/lib/exlibris/aleph/{config → tabs_parser}/tab15_by_item_status.rb +2 -2
  16. data/lib/exlibris/aleph/{config → tabs_parser}/tab31.rb +2 -2
  17. data/lib/exlibris/aleph/{config → tabs_parser}/tab37.rb +2 -2
  18. data/lib/exlibris/aleph/{config → tabs_parser}/tab40.rb +2 -2
  19. data/lib/exlibris/aleph/{config → tabs_parser}/tab_sub_library.rb +2 -2
  20. data/lib/exlibris/aleph/{config → tabs_parser}/tab_www_item_desc.rb +2 -2
  21. data/lib/exlibris/aleph/task_installer.rb +23 -0
  22. data/lib/exlibris/aleph/version.rb +1 -1
  23. data/lib/exlibris/aleph/write_attributes.rb +38 -0
  24. data/lib/exlibris/aleph/xml_util.rb +50 -0
  25. data/lib/exlibris/aleph/xservice/bor_auth.rb +47 -0
  26. data/lib/tasks/exlibris-aleph_tasks.rake +1 -8
  27. data/test/{dummy/config → config}/aleph/alephe/sub_libraries.yml +0 -1
  28. data/test/{dummy/config → config}/aleph/nyu50/collections.yml +0 -1
  29. data/test/{dummy/config → config}/aleph/nyu50/item_permissions_by_item_process_status.yml +0 -1
  30. data/test/{dummy/config → config}/aleph/nyu50/item_permissions_by_item_status.yml +104 -105
  31. data/test/{dummy/config → config}/aleph/nyu50/items.yml +0 -1
  32. data/test/{dummy/config → config}/aleph/nyu50/patron_permissions.yml +27 -28
  33. data/test/{dummy/config → config}/aleph/nyu50/patrons.yml +0 -1
  34. data/test/{dummy/config → config}/aleph/nyu50/pickup_locations.yml +0 -1
  35. data/test/{dummy/config → config}/aleph/nyu51/collections.yml +0 -1
  36. data/test/{dummy/config → config}/aleph/nyu51/item_permissions_by_item_process_status.yml +0 -1
  37. data/test/{dummy/config → config}/aleph/nyu51/item_permissions_by_item_status.yml +6 -7
  38. data/test/{dummy/config → config}/aleph/nyu51/items.yml +0 -1
  39. data/test/{dummy/config → config}/aleph/nyu51/patron_permissions.yml +27 -28
  40. data/test/{dummy/config → config}/aleph/nyu51/patrons.yml +0 -1
  41. data/test/{dummy/config → config}/aleph/nyu51/pickup_locations.yml +0 -1
  42. data/test/config_test.rb +24 -0
  43. data/test/patron_test.rb +98 -0
  44. data/test/{unit/record_benchmarks.rb → record_benchmarks.rb} +0 -0
  45. data/test/record_test.rb +64 -0
  46. data/test/support/config.yml +2 -0
  47. data/test/{unit/tab_helper_benchmarks.rb → tab_helper_benchmarks.rb} +5 -20
  48. data/test/tab_helper_test.rb +178 -0
  49. data/test/test_helper.rb +26 -22
  50. data/test/vcr_cassettes/bor_auth.yml +8 -10
  51. data/test/vcr_cassettes/patron.yml +77 -18
  52. data/test/vcr_cassettes/patron_address.yml +45 -0
  53. data/test/vcr_cassettes/patron_bogus_url.yml +731 -0
  54. data/test/vcr_cassettes/patron_error.yml +93 -0
  55. data/test/vcr_cassettes/record.yml +18 -17
  56. data/test/vcr_cassettes/record_bogus_url.yml +690 -0
  57. data/test/{unit → xservice}/bor_auth_test.rb +4 -4
  58. metadata +160 -150
  59. data/README.rdoc +0 -67
  60. data/lib/exlibris/aleph/bor_auth.rb +0 -45
  61. data/lib/exlibris/aleph/railtie.rb +0 -9
  62. data/lib/exlibris/aleph/rest.rb +0 -43
  63. data/lib/exlibris/aleph/tasks.rb +0 -25
  64. data/test/dummy/README.rdoc +0 -261
  65. data/test/dummy/Rakefile +0 -7
  66. data/test/dummy/app/assets/javascripts/application.js +0 -15
  67. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  68. data/test/dummy/app/controllers/application_controller.rb +0 -3
  69. data/test/dummy/app/helpers/application_helper.rb +0 -2
  70. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  71. data/test/dummy/config.ru +0 -4
  72. data/test/dummy/config/application.rb +0 -56
  73. data/test/dummy/config/boot.rb +0 -10
  74. data/test/dummy/config/database.yml +0 -25
  75. data/test/dummy/config/environment.rb +0 -5
  76. data/test/dummy/config/environments/development.rb +0 -37
  77. data/test/dummy/config/environments/production.rb +0 -67
  78. data/test/dummy/config/environments/test.rb +0 -37
  79. data/test/dummy/config/initializers/aleph.rb +0 -1
  80. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  81. data/test/dummy/config/initializers/inflections.rb +0 -15
  82. data/test/dummy/config/initializers/mime_types.rb +0 -5
  83. data/test/dummy/config/initializers/secret_token.rb +0 -7
  84. data/test/dummy/config/initializers/session_store.rb +0 -8
  85. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  86. data/test/dummy/config/locales/en.yml +0 -5
  87. data/test/dummy/config/routes.rb +0 -58
  88. data/test/dummy/db/README +0 -0
  89. data/test/dummy/db/test.sqlite3 +0 -0
  90. data/test/dummy/log/aleph/aleph_tab_helper.log +0 -1
  91. data/test/dummy/log/aleph/tab_helper.log +0 -109
  92. data/test/dummy/log/tab_helper.log +0 -16
  93. data/test/dummy/log/test.log +0 -5160
  94. data/test/dummy/public/404.html +0 -26
  95. data/test/dummy/public/422.html +0 -26
  96. data/test/dummy/public/500.html +0 -25
  97. data/test/dummy/public/favicon.ico +0 -0
  98. data/test/dummy/script/rails +0 -6
  99. data/test/unit/patron_test.rb +0 -41
  100. data/test/unit/record_test.rb +0 -32
  101. data/test/unit/tab_helper_test.rb +0 -222
data/README.rdoc DELETED
@@ -1,67 +0,0 @@
1
- = Exlibris::Aleph
2
- {<img src="https://api.travis-ci.org/scotdalton/exlibris-aleph.png?branch=master" alt="Build Status" />}[https://secure.travis-ci.org/scotdalton/exlibris-aleph]
3
- {<img src="https://gemnasium.com/scotdalton/exlibris-aleph.png" alt="Dependency Status" />}[https://gemnasium.com/scotdalton/exlibris-aleph]
4
- {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/scotdalton/exlibris-aleph]
5
-
6
- Exlibris::Aleph offers a set of libraries for interacting with the ExLibris Aleph ILS.
7
-
8
- == Exlibris::Aleph::Patron
9
- Exlibris::Aleph::Patron provides access to the Aleph Patron REST API.
10
-
11
- === Example of Exlibris::Aleph::Patron in action
12
- patron =
13
- Exlibris::Aleph::Patron.
14
- new("S0M31D", "http://aleph.institution.edu")
15
- patron.address # Returns HTTParty::Response of patron's address
16
- patron.loans # Returns HTTParty::Response patron's loan
17
- patron.renew_loans # Renews all loans
18
- patron.renew_loans("ADM5000000001") # Renews loan of item 00000001 in ADM50
19
- patron.place_hold("ADM50", "SBLIB", "00000001", "00000001", {:pickup_location => "SBLIB"}) # Places hold on the specified item for pickup at SBLIB
20
-
21
- == Exlibris::Aleph::Record
22
- Provides access to the Aleph Record REST API.
23
-
24
- === Example of Exlibris::Aleph::Record in action
25
- record =
26
- Exlibris::Aleph::Record.
27
- new("ADM50", "00000001", "http://aleph.institution.edu")
28
- record.bib # Returns HTTParty::Response of record's bibliographic metadata
29
- record.holdings # Returns HTTParty::Response of record's holdings
30
- record.items # Returns HTTParty::Response of record's items
31
-
32
- == Exlibris::Aleph::TabHelper
33
- Exlibris::Aleph::TabHelper provides a way to access the various tab settings for patrons, patron_permissions, items, item_permission (both by item status and by item processing status), collections and pickup locations. It also provides convenience methods for common tasks like getting the pickup location for a given combination of item status, item process status and borrower status or getting an item's web text. Support a
34
-
35
- === Example of Exlibris::Aleph::TabHelper in action
36
- # Placed this in an initializer.
37
- Exlibris::Aleph::TabHelper.init("/mnt/aleph_tab", ["ADM50", "ADM50"])
38
-
39
- # Rake task to refresh the config yml files
40
- rake exlibris:aleph:refresh
41
-
42
- # Get an instance of TabHelper
43
- helper = Exlibris::Aleph::TabHelper.instance
44
- helper.sub_library_text("SBLIB") # Returns display text for the give code
45
- helper.sub_library_adm("SBLIB") # Returns ADM for the give code
46
- helper.item_pickup_locations({:adm_library_code => "ADM50", :sub_library_code => "SBLIB", :bor_status => "51"}) # Returns the pickup locations for the given parameters
47
- helper.collection_text({:adm_library_code => "ADM50", :sub_library_code => "SBLIB", :collection_code => "MAIN"}) # Returns the collection display text for the give parameters
48
- helper.item_web_text({:adm_library_code => "ADM50", :item_process_status => "Item Process Status"}) # Returns the web text for the given parameters
49
- helper.item_web_text({:adm_library_code => "ADM50", :sub_library_code => "SBLIB", :item_process_status_code => "DP"}) # Returns the web text for the given parameters
50
-
51
- === Configure irrelevant sub libraries in TabHelper
52
- To configure the gem to ignore sub libraries pulled from Aleph but not relevant to working with permissions call the following setter with an array of sub library Aleph codes.
53
-
54
- # Place this in an initializer.
55
- Exlibris::Aleph::TabHelper.set_irrelevant_sub_libraries(["IRRLIB1", "IRRLIB1"], replace = false)
56
-
57
- If the boolean variable _replace_ is true the array passed in will replace the defaults. If it is false the array passed in will merge with the results. The default value is true.
58
-
59
- == Exlibris::Aleph::BorAuth
60
- Exlibris::Aleph::BorAuth provides access to the BorAuth Aleph XService.
61
-
62
- === Example of Exlibris::Aleph::BorAuth in action
63
- bor_auth =
64
- Exlibris::Aleph::BorAuth.
65
- new("http://aleph.institution.edu", "ADM50", "SBLIB", "N", "S0M31D", "V3R1F1C@T10N")
66
- permissions = bor_auth.permissions # Return a Hash of permissions based on the Exlibris::Aleph::BorAuth instance
67
-
@@ -1,45 +0,0 @@
1
- module Exlibris
2
- module Aleph
3
- require 'open-uri'
4
- require 'nokogiri'
5
- # ==Overview
6
- # Exlibris::Aleph::BorAuth provides access to the BorAuth Aleph XService.
7
- class BorAuth
8
- attr_reader :response, :error, :session_id
9
-
10
- # Creates an instance of Exlibris::Aleph::BorAuth based on the input parameters.
11
- def initialize(aleph_url, library, sub_library, translate, bor_id, bor_verification)
12
- url = "#{aleph_url}/X?"
13
- url += "op=bor-auth&library=#{library}&"
14
- url += "sub_library=#{sub_library}&translate=#{translate}&"
15
- url += "bor_id=#{bor_id}&verification=#{bor_verification}&"
16
- @response = Nokogiri.XML(open(url))
17
- @session_id = @response.at("//session-id").inner_text unless @response.at("//session-id").nil?
18
- @error = @response.at("//error").inner_text unless @response.at("//error").nil?
19
- end
20
-
21
- # Returns a Hash of permissions for the Aleph sub library passed into the constructor.
22
- def permissions
23
- rv = {}
24
- return rv unless @response and self.error.nil?
25
- rv[:home_sub_library] = @response.at("z303-home-library").inner_text unless @response.at("z303-home-library").nil?
26
- rv[:bor_status] = @response.at("z305-bor-status").inner_text unless @response.at("z305-bor-status").nil?
27
- rv[:bor_type] = @response.at("z305-bor-type").inner_text unless @response.at("z305-bor-type").nil?
28
- rv[:loan_permission] = @response.at("z305-loan-permission").inner_text unless @response.at("z305-loan-permission").nil?
29
- rv[:photo_permission] = @response.at("z305-photo-permission").inner_text unless @response.at("z305-photo-permission").nil?
30
- rv[:over_permission] = @response.at("z305-over-permission").inner_text unless @response.at("z305-over-permission").nil?
31
- rv[:multi_hold] = @response.at("z305-multi-hold").inner_text unless @response.at("z305-multi-hold").nil?
32
- rv[:loan_check] = @response.at("z305-loan-check").inner_text unless @response.at("z305-loan-check").nil?
33
- rv[:hold_permission] = @response.at("z305-hold-permission").inner_text unless @response.at("z305-hold-permission").nil?
34
- rv[:renew_permission] = @response.at("z305-renew-permission").inner_text unless @response.at("z305-renew-permission").nil?
35
- rv[:rr_permission] = @response.at("z305-rr-permission").inner_text unless @response.at("z305-rr-permission").nil?
36
- rv[:ignore_late_return] = @response.at("z305-ignore-late-return").inner_text unless @response.at("z305-ignore-late-return").nil?
37
- rv[:hold_on_shelf] = @response.at("z305-hold-on-shelf").inner_text unless @response.at("z305-hold-on-shelf").nil?
38
- rv[:end_block_date] = @response.at("z305-end-block-date").inner_text unless @response.at("z305-end-block-date").nil?
39
- rv[:booking_permission] = @response.at("z305-booking-permission").inner_text unless @response.at("z305-booking-permission").nil?
40
- rv[:booking_ignore_hours] = @response.at("z305-booking-ignore-hours").inner_text unless @response.at("z305-booking-ignore-hours").nil?
41
- return rv
42
- end
43
- end
44
- end
45
- end
@@ -1,9 +0,0 @@
1
- module Exlibris
2
- module Aleph
3
- class Railtie < Rails::Railtie
4
- rake_tasks do
5
- load "tasks/exlibris-aleph_tasks.rake"
6
- end
7
- end
8
- end
9
- end
@@ -1,43 +0,0 @@
1
- module Exlibris
2
- module Aleph
3
- require 'httparty'
4
- # ==Overview
5
- # Base implementation for Aleph REST APIs.
6
- # Not intended for use on its own, but should
7
- # instead be extended by implementing classes.
8
- class Rest
9
- include HTTParty
10
- format :xml
11
- # Create and instance of Exlibris::Aleph::Rest for the given Aleph URI.
12
- def initialize(uri)
13
- @uri = uri
14
- raise "Initialization error in #{self.class}. Missing URI." if @uri.nil?
15
- end
16
-
17
- # Returns the error associated with the request.
18
- # Returns nil if no error.
19
- def error
20
- return nil if reply_code == "0000"
21
- return "#{reply_text}"
22
- end
23
-
24
- # Returns the reply code associate with the request.
25
- def reply_code
26
- return "No response." if @response.nil?
27
- return (not @response.first.last.kind_of?(Hash) or @response.first.last["reply_code"].nil?) ? "Unexpected response hash." : @response.first.last["reply_code"] if @response.instance_of?(Hash)
28
- response_match = @response.match(/\<reply-code\>(.+)\<\/reply-code\>/) if @response.instance_of?(String)
29
- return (response_match.nil?) ? "Unexpected response string." : response_match[1] if @response.instance_of?(String)
30
- return "Unexpected response type."
31
- end
32
-
33
- # Returns the reply text associate with the request.
34
- def reply_text
35
- return "No response." if @response.nil?
36
- return (not @response.first.last.kind_of?(Hash) or @response.first.last["reply_text"].nil?) ? "Unexpected response hash." : @response.first.last["reply_text"] if @response.instance_of?(Hash)
37
- response_match = @response.match(/\<reply-text\>(.+)\<\/reply-text\>/) if @response.instance_of?(String)
38
- return (response_match.nil?) ? "Unexpected response string." : response_match[1] if @response.instance_of?(String)
39
- return "Unexpected response type."
40
- end
41
- end
42
- end
43
- end
@@ -1,25 +0,0 @@
1
- module Exlibris
2
- module Aleph
3
- class Tasks
4
- class << self
5
- def rake_tasks(&blk)
6
- @rake_tasks ||= []
7
- @rake_tasks << blk if blk
8
- @rake_tasks
9
- end
10
- end
11
- rake_tasks do
12
- load "tasks/exlibris-aleph_tasks.rake"
13
- end
14
- require 'rake'
15
- extend Rake::DSL
16
- self.rake_tasks.each { |block| self.instance_exec(app, &block) }
17
- # Also load tasks from all superclasses
18
- klass = self.superclass
19
- while klass.respond_to?(:rake_tasks)
20
- klass.rake_tasks.each { |t| self.instance_exec(app, &t) }
21
- klass = klass.superclass
22
- end
23
- end
24
- end
25
- end
@@ -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
- | `-- 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.