access_control 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ 0.0.1 (Jun 20, 2010)
2
+
3
+ * Initial release
@@ -0,0 +1,7 @@
1
+ # Access Control
2
+
3
+ Access-Control headers are important. If you are doing stuff like embedding fonts with @font-face and you want to use them on another domain than your app, it won't work in several browsers (Firefox being the main one). This gem provides some middleware to solve this. Simply include it in any environments you want Access Control do it's thing like this:
4
+
5
+ config.middleware.insert_before ActionDispatch::Static, "AccessControl::Middleware"
6
+
7
+ Currently all of the options are predefined. Eventually, I'd like to add a way to provide more fine-grain control.
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require "access_control"
@@ -0,0 +1,15 @@
1
+ module AccessControl
2
+ class Middleware
3
+ def initialize app
4
+ @app = app
5
+ end
6
+
7
+ def call env
8
+ res = @app.call(env)
9
+ res[1]["Access-Control-Allow-Origin"] = "*"
10
+ res[1]["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS"
11
+ res[1]["Access-Control-Allow-Headers"] = "X-PINGOTHER "
12
+ res
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: access_control
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Sam Soffes
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-20 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Easily add Access-Control headers with a handy middleware.
23
+ email: sam@samsoff.es
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/access_control.rb
32
+ - Changelog.markdown
33
+ - Readme.markdown
34
+ - init.rb
35
+ has_rdoc: true
36
+ homepage: http://github.com/samsoffes/access_control
37
+ licenses: []
38
+
39
+ post_install_message:
40
+ rdoc_options: []
41
+
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ hash: 3
50
+ segments:
51
+ - 0
52
+ version: "0"
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ requirements: []
63
+
64
+ rubyforge_project:
65
+ rubygems_version: 1.3.7
66
+ signing_key:
67
+ specification_version: 3
68
+ summary: Easily add Access-Control headers.
69
+ test_files: []
70
+