optionsful 0.1.1 → 0.1.2
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.
- data/README.textile +1 -5
- data/Rakefile +1 -1
- data/lib/{baurets/optionsful.rb → optionsful.rb} +1 -4
- data/rails/init.rb +1 -1
- data/spec/optionsful_spec.rb +4 -4
- data/spec/spec_helper.rb +3 -3
- metadata +4 -4
data/README.textile
CHANGED
@@ -46,11 +46,7 @@ h2. INSTALLATION:
|
|
46
46
|
|
47
47
|
h2. TODO & WHISH-LIST
|
48
48
|
* -Make the installation easier.-
|
49
|
-
* Create tests! (Oh no! Psst! Don't tell anyone!)
|
50
|
-
* Research if there are means to know whether formats (types) each one of available methods can accept and serve - WHY NOT make use of BRUTE FORCE? 8-D - We Will Rock You approach - IT WILL BE ANOTHER PROJECT?
|
51
|
-
* Provide on demand human readable documentation (maybe attribute oriented programming) hopefully supporting the _about to be given_ @Link@ HTTP header
|
52
|
-
* -Implement instrumentation, logging - (really needed?)-
|
53
|
-
* -Research if there are means to test authorization, if Authorization header provided in the request- OUT_OF_SCOPE
|
49
|
+
* -Create tests! (Oh no! Psst! Don't tell anyone!)-
|
54
50
|
|
55
51
|
|
56
52
|
h2. KNOWN ISSUES
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
|
|
3
3
|
require 'spec/rake/spectask'
|
4
4
|
|
5
5
|
Spec::Rake::SpecTask.new(:spec) do |t|
|
6
|
-
t.spec_files = Dir.glob('spec/**/*_spec.rb')
|
6
|
+
t.spec_files = Dir.glob( File.dirname(__FILE__) + '/spec/**/*_spec.rb')
|
7
7
|
t.spec_opts << '--format specdoc'
|
8
8
|
t.rcov = true
|
9
9
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
module Baurets
|
2
1
|
|
3
2
|
class Optionsful
|
4
3
|
|
@@ -72,7 +71,6 @@ module Baurets
|
|
72
71
|
if segment.kind_of?(ActionController::Routing::StaticSegment)
|
73
72
|
static_path << segment.value if (segment.respond_to?(:value) && segment.value != "/")
|
74
73
|
elsif segment.kind_of?(ActionController::Routing::DynamicSegment)
|
75
|
-
#TODO ignoring (.:format), think about it:
|
76
74
|
static_path << :dynamic unless (segment.respond_to?(:key) && segment.key == :format)
|
77
75
|
end
|
78
76
|
end
|
@@ -82,7 +80,7 @@ module Baurets
|
|
82
80
|
end
|
83
81
|
|
84
82
|
def prepare_request_path(path)
|
85
|
-
path = path[0..(path.rindex('.')-1)] if path.include?('.')
|
83
|
+
path = path[0..(path.rindex('.')-1)] if path.include?('.')
|
86
84
|
path_parts = path.split("/")
|
87
85
|
path_parts.delete("")
|
88
86
|
path_parts
|
@@ -90,4 +88,3 @@ module Baurets
|
|
90
88
|
|
91
89
|
end
|
92
90
|
|
93
|
-
end
|
data/rails/init.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# Adding Optionsful to the Rack middleware stack:
|
2
|
-
ActionController::Dispatcher.middleware.use
|
2
|
+
ActionController::Dispatcher.middleware.use Optionsful
|
data/spec/optionsful_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
3
|
|
4
|
-
describe "
|
4
|
+
describe "Optionsful," do
|
5
5
|
|
6
6
|
include Rack::Test::Methods
|
7
7
|
|
@@ -15,16 +15,16 @@ describe "Baurets::Optionsful," do
|
|
15
15
|
describe "as a Rack middleware" do
|
16
16
|
|
17
17
|
it "is a Ruby object that responds to call;" do
|
18
|
-
assert
|
18
|
+
assert Optionsful.new(app).respond_to? :call
|
19
19
|
end
|
20
20
|
|
21
21
|
it "takes exactly one argument, (the environment) and returns an Array;" do
|
22
|
-
response =
|
22
|
+
response = Optionsful.new(app).call(mock_env({"REQUEST_METHOD" => "OPTIONS", "PATH_INFO" => "/posts"}))
|
23
23
|
assert response.kind_of?(Array)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "the returned Array must have exactly three values: the status, the headers and the body;" do
|
27
|
-
response =
|
27
|
+
response = Optionsful.new(app).call(mock_env({"REQUEST_METHOD" => "OPTIONS", "PATH_INFO" => "/posts"}))
|
28
28
|
assert response.size.should == 3
|
29
29
|
assert response[0].kind_of? Fixnum
|
30
30
|
assert response[1].kind_of? Hash
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', 'lib',
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'lib','optionsful.rb')
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'sinatra'
|
@@ -41,7 +41,7 @@ DEFAULT_ENV = { "rack.version" => Rack::VERSION, "rack.input" => StringIO.new, "
|
|
41
41
|
app = Rack::Builder.new {
|
42
42
|
use Rack::CommonLogger
|
43
43
|
use Rack::ShowExceptions
|
44
|
-
use
|
44
|
+
use Optionsful
|
45
45
|
map "/lobster" do
|
46
46
|
use Rack::Lint
|
47
47
|
run Rack::Lobster.new
|
@@ -55,7 +55,7 @@ DEFAULT_ENV = { "rack.version" => Rack::VERSION, "rack.input" => StringIO.new, "
|
|
55
55
|
|
56
56
|
def http_options_request(path)
|
57
57
|
complex_env = mock_env({"REQUEST_METHOD" => "OPTIONS", "PATH_INFO" => path })
|
58
|
-
response =
|
58
|
+
response = Optionsful.new(app).call(complex_env)
|
59
59
|
response
|
60
60
|
end
|
61
61
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optionsful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marco Antonio Gonzalez Junior
|
@@ -30,7 +30,7 @@ extra_rdoc_files: []
|
|
30
30
|
files:
|
31
31
|
- README.textile
|
32
32
|
- MIT-LICENSE
|
33
|
-
- lib/
|
33
|
+
- lib/optionsful.rb
|
34
34
|
- rails/init.rb
|
35
35
|
- lib/tasks/optionsful.rake
|
36
36
|
- Rakefile
|