charcoal 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -0
- data/Appraisals +3 -10
- data/Gemfile +3 -3
- data/README.md +85 -1
- data/charcoal.gemspec +6 -5
- data/gemfiles/rails_2.3.gemfile +5 -4
- data/gemfiles/rails_2.3.gemfile.lock +17 -3
- data/gemfiles/rails_3.1.gemfile +5 -6
- data/gemfiles/rails_3.1.gemfile.lock +37 -9
- data/gemfiles/rails_3.2.gemfile +5 -6
- data/gemfiles/rails_3.2.gemfile.lock +37 -9
- data/lib/charcoal/controller_filter.rb +4 -1
- data/lib/charcoal/version.rb +1 -1
- data/test/helper.rb +7 -3
- metadata +12 -11
data/.travis.yml
ADDED
data/Appraisals
CHANGED
@@ -1,18 +1,11 @@
|
|
1
1
|
appraise "rails-2.3" do
|
2
|
-
gem "
|
3
|
-
gem "actionpack", "~> 2.3.5"
|
2
|
+
gem "rails", "~> 2.3.5"
|
4
3
|
end
|
5
4
|
|
6
5
|
appraise "rails-3.1" do
|
7
|
-
gem "
|
8
|
-
gem "actionpack", "~> 3.1.0"
|
9
|
-
gem "railties", "~> 3.1.0"
|
10
|
-
gem "tzinfo"
|
6
|
+
gem "rails", "~> 3.1.0"
|
11
7
|
end
|
12
8
|
|
13
9
|
appraise "rails-3.2" do
|
14
|
-
gem "
|
15
|
-
gem "actionpack", "~> 3.2.0"
|
16
|
-
gem "railties", "~> 3.2.0"
|
17
|
-
gem "tzinfo"
|
10
|
+
gem "rails", "~> 3.2.0"
|
18
11
|
end
|
data/Gemfile
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem "rake"
|
4
|
-
|
5
3
|
gem "activesupport", ">= 2.3.5"
|
6
4
|
gem "actionpack", ">= 2.3.5"
|
7
5
|
|
6
|
+
gem "rake", :group => :development
|
8
7
|
gem "yard", "~> 0.7", :group => :development
|
9
8
|
gem "bundler", "~> 1.2.0", :group => :development
|
10
9
|
gem "jeweler", "~> 1.8.4", :group => :development
|
11
10
|
|
11
|
+
gem "rails", ">= 2.3.5", :group => :test
|
12
12
|
gem "appraisal", ">= 0.5.0", :group => :test
|
13
13
|
gem "shoulda", ">= 0", :group => :test
|
14
14
|
gem "shoulda-context", ">= 0", :group => :test
|
15
|
-
gem "mocha", :group => :test
|
15
|
+
gem "mocha", :group => :test, :require => false
|
data/README.md
CHANGED
@@ -9,15 +9,99 @@ JSONP ("JSON with padding") and CORS (Cross-Origin Resource Sharing) filtration
|
|
9
9
|
Include the module `Charcoal::JSONP` in the controller you'd like to allow JSONP.
|
10
10
|
You may then use `allow_jsonp` class method with the following options:
|
11
11
|
|
12
|
+
```ruby
|
13
|
+
# directive is a method (symbol) or block (taking one argument, the controller instance)
|
14
|
+
allow_jsonp method [method2 ...], :if => directive, :unless => directive
|
15
|
+
```
|
16
|
+
|
17
|
+
`:all` is also a valid argument that applies to all methods. The default (with no arguments) is the same as `:all`.
|
12
18
|
|
13
19
|
Requests that come in with a callback parameter (e.g. `http://test.com/users.json?callback=hello`)
|
14
20
|
will have the response body wrapped in that callback and the content type changed to `application/javascript`
|
15
21
|
|
16
22
|
### CORS
|
17
23
|
|
24
|
+
Please familiarize yourself with the [documentation](https://developer.mozilla.org/En/HTTP_access_control) ([wikipedia](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)) before proceeding.
|
25
|
+
|
18
26
|
Include the module `Charcoal::CORS` in the controller you'd like to allow CORS.
|
19
|
-
|
27
|
+
`allow_cors` accepts the same arguments as `allow_jsonp`
|
28
|
+
|
29
|
+
Included is a CORS pre-flight controller that must be hooked up to the Rails router:
|
30
|
+
|
31
|
+
Rails 2:
|
32
|
+
```ruby
|
33
|
+
map.connect "*path.:format", :conditions => { :method => :options }, :action => "preflight", :controller => "CORS", :namespace => "charcoal"
|
34
|
+
```
|
35
|
+
|
36
|
+
Rails 3:
|
37
|
+
```ruby
|
38
|
+
TODO
|
39
|
+
```
|
40
|
+
|
41
|
+
#### Configuration
|
42
|
+
|
43
|
+
The configuration options and defaults for CORS are as follows:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# Access-Control-Allow-Origin
|
47
|
+
"allow-origin" => "*"
|
48
|
+
|
49
|
+
# Access-Control-Allow-Headers
|
50
|
+
"allow-headers" => ["X-Requested-With", "X-Prototype-Version"]
|
51
|
+
|
52
|
+
# Sets Access-Control-Allow-Credentials
|
53
|
+
"credentials" => true
|
54
|
+
|
55
|
+
# Access-Control-Allow-Headers
|
56
|
+
"expose-headers" => []
|
57
|
+
|
58
|
+
# Access-Control-Max-Age
|
59
|
+
"max-age" => 86400
|
60
|
+
```
|
61
|
+
|
62
|
+
### Creating Your Own Filter
|
63
|
+
|
64
|
+
It's possible to create your own controller filter like so:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
require 'charcoal/controller_filter'
|
68
|
+
|
69
|
+
module MyFilter
|
70
|
+
def self.included(klass)
|
71
|
+
klass.extend(ClassMethods)
|
72
|
+
klass.before_filter :quack, :if => :animals_allowed?
|
73
|
+
end
|
74
|
+
|
75
|
+
module ClassMethods
|
76
|
+
include Charcoal::ControllerFilter
|
77
|
+
|
78
|
+
def animals_allowed
|
79
|
+
@animals_allowed ||= Hash.new(lambda {|_| false})
|
80
|
+
end
|
81
|
+
|
82
|
+
allow :animals do |method, directive|
|
83
|
+
animals_allowed[method] = directive
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def animals_allowed?
|
88
|
+
self.class.animals_allowed[params[:action]].call(self)
|
89
|
+
end
|
90
|
+
|
91
|
+
protected
|
92
|
+
|
93
|
+
def quack
|
94
|
+
Rails.logger.info("QUACK!")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
```
|
98
|
+
|
99
|
+
This example adds the `allow_animals` directive that logs "QUACK!" if an applicable request is received.
|
100
|
+
|
101
|
+
## Supported Versions
|
20
102
|
|
103
|
+
Tested with Ruby 1.8.7 and 1.9.3 and Rails 2.3, 3.1, and 3.2.
|
104
|
+
[![Build Status](https://secure.travis-ci.org/steved555/charcoal.png?branch=master)](http://travis-ci.org/steved555/charcoal)
|
21
105
|
|
22
106
|
## Contributing to charcoal
|
23
107
|
|
data/charcoal.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "charcoal"
|
8
|
-
s.version = "0.1"
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Steven Davidovitz"]
|
12
|
-
s.date = "2012-11-
|
12
|
+
s.date = "2012-11-27"
|
13
13
|
s.description = "Helps you support JSONP and CORS in your Rails app"
|
14
14
|
s.email = "sdavidovitz@zendesk.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
|
+
".travis.yml",
|
20
21
|
"Appraisals",
|
21
22
|
"Gemfile",
|
22
23
|
"LICENSE",
|
@@ -52,24 +53,24 @@ Gem::Specification.new do |s|
|
|
52
53
|
s.specification_version = 3
|
53
54
|
|
54
55
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
-
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
56
56
|
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
|
57
57
|
s.add_runtime_dependency(%q<actionpack>, [">= 2.3.5"])
|
58
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
58
59
|
s.add_development_dependency(%q<yard>, ["~> 0.7"])
|
59
60
|
s.add_development_dependency(%q<bundler>, ["~> 1.2.0"])
|
60
61
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
61
62
|
else
|
62
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
63
63
|
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
64
64
|
s.add_dependency(%q<actionpack>, [">= 2.3.5"])
|
65
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
65
66
|
s.add_dependency(%q<yard>, ["~> 0.7"])
|
66
67
|
s.add_dependency(%q<bundler>, ["~> 1.2.0"])
|
67
68
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
68
69
|
end
|
69
70
|
else
|
70
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
71
71
|
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
72
72
|
s.add_dependency(%q<actionpack>, [">= 2.3.5"])
|
73
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
73
74
|
s.add_dependency(%q<yard>, ["~> 0.7"])
|
74
75
|
s.add_dependency(%q<bundler>, ["~> 1.2.0"])
|
75
76
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
data/gemfiles/rails_2.3.gemfile
CHANGED
@@ -2,14 +2,15 @@
|
|
2
2
|
|
3
3
|
source "http://rubygems.org"
|
4
4
|
|
5
|
-
gem "
|
5
|
+
gem "activesupport", ">= 2.3.5"
|
6
|
+
gem "actionpack", ">= 2.3.5"
|
7
|
+
gem "rake", :group=>:development
|
6
8
|
gem "yard", "~> 0.7", :group=>:development
|
7
9
|
gem "bundler", "~> 1.2.0", :group=>:development
|
8
10
|
gem "jeweler", "~> 1.8.4", :group=>:development
|
9
11
|
gem "appraisal", ">= 0.5.0", :group=>:test
|
10
12
|
gem "shoulda", ">= 0", :group=>:test
|
11
13
|
gem "shoulda-context", ">= 0", :group=>:test
|
12
|
-
gem "mocha", :group=>:test
|
13
|
-
gem "
|
14
|
-
gem "actionpack", "~> 2.3.5"
|
14
|
+
gem "mocha", :require=>false, :group=>:test
|
15
|
+
gem "rails", "~> 2.3.5"
|
15
16
|
|
@@ -1,9 +1,15 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
actionmailer (2.3.14)
|
5
|
+
actionpack (= 2.3.14)
|
4
6
|
actionpack (2.3.14)
|
5
7
|
activesupport (= 2.3.14)
|
6
8
|
rack (~> 1.1.0)
|
9
|
+
activerecord (2.3.14)
|
10
|
+
activesupport (= 2.3.14)
|
11
|
+
activeresource (2.3.14)
|
12
|
+
activesupport (= 2.3.14)
|
7
13
|
activesupport (2.3.14)
|
8
14
|
appraisal (0.5.1)
|
9
15
|
bundler
|
@@ -19,13 +25,20 @@ GEM
|
|
19
25
|
mocha (0.13.0)
|
20
26
|
metaclass (~> 0.0.1)
|
21
27
|
rack (1.1.3)
|
28
|
+
rails (2.3.14)
|
29
|
+
actionmailer (= 2.3.14)
|
30
|
+
actionpack (= 2.3.14)
|
31
|
+
activerecord (= 2.3.14)
|
32
|
+
activeresource (= 2.3.14)
|
33
|
+
activesupport (= 2.3.14)
|
34
|
+
rake (>= 0.8.3)
|
22
35
|
rake (10.0.2)
|
23
36
|
rdoc (3.12)
|
24
37
|
json (~> 1.4)
|
25
38
|
shoulda (3.0.1)
|
26
39
|
shoulda-context (~> 1.0.0)
|
27
40
|
shoulda-matchers (~> 1.0.0)
|
28
|
-
shoulda-context (1.0.
|
41
|
+
shoulda-context (1.0.1)
|
29
42
|
shoulda-matchers (1.0.0)
|
30
43
|
yard (0.8.3)
|
31
44
|
|
@@ -33,12 +46,13 @@ PLATFORMS
|
|
33
46
|
ruby
|
34
47
|
|
35
48
|
DEPENDENCIES
|
36
|
-
actionpack (
|
37
|
-
activesupport (
|
49
|
+
actionpack (>= 2.3.5)
|
50
|
+
activesupport (>= 2.3.5)
|
38
51
|
appraisal (>= 0.5.0)
|
39
52
|
bundler (~> 1.2.0)
|
40
53
|
jeweler (~> 1.8.4)
|
41
54
|
mocha
|
55
|
+
rails (~> 2.3.5)
|
42
56
|
rake
|
43
57
|
shoulda
|
44
58
|
shoulda-context
|
data/gemfiles/rails_3.1.gemfile
CHANGED
@@ -2,16 +2,15 @@
|
|
2
2
|
|
3
3
|
source "http://rubygems.org"
|
4
4
|
|
5
|
-
gem "
|
5
|
+
gem "activesupport", ">= 2.3.5"
|
6
|
+
gem "actionpack", ">= 2.3.5"
|
7
|
+
gem "rake", :group=>:development
|
6
8
|
gem "yard", "~> 0.7", :group=>:development
|
7
9
|
gem "bundler", "~> 1.2.0", :group=>:development
|
8
10
|
gem "jeweler", "~> 1.8.4", :group=>:development
|
9
11
|
gem "appraisal", ">= 0.5.0", :group=>:test
|
10
12
|
gem "shoulda", ">= 0", :group=>:test
|
11
13
|
gem "shoulda-context", ">= 0", :group=>:test
|
12
|
-
gem "mocha", :group=>:test
|
13
|
-
gem "
|
14
|
-
gem "actionpack", "~> 3.1.0"
|
15
|
-
gem "railties", "~> 3.1.0"
|
16
|
-
gem "tzinfo"
|
14
|
+
gem "mocha", :require=>false, :group=>:test
|
15
|
+
gem "rails", "~> 3.1.0"
|
17
16
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
actionmailer (3.1.8)
|
5
|
+
actionpack (= 3.1.8)
|
6
|
+
mail (~> 2.3.3)
|
4
7
|
actionpack (3.1.8)
|
5
8
|
activemodel (= 3.1.8)
|
6
9
|
activesupport (= 3.1.8)
|
@@ -16,11 +19,20 @@ GEM
|
|
16
19
|
activesupport (= 3.1.8)
|
17
20
|
builder (~> 3.0.0)
|
18
21
|
i18n (~> 0.6)
|
22
|
+
activerecord (3.1.8)
|
23
|
+
activemodel (= 3.1.8)
|
24
|
+
activesupport (= 3.1.8)
|
25
|
+
arel (~> 2.2.3)
|
26
|
+
tzinfo (~> 0.3.29)
|
27
|
+
activeresource (3.1.8)
|
28
|
+
activemodel (= 3.1.8)
|
29
|
+
activesupport (= 3.1.8)
|
19
30
|
activesupport (3.1.8)
|
20
31
|
multi_json (>= 1.0, < 1.3)
|
21
32
|
appraisal (0.5.1)
|
22
33
|
bundler
|
23
34
|
rake
|
35
|
+
arel (2.2.3)
|
24
36
|
builder (3.0.4)
|
25
37
|
erubis (2.7.0)
|
26
38
|
git (1.2.5)
|
@@ -32,10 +44,16 @@ GEM
|
|
32
44
|
rake
|
33
45
|
rdoc
|
34
46
|
json (1.7.5)
|
47
|
+
mail (2.3.3)
|
48
|
+
i18n (>= 0.4.0)
|
49
|
+
mime-types (~> 1.16)
|
50
|
+
treetop (~> 1.4.8)
|
35
51
|
metaclass (0.0.1)
|
52
|
+
mime-types (1.19)
|
36
53
|
mocha (0.13.0)
|
37
54
|
metaclass (~> 0.0.1)
|
38
55
|
multi_json (1.2.0)
|
56
|
+
polyglot (0.3.3)
|
39
57
|
rack (1.3.6)
|
40
58
|
rack-cache (1.2)
|
41
59
|
rack (>= 0.4)
|
@@ -45,6 +63,14 @@ GEM
|
|
45
63
|
rack
|
46
64
|
rack-test (0.6.2)
|
47
65
|
rack (>= 1.0)
|
66
|
+
rails (3.1.8)
|
67
|
+
actionmailer (= 3.1.8)
|
68
|
+
actionpack (= 3.1.8)
|
69
|
+
activerecord (= 3.1.8)
|
70
|
+
activeresource (= 3.1.8)
|
71
|
+
activesupport (= 3.1.8)
|
72
|
+
bundler (~> 1.0)
|
73
|
+
railties (= 3.1.8)
|
48
74
|
railties (3.1.8)
|
49
75
|
actionpack (= 3.1.8)
|
50
76
|
activesupport (= 3.1.8)
|
@@ -55,11 +81,11 @@ GEM
|
|
55
81
|
rake (10.0.2)
|
56
82
|
rdoc (3.12)
|
57
83
|
json (~> 1.4)
|
58
|
-
shoulda (3.
|
59
|
-
shoulda-context (~> 1.0)
|
60
|
-
shoulda-matchers (~> 1.
|
61
|
-
shoulda-context (1.0.
|
62
|
-
shoulda-matchers (1.
|
84
|
+
shoulda (3.3.2)
|
85
|
+
shoulda-context (~> 1.0.1)
|
86
|
+
shoulda-matchers (~> 1.4.1)
|
87
|
+
shoulda-context (1.0.1)
|
88
|
+
shoulda-matchers (1.4.1)
|
63
89
|
activesupport (>= 3.0.0)
|
64
90
|
sprockets (2.0.4)
|
65
91
|
hike (~> 1.2)
|
@@ -67,6 +93,9 @@ GEM
|
|
67
93
|
tilt (~> 1.1, != 1.3.0)
|
68
94
|
thor (0.14.6)
|
69
95
|
tilt (1.3.3)
|
96
|
+
treetop (1.4.12)
|
97
|
+
polyglot
|
98
|
+
polyglot (>= 0.3.1)
|
70
99
|
tzinfo (0.3.35)
|
71
100
|
yard (0.8.3)
|
72
101
|
|
@@ -74,15 +103,14 @@ PLATFORMS
|
|
74
103
|
ruby
|
75
104
|
|
76
105
|
DEPENDENCIES
|
77
|
-
actionpack (
|
78
|
-
activesupport (
|
106
|
+
actionpack (>= 2.3.5)
|
107
|
+
activesupport (>= 2.3.5)
|
79
108
|
appraisal (>= 0.5.0)
|
80
109
|
bundler (~> 1.2.0)
|
81
110
|
jeweler (~> 1.8.4)
|
82
111
|
mocha
|
83
|
-
|
112
|
+
rails (~> 3.1.0)
|
84
113
|
rake
|
85
114
|
shoulda
|
86
115
|
shoulda-context
|
87
|
-
tzinfo
|
88
116
|
yard (~> 0.7)
|
data/gemfiles/rails_3.2.gemfile
CHANGED
@@ -2,16 +2,15 @@
|
|
2
2
|
|
3
3
|
source "http://rubygems.org"
|
4
4
|
|
5
|
-
gem "
|
5
|
+
gem "activesupport", ">= 2.3.5"
|
6
|
+
gem "actionpack", ">= 2.3.5"
|
7
|
+
gem "rake", :group=>:development
|
6
8
|
gem "yard", "~> 0.7", :group=>:development
|
7
9
|
gem "bundler", "~> 1.2.0", :group=>:development
|
8
10
|
gem "jeweler", "~> 1.8.4", :group=>:development
|
9
11
|
gem "appraisal", ">= 0.5.0", :group=>:test
|
10
12
|
gem "shoulda", ">= 0", :group=>:test
|
11
13
|
gem "shoulda-context", ">= 0", :group=>:test
|
12
|
-
gem "mocha", :group=>:test
|
13
|
-
gem "
|
14
|
-
gem "actionpack", "~> 3.2.0"
|
15
|
-
gem "railties", "~> 3.2.0"
|
16
|
-
gem "tzinfo"
|
14
|
+
gem "mocha", :require=>false, :group=>:test
|
15
|
+
gem "rails", "~> 3.2.0"
|
17
16
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
actionmailer (3.2.8)
|
5
|
+
actionpack (= 3.2.8)
|
6
|
+
mail (~> 2.4.4)
|
4
7
|
actionpack (3.2.8)
|
5
8
|
activemodel (= 3.2.8)
|
6
9
|
activesupport (= 3.2.8)
|
@@ -14,12 +17,21 @@ GEM
|
|
14
17
|
activemodel (3.2.8)
|
15
18
|
activesupport (= 3.2.8)
|
16
19
|
builder (~> 3.0.0)
|
20
|
+
activerecord (3.2.8)
|
21
|
+
activemodel (= 3.2.8)
|
22
|
+
activesupport (= 3.2.8)
|
23
|
+
arel (~> 3.0.2)
|
24
|
+
tzinfo (~> 0.3.29)
|
25
|
+
activeresource (3.2.8)
|
26
|
+
activemodel (= 3.2.8)
|
27
|
+
activesupport (= 3.2.8)
|
17
28
|
activesupport (3.2.8)
|
18
29
|
i18n (~> 0.6)
|
19
30
|
multi_json (~> 1.0)
|
20
31
|
appraisal (0.5.1)
|
21
32
|
bundler
|
22
33
|
rake
|
34
|
+
arel (3.0.2)
|
23
35
|
builder (3.0.4)
|
24
36
|
erubis (2.7.0)
|
25
37
|
git (1.2.5)
|
@@ -32,10 +44,16 @@ GEM
|
|
32
44
|
rdoc
|
33
45
|
journey (1.0.4)
|
34
46
|
json (1.7.5)
|
47
|
+
mail (2.4.4)
|
48
|
+
i18n (>= 0.4.0)
|
49
|
+
mime-types (~> 1.16)
|
50
|
+
treetop (~> 1.4.8)
|
35
51
|
metaclass (0.0.1)
|
52
|
+
mime-types (1.19)
|
36
53
|
mocha (0.13.0)
|
37
54
|
metaclass (~> 0.0.1)
|
38
55
|
multi_json (1.3.7)
|
56
|
+
polyglot (0.3.3)
|
39
57
|
rack (1.4.1)
|
40
58
|
rack-cache (1.2)
|
41
59
|
rack (>= 0.4)
|
@@ -43,6 +61,14 @@ GEM
|
|
43
61
|
rack
|
44
62
|
rack-test (0.6.2)
|
45
63
|
rack (>= 1.0)
|
64
|
+
rails (3.2.8)
|
65
|
+
actionmailer (= 3.2.8)
|
66
|
+
actionpack (= 3.2.8)
|
67
|
+
activerecord (= 3.2.8)
|
68
|
+
activeresource (= 3.2.8)
|
69
|
+
activesupport (= 3.2.8)
|
70
|
+
bundler (~> 1.0)
|
71
|
+
railties (= 3.2.8)
|
46
72
|
railties (3.2.8)
|
47
73
|
actionpack (= 3.2.8)
|
48
74
|
activesupport (= 3.2.8)
|
@@ -53,11 +79,11 @@ GEM
|
|
53
79
|
rake (10.0.2)
|
54
80
|
rdoc (3.12)
|
55
81
|
json (~> 1.4)
|
56
|
-
shoulda (3.
|
57
|
-
shoulda-context (~> 1.0)
|
58
|
-
shoulda-matchers (~> 1.
|
59
|
-
shoulda-context (1.0.
|
60
|
-
shoulda-matchers (1.
|
82
|
+
shoulda (3.3.2)
|
83
|
+
shoulda-context (~> 1.0.1)
|
84
|
+
shoulda-matchers (~> 1.4.1)
|
85
|
+
shoulda-context (1.0.1)
|
86
|
+
shoulda-matchers (1.4.1)
|
61
87
|
activesupport (>= 3.0.0)
|
62
88
|
sprockets (2.1.3)
|
63
89
|
hike (~> 1.2)
|
@@ -65,6 +91,9 @@ GEM
|
|
65
91
|
tilt (~> 1.1, != 1.3.0)
|
66
92
|
thor (0.16.0)
|
67
93
|
tilt (1.3.3)
|
94
|
+
treetop (1.4.12)
|
95
|
+
polyglot
|
96
|
+
polyglot (>= 0.3.1)
|
68
97
|
tzinfo (0.3.35)
|
69
98
|
yard (0.8.3)
|
70
99
|
|
@@ -72,15 +101,14 @@ PLATFORMS
|
|
72
101
|
ruby
|
73
102
|
|
74
103
|
DEPENDENCIES
|
75
|
-
actionpack (
|
76
|
-
activesupport (
|
104
|
+
actionpack (>= 2.3.5)
|
105
|
+
activesupport (>= 2.3.5)
|
77
106
|
appraisal (>= 0.5.0)
|
78
107
|
bundler (~> 1.2.0)
|
79
108
|
jeweler (~> 1.8.4)
|
80
109
|
mocha
|
81
|
-
|
110
|
+
rails (~> 3.2.0)
|
82
111
|
rake
|
83
112
|
shoulda
|
84
113
|
shoulda-context
|
85
|
-
tzinfo
|
86
114
|
yard (~> 0.7)
|
@@ -6,7 +6,8 @@ module Charcoal
|
|
6
6
|
|
7
7
|
module ClassMethods
|
8
8
|
def allow(filter, &block)
|
9
|
-
|
9
|
+
action = "allow_#{filter}"
|
10
|
+
define_method action do |*args|
|
10
11
|
# If we don't need 1.8 compat then ->(options = {}) instead of *args and the next line
|
11
12
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
12
13
|
options.assert_valid_keys(:only, :except, :if, :unless)
|
@@ -24,6 +25,8 @@ module Charcoal
|
|
24
25
|
instance_exec(method, directive, &block)
|
25
26
|
end
|
26
27
|
end
|
28
|
+
|
29
|
+
hide_action action if respond_to?(:hide_action)
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
data/lib/charcoal/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -11,6 +11,13 @@ rescue Bundler::BundlerError => e
|
|
11
11
|
exit e.status_code
|
12
12
|
end
|
13
13
|
|
14
|
+
require 'test/unit'
|
15
|
+
require 'mocha/setup'
|
16
|
+
|
17
|
+
# https://github.com/freerange/mocha/issues/94
|
18
|
+
Mocha::Integration::TestUnit::AssertionCounter = Mocha::Integration::AssertionCounter
|
19
|
+
|
20
|
+
require 'shoulda'
|
14
21
|
require 'active_support/version'
|
15
22
|
|
16
23
|
if ActiveSupport::VERSION::MAJOR >= 3
|
@@ -48,7 +55,4 @@ else
|
|
48
55
|
ActionDispatch = ActionController
|
49
56
|
end
|
50
57
|
|
51
|
-
require 'test/unit'
|
52
|
-
require 'shoulda'
|
53
|
-
|
54
58
|
require 'charcoal'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: charcoal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,16 +9,16 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: activesupport
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 2.3.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,9 +26,9 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 2.3.5
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: actionpack
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
@@ -44,21 +44,21 @@ dependencies:
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 2.3.5
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: rake
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
type: :
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: yard
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +115,7 @@ extra_rdoc_files:
|
|
115
115
|
- LICENSE
|
116
116
|
- README.md
|
117
117
|
files:
|
118
|
+
- .travis.yml
|
118
119
|
- Appraisals
|
119
120
|
- Gemfile
|
120
121
|
- LICENSE
|
@@ -154,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
155
|
version: '0'
|
155
156
|
segments:
|
156
157
|
- 0
|
157
|
-
hash:
|
158
|
+
hash: -2919837306301132765
|
158
159
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
160
|
none: false
|
160
161
|
requirements:
|