sinatra-documentation 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,12 +1,17 @@
1
- # Self
1
+ # sinatra-documentation
2
2
 
3
- TODO: Write a gem description
3
+ An extension for a Sinatra application that allows your routes to automatically return
4
+ help documentation by specifying a route with a '.readme' extension
5
+ (ie. '/users/show.readme') and rendering the matched '.md' file.
6
+
7
+ **NOTE** This is still under development. It works, but will make API changes as it gets
8
+ more flushed out.
4
9
 
5
10
  ## Installation
6
11
 
7
12
  Add this line to your application's Gemfile:
8
13
 
9
- gem 'self'
14
+ gem 'sinatra-documentation'
10
15
 
11
16
  And then execute:
12
17
 
@@ -14,7 +19,7 @@ And then execute:
14
19
 
15
20
  Or install it yourself as:
16
21
 
17
- $ gem install self
22
+ $ gem install sinatra-documentation
18
23
 
19
24
  ## Usage
20
25
 
@@ -1,11 +1,10 @@
1
1
  require 'sinatra'
2
2
  require 'sinatra/documentation'
3
3
 
4
+ get '/foo/bar' do
5
+ "Hello World"
6
+ end
4
7
 
5
- get '/foo/bar' do
6
- "Hello World"
7
- end
8
-
9
- get '/' do
10
- 'some shit'
11
- end
8
+ get '/' do
9
+ 'some shit'
10
+ end
@@ -8,6 +8,7 @@ module Sinatra
8
8
 
9
9
  mime_type :readme, 'text/html'
10
10
  set :default_content, :html
11
+ set :html_triggers_documentation, true
11
12
 
12
13
  before do
13
14
  # Let through sinatra image urls in development
@@ -47,7 +48,9 @@ module Sinatra
47
48
  end
48
49
 
49
50
  get '/*' do
50
- pass unless format == :readme
51
+ pass if format != :readme and (request.preferred_type == 'text/html' and !settings.html_triggers_documentation)
52
+ pass if self.class.development? && request.path_info =~ %r{/__sinatra__/.*?.png}
53
+ cache_control :public, :max_age => 300
51
54
  render(:markdown, :"#{request.path}")
52
55
  end
53
56
  end
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module Documentation
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -23,4 +23,5 @@ Gem::Specification.new do |gem|
23
23
  gem.add_development_dependency 'bundler'
24
24
  gem.add_development_dependency 'rspec'
25
25
  gem.add_development_dependency 'shotgun'
26
+ gem.add_development_dependency 'thin'
26
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-documentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-23 00:00:00.000000000 Z
12
+ date: 2012-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redcarpet
16
- requirement: &70283592138200 !ruby/object:Gem::Requirement
16
+ requirement: &70100872520840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70283592138200
24
+ version_requirements: *70100872520840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sinatra
27
- requirement: &70283592137420 !ruby/object:Gem::Requirement
27
+ requirement: &70100872519480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70283592137420
35
+ version_requirements: *70100872519480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sinatra-contrib
38
- requirement: &70283592144640 !ruby/object:Gem::Requirement
38
+ requirement: &70100872517720 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70283592144640
46
+ version_requirements: *70100872517720
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: tilt
49
- requirement: &70283592141860 !ruby/object:Gem::Requirement
49
+ requirement: &70100872516920 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70283592141860
57
+ version_requirements: *70100872516920
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &70283592154540 !ruby/object:Gem::Requirement
60
+ requirement: &70100872516340 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70283592154540
68
+ version_requirements: *70100872516340
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &70283592151600 !ruby/object:Gem::Requirement
71
+ requirement: &70100872515440 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70283592151600
79
+ version_requirements: *70100872515440
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: shotgun
82
- requirement: &70283592150720 !ruby/object:Gem::Requirement
82
+ requirement: &70100872530360 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,18 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70283592150720
90
+ version_requirements: *70100872530360
91
+ - !ruby/object:Gem::Dependency
92
+ name: thin
93
+ requirement: &70100872529280 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70100872529280
91
102
  description: Tools for creating a simple web API
92
103
  email:
93
104
  - justin.smestad@gmail.com
@@ -124,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
135
  version: '0'
125
136
  segments:
126
137
  - 0
127
- hash: -511765631575549300
138
+ hash: -1745227160013132977
128
139
  required_rubygems_version: !ruby/object:Gem::Requirement
129
140
  none: false
130
141
  requirements:
@@ -133,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
144
  version: '0'
134
145
  segments:
135
146
  - 0
136
- hash: -511765631575549300
147
+ hash: -1745227160013132977
137
148
  requirements: []
138
149
  rubyforge_project:
139
150
  rubygems_version: 1.8.17