roda-unpoly 0.1.0

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 (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +44 -0
  3. data/Rakefile +3 -0
  4. data/lib/roda/plugins/unpoly.rb +24 -0
  5. metadata +74 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 750f490bc31f40dedde2a2494094561c8b865d07
4
+ data.tar.gz: 6fcaf19eaa0dd9aaf62e2a39e982cdbfaea8b3fb
5
+ SHA512:
6
+ metadata.gz: 3bca31e586e66f5351528d0c11289e72e474ec0204f97b56a3103759c71376338682e691eaa50508ade5ae8b31932918ebec7ac3d206041e09a4e9d4554ee4a4
7
+ data.tar.gz: 2702023eba6cd543c20ddb40532e282a6fd8675228f1563d9c87ce22938aa052555a46b184a8c4caec234a8afdb4c499a1ccc8e18b30757a7f03d66d1ff7f477
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Unpoly for Roda
2
+
3
+ Easily add support for the server protocol expected by Unpoly.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem "roda-unpoly"
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install roda-unpoly
20
+
21
+ ## Usage
22
+
23
+ TODO: Fill me in
24
+
25
+ ## Where are the Javascript and CSS assets?
26
+
27
+ I've chosen not to bundle those assets with the gem as they might be updated more
28
+ frequently then this library. Roda is also asset-agnostic (for the most part),
29
+ so it's easier if you bring in your assets as you see fit for your specific needs.
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/adam12/roda-unpoly.
34
+
35
+ I love pull requests! If you fork this project and modify it, please ping me to see
36
+ if your changes can be incorporated back into this project.
37
+
38
+ That said, if your feature idea is nontrivial, you should probably open an issue to
39
+ [discuss it](http://www.igvita.com/2011/12/19/dont-push-your-pull-requests/)
40
+ before attempting a pull request.
41
+
42
+ ## License
43
+
44
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require "rubygems/tasks"
2
+
3
+ Gem::Tasks.new
@@ -0,0 +1,24 @@
1
+ class Roda
2
+ module RodaPlugins
3
+ module Unpoly
4
+ module RequestMethods
5
+ def unpoly?
6
+ get_header("X-Up-Target").to_s.strip != ""
7
+ end
8
+
9
+ def unpoly
10
+ response.headers["X-Up-Location"] = path
11
+ response.headers["X-Up-Method"] = request_method
12
+
13
+ if !get? && !unpoly?
14
+ Rack::Utils.set_cookie_header!(response.headers, "_up_method", request_method)
15
+ else
16
+ Rack::Utils.delete_cookie_header!(response.headers, "_up_method")
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ register_plugin :unpoly, Unpoly
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: roda-unpoly
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Adam Daniels
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-03-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '10.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubygems-tasks
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.2'
41
+ description:
42
+ email: adam@mediadrive.ca
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - README.md
48
+ - Rakefile
49
+ - lib/roda/plugins/unpoly.rb
50
+ homepage: https://github.com/adam12/roda-unpoly
51
+ licenses:
52
+ - MIT
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.6.8
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: Integrate Unpoly with Roda
74
+ test_files: []