enju_ndl 0.1.1 → 0.2.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -3
  3. data/app/controllers/ndl_books_controller.rb +3 -6
  4. data/app/policies/ndl_book_policy.rb +9 -0
  5. data/app/views/ndl_books/index.html.erb +5 -0
  6. data/config/locales/en.yml +1 -0
  7. data/config/locales/ja.yml +1 -0
  8. data/lib/enju_ndl/ndl_search.rb +7 -0
  9. data/lib/enju_ndl/version.rb +1 -1
  10. data/spec/cassette_library/NdlBook/import/should_import_edition.yml +191 -0
  11. data/spec/cassette_library/NdlBook/import/should_import_series_statement_if_the_resource_is_serial.yml +30 -26
  12. data/spec/cassette_library/NdlBook/import/should_import_volume_title.yml +182 -0
  13. data/spec/cassette_library/ndl_books/index/ndl_search_menu/should_reflect_query_params_for_views.yml +422 -0
  14. data/spec/dummy/app/controllers/application_controller.rb +7 -0
  15. data/spec/dummy/app/models/user.rb +1 -2
  16. data/spec/dummy/config/application.rb +7 -26
  17. data/spec/dummy/config/environments/development.rb +25 -14
  18. data/spec/dummy/config/environments/production.rb +50 -31
  19. data/spec/dummy/config/environments/test.rb +23 -18
  20. data/spec/dummy/config/initializers/enju_leaf.rb +1 -0
  21. data/spec/dummy/db/migrate/059_create_libraries.rb +28 -0
  22. data/spec/dummy/db/migrate/069_create_shelves.rb +15 -0
  23. data/spec/dummy/db/migrate/080_create_library_groups.rb +17 -0
  24. data/spec/dummy/db/migrate/120_create_baskets.rb +12 -0
  25. data/spec/dummy/db/migrate/124_create_bookstores.rb +17 -0
  26. data/spec/dummy/db/migrate/130_create_request_status_types.rb +12 -0
  27. data/spec/dummy/db/migrate/131_create_request_types.rb +12 -0
  28. data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +17 -0
  29. data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +14 -0
  30. data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +17 -0
  31. data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +9 -0
  32. data/spec/dummy/db/migrate/20100314190054_add_opening_hour_to_library.rb +9 -0
  33. data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +9 -0
  34. data/spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb +5 -0
  35. data/spec/dummy/db/migrate/20120129014038_create_budget_types.rb +12 -0
  36. data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +14 -0
  37. data/spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb +5 -0
  38. data/spec/dummy/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb +6 -0
  39. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
  40. data/spec/dummy/db/schema.rb +175 -0
  41. data/spec/fixtures/library_groups.yml +31 -0
  42. data/spec/fixtures/users.yml +1 -1
  43. data/spec/models/ndl_book_spec.rb +20 -1
  44. data/spec/requests/ndl_books_spec.rb +2 -1
  45. data/spec/spec_helper.rb +12 -0
  46. data/spec/support/devise.rb +2 -2
  47. data/spec/views/ndl_books/index.html.erb_spec.rb +17 -0
  48. metadata +117 -26
  49. data/spec/dummy/config/application.yml +0 -38
@@ -1,60 +1,79 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
- # Code is not reloaded between requests
4
+ # Code is not reloaded between requests.
5
5
  config.cache_classes = true
6
6
 
7
- # Full error reports are disabled and caching is turned on
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
8
14
  config.consider_all_requests_local = false
9
15
  config.action_controller.perform_caching = true
10
16
 
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
21
+ # config.action_dispatch.rack_cache = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
13
26
 
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
16
30
 
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
18
32
  config.assets.compile = false
19
33
 
20
- # Generate digests for assets URLs
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
21
36
  config.assets.digest = true
22
37
 
23
- # Defaults to Rails.root.join("public/assets")
24
- # config.assets.manifest = YOUR_PATH
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
25
39
 
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
40
+ # Specifies the header that your server uses for sending files.
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
29
43
 
30
44
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
45
  # config.force_ssl = true
32
46
 
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
35
50
 
36
- # Use a different logger for distributed setups
37
- # config.logger = SyslogLogger.new
51
+ # Prepend all log lines with the following tags.
52
+ # config.log_tags = [ :subdomain, :uuid ]
38
53
 
