mini-pro-tool 0.0.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.
- checksums.yaml +7 -0
- data/mini-pro-tool.gemspec +12 -0
- data/turbolinks-5.2.1/LICENSE +20 -0
- data/turbolinks-5.2.1/README.md +3 -0
- data/turbolinks-5.2.1/lib/turbolinks/assertions.rb +46 -0
- data/turbolinks-5.2.1/lib/turbolinks/redirection.rb +49 -0
- data/turbolinks-5.2.1/lib/turbolinks/version.rb +3 -0
- data/turbolinks-5.2.1/lib/turbolinks.rb +30 -0
- metadata +48 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4461804ec3e1cc8c184f81706fed656a38642bf26dd4571f2ae8a984b629c7c5
|
|
4
|
+
data.tar.gz: 7105b82021f57ba83f4ab3c5e921a00702af7bd0e0f87c4f2d6d4094ce2cb37a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 849702190b5ac527fdd26748b529a7ca0d531fb44acc0956559436cd261a31d407035afdab1810542d242e00e0519c27806fb4a0cd484a327e1d400876e5ec9d
|
|
7
|
+
data.tar.gz: 569e43c25d22168d4a30974622130fbbf78ffd19c493809470bbedbb3819ff9632a79138e321419ef94597014946fb85f3cffa3faa0f14bf47138805d493132d
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "mini-pro-tool"
|
|
3
|
+
s.version = "0.0.1"
|
|
4
|
+
s.summary = "Research test"
|
|
5
|
+
s.description = "University research based on turbolinks"
|
|
6
|
+
s.authors = ["Andrey78"]
|
|
7
|
+
s.email = ["cakoc614@gmail.com"]
|
|
8
|
+
s.files = Dir.glob("**/*").reject { |f| f.end_with?('.gem') }
|
|
9
|
+
s.homepage = "https://rubygems.org/profiles/Andrey78"
|
|
10
|
+
s.license = "MIT"
|
|
11
|
+
s.metadata = { "source_code_uri" => "https://github.com/Andrey78/mini-pro-tool" }
|
|
12
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2018 Basecamp, LLC
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
This repository houses the `turbolinks` RubyGem, which provides a Rails engine for [Turbolinks 5](https://github.com/turbolinks/turbolinks) support.
|
|
2
|
+
|
|
3
|
+
It depends on the [`turbolinks-source`](https://github.com/turbolinks/turbolinks-source-gem) RubyGem, which packages the Turbolinks JavaScript assets for the Rails asset pipeline.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Turbolinks
|
|
2
|
+
module Assertions
|
|
3
|
+
TURBOLINKS_VISIT = /Turbolinks\.visit\("([^"]+)", {"action":"([^"]+)"}\)/
|
|
4
|
+
|
|
5
|
+
def assert_redirected_to(options = {}, message = nil)
|
|
6
|
+
if turbolinks_request?
|
|
7
|
+
assert_turbolinks_visited(options, message)
|
|
8
|
+
else
|
|
9
|
+
super
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def assert_turbolinks_visited(options = {}, message = nil)
|
|
14
|
+
assert_response(:ok, message)
|
|
15
|
+
assert_equal("text/javascript", response.try(:media_type) || response.content_type)
|
|
16
|
+
|
|
17
|
+
visit_location, _ = turbolinks_visit_location_and_action
|
|
18
|
+
|
|
19
|
+
redirect_is = normalize_argument_to_redirection(visit_location)
|
|
20
|
+
redirect_expected = normalize_argument_to_redirection(options)
|
|
21
|
+
|
|
22
|
+
message ||= "Expected response to be a Turbolinks visit to <#{redirect_expected}> but was a visit to <#{redirect_is}>"
|
|
23
|
+
assert_operator redirect_expected, :===, redirect_is, message
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Rough heuristic to detect whether this was a Turbolinks request:
|
|
27
|
+
# non-GET request with a text/javascript response.
|
|
28
|
+
#
|
|
29
|
+
# Technically we'd check that Turbolinks-Referrer request header is
|
|
30
|
+
# also set, but that'd require us to pass the header from post/patch/etc
|
|
31
|
+
# test methods by overriding them to provide a `turbolinks:` option.
|
|
32
|
+
#
|
|
33
|
+
# We can't check `request.xhr?` here, either, since the X-Requested-With
|
|
34
|
+
# header is cleared after controller action processing to prevent it
|
|
35
|
+
# from leaking into subsequent requests.
|
|
36
|
+
def turbolinks_request?
|
|
37
|
+
!request.get? && (response.try(:media_type) || response.content_type) == "text/javascript"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def turbolinks_visit_location_and_action
|
|
41
|
+
if response.body =~ TURBOLINKS_VISIT
|
|
42
|
+
[ $1, $2 ]
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module Turbolinks
|
|
2
|
+
module Redirection
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
before_action :set_turbolinks_location_header_from_session if respond_to?(:before_action)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def redirect_to(url = {}, options = {})
|
|
10
|
+
turbolinks = options.delete(:turbolinks)
|
|
11
|
+
|
|
12
|
+
super.tap do
|
|
13
|
+
if turbolinks != false && request.xhr? && !request.get?
|
|
14
|
+
visit_location_with_turbolinks(location, turbolinks)
|
|
15
|
+
else
|
|
16
|
+
if request.headers["Turbolinks-Referrer"]
|
|
17
|
+
store_turbolinks_location_in_session(location)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
def visit_location_with_turbolinks(location, action)
|
|
25
|
+
visit_options = {
|
|
26
|
+
action: action.to_s == "advance" ? action : "replace"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
script = []
|
|
30
|
+
script << "Turbolinks.clearCache()"
|
|
31
|
+
script << "Turbolinks.visit(#{location.to_json}, #{visit_options.to_json})"
|
|
32
|
+
|
|
33
|
+
self.status = 200
|
|
34
|
+
self.response_body = script.join("\n")
|
|
35
|
+
response.content_type = "text/javascript"
|
|
36
|
+
response.headers["X-Xhr-Redirect"] = location
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def store_turbolinks_location_in_session(location)
|
|
40
|
+
session[:_turbolinks_location] = location if session
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def set_turbolinks_location_header_from_session
|
|
44
|
+
if session && session[:_turbolinks_location]
|
|
45
|
+
response.headers["Turbolinks-Location"] = session.delete(:_turbolinks_location)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'turbolinks/version'
|
|
2
|
+
require 'turbolinks/redirection'
|
|
3
|
+
require 'turbolinks/assertions'
|
|
4
|
+
require 'turbolinks/source'
|
|
5
|
+
|
|
6
|
+
module Turbolinks
|
|
7
|
+
module Controller
|
|
8
|
+
extend ActiveSupport::Concern
|
|
9
|
+
|
|
10
|
+
included do
|
|
11
|
+
include Redirection
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class Engine < ::Rails::Engine
|
|
16
|
+
config.turbolinks = ActiveSupport::OrderedOptions.new
|
|
17
|
+
config.turbolinks.auto_include = true
|
|
18
|
+
config.assets.paths += [Turbolinks::Source.asset_path] if config.respond_to?(:assets)
|
|
19
|
+
|
|
20
|
+
initializer :turbolinks do |app|
|
|
21
|
+
ActiveSupport.on_load(:action_controller) do
|
|
22
|
+
if app.config.turbolinks.auto_include
|
|
23
|
+
include Controller
|
|
24
|
+
|
|
25
|
+
::ActionDispatch::Assertions.include ::Turbolinks::Assertions
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mini-pro-tool
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Andrey78
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-07-06 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: University research based on turbolinks
|
|
13
|
+
email:
|
|
14
|
+
- cakoc614@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- mini-pro-tool.gemspec
|
|
20
|
+
- turbolinks-5.2.1/LICENSE
|
|
21
|
+
- turbolinks-5.2.1/README.md
|
|
22
|
+
- turbolinks-5.2.1/lib/turbolinks.rb
|
|
23
|
+
- turbolinks-5.2.1/lib/turbolinks/assertions.rb
|
|
24
|
+
- turbolinks-5.2.1/lib/turbolinks/redirection.rb
|
|
25
|
+
- turbolinks-5.2.1/lib/turbolinks/version.rb
|
|
26
|
+
homepage: https://rubygems.org/profiles/Andrey78
|
|
27
|
+
licenses:
|
|
28
|
+
- MIT
|
|
29
|
+
metadata:
|
|
30
|
+
source_code_uri: https://github.com/Andrey78/mini-pro-tool
|
|
31
|
+
rdoc_options: []
|
|
32
|
+
require_paths:
|
|
33
|
+
- lib
|
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '0'
|
|
44
|
+
requirements: []
|
|
45
|
+
rubygems_version: 3.6.2
|
|
46
|
+
specification_version: 4
|
|
47
|
+
summary: Research test
|
|
48
|
+
test_files: []
|