umlaut 4.0.0.beta4 → 4.0.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDcwZWM2OWQ1ZGRhYmYzNzNkZDQwMzFkMjRhMWY0MDQ5ZjZjMDJhNw==
4
+ Mzk2MTBjNThjOTVjZDUyYWJhYTQ1NmU2NGM4ZTg3NzJmNjE2MjYwZg==
5
5
  data.tar.gz: !binary |-
6
- ZWI0ZmQ3NzBkN2ZjZjAyYWE2NWM1MjMwOGZkN2YzZDU5N2FlODcwMQ==
6
+ MDNkMThjODUzNmFlMTRkZTY0MTViMDkwNmYyNmY0NjNiMzliOTYwMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjM2NGU4MWZkN2NhMGQyOGVlNjk1YjE0ODg3ZDBmODA3ODk5OGE0YTg2Zjky
10
- NWYzMmUzYzE5ZDI0YmI5YzUzY2VjYzcwMzU0YjMzYmQ2NTA5ZGZlODk5MTIz
11
- ZWU1MWZmMDRmNDUwMWNmYzcxYWE1NDc0N2ZkMjAxZTllN2Q2MzE=
9
+ NmY0MWNiMDlmMjU0YWZjMmM2MTM2ZGI4M2Y4NzdlNDU4MDdjNTRkYjY1OWU4
10
+ Y2VlNmI0Zjg3MWJiM2M1ZDI3ZTM4NTc1NDMyNDc4NjM2MDA1YWJkMzhjOGRl
11
+ YmFlMmZlYzQxMmMyOWE5YTQyMmZjZTEwNzc4Mzc0NTIwYTc4MjM=
12
12
  data.tar.gz: !binary |-
13
- YmRmNWYwMWVjZGEyNzZhMWVlZjkwODk5MzUwNjQwMDVlM2MyYTk4YzQyZDkw
14
- OTI5MGIyZmM1ODdmYjlhMzc5MTQzMTNkZTMzZGM2MDM3Y2U5NTMzOWE1MmYy
15
- YzAzNjFlZGQ0MjllZDExNDc2YjY0MTJkNjU3ZTVlNWFhY2FlYjM=
13
+ YjdlMGIwMmU5YTlkMjFmNTgwY2RkOTZlYWZhYjg2ZWUxMjkwY2VlYWMyYzYy
14
+ ZmI5NDVhOTIzNDJmYTRjMjAyMGJjNjRmNWNjMTc0ODEzN2U5NDdlMDJjYjg1
15
+ NmEyZGYwNzQ2ZDIzYWQ2NWQ1ZjAxYzQzYTkxNTRkMGI2NGY4NTg=
@@ -9,14 +9,14 @@ jQuery(document).ready(function($) {
9
9
  event.preventDefault();
10
10
  return false;
11
11
  });