39
- # Use a different cache store in production
40
- # config.cache_store = :mem_cache_store
54
+ # Use a different logger for distributed setups.
55
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
56
 
42
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
43
- # config.action_controller.asset_host = "http://assets.example.com"
57
+ # Use a different cache store in production.
58
+ # config.cache_store = :mem_cache_store
44
59
 
45
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46
- # config.assets.precompile += %w( search.js )
60
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
47
62
 
48
- # Disable delivery errors, bad email addresses will be ignored
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
49
65
  # config.action_mailer.raise_delivery_errors = false
50
66
 
51
- # Enable threaded mode
52
- # config.threadsafe!
53
-
54
67
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
55
- # the I18n.default_locale when a translation can not be found)
68
+ # the I18n.default_locale when a translation cannot be found).
56
69
  config.i18n.fallbacks = true
57
70
 
58
- # Send deprecation notices to registered listeners
71
+ # Send deprecation notices to registered listeners.
59
72
  config.active_support.deprecation = :notify
73
+
74
+ # Use default logging formatter so that PID and timestamp are not suppressed.
75
+ config.log_formatter = ::Logger::Formatter.new
76
+
77
+ # Do not dump schema after migrations.
78
+ config.active_record.dump_schema_after_migration = false
60
79
  end
@@ -1,39 +1,44 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
5
+ # test suite. You never need to work with it otherwise. Remember that
6
6
  # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
7
+ # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
- # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
13
14
 
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
16
18
 
17
- # Show full error reports and disable caching
19
+ # Show full error reports and disable caching.
18
20
  config.consider_all_requests_local = true
19
21
  config.action_controller.perform_caching = false
20
22
 
21
- # Raise exceptions instead of rendering exception templates
23
+ # Raise exceptions instead of rendering exception templates.
22
24
  config.action_dispatch.show_exceptions = false
23
25
 
24
- # Disable request forgery protection in test environment
25
- config.action_controller.allow_forgery_protection = false
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
26
28
 
27
29
  # Tell Action Mailer not to deliver emails to the real world.
28
30
  # The :test delivery method accumulates sent emails in the
29
31
  # ActionMailer::Base.deliveries array.
30
32
  config.action_mailer.delivery_method = :test
31
33
 
32
- # Use SQL instead of Active Record's schema dumper when creating the test database.
33
- # This is necessary if your schema can't be completely dumped by the schema dumper,
34
- # like if you have constraints or database-specific column types
35
- # config.active_record.schema_format = :sql
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
36
 
37
- # Print deprecation notices to the stderr
37
+ # Print deprecation notices to the stderr.
38
38
  config.active_support.deprecation = :stderr
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+
43
+ config.action_mailer.default_url_options = {:host => 'localhost:3000'}
39
44
  end
