force_format 0.0.7 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4345cd2da6375d312b3c78e8d675dce5334cd1c2
4
- data.tar.gz: 541fd591fa06f058a59417c6abad05e05b6684da
3
+ metadata.gz: 4afac289a1000cf32cdd785cdbd6601f3db53c69
4
+ data.tar.gz: be2714235206ce65ef4c349ec92a7a6b99d5cd41
5
5
  SHA512:
6
- metadata.gz: d13f190eb6b6ece7829c9af976a64dac687fba1e4c3b2cf43bf85d595064d8f668ddb5c0be256f65fa3e4b490098530133f7cccede82258ca21c1dbc0cfa29e7
7
- data.tar.gz: 1e3c7372ae4bcdc618f9d5f03a1ec3ae8695198442ccb6cb8d2605a757940318d0128ed170548df9f6d52f190b1e1c43cc2b99480de507afaebf0df9a2d2d5e4
6
+ metadata.gz: ba84607927172369c0aa10dd1c5a6a4930e8d0350f70abd5202cc42bee82860b2495d00917d7c4e163502e73ca7691d53d36c82130307a9ac9dee5b7c3d8a509
7
+ data.tar.gz: 78cd54338d32eeefa426e1a7e6a6dd0b189cbb28fa53cbd1b3764b1a26b9625de6cd2a79e003e7714a52c2361f77943fe0403cbd9514e6b4847d4d0346b8dd2b
data/README.md CHANGED
@@ -23,7 +23,7 @@ to html and javascript requests.
23
23
  end
24
24
  end
25
25
 
26
- All other requests will return a white page with status code 406 (Not Acceptable). FOr some this seems to be a correct behaviour but it may be important for some webapps to render out a error page giving a good description of the error - like 404 pages. In other words: if the action can't handle the requested format render out an error page with an supported format like html.
26
+ All other requests will return a white page with status code 406 (Not Acceptable). For some this seems to be a correct behaviour but it may be important for some webapps to render out a error page giving a good description of the error - like 404 pages. In other words: If the action can't handle the requested format, render out an error page with an supported format like html.
27
27
 
28
28
  This is where ```force_format``` joins the game. The gem adds some accessible methods for your controllers based on before_filters. With that you can define the allowed formats for each controller action. If the requested mime-type does not
29
29
  match one of the specified formats, ```force_format``` will raise a custom exception wich you can handle on you own (e.g. print out some useful sentences for your users).
@@ -6,7 +6,7 @@ require 'force_format/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "force_format"
8
8
  spec.version = ForceFormat::VERSION
9
- spec.authors = ["Marcus Geißler\n"]
9
+ spec.author = "Marcus Geißler"
10
10
  spec.email = ["marcus3006@gmail.com"]
11
11
  spec.description = %q{Define the formats your Rails application should respond to in your controllers}
12
12
  spec.summary = %q{Forcing the format Rails controllers should respond to}
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "pry"
27
27
  spec.add_development_dependency "appraisal", "~> 0.5.2"
28
28
 
29
- spec.add_dependency "rails", ">= 3.2"
29
+ spec.add_dependency "rails", ">= 3.2.0", "<= 4.1"
30
30
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "jquery-rails"
6
5
  gem "rails", "~> 3.2.14"
7
6
 
8
7
  gemspec :path=>"../"
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: /home/marcus/Work/repos/github/force_format
3
3
  specs:
4
- force_format (0.0.6)
5
- rails (>= 3.2)
4
+ force_format (0.0.7)
5
+ rails (>= 3.2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -45,9 +45,6 @@ GEM
45
45
  hike (1.2.3)
46
46
  i18n (0.6.5)
47
47
  journey (1.0.4)
48
- jquery-rails (3.0.4)
49
- railties (>= 3.0, < 5.0)
50
- thor (>= 0.14, < 2.0)
51
48
  json (1.8.0)
52
49
  mail (2.5.4)
53
50
  mime-types (~> 1.16)
@@ -119,7 +116,6 @@ DEPENDENCIES
119
116
  appraisal (~> 0.5.2)
120
117
  bundler (~> 1.3)
121
118
  force_format!
122
- jquery-rails
123
119
  pry
124
120
  rails (~> 3.2.14)
125
121
  rake (~> 10.1)
@@ -2,7 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "jquery-rails"
6
5
  gem "rails", "~> 4.0.0"
7
6
 
8
7
  gemspec :path=>"../"
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: /home/marcus/Work/repos/github/force_format
3
3
  specs:
4
- force_format (0.0.6)
5
- rails (>= 3.2)
4
+ force_format (0.0.7)
5
+ rails (>= 3.2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -42,9 +42,6 @@ GEM
42
42
  erubis (2.7.0)
43
43
  hike (1.2.3)
44
44
  i18n (0.6.5)
45
- jquery-rails (3.0.4)
46
- railties (>= 3.0, < 5.0)
47
- thor (>= 0.14, < 2.0)
48
45
  mail (2.5.4)
49
46
  mime-types (~> 1.16)
50
47
  treetop (~> 1.4.8)
@@ -114,7 +111,6 @@ DEPENDENCIES
114
111
  appraisal (~> 0.5.2)
115
112
  bundler (~> 1.3)
116
113
  force_format!
117
- jquery-rails
118
114
  pry
119
115
  rails (~> 4.0.0)
120
116
  rake (~> 10.1)
@@ -5,7 +5,7 @@ module ForceFormat
5
5
  extend ActiveSupport::Concern
6
6
  FORCE_FORMAT_TYPES = [:html, :js, :json, :pdf, :csv, :zip, :xml]
7
7
  FORCE_FORMAT_DEFAULT_TYPES = [:html]
8
- FORCE_FORMAT_EXCEPTION = lambda { |o| raise(UnknownFormat.new(o)) }
8
+ FORCE_FORMAT_EXCEPTION = lambda { |o| raise(ForceFormat::Errors::UnknownFormat.new(o)) }
9
9
  FORCE_FORMAT_WILDCARD = "*/*"
10
10
 
11
11
 
@@ -30,7 +30,7 @@ module ForceFormat
30
30
  force_formats = force_format_extract_formats
31
31
  return unless force_formats
32
32
  unsupported = force_formats - FORCE_FORMAT_TYPES
33
- raise UnsupportedFormat.new("There is no support for #{unsupported} format") if unsupported.any?
33
+ raise ForceFormat::Errors::UnsupportedFormat.new("There is no support for #{unsupported} format") if unsupported.any?
34
34
 
35
35
  if request.format.to_s == FORCE_FORMAT_WILDCARD and not force_format_skip_wildcard_rewrite?
36
36
  request.format = :html
@@ -1,3 +1,3 @@
1
1
  module ForceFormat
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -24,15 +24,15 @@ describe PagesController, :type => :controller do
24
24
  end
25
25
 
26
26
  it "should respond with RoutingError for js" do
27
- expect { get "index", :format => :js }.to raise_error(UnknownFormat)
27
+ expect { get "index", :format => :js }.to raise_error(ForceFormat::Errors::UnknownFormat)
28
28
  end
29
29
 
30
30
  it "should respond with RoutingError for xml" do
31
- expect { get "index", :format => :xml }.to raise_error(UnknownFormat)
31
+ expect { get "index", :format => :xml }.to raise_error(ForceFormat::Errors::UnknownFormat)
32
32
  end
33
33
 
34
34
  it "should respond with RoutingError for json" do
35
- expect { get "index", :format => :json }.to raise_error(UnknownFormat)
35
+ expect { get "index", :format => :json }.to raise_error(ForceFormat::Errors::UnknownFormat)
36
36
  end
37
37
 
38
38
  end
@@ -63,11 +63,11 @@ describe PagesController, :type => :controller do
63
63
  end
64
64
 
65
65
  it "should respond with RoutingError for xml" do
66
- expect { get "index", :format => :xml }.to raise_error(UnknownFormat)
66
+ expect { get "index", :format => :xml }.to raise_error(ForceFormat::Errors::UnknownFormat)
67
67
  end
68
68
 
69
69
  it "should respond with RoutingError for json" do
70
- expect { get "index", :format => :json }.to raise_error(UnknownFormat)
70
+ expect { get "index", :format => :json }.to raise_error(ForceFormat::Errors::UnknownFormat)
71
71
  end
72
72
 
73
73
  end
@@ -85,23 +85,23 @@ describe PagesController, :type => :controller do
85
85
  end
86
86
 
87
87
  it "should respond with RoutingError for html" do
88
- expect { get "index" }.to raise_error(UnsupportedFormat)
88
+ expect { get "index" }.to raise_error(ForceFormat::Errors::UnsupportedFormat)
89
89
  end
90
90
 
91
91
  it "should respond with RoutingError for js" do
92
- expect { get "index", :format => :js }.to raise_error(UnsupportedFormat)
92
+ expect { get "index", :format => :js }.to raise_error(ForceFormat::Errors::UnsupportedFormat)
93
93
  end
94
94
 
95
95
  it "should respond with RoutingError for invalid" do
96
- expect { get "index", :format => :invalid }.to raise_error(UnsupportedFormat)
96
+ expect { get "index", :format => :invalid }.to raise_error(ForceFormat::Errors::UnsupportedFormat)
97
97
  end
98
98
 
99
99
  it "should respond with RoutingError for xml" do
100
- expect { get "index", :format => :xml }.to raise_error(UnsupportedFormat)
100
+ expect { get "index", :format => :xml }.to raise_error(ForceFormat::Errors::UnsupportedFormat)
101
101
  end
102
102
 
103
103
  it "should respond with RoutingError for json" do
104
- expect { get "index", :format => :json }.to raise_error(UnsupportedFormat)
104
+ expect { get "index", :format => :json }.to raise_error(ForceFormat::Errors::UnsupportedFormat)
105
105
  end
106
106
 
107
107
  end
@@ -27,11 +27,11 @@ describe PagesController, :type => :controller do
27
27
  end
28
28
 
29
29
  it "should respond with RoutingError for html" do
30
- expect { get "index", :format => :html }.to raise_error(UnknownFormat)
30
+ expect { get "index", :format => :html }.to raise_error(ForceFormat::Errors::UnknownFormat)
31
31
  end
32
32
 
33
33
  it "should respond with RoutingError for html" do
34
- expect { get "new", :format => :html }.to raise_error(UnknownFormat)
34
+ expect { get "new", :format => :html }.to raise_error(ForceFormat::Errors::UnknownFormat)
35
35
  end
36
36
 
37
37
  end
@@ -61,11 +61,11 @@ describe PagesController, :type => :controller do
61
61
  end
62
62
 
63
63
  it "should respond with RoutingError for html" do
64
- expect { get "index", :format => :html }.to raise_error(UnknownFormat)
64
+ expect { get "index", :format => :html }.to raise_error(ForceFormat::Errors::UnknownFormat)
65
65
  end
66
66
 
67
67
  it "should respond with RoutingError for html" do
68
- expect { get "new", :format => :html }.to raise_error(UnknownFormat)
68
+ expect { get "new", :format => :html }.to raise_error(ForceFormat::Errors::UnknownFormat)
69
69
  end
70
70
 
71
71
  end
@@ -82,7 +82,7 @@ describe PagesController, :type => :controller do
82
82
  end
83
83
 
84
84
  it "should respond with UnsupportedFormat for html" do
85
- expect { get "index", :format => :html }.to raise_error(UnsupportedFormat)
85
+ expect { get "index", :format => :html }.to raise_error(ForceFormat::Errors::UnsupportedFormat)
86
86
  end
87
87
 
88
88
  end
@@ -98,7 +98,7 @@ describe PagesController, :type => :controller do
98
98
  end
99
99
 
100
100
  it "should respond with UnsupportedFormat for html" do
101
- expect { get "index", :format => :html }.to raise_error(UnsupportedFormat)
101
+ expect { get "index", :format => :html }.to raise_error(ForceFormat::Errors::UnsupportedFormat)
102
102
  end
103
103
 
104
104
  end
@@ -61,15 +61,15 @@ describe PagesController, :type => :controller do
61
61
  end
62
62
 
63
63
  it "should respond with RoutingError for js" do
64
- expect { get "index", :format => :js }.to raise_error(UnknownFormat)
64
+ expect { get "index", :format => :js }.to raise_error(ForceFormat::Errors::UnknownFormat)
65
65
  end
66
66
 
67
67
  it "should respond with RoutingError for xml" do
68
- expect { get "index", :format => :xml }.to raise_error(UnknownFormat)
68
+ expect { get "index", :format => :xml }.to raise_error(ForceFormat::Errors::UnknownFormat)
69
69
  end
70
70
 
71
71
  it "should respond with RoutingError for json" do
72
- expect { get "index", :format => :json }.to raise_error(UnknownFormat)
72
+ expect { get "index", :format => :json }.to raise_error(ForceFormat::Errors::UnknownFormat)
73
73
  end
74
74
 
75
75
 
@@ -33,7 +33,7 @@ describe PagesController, :type => :controller do
33
33
  expect do
34
34
  request.env["HTTP_ACCEPT"] = '*/*'
35
35
  get "index"
36
- end.to raise_error(UnknownFormat)
36
+ end.to raise_error(ForceFormat::Errors::UnknownFormat)
37
37
  end
38
38
 
39
39
  end
@@ -22,15 +22,15 @@ describe PagesController, :type => :controller do
22
22
  end
23
23
 
24
24
  it "should respond with RoutingError for js" do
25
- expect { get "index", :format => :js }.to raise_error(UnknownFormat)
25
+ expect { get "index", :format => :js }.to raise_error(ForceFormat::Errors::UnknownFormat)
26
26
  end
27
27
 
28
28
  it "should respond with RoutingError for xml" do
29
- expect { get "index", :format => :xml }.to raise_error(UnknownFormat)
29
+ expect { get "index", :format => :xml }.to raise_error(ForceFormat::Errors::UnknownFormat)
30
30
  end
31
31
 
32
32
  it "should respond with RoutingError for json" do
33
- expect { get "index", :format => :json }.to raise_error(UnknownFormat)
33
+ expect { get "index", :format => :json }.to raise_error(ForceFormat::Errors::UnknownFormat)
34
34
  end
35
35
 
36
36
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: force_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
- - |
8
- Marcus Geißler
7
+ - Marcus Geißler
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-29 00:00:00.000000000 Z
11
+ date: 2013-09-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
@@ -115,14 +114,20 @@ dependencies:
115
114
  requirements:
116
115
  - - '>='
117
116
  - !ruby/object:Gem::Version
118
- version: '3.2'
117
+ version: 3.2.0
118
+ - - <=
119
+ - !ruby/object:Gem::Version
120
+ version: '4.1'
119
121
  type: :runtime
120
122
  prerelease: false
121
123
  version_requirements: !ruby/object:Gem::Requirement
122
124
  requirements:
123
125
  - - '>='
124
126
  - !ruby/object:Gem::Version
125
- version: '3.2'
127
+ version: 3.2.0
128
+ - - <=
129
+ - !ruby/object:Gem::Version
130
+ version: '4.1'
126
131
  description: Define the formats your Rails application should respond to in your controllers
127
132
  email:
128
133
  - marcus3006@gmail.com