12
- $(document).on("show", ".collapse", function(event) {
12
+ $(document).on("show.bs.collapse", ".collapse", function(event) {
13
13
  // Update the icon
14
14
  $(this).parent().find('.collapse-toggle i').removeClass("umlaut_icons-list-closed").addClass("umlaut_icons-list-open");
15
15
  // Update the action label
16
16
  $(this).parent().find(".expand_contract_action_label").text("Hide ");
17
17
 
18
18
  });
19
- $(document).on("hide", ".collapse", function(event) {
19
+ $(document).on("hide.bs.collapse", ".collapse", function(event) {
20
20
  // Update the icon
21
21
  $(this).parent().find('.collapse-toggle i').removeClass("umlaut_icons-list-open").addClass("umlaut_icons-list-closed");
22
22
  // Update the action label
@@ -1,5 +1,11 @@
1
1
  // Bootstrap Variable over-rides can go here
2
2
 
3
+ // We default the Bootstrap 2.x colors for links, they worked
4
+ // well with our design, and the Bootstrap 3.x colors seem
5
+ // too muted and hard to read in our design.
6
+ $link-color: #08c !default;
7
+ $link-hover-color: darken($link-color, 15%) !default;
8
+
3
9
 
4
10
  @import "bootstrap-sprockets";
5
11
  @import "bootstrap";
@@ -16,8 +16,15 @@
16
16
  }
17
17
  }
18
18
 
19
- .collapsible .collapse {
20
- margin-top: $line-height-computed / 2;
19
+ .collapsible {
20
+ // Difficult to get space between the toggle and the expanded
21
+ // content, that's only there when content is expanded, without
22
+ // causing a jump on expand/contract.
23
+ // We give up and provide the space even when collapsed.
24
+ .collapse-toggle {
25
+ display: block;
26
+ margin-bottom: $line-height-computed / 2;
27
+ }
21
28
  }
22
29
 
23
30
  /* Google Scholar Link:
@@ -1,5 +1,5 @@
1
1
  // See also, possible umlaut theme over-ride of default bootstrap
2
- // variables in umalut.scss
2
+ // variables in umlaut.scss
3
3
 
4
4
  // Basic colors, all other colors by default are defined in terms of these
5
5
  // Overall Border and Background
@@ -3,11 +3,13 @@
3
3
  # parameter umlaut.request_id=[some id] to hook up to a pre-existing
4
4
  # umlaut request (that presumably was an OpenURL).
5
5
  class ResolveController < UmlautController
6
- before_filter :init_processing
6
+ # These methods are meant as API called from other sites via Javascript
7
+ # with JS responses. We don't want Rails to keep it from happening.
8
+ # http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html
9
+ skip_before_filter :verify_authenticity_token, only: [:index, :background_status, :partial_html_sections, :api]
7
10
 
8
- # We need to NOT require a CSRF token on post to #index,
9
- # to allow POSTed OpenURLs
10
- protect_from_forgery :except => :index
11
+ before_filter :init_processing
12
+
11
13
  # POST'ed OpenURLs are a mess, redirect them to GETs
12
14
  before_filter :post_to_get, :only => :index
13
15
 
@@ -142,7 +144,7 @@ class ResolveController < UmlautController
142
144
  # no end of problems later. We can't just refuse to process, sources
143
145
  # do send us bad bytes, I'm afraid.
144
146
  params.values.each do |v|
145
- v.scrub!
147
+ v.scrub! if v.respond_to?(:'scrub!')
146
148
  end
147
149
  # Create an UmlautRequest object.
148
150
  options = {}
@@ -74,7 +74,7 @@ module Umlaut::ControllerBehavior
74
74
  # See https://github.com/team-umlaut/umlaut/wiki/Alternate-service-groups
75
75
  def create_collection
76
76
  services = ServiceStore.global_service_store.determine_services( self.specified_service_groups.uniq )
77
- return Collection.new(@user_request, services)
77
+ return Collection.new(@user_request, services, umlaut_config)
78
78
  end
79
79
  protected :create_collection
80
80
 
@@ -15,8 +15,9 @@ module Umlaut::UrlGeneration
15
15
  def url_for(*arguments)
16
16
  url = super
17
17
  if @generate_urls_with_host && url.starts_with?("/")
18
- #regex replace trailing slashes or trailing locale if present
19
- url = root_url.gsub(/(\/$)?(\/\?.*)?/, '') + url
18
+ #regex take root url and get just scheme/port part, no path.
19
+ # the path we want is in our own url we will add on.
20
+ url = root_url.gsub(/\A(.*\/\/[^\/]+)\/.*\Z/, '\1') + url
20
21
  end
21
22
  return url
22
23
  end
@@ -16,7 +16,7 @@ class Collection
16
16
  attr_accessor :umlaut_request
17
17
  attr_accessor :logger
18
18
  # configs
19
- attr_accessor :response_expire_interval, :response_expire_crontab_format, :background_service_timeout, :requeue_failedtemporary_services
19
+ attr_accessor :response_expire_interval, :response_expire_crontab_format, :background_service_timeout, :requeue_failedtemporary_services_in
20
20
 
21
21
  # generally only set to true in testing, can be set for the whole class
22
22
  # or for particular Collection instances.
@@ -30,7 +30,7 @@ class Collection
30
30
  # config is a Confstruct::Configuration associated with the current controller,
31
31
  # has a few config options in it relevant to collection service exec; but
32
32
  # don't pass in, we'll use a blank one with default values, no prob.
33
- def initialize(a_umlaut_request, service_hash, config = Confstruct::Configuration.new)
33
+ def initialize(a_umlaut_request, service_hash, config = Confstruct::Configuration.new)
34
34
  self.umlaut_request = a_umlaut_request
35
35
 
36
36
  self.logger = Rails.logger
@@ -38,7 +38,7 @@ class Collection
38
38
  self.response_expire_interval = config.lookup!("response_expire_interval", 1.day)
39
39
  self.response_expire_crontab_format = config.lookup!("response_expire_crontab_format", nil)
40
40
  self.background_service_timeout = config.lookup!("background_service_timeout", 30.seconds)
41
- self.requeue_failedtemporary_services = config.lookup!("requeue_failedtemporary_services", 500.seconds)
41
+ self.requeue_failedtemporary_services_in = config.lookup!("requeue_failedtemporary_services_in", 500.seconds)
42
42
 
43
43
  # @service_definitions will be a two-level hash, pointing to an array.. Task is Standard, LinkOut, etc.
44
44
  # { [task] => { [priority_level] => [config1, config2, config3],
@@ -186,6 +186,8 @@ class Collection
186
186
  logger.warn("Background service timed out, thread assumed dead. #{umlaut_request.id} / #{ds.service_id}")
187
187
  end
188
188
 
189
+
190
+
189
191
  # go through dispatched_services and delete:
190
192
  # 1) old completed dispatches, too old to use.
191
193
  # 2) failedtemporary dispatches that are older than our resurrection time
@@ -193,7 +195,7 @@ class Collection
193
195
  # After being deleted, they'll end up re-queued.
194
196
  if ( (ds.completed? && completed_dispatch_expired?(ds) ) ||
195
197
  ( ds.status == DispatchedService::FailedTemporary &&
196
- (Time.now - ds.updated_at) > self.requeue_failedtemporary_services
198
+ (Time.now - ds.updated_at) > self.requeue_failedtemporary_services_in
197
199
  )
198
200
  )
199
201
 
@@ -12,11 +12,15 @@ class Referent < ActiveRecord::Base
12
12
  # for shortcut metadata manipulations
13
13
  include MetadataHelper
14
14
 
15
-
16
15
  has_many :requests
17
16
  has_many :referent_values
18
17
  has_many :permalinks
19
18
 
19
+ # Make sure years get truncated to 4 chars
20
+ def year=(y)
21
+ super(y.slice(0,4))
22
+ end
23
+
20
24
  # Pass in :permalink => :force to force creation of a permalink, otherwise
21
25
  # no permalink is created by this method, one can be lazily created when
22
26
  # needed.
@@ -431,9 +431,31 @@ class Request < ActiveRecord::Base
431
431
  req.client_ip_is_simulated = true if req.client_ip_addr != a_rails_request.remote_ip()
432
432
 
433
433
  # Save selected http headers, keep some out to avoid being too long to
434
- # serialize.
434
+ # serialize. This is in retrospect not a great design to save http hash,
435
+ # should be individual columns of things we want to save. When we next make
436
+ # Umlaut schema changes maybe.
437
+ #
438
+ # One problem we're running into is exceeding width of db column.
439
+ # We'll only save REQUEST_URI AND HTTP_REFERER if they're not too long to try and avoid.
440
+ #
441
+ # Also mark as "ISO-8859-1" to save space in the YAML encoding, current YAML uuencodes
442
+ # 'binary' taking up too much space. HTTP headers are usually ascii, theoretically
443
+ # can be ISO-8859-1, theoretically can but never are something else with proper marking,
444
+ # we won't worry about.
435
445
  req.http_env = {}
436
- a_rails_request.env.each {|k, v| req.http_env[k] = v if ((k.slice(0,5) == 'HTTP_' && k != 'HTTP_COOKIE') || k == 'REQUEST_URI' || k == 'SERVER_NAME') }
446
+ a_rails_request.env.each do |k, v|
447
+ if ((k.slice(0,5) == 'HTTP_' && k != 'HTTP_COOKIE' ) ||
448
+ (k == 'REQUEST_URI') ||
449
+ k == 'SERVER_NAME')
450
+ k = k.dup.force_encoding("ISO-8859-1")
451
+ v.force_encoding("ISO-8859-1")
452
+ v.scrub!
453
+ req.http_env[k] = v.slice(0, 800) # only first 800 chars sorry
454
+ end
455
+ end
456
+ #["HTTP_X_FORWARDED_FOR", "SERVER_NAME", "HTTP_USER_AGENT", "HTTP_ACCEPT", 'HTTP_ACCEPT_LANGUAGE', 'HTTP_ACCEPT_CHARSET', 'HTTP_ACCEPT_ENCODING']
457
+
458
+
437
459
 
438
460
  req.save!
439
461
  return req
@@ -97,7 +97,7 @@ class Blacklight < Service
97
97
  doc = Nokogiri::XML( http_fetch(url).body )
98
98
  # filter out matches whose titles don't really match at all, or
99
99
  # which have already been seen in identifier search.
100
- entries = filter_keyword_entries( doc.xpath("atom:feed/atom:entry", xml_ns) , :exclude_ids => ids_processed, :remove_subtitle => (! title_is_serial?(request.referent)) )
100
+ entries = filter_keyword_entries(request, doc.xpath("atom:feed/atom:entry", xml_ns) , :exclude_ids => ids_processed, :remove_subtitle => (! title_is_serial?(request.referent)) )
101
101
 
102
102
 
103
103
  marc_by_atom_id = {}
@@ -286,7 +286,7 @@ class Blacklight < Service
286
286
  return service_data.length
287
287
  end
288
288
 
289
- def filter_keyword_entries(atom_entries, options = {})
289
+ def filter_keyword_entries(request, atom_entries, options = {})
290
290
  options[:exclude_ids] ||= []
291
291
  options[:remove_subtitle] ||= true
292
292
 
@@ -14,6 +14,11 @@
14
14
  #
15
15
  # If a thumbnail_url is returned in the responses, a cover image is displayed.
16
16
  #
17
+ # Can also enhances with an abstract, if available. -- off by default, set `abstract: true` to turn on.
18
+ #
19
+ # And fleshes out bibliographic details from an identifier -- if all you had was an
20
+ # ISBN, will fill in title, author, etc in referent from GBS response.
21
+ #
17
22
  # = Google API Key
18
23
  #
19
24
  # Setting an api key in :api_key STRONGLY recommended, or you'll
@@ -50,13 +55,18 @@ class GoogleBookSearch < Service
50
55
  attr_reader :url, :display_name, :num_full_views
51
56
 
52
57
  def service_types_generated
53
- types= [
54
- ServiceTypeValue[:fulltext],
55
- ServiceTypeValue[:cover_image],
56
- ServiceTypeValue[:highlighted_link],
57
- ServiceTypeValue[:search_inside],
58
- ServiceTypeValue[:excerpts]]
58
+ types= []
59
+
60
+ if @web_links
61
+ types.push ServiceTypeValue[:highlighted_link]
62
+ types.push ServiceTypeValue[:excerpts]
63
+ end
64
+ types.push(ServiceTypeValue[:search_inside]) if @search_inside
65
+ types.push(ServiceTypeValue[:fulltext]) if @fulltext
66
+ types.push(ServiceTypeValue[:cover_image]) if @cover_image
59
67
  types.push(ServiceTypeValue[:referent_enhance]) if @referent_enhance
68
+ types.push(ServiceTypeValue[:abstract]) if @abstract
69
+
60
70
  return types
61
71
  end
62
72
 
@@ -64,10 +74,22 @@ class GoogleBookSearch < Service
64
74
  @url = 'https://www.googleapis.com/books/v1/volumes?q='
65
75
 
66
76
  @display_name = 'Google Books'
77
+
67
78
  # number of full views to show
68
79
  @num_full_views = 1
80
+
69
81
  # default on, to enhance our metadata with stuff from google
70
82
  @referent_enhance = true
83
+
84
+ # default OFF, add description/abstract from GBS
85
+ @abstract = false
86
+
87
+ # Other responses on by default but can be turned off
88
+ @cover_image = true
89
+ @fulltext = true
90
+ @search_inside = true
91
+ @web_links = true # to partial view :excerpts or :fulltext
92
+
71
93
  # google api key strongly recommended, otherwise you'll
72
94
  # probably get rate limited.
73
95
  @api_key = nil
@@ -101,21 +123,29 @@ class GoogleBookSearch < Service
101
123
  return request.dispatched(self, true) if data["totalItems"] == 0
102
124
 
103
125
  enhance_referent(request, data) if @referent_enhance
126
+
127
+ add_abstract(request, data) if @abstract
104
128
 
105
129
  #return full views first
106
- full_views_shown = create_fulltext_service_response(request, data)
130
+ if @fulltext
131
+ full_views_shown = create_fulltext_service_response(request, data)
132
+ end
107
133
 
108
- # Add search_inside link if appropriate
109
- add_search_inside(request, data)
134
+ if @search_inside
135
+ # Add search_inside link if appropriate
136
+ add_search_inside(request, data)
137
+ end
110
138
 
111
139
  # only if no full view is shown, add links for partial view or noview
112
140
  unless full_views_shown
113
141
  do_web_links(request, data)
114
142
  end
115
143
 
116
- thumbnail_url = find_thumbnail_url(data)
117
- if thumbnail_url
118
- add_cover_image(request, thumbnail_url)
144
+ if @cover_image
145
+ thumbnail_url = find_thumbnail_url(data)
146
+ if thumbnail_url
147
+ add_cover_image(request, thumbnail_url)
148
+ end
119
149
  end
120
150
 
121
151
  return request.dispatched(self, true)
@@ -139,7 +169,7 @@ class GoogleBookSearch < Service
139
169
 
140
170
  element_enhance(request, "tpages", volumeInfo["pageCount"])
141
171
 
142
- if (date = volumeInfo["publishedDate"] && date =~ /^(\d\d\d\d)/)
172
+ if (date = volumeInfo["publishedDate"]) && date =~ /^(\d\d\d\d)/
143
173
  element_enhance(request, "date", $1)
144
174
  end
145
175
 
@@ -168,6 +198,21 @@ class GoogleBookSearch < Service
168
198
  end
169
199
  end
170
200
 
201
+ def add_abstract(request, data)
202
+ info = data["items"].first.try {|h| h["volumeInfo"]}
203
+ if description = info["description"]
204
+
205
+ url = info["infoLink"]
206
+ request.add_service_response(
207
+ :service => self,
208
+ :display_text => "Description from Google Books",
209
+ :display_text_i18n => "description",
210
+ :url => remove_query_context(url),
211
+ :service_type_value => :abstract
212
+ )
213
+ end
214
+ end
215
+
171
216
  # Will not over-write existing referent values.
172
217
  def element_enhance(request, rft_key, value)
173
218
  if (value)
@@ -266,11 +266,8 @@ class Sfx < Service
266
266
  end
267
267
 
268
268
  if ( umlaut_service ) # Okay, it's in services or targets of interest
269
- if (target/"./displayer")
270
- source = "SFX/"+(target/"./displayer").inner_text
271
- else
272
- source = "SFX"+URI.parse(self.url).path
273
- end
269
+
270
+ source = @display_name || "SFX"
274
271
 
275
272
  target_service_id = (target/"./target_service_id").inner_text
276
273
 
@@ -1,32 +1,32 @@
1
1
  <h1>Contact Us <small>Send us questions, problems, or comments</small></h1>
2
2
 
3
- <%= form_tag(feedback_path(params[:request_id], :contact_id => params[:contact_id]) , :method => :post, :class => "feedback-form form-horizontal") do %>
3
+ <%= form_tag(feedback_path(params[:request_id], :contact_id => params[:contact_id]) , :method => :post, :class => "feedback-form form-horizontal", :role => "form") do %>
4
4
 
5
5
  <div class="form-group">
6
- <label class="control-label" for="name">Your Name</label>
7
- <div class="controls">
8
- <input type="text" id="name" name="name">
6
+ <label class="control-label col-sm-2" for="name">Your Name</label>
7
+ <div class="controls col-sm-10">
8
+ <input type="text" id="name" name="name" class="form-control">
9
9
  </div>
10
10
  </div>
11
11
 
12
12
  <div class="form-group">
13
- <label class="control-label" for="email">Your Email</label>
14
- <div class="controls">
15
- <input type="text" id="email" name="email">
13
+ <label class="control-label col-sm-2" for="email">Your Email</label>
14
+ <div class="controls col-sm-10">
15
+ <input type="text" id="email" name="email" class="form-control">
16
16
  </div>
17
17
  </div>
18
18
 
19
19
  <div class="form-group">
20
- <label class="control-label" for="feedback">Question or Comment</label>
21
- <div class="controls">
22
- <textarea id="feedback" name="feedback" class="input-xxlarge" rows=6></textarea>
20
+ <label class="control-label col-sm-2" for="feedback">Question or Comment</label>
21
+ <div class="controls col-sm-10">
22
+ <textarea id="feedback" name="feedback" class="form-control" rows=6></textarea>
23
23
  </div>
24
24
  </div>
25
25
 
26
26
 
27
27
  <div class="form-group">
28
- <div class="controls">
29
- <button type="submit" class="btn btn-default">Send</button>
28
+ <div class="controls col-sm-offset-2 col-sm-10">
29
+ <button type="submit" class="btn btn-primary">Send</button>
30
30
  </div>
31
31
  </div>
32
32
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  <% if display_not_found_warning?(user_request) %>
7
7
  <div class="alert alert-danger">
8
- <i class="umlaut_icons-famfamfam-error"/>
8
+ <i class="umlaut_icons-famfamfam-error"></i>
9
9
  <%= t("umlaut.resolve.not_found_warning", :app_name => umlaut_config.app_name, :resource_type => user_request.referent.container_type_of_thing.downcase) %>
10
10
  </div>
11
11
  <% end %>
@@ -3,7 +3,7 @@
3
3
  [:alert_success, :alert_info, :alert_error].each do |key|
4
4
  if flash[key]
5
5
  text = flash[key]
6
- css_class = key.to_s.parameterize
6
+ css_class = key.to_s.dasherize
7
7
  end
8
8
  end
9
9
  -%>
@@ -157,6 +157,7 @@ en:
157
157
  notes_html: "This article <b>may</b> be available on the public web, look for links labelled <span class='gscholar_example'>[html]</span> or <span class='gscholar_example'>[pdf]</span>"
158
158
  google_book_search:
159
159
  book_information: "Book information"
160
+ description: "Description from Google Books"
160
161
  amazon:
161
162
  display_text: "Amazon's page"
162
163
  description: "Description from Amazon.com"
@@ -31,28 +31,33 @@ default:
31
31
  base_url: YOUR_SFX_BASE_URL
32
32
  priority: 3
33
33
 
34
+ # We have GoogleBookSearch running early because it can take a bare ISBN
35
+ # and look up bibliographic metadata, which is useful to happen early.
36
+ # By running at the same priority as SFX, 3, it will run concurrently
37
+ # and maximize fast response time. You could also have it run before SFX,
38
+ # if you needed SFX to have the enhanced metadata from GoogleBookSearch.
39
+ #
40
+ # It can also find cover images, abstracts, and links to
41
+ # previews and search-inside-the-book. You can turn
42
+ # each of those off if you want.
43
+ GoogleBookSearch:
44
+ type: GoogleBookSearch
45
+ disabled: true
46
+ priority: 3
47
+ api_key: 'YOUR_GBS_API_KEY'
48
+ referent_enhance: true
49
+ fulltext: true
50
+ cover_image: true
51
+ abstract: true
52
+ web_links: true
53
+
34
54
  # blind link to price comparison site AllBooks.com.
35
55
  # just a blind link with no API pre-check, will be near
36
56
  # instantaneous to calculate.
37
57
  AllBooksDotCom:
38
58
  type: AllBooksDotCom
39
59
  priority: 3
40
-
41
-
42
- # First half of Amazon, run in foreground, get metadata and cover images.
43
- Amazon:
44
- disabled: true
45
- display_name: Amazon.com
46
- type: Amazon
47
- url: http://webservices.amazon.com/onca/xml
48
- api_key: "NEED_API_KEY"
49
- secret_key: "NEED_SECRET_KEY"
50
- associate_tag: "NEED_ASSOCIATE_ID"
51
- priority: 3
52
- service_types:
53
- - abstract
54
- - referent_enhance
55
- - cover_image
60
+
56
61
 
57
62
 
58
63
  # Priority c : Background
@@ -61,20 +66,7 @@ default:
61
66
  # be put in the same bg wave, to increase perceived responsiveness
62
67
  # by ending the spinner in the fulltext area.
63
68
 
64
- # Second half of Amazon. It's Slow to lookup highlighted_link and search_inside
65
- # availability, so we do it in a bg wave.
66
- Amazon_bg:
67
- type: Amazon
68
- disabled: true
69
- api_key: "NEED_API_KEY"
70
- secret_key: "NEED_SECRET_KEY"
71
- associate_tag: "NEED_ASSOCIATE_ID"
72
- priority: c
73
- make_aws_call: false
74
- service_types:
75
- - highlighted_link
76
- - search_inside
77
- - excerpts
69
+
78
70
 
79
71
  CoverThing:
80
72
  type: CoverThing
@@ -93,12 +85,6 @@ default:
93
85
  UlrichsCover:
94
86
  type: UlrichsCover
95
87
  priority: c
96
-
97
- GoogleBookSearch:
98
- type: GoogleBookSearch
99
- disabled: true
100
- priority: c
101
- api_key: 'YOUR_GBS_API_KEY'
102
88
 
103
89
  InternetArchive:
104
90
  display_name: the Internet Archive
@@ -21,7 +21,7 @@ module Umlaut
21
21
  #{$1}# UMLAUT: Umlaut's use of threading makes Rails dev-mode class reloading tricky
22
22
  #{$1}# It seems to be be mostly okay with cache_classes=false AND eager_load=true
23
23
  #{$1}# but beware of editing files while background requests are running.
24
- #{$1}config.eager_loading = true
24
+ #{$1}config.eager_load = true
25
25
  EOS
26
26
  end
27
27
  end
@@ -0,0 +1,50 @@
1
+ # Rails4 doesn't create un-fingerprinted assets anymore, but we
2
+ # need a couple for umlaut's API. Let's try to hook in and make
3
+ # symlinks.
4
+ #
5
+ # list of what file(globs) need non-digest-named copies is kept in
6
+ # Umlaut::Engine.config.non_digest_named_assets
7
+ # defined in lib/umlaut.rb, but app can modify it if desired.
8
+
9
+ require 'umlaut'
10
+ require 'pathname'
11
+
12
+
13
+ # Every time assets:precompile is called, trigger umlaut:create_non_digest_assets afterwards.
14
+ Rake::Task["assets:precompile"].enhance do
15
+ Rake::Task["umlaut:create_non_digest_assets"].invoke
16
+ end
17
+
18
+ namespace :umlaut do
19
+
20
+ # This seems to be basically how ordinary asset precompile
21
+ # is logging, ugh.
22
+ logger = Logger.new($stderr)
23
+
24
+ # Based on suggestion at https://github.com/rails/sprockets-rails/issues/49#issuecomment-20535134
25
+ # but limited to files in umlaut's namespaced asset directories.
26
+ task :create_non_digest_assets => :"assets:environment" do
27
+ manifest_path = Dir.glob(File.join(Rails.root, 'public/assets/manifest-*.json')).first
28
+ manifest_data = JSON.load(File.new(manifest_path))
29
+
30
+ manifest_data["assets"].each do |logical_path, digested_path|
31
+ logical_pathname = Pathname.new logical_path
32
+
33
+ if Umlaut::Engine.config.non_digest_named_assets.any? {|testpath| logical_pathname.fnmatch?(testpath, File::FNM_PATHNAME) }
34
+ full_digested_path = File.join(Rails.root, 'public/assets', digested_path)
35
+ full_nondigested_path = File.join(Rails.root, 'public/assets', logical_path)
36
+
37
+ logger.info "(Umlaut) Copying to #{full_nondigested_path}"
38
+
39
+ # Use FileUtils.copy_file with true third argument to copy
40
+ # file attributes (eg mtime) too, as opposed to FileUtils.cp
41
+ # Making symlnks with FileUtils.ln_s would be another option, not
42
+ # sure if it would have unexpected issues.
43
+ FileUtils.copy_file full_digested_path, full_nondigested_path, true
44
+ end
45
+ end
46
+
47
+ end
48
+ end
49
+
50
+
@@ -8,6 +8,16 @@ require 'bootstrap-sass'
8
8
  module Umlaut
9
9
  class Engine < Rails::Engine
10
10
  engine_name "umlaut"
11
+
12
+ ## Umlaut patches assets:precompile rake task to make non-digest-named
13
+ # copies of files matching this config. LOGICAL names of assets.
14
+ # These can be dirglobs if desired.
15
+ #
16
+ # See lib/tasks/umlaut_asset_compile.rake
17
+ #
18
+ # umlaut_ui.js and spinner.gif prob should have been put under umlaut/
19
+ # dir, but we didn't.
20
+ config.non_digest_named_assets = ["umlaut/*.js", "umlaut_ui.js", "spinner.gif"]
11
21
 
12
22
  # We need the update_html.js script to be available as it's own
13
23
  # JS file too, not just compiled into application.js, so we can
@@ -98,7 +98,11 @@ module Umlaut
98
98
 
99
99
  def link_router
100
100
  add_routes do |options|
101
- get 'link_router(/index)' => "link_router#index"
101
+ # legacy with the index, to keep old bookmarks working, needs to come first
102
+ get 'link_router/index(/:id)' => "link_router#index"
103
+
104
+ get 'link_router/:id' => "link_router#index"
105
+
102
106
  end
103
107
  end
104
108
 
@@ -1,5 +1,5 @@
1
1
  module Umlaut
2
- VERSION = "4.0.0.beta4"
2
+ VERSION = "4.0.0.beta5"
3
3
 
4
4
  # This is used in Umlaut's .gemspec for generating the gem,
5
5
  # and is also used in the umlaut app generator to make sure
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umlaut
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta4
4
+ version: 4.0.0.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind, et al
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-22 00:00:00.000000000 Z
11
+ date: 2014-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -294,7 +294,6 @@ files:
294
294
  - active_record_patch/connection_pool.rb
295
295
  - app/assets/images/error.gif
296
296
  - app/assets/images/frame_remove.gif
297
- - app/assets/images/jhu_findit.gif
298
297
  - app/assets/images/spinner.gif
299
298
  - app/assets/images/umlaut_icons.png
300
299
  - app/assets/images/umlaut_icons/famfamfam-book-go.png
@@ -504,6 +503,7 @@ files:
504
503
  - lib/generators/umlaut/remove_turbolinks_generator.rb
505
504
  - lib/generators/umlaut_app_template.rb
506
505
  - lib/tasks/umlaut.rake
506
+ - lib/tasks/umlaut_asset_compile.rake
507
507
  - lib/tasks/umlaut_migrate_permalinks.rake
508
508
  - lib/term_color.rb
509
509
  - lib/umlaut.rb