optionsful 0.2.3 → 0.3.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.
data/spec/spec_helper.rb CHANGED
@@ -1,24 +1,24 @@
1
- require File.join(File.dirname(__FILE__), '..', 'lib', "baurets", 'optionsful', "config.rb")
2
- require File.join(File.dirname(__FILE__), '..', 'lib', "baurets", 'optionsful', "server.rb")
3
- require File.join(File.dirname(__FILE__), '..', 'lib', "baurets", 'optionsful', "introspections.rb")
4
- # TODO ^ this was ugly?! :-S
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'baurets'))
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'baurets', 'optionsful'))
5
+ require 'optionsful'
6
+ require 'server'
7
+ require 'introspections'
5
8
 
6
- require 'rubygems'
7
- require 'sinatra'
8
- require 'rack/test'
9
+ require 'spec'
10
+ require 'spec/autorun'
11
+ require 'fake_app'
12
+ require 'rubygems'
13
+
14
+ require 'rails'
9
15
  require 'rack'
16
+ require 'rack/test'
10
17
  require 'rack/lobster'
11
- require 'spec'
12
- require 'spec/autorun'
13
- require 'spec/interop/test'
14
- require 'action_controller'
15
18
 
19
+ Spec::Runner.configure do |config|
16
20
 
17
- # set test environment
18
- set :environment, :test
19
- set :run, false
20
- set :raise_errors, true
21
- set :logging, true
21
+ end
22
22
 
23
23
  DEFAULT_ENV = { "rack.version" => Rack::VERSION, "rack.input" => StringIO.new, "rack.errors" => StringIO.new,
24
24
  "rack.multithread" => true, "rack.multiprocess" => true, "rack.run_once" => false, }