@@ -0,0 +1 @@
1
+ Manifestation.include(EnjuSubject::EnjuManifestation)
@@ -0,0 +1,28 @@
1
+ class CreateLibraries < ActiveRecord::Migration
2
+ def change
3
+ create_table :libraries do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.string :short_display_name, :null => false
7
+ t.string :zip_code
8
+ t.text :street
9
+ t.text :locality
10
+ t.text :region
11
+ t.string :telephone_number_1
12
+ t.string :telephone_number_2
13
+ t.string :fax_number
14
+ t.text :note
15
+ t.integer :call_number_rows, :default => 1, :null => false
16
+ t.string :call_number_delimiter, :default => "|", :null => false
17
+ t.integer :library_group_id, :default => 1, :null => false
18
+ t.integer :users_count, :default => 0, :null => false
19
+ t.integer :position
20
+ t.integer :country_id
21
+
22
+ t.timestamps
23
+ t.datetime :deleted_at
24
+ end
25
+ add_index :libraries, :library_group_id
26
+ add_index :libraries, :name, :unique => true
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ class CreateShelves < ActiveRecord::Migration
2
+ def change
3
+ create_table :shelves do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :library_id, :default => 1, :null => false
8
+ t.integer :items_count, :default => 0, :null => false
9
+ t.integer :position
10
+ t.timestamps
11
+ t.datetime :deleted_at
12
+ end
13
+ add_index :shelves, :library_id
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ class CreateLibraryGroups < ActiveRecord::Migration
2
+ def change
3
+ create_table :library_groups do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.string :short_name, :null => false
7
+ t.text :my_networks
8
+ t.text :login_banner
9
+ t.text :note
10
+ t.integer :country_id
11
+ t.integer :position
12
+
13
+ t.timestamps
14
+ end
15
+ add_index :library_groups, :short_name
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ class CreateBaskets < ActiveRecord::Migration
2
+ def change
3
+ create_table :baskets do |t|
4
+ t.integer :user_id
5
+ t.text :note
6
+ t.integer :lock_version, :default => 0, :null => false
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :baskets, :user_id
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ class CreateBookstores < ActiveRecord::Migration
2
+ def change
3
+ create_table :bookstores do |t|
4
+ t.text :name, :null => false
5
+ t.string :zip_code
6
+ t.text :address
7
+ t.text :note
8
+ t.string :telephone_number
9
+ t.string :fax_number
10
+ t.string :url
11
+ t.integer :position
12
+ t.datetime :deleted_at
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ class CreateRequestStatusTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :request_status_types do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ class CreateRequestTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :request_types do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ class CreateSubscriptions < ActiveRecord::Migration
2
+ def change
3
+ create_table :subscriptions do |t|
4
+ t.text :title, :null => false
5
+ t.text :note
6
+ #t.integer :subscription_list_id, :integer
7
+ t.integer :user_id
8
+ t.integer :order_list_id
9
+ t.datetime :deleted_at
10
+ t.integer :subscribes_count, :default => 0, :null => false
11
+
12
+ t.timestamps
13
+ end
14
+ add_index :subscriptions, :user_id
15
+ add_index :subscriptions, :order_list_id
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ class CreateSubscribes < ActiveRecord::Migration
2
+ def change
3
+ create_table :subscribes do |t|
4
+ t.integer :subscription_id, :null => false
5
+ t.integer :work_id, :null => false
6
+ t.datetime :start_at, :null => false
7
+ t.datetime :end_at, :null => false
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :subscribes, :subscription_id
12
+ add_index :subscribes, :work_id
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ class CreateSearchEngines < ActiveRecord::Migration
2
+ def change
3
+ create_table :search_engines do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.string :url, :null => false
7
+ t.text :base_url, :null => false
8
+ t.text :http_method, :null => false
9
+ t.text :query_param, :null => false
10
+ t.text :additional_param
11
+ t.text :note
12
+ t.integer :position
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ class AddAdminNetworksToLibraryGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :library_groups, :admin_networks, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :library_groups, :admin_networks
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddOpeningHourToLibrary < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :libraries, :opening_hour, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :libraries, :opening_hour
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddUrlToLibraryGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :library_groups, :url, :string, :default => 'http://localhost:3000/'
4
+ end
5
+
6
+ def self.down
7
+ remove_column :library_groups, :url
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddIsilToLibrary < ActiveRecord::Migration
2
+ def change
3
+ add_column :libraries, :isil, :string
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ class CreateBudgetTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :budget_types do |t|
4
+ t.string :name
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ class CreateAccepts < ActiveRecord::Migration
2
+ def change
3
+ create_table :accepts do |t|
4
+ t.integer :basket_id
5
+ t.integer :item_id
6
+ t.integer :librarian_id
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ add_index :accepts, :basket_id
12
+ add_index :accepts, :item_id
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ class AddClosedToShelf < ActiveRecord::Migration
2
+ def change
3
+ add_column :shelves, :closed, :boolean, :default => false, :null => false
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddLatitudeAndLongitudeToLibrary < ActiveRecord::Migration
2
+ def change
3
+ add_column :libraries, :latitude, :float
4
+ add_column :libraries, :longitude, :float
5
+ end
6
+ end
@@ -0,0 +1,14 @@
1
+ class CreateColors < ActiveRecord::Migration
2
+ def change
3
+ create_table :colors do |t|
4
+ t.integer :library_group_id
5
+ t.string :property
6
+ t.string :code
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :colors, :library_group_id
13
+ end
14
+ end