[DRE-commits] [ruby-turbolinks] 01/07: include gitlab-turbolinks-classic as patch

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Wed Jan 18 06:20:50 UTC 2017


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository ruby-turbolinks.

commit 4015e5123106cd39daa6705c63f7ebee4df1ee99
Author: Pirate Praveen <praveen at debian.org>
Date:   Wed Jan 18 11:05:21 2017 +0530

    include gitlab-turbolinks-classic as patch
---
 debian/copy-gemspec                                |   4 +
 .../patches/gitlab-turbolinks-classic2.5.6.patch   | 299 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 debian/rules                                       |   1 +
 4 files changed, 305 insertions(+)

diff --git a/debian/copy-gemspec b/debian/copy-gemspec
new file mode 100755
index 0000000..17220c0
--- /dev/null
+++ b/debian/copy-gemspec
@@ -0,0 +1,4 @@
+#!/bin/sh
+# provide gitlab-turbolinks-classic
+version=$(head -1 debian/changelog |cut -d'(' -f2|cut -d'-' -f1|cut -d+ -f1)
+cp gitlab-turbolinks-classic.gemspec debian/ruby-turbolinks/usr/share/rubygems-integration/all/specifications/gitlab-turbolinks-classic-${version}.gemspec
diff --git a/debian/patches/gitlab-turbolinks-classic2.5.6.patch b/debian/patches/gitlab-turbolinks-classic2.5.6.patch
new file mode 100644
index 0000000..6c0331b
--- /dev/null
+++ b/debian/patches/gitlab-turbolinks-classic2.5.6.patch
@@ -0,0 +1,299 @@
+--- a/README.md
++++ b/README.md
+@@ -1,6 +1,11 @@
+-Turbolinks
++Turbolinks Classic (GitLab fork)
+ ===========
+ 
++Turbolinks 5 is a ground-up rewrite with a new flow, new events, but the same core idea. It's available at [turbolinks/turbolinks](https://github.com/turbolinks/turbolinks). Releases for v2.5 stalled while version 3 was in development, but valuable changes were made on the [master branch](https://github.com/turbolinks/turbolinks-classic/commits/master). This repository is a fork with some changes from Turbolinks 2/3 before the rewrite, with the potential to backport small fixes from ver [...]
++
++About Turbolinks
++----------------
++
+ Turbolinks makes following links in your web application faster. Instead of letting the browser recompile the JavaScript and CSS between each page change, it keeps the current page instance alive and replaces only the body and the title in the head. Think CGI vs persistent process.
+ 
+ This is similar to [pjax](https://github.com/defunkt/jquery-pjax), but instead of worrying about what element on the page to replace, and tailoring the server-side response to fit, we replace the entire body. This means that you get the bulk of the speed benefits from pjax (no recompiling of the JavaScript or CSS) without having to tailor the server-side response. It just works.
+@@ -21,7 +26,7 @@
+ No jQuery or any other library
+ --------------------------------
+ 
+-Turbolinks is designed to be as light-weight as possible (so you won't think twice about using it even for mobile stuff). It does not require jQuery or any other library to work. But it works great _with_ the jQuery or Prototype framework, or whatever else have you.
++Turbolinks is designed to be as light-weight as possible (so you won't think twice about using it even for mobile stuff). It does not require jQuery or any other library to work. But it works great _with_ the jQuery or Prototype framework, or whatever else you have.
+ 
+ 
+ Events
+@@ -57,13 +62,18 @@
+ Turbolinks.pagesCached(20);
+ ```
+ 
+-When a page is removed from the cache due to the cache reaching its size limit, the `page:expire` event is triggered.  Listeners bound to this event can access the cached page object using `event.originalEvent.data`.  Keys of note for this page cache object include `url`, `body`, and `title`.  
++If you need to make dynamic HTML updates in the current page and want it to be cached properly you can call:
++```javascript
++Turbolinks.cacheCurrentPage();
++```
++
++When a page is removed from the cache due to the cache reaching its size limit, the `page:expire` event is triggered.  Listeners bound to this event can access the cached page object using `event.originalEvent.data`.  Keys of note for this page cache object include `url`, `body`, and `title`.
+ 
+ To implement a client-side spinner, you could listen for `page:fetch` to start it and `page:receive` to stop it.
+ 
+ ```javascript
+ // using jQuery for simplicity
+-    
++
+ $(document).on("page:fetch", startSpinner);
+ $(document).on("page:receive", stopSpinner);
+ ```
+--- /dev/null
++++ b/gitlab-turbolinks-classic.gemspec
+@@ -0,0 +1,32 @@
++#########################################################
++# This file has been automatically generated by gem2tgz #
++#########################################################
++# -*- encoding: utf-8 -*-
++
++Gem::Specification.new do |s|
++  s.name = "gitlab-turbolinks-classic"
++  s.version = "2.5.6"
++
++  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
++  s.authors = ["David Heinemeier Hansson"]
++  s.date = "2017-01-05"
++  s.email = "david at loudthinking.com"
++  s.files = ["MIT-LICENSE", "README.md", "lib/assets/javascripts/turbolinks.js.coffee", "lib/gitlab-turbolinks-classic.rb", "lib/turbolinks.rb", "lib/turbolinks/cookies.rb", "lib/turbolinks/redirection.rb", "lib/turbolinks/version.rb", "lib/turbolinks/x_domain_blocker.rb", "lib/turbolinks/xhr_headers.rb", "lib/turbolinks/xhr_url_for.rb", "test/attachment.html", "test/config.ru", "test/dummy.gif", "test/index.html", "test/manifest.appcache", "test/offline.html", "test/other.html", "test/ [...]
++  s.homepage = "https://gitlab.com/jamedjo/gitlab-turbolinks-classic/"
++  s.licenses = ["MIT"]
++  s.require_paths = ["lib"]
++  s.rubygems_version = "1.8.23"
++  s.summary = "Turbolinks makes following links in your web application faster (use with Rails Asset Pipeline)"
++
++  if s.respond_to? :specification_version then
++    s.specification_version = 4
++
++    if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
++      s.add_runtime_dependency(%q<coffee-rails>, [">= 0"])
++    else
++      s.add_dependency(%q<coffee-rails>, [">= 0"])
++    end
++  else
++    s.add_dependency(%q<coffee-rails>, [">= 0"])
++  end
++end
+--- a/lib/assets/javascripts/turbolinks.js.coffee
++++ b/lib/assets/javascripts/turbolinks.js.coffee
+@@ -65,10 +65,13 @@
+       reflectNewUrl url
+       reflectRedirectedUrl()
+       changePage extractTitleAndBody(doc)...
++      if showProgressBar
++        progressBar?.done()
+       manuallyTriggerHashChangeForFirefox()
+       onLoadFunction?()
+       triggerEvent EVENTS.LOAD
+     else
++      progressBar?.done()
+       document.location.href = crossOriginRedirect() or url.absolute
+ 
+   if progressBar and showProgressBar
+@@ -87,6 +90,7 @@
+ fetchHistory = (cachedPage) ->
+   xhr?.abort()
+   changePage cachedPage.title, cachedPage.body
++  progressBar?.done()
+   recallScrollPosition cachedPage
+   triggerEvent EVENTS.RESTORE
+ 
+@@ -127,7 +131,6 @@
+   setAutofocusElement()
+   executeScriptTags() if runScripts
+   currentState = window.history.state
+-  progressBar?.done()
+   triggerEvent EVENTS.CHANGE
+   triggerEvent EVENTS.UPDATE
+ 
+@@ -228,6 +231,10 @@
+     (contentType = xhr.getResponseHeader('Content-Type'))? and
+       contentType.match /^(?:text\/html|application\/xhtml\+xml|application\/xml)(?:;|$)/
+ 
++  downloadingFile = ->
++    (disposition = xhr.getResponseHeader('Content-Disposition'))? and
++      disposition.match /^attachment/
++
+   extractTrackAssets = (doc) ->
+     for node in doc.querySelector('head').childNodes when node.getAttribute?('data-turbolinks-track')?
+       node.getAttribute('src') or node.getAttribute('href')
+@@ -241,7 +248,7 @@
+     [a, b] = [b, a] if a.length > b.length
+     value for value in a when value in b
+ 
+-  if not clientOrServerError() and validContent()
++  if not clientOrServerError() and validContent() and not downloadingFile()
+     doc = createDocument xhr.responseText
+     if doc and !assetsChanged doc
+       return doc
+@@ -375,14 +382,15 @@
+ 
+ class ProgressBar
+   className = 'turbolinks-progress-bar'
++  # Setting the opacity to a value < 1 fixes a display issue in Safari 6 and
++  # iOS 6 where the progress bar would fill the entire page.
++  originalOpacity = 0.99
+ 
+   constructor: (@elementSelector) ->
+     @value = 0
+     @content = ''
+     @speed = 300
+-    # Setting the opacity to a value < 1 fixes a display issue in Safari 6 and
+-    # iOS 6 where the progress bar would fill the entire page.
+-    @opacity = 0.99
++    @opacity = originalOpacity
+     @install()
+ 
+   install: ->
+@@ -397,6 +405,10 @@
+     document.head.removeChild(@styleElement)
+ 
+   start: ->
++    if @value > 0
++      @_reset()
++      @_reflow()
++
+     @advanceTo(5)
+ 
+   advanceTo: (value) ->
+@@ -412,34 +424,41 @@
+   done: ->
+     if @value > 0
+       @advanceTo(100)
+-      @_reset()
+-
+-  _reset: ->
+-    originalOpacity = @opacity
++      @_finish()
+ 
+-    setTimeout =>
++  _finish: ->
++    @fadeTimer = setTimeout =>
+       @opacity = 0
+       @_updateStyle()
+     , @speed / 2
+ 
+-    setTimeout =>
+-      @value = 0
+-      @opacity = originalOpacity
+-      @_withSpeed(0, => @_updateStyle(true))
+-    , @speed
++    @resetTimer = setTimeout(@_reset, @speed)
++
++  _reflow: ->
++    @element.offsetHeight
++
++  _reset: =>
++    @_stopTimers()
++    @value = 0
++    @opacity = originalOpacity
++    @_withSpeed(0, => @_updateStyle(true))
++
++  _stopTimers: ->
++    @_stopTrickle()
++    clearTimeout(@fadeTimer)
++    clearTimeout(@resetTimer)
+ 
+   _startTrickle: ->
+-    return if @trickling
+-    @trickling = true
+-    setTimeout(@_trickle, @speed)
++    return if @trickleTimer
++    @trickleTimer = setTimeout(@_trickle, @speed)
+ 
+   _stopTrickle: ->
+-    delete @trickling
++    clearTimeout(@trickleTimer)
++    delete @trickleTimer
+ 
+   _trickle: =>
+-    return unless @trickling
+     @advanceTo(@value + Math.random() / 2)
+-    setTimeout(@_trickle, @speed)
++    @trickleTimer = setTimeout(@_trickle, @speed)
+ 
+   _withSpeed: (speed, fn) ->
+     originalSpeed = @speed
+@@ -544,12 +563,14 @@
+ #   Turbolinks.pagesCached()
+ #   Turbolinks.pagesCached(20)
+ #   Turbolinks.enableTransitionCache()
++#   Turbolinks.cacheCurrentPage()
+ #   Turbolinks.allowLinkExtensions('md')
+ #   Turbolinks.supported
+ #   Turbolinks.EVENTS
+ @Turbolinks = {
+   visit,
+   pagesCached,
++  cacheCurrentPage,
+   enableTransitionCache,
+   enableProgressBar,
+   allowLinkExtensions: Link.allowExtensions,
+--- /dev/null
++++ b/lib/gitlab-turbolinks-classic.rb
+@@ -0,0 +1 @@
++require 'turbolinks'
+\ No newline at end of file
+--- a/lib/turbolinks.rb
++++ b/lib/turbolinks.rb
+@@ -12,8 +12,14 @@
+       ActiveSupport.on_load(:action_controller) do
+         ActionController::Base.class_eval do
+           include XHRHeaders, Cookies, XDomainBlocker, Redirection
+-          before_filter :set_xhr_redirected_to, :set_request_method_cookie
+-          after_filter :abort_xdomain_redirect
++
++          if respond_to?(:before_action)
++            before_action :set_xhr_redirected_to, :set_request_method_cookie
++            after_action :abort_xdomain_redirect
++          else
++            before_filter :set_xhr_redirected_to, :set_request_method_cookie
++            after_filter :abort_xdomain_redirect
++          end
+         end
+ 
+         ActionDispatch::Request.class_eval do
+--- a/lib/turbolinks/version.rb
++++ b/lib/turbolinks/version.rb
+@@ -1,3 +1,3 @@
+ module Turbolinks
+-  VERSION = '2.5.3'
++  VERSION = '2.5.6'
+ end
+--- /dev/null
++++ b/test/attachment.html
+@@ -0,0 +1,5 @@
++<html>
++<body>
++<script language="javascript">alert("you shouldn't see this");</script>
++</body>
++</html>
+--- a/test/config.ru
++++ b/test/config.ru
+@@ -53,3 +53,11 @@
+ map "/" do
+   run Rack::Directory.new(File.join(Root, "test"))
+ end
++
++map "/attachment.txt" do
++  run Rack::File.new(File.join(Root, "test", "attachment.html"), "Content-Type" => "text/plain")
++end
++
++map "/attachment.html" do
++  run Rack::File.new(File.join(Root, "test", "attachment.html"), "Content-Type" => "text/html", "Content-Disposition" => "attachment; filename=attachment.html")
++end
+--- a/test/index.html
++++ b/test/index.html
+@@ -34,6 +34,8 @@
+     <li><a href="/bounce">Redirect</a></li>
+     <li><a href="#">Hash link</a></li>
+     <li><a href="/reload.html#foo">New assets track with hash link</a></li>
++    <li><a href="/attachment.txt">A text response should load normally</a></li>        
++    <li><a href="/attachment.html">An html response with Content-Disposition: attachment should load normally</a></li>    
+     <li><h5>If you stop the server or go into airplane/offline mode</h5></li>
+     <li><a href="/doesnotexist.html">A page with client error (4xx, rfc2616 sec. 10.4) should error out</a></li>
+     <li><a href="/500">Also server errors (5xx, rfc2616 sec. 10.5) should error out</a></li>
diff --git a/debian/patches/series b/debian/patches/series
index d77d941..34e9f9c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 engine-root.patch
+gitlab-turbolinks-classic2.5.6.patch
diff --git a/debian/rules b/debian/rules
index 78ff6a3..5dc72c2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,3 +9,4 @@ override_dh_auto_install:
 	dh_auto_install
 	mkdir -p $(CURDIR)/debian/ruby-turbolinks/usr/share/ruby-turbolinks/lib
 	mv $(CURDIR)/debian/ruby-turbolinks/usr/lib/ruby/vendor_ruby/assets $(CURDIR)/debian/ruby-turbolinks/usr/share/ruby-turbolinks/lib/assets
+	debian/copy-gemspec

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-turbolinks.git



More information about the Pkg-ruby-extras-commits mailing list