@@ -67,6 +67,16 @@ DEFAULT_ENV = { "rack.version" => Rack::VERSION, "rack.input" => StringIO.new, "
67
67
  def allows?(headers, method)
68
68
  headers["Allow"].include?(method)
69
69
  end
70
-
71
-
72
-
70
+
71
+ def validate_response(response)
72
+ response.should be_a_kind_of Array
73
+ response.size.should == 3
74
+ response[0].should be_a_kind_of Fixnum
75
+ response[1].should be_a_kind_of Hash
76
+ response[2].should_not be nil
77
+ end
78
+
79
+ def rails_app
80
+ app = FakeApp.initialize!
81
+ app
82
+ end
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: 17
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
9
8
  - 3
10
- version: 0.2.3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marco Antonio Gonzalez Junior
@@ -15,43 +15,112 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-31 00:00:00 -03:00
18
+ date: 2010-08-05 00:00:00 -03:00
19
19
  default_executable:
20
- dependencies: []
21
-
22
- description: Help building RESTful web services enabling HTTP OPTIONS verb on Ruby on Rails applications.
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 13
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 9
34
+ version: 1.2.9
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: yard
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: cucumber
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: rails
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 7
74
+ segments:
75
+ - 3
76
+ - 0
77
+ - 0
78
+ version: 3.0.0
79
+ type: :runtime
80
+ version_requirements: *id004
81
+ description: Help building RESTful web services by supporting the HTTP OPTIONS verb on Ruby on Rails applications.
23
82
  email: kayaman@baurets.net
24
83
  executables: []
25
84
 
26
85
  extensions: []
27
86
 
28
- extra_rdoc_files: []
29
-
87
+ extra_rdoc_files:
88
+ - LICENSE
89
+ - README.rdoc
30
90
  files:
31
- - README.textile
32
- - MIT-LICENSE
91
+ - .autotest
92
+ - .document
93
+ - .gitignore
94
+ - LICENSE
95
+ - README.rdoc
33
96
  - Rakefile
34
- - lib/optionsful.rb
35
- - lib/baurets/optionsful/server.rb
36
- - lib/baurets/optionsful/introspections.rb
97
+ - VERSION
98
+ - config/optionsful.yml
99
+ - features/optionsful.feature
100
+ - features/step_definitions/optionsful3_steps.rb
101
+ - features/support/env.rb
37
102
  - lib/baurets/optionsful/config.rb
38
- - lib/baurets/optionsful/version.rb
103
+ - lib/baurets/optionsful/introspections.rb
104
+ - lib/baurets/optionsful/server.rb
105
+ - lib/optionsful.rb
39
106
  - lib/tasks/optionsful.rake
107
+ - optionsful.gemspec
40
108
  - rails/init.rb
41
- - samples/optionsful.yml
42
- - spec/fixtures/optionsful.yml
43
- - spec/fixtures/optionsful_bug.yml
44
- - spec/optionsful_server_spec.rb
109
+ - spec/config/optionsful.yml
110
+ - spec/config/optionsful_host_auto.yml
111
+ - spec/config/optionsful_link_false.yml
112
+ - spec/fake_app.rb
45
113
  - spec/optionsful_config_spec.rb
114
+ - spec/optionsful_server_spec.rb
46
115
  - spec/spec.opts
47
116
  - spec/spec_helper.rb
48
117
  has_rdoc: true
49
- homepage: http://github.com/kayaman/optionsful
118
+ homepage: http://github.com/kayaman/optionsful3
50
119
  licenses: []
51
120
 
52
121
  post_install_message:
53
- rdoc_options: []
54
-
122
+ rdoc_options:
123
+ - --charset=UTF-8
55
124
  require_paths:
56
125
  - lib
57
126
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -74,10 +143,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
143
  version: "0"
75
144
  requirements: []
76
145
 
77
- rubyforge_project:
146
+ rubyforge_project: optionsful3
78
147
  rubygems_version: 1.3.7
79
148
  signing_key:
80
149
  specification_version: 3
81
- summary: Support HTTP OPTIONS verb on your Rails app.
82
- test_files: []
83
-
150
+ summary: Support HTTP OPTIONS verb on your Rails 3 app.
151
+ test_files:
152
+ - spec/fake_app.rb
153
+ - spec/optionsful_config_spec.rb
154
+ - spec/optionsful_server_spec.rb
155
+ - spec/spec_helper.rb
data/README.textile DELETED
@@ -1,91 +0,0 @@
1
- h1. *Optionsful*
2
-
3
- Provide HTTP OPTIONS support for the Ruby on Rails framework.
4
-
5
- * Note for the impatient: installation instructions below.
6
- * Note for the dummies: change host names and paths properly.
7
- * Note for the unfaithful: run @rake routes@ to validate the results.
8
-
9
- h2. "-No! No! No! *-Show me the code!*"
10
-
11
- h3. Retrieving an HTTP OPTIONS request via telnet:
12
-
13
- <pre>
14
-
15
- $ telnet localhost 3000
16
- OPTIONS /posts HTTP/1.1
17
- Host: http://localhost:3000
18
-
19
- HTTP/1.1 204 No Content
20
- Allow: GET, POST
21
- Connection: close
22
- Date: Thu, 22 Jul 2010 17:20:27 GMT
23
- Link: "<http://localhost:3000/optionsful/posts>; type=text/html; rel=help"
24
-
25
- OPTIONS /posts/1 HTTP/1.1
26
- Host: http://localhost:3000
27
-
28
- HTTP/1.1 204 No Content
29
- Allow: GET, PUT, DELETE
30
- Connection: close
31
- Date: Thu, 22 Jul 2010 18:14:24 GMT
32
- Link: "<http://localhost:3000/optionsful/posts/1/>; type=text/html; rel=help"
33
-
34
- OPTIONS /posts/1/comments HTTP/1.1
35
- Host: http://localhost:3000
36
-
37
- HTTP/1.1 204 No Content
38
- Allow: GET, POST
39
- Connection: close
40
- Date: Thu, 22 Jul 2010 18:12:43 GMT
41
- Link: "<http://localhost:3000/optionsful/posts/1/comments>; type=text/html; rel=help"
42
-
43
- </pre>
44
- ~Note the empty line which is part of the HTTP protocol.~
45
-
46
- h3. Telnet is the geek way. You would like better to use an HTTP client software. I use "HTTP Client":http://ditchnet.org/httpclient/ on Mac OS X.
47
-
48
- h2. INSTALLATION:
49
-
50
- # Change directory to your Ruby on Rails web application,
51
- # Add gem dependency to @config/environment.rb@:
52
- <pre>
53
- config.gem "optionsful"
54
- </pre>
55
- # To install it, run @rake gems:install@ or:
56
- <pre>
57
- $ gem install optionsful
58
- </pre>
59
- # Enjoy! And give feedback! :)
60
-
61
- h2. Link header WARNING
62
-
63
- To enable the Link URI on your application, check the "Wisdomful":http://github.com/kayaman/wisdomful project!
64
-
65
- h3. Link base path (Note: _Work in Progress_)
66
-
67
- * To change the generated URI base path, install and edit the configuration file:
68
- ** run @rake optionsful:yml@
69
- ** edit the 'optionsful.yml' file at your application's 'config' folder.
70
- * Example:
71
- <pre>
72
- development:
73
- http:
74
- base_path: /blopts
75
- </pre>
76
-
77
- * Note: @Allow@ and @Link@ are expected headers on a response to an HTTP OPTIONS request. I will think about some features to add more flexibility on the @Link@ generation pretty soon.
78
-
79
- h2. KNOWN ISSUES
80
- * Rails route recognition still need some work
81
- * Platform: ruby 1.8.7, rails 2.3.8, rack 1.2.1
82
-
83
- h2. Get involved
84
- * Mailing list: http://groups.google.com/group/optionsful
85
- * Bug tracker : http://kayaman.lighthouseapp.com/projects/56438-optionsful/overview
86
-
87
- h2. CONTRIBUTORS
88
- * Me, myself and I, so far.
89
- * You are welcome, do it. ;-)
90
-
91
- Copyright (c) 2010 Marco Antonio Gonzalez Junior, kayaman@baurets.net, released under the MIT license.
@@ -1,16 +0,0 @@
1
- module Baurets
2
- module Optionsful
3
- module Version
4
-
5
- MAJOR = 0
6
- MINOR = 2
7
- TINY = 3
8
-
9
- def self.to_s
10
- "#{MAJOR}.#{MINOR}.#{TINY}"
11
- end
12
-
13
- end
14
-
15
- end
16
- end
@@ -1,14 +0,0 @@
1
- development:
2
- introspection: enabled
3
- http:
4
- base_path: /blopts
5
-
6
- test:
7
- introspection: enabled
8
- http:
9
- base_path: /blopts
10
-
11
- production:
12
- introspection: enabled
13
- http:
14
- base_path: /blopts
@@ -1,11 +0,0 @@
1
- development:
2
- http:
3
- base_path: /blopts
4
-
5
- test:
6
- http:
7
- base_path: /test
8
-
9
- production:
10
- http:
11
- base_path: /blopts