flyapi 0.1.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/Manifest ADDED
@@ -0,0 +1,7 @@
1
+ Manifest
2
+ README.rdoc
3
+ Rakefile
4
+ assets/api.css
5
+ flyapi.gemspec
6
+ lib/flyapi.rb
7
+ tasks/flyapi_tasks.rake
data/README.rdoc ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('flyapi', '0.1.0') do |p|
6
+ p.description = "Generate API documentation for a REST-styled Rails application."
7
+ p.url = "http://github.com/liammonahan/flyapi"
8
+ p.author = "Liam Monahan"
9
+ p.email = "liammonahan@gmail.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
data/assets/api.css ADDED
@@ -0,0 +1,217 @@
1
+ body {
2
+ margin: 0px;
3
+ font-family: "Helvetica Neue", Helvetica, sans-serif;
4
+ font-size: 14px;
5
+ background-color: #EBEBEB;
6
+ }
7
+
8
+ img { border: none; }
9
+
10
+ #sidebar {
11
+ width: 140px;
12
+ height: 100%;
13
+ margin: 0 29px 0 20px;
14
+ position: fixed;
15
+ }
16
+
17
+ h1 {
18
+ font-size: 27px;
19
+ font-weight: 900;
20
+ color: #3F3F3F;
21
+ }
22
+
23
+ .highlight {
24
+ margin: -25px 0 0px 0;
25
+ padding: 1px 0 0px 15px;
26
+ background: #ede7d1;
27
+ border-bottom: 1px solid #CCCCCC;
28
+ }
29
+
30
+ .highlight img{
31
+ position: relative;
32
+ top: 4px;
33
+ }
34
+
35
+ .highlight_bottom {
36
+ height: 20px;
37
+ width: 100%;
38
+ margin-top: -6px;
39
+ background: url("/images/header-shadow.gif") no-repeat bottom center;
40
+ }
41
+
42
+ .message {
43
+ margin-top: 10px;
44
+ background: #ede7d1;
45
+ border-top: 1px solid #CCCCCC;
46
+ border-bottom: 1px solid #CCCCCC;
47
+ font-size: 20px;
48
+ text-align: center;
49
+ }
50
+
51
+ #header {
52
+ margin-left: auto;
53
+ margin-right: auto;
54
+ width: 100%;
55
+ height: 55px;
56
+ padding: 0;
57
+ font-family: Helvetica;
58
+ text-decoration: none;
59
+ font-size: 15px;
60
+ background: #3f3f3f;
61
+ position: relative;
62
+ border-bottom: 1px solid #4a4a4a;
63
+ }
64
+
65
+ #header .separator {
66
+ color: #666666;
67
+ }
68
+
69
+ #header_links {
70
+ margin-left: 20px;
71
+ }
72
+
73
+ #header p{
74
+ float: left;
75
+ margin: 18px 0 0 6px;
76
+ }
77
+
78
+ #header a {
79
+ color: white;
80
+ text-decoration: none;
81
+ }
82
+
83
+ #header a:hover {
84
+ color: #CCCCCC;
85
+ }
86
+
87
+ #header a img {
88
+ align: right;
89
+ margin: 9px 20px 0 0;
90
+ }
91
+
92
+ a {
93
+ color: black;
94
+ }
95
+
96
+ #skinny_line {
97
+ height: 1px;
98
+ background-color: #202020;
99
+ }
100
+
101
+ hr#header_stripe {
102
+ height: 12px;
103
+ width: 100%;
104
+ position: relative;
105
+ top: -8px;
106
+ background-color: #191919;
107
+ border: none;
108
+ color: #191919;
109
+ }
110
+
111
+ hr.help {
112
+ margin-top: 20px;
113
+ }
114
+
115
+ #wrapper {
116
+ margin-left: auto;
117
+ margin-right: auto;
118
+ width: 910px;
119
+ text-align: left;
120
+ }
121
+
122
+ th {
123
+ text-align: center;
124
+ font-size: 17px;
125
+ color: #ACACD7;
126
+ }
127
+
128
+ td {
129
+ vertical-align: top;
130
+ text-align: left;
131
+ font-size: 13px;
132
+ line-height: 1.5
133
+ }
134
+
135
+ #top_of_footer {
136
+ width: 100%;
137
+ height: 10px;
138
+ background: url("/images/header-shadow-flipped.gif") no-repeat bottom center;
139
+ }
140
+
141
+ #footer {
142
+ padding: 0 0 15px 0;
143
+ text-align: center;
144
+ background: #1F1D1D; /* what about #111? */
145
+ }
146
+
147
+ #footer img {
148
+ margin: 20px 0 0 0;
149
+ }
150
+
151
+ #footer p {
152
+ color: white;
153
+ font-size: 13px;
154
+ }
155
+
156
+ #footer a {
157
+ margin: 0 10px 0 0;
158
+ color: white;
159
+ }
160
+
161
+ #tour {
162
+ margin-left: -120px;
163
+ }
164
+
165
+ .right { float:right; }
166
+ .center { margin: 0 auto; }
167
+
168
+ #content {
169
+ margin-left: auto;
170
+ margin-right: auto;
171
+ font-size: 13px;
172
+ text-align: left;
173
+ width: 650px;
174
+ border: 1px solid #e3e3e3;
175
+ background-color: white;
176
+ padding: 15px;
177
+ }
178
+
179
+ #sidebar ul {
180
+ list-style-type: none;
181
+ text-indent: -3em;
182
+ list-style-position: outside;
183
+ }
184
+
185
+ #sidebar li {
186
+ margin: 6px 0 0 0;
187
+ }
188
+
189
+ #content .highlight h1{
190
+ margin: 5px 0 10px 0;
191
+ }
192
+
193
+ .api pre {
194
+ background: #363131;
195
+ padding: 5px;
196
+ margin: 0 0 10px 0;
197
+ }
198
+
199
+ h3 { margin-bottom: 0; }
200
+
201
+ .api code, .api code a {
202
+ font-size: 10px;
203
+ color: #fff;
204
+ margin: 0;
205
+ }
206
+
207
+ .api ul code {
208
+ color: black;
209
+ }
210
+
211
+ .api code a {
212
+ color: #cf9;
213
+ }
214
+
215
+ .api code span {
216
+ color: #cf9;
217
+ }
data/flyapi.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{flyapi}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Liam Monahan"]
9
+ s.date = %q{2009-12-26}
10
+ s.description = %q{Generate API documentation for a REST-styled Rails application.}
11
+ s.email = %q{liammonahan@gmail.com}
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/flyapi.rb", "tasks/flyapi_tasks.rake"]
13
+ s.files = ["Manifest", "README.rdoc", "Rakefile", "assets/api.css", "flyapi.gemspec", "lib/flyapi.rb", "tasks/flyapi_tasks.rake"]
14
+ s.homepage = %q{http://github.com/liammonahan/flyapi}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Flyapi", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{flyapi}
18
+ s.rubygems_version = %q{1.3.5}
19
+ s.summary = %q{Generate API documentation for a REST-styled Rails application.}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
+ else
27
+ end
28
+ else
29
+ end
30
+ end
data/lib/flyapi.rb ADDED
@@ -0,0 +1,2 @@
1
+ module Flyapi
2
+ end
@@ -0,0 +1,44 @@
1
+ namespace :api do
2
+ desc "Generate API documentation."
3
+ task :generate => :environment do
4
+ puts "Generating folder structures..."
5
+ `mkdir #{RAILS_ROOT}/doc/api` if File.exist?("#{RAILS_ROOT}/doc/api") == false
6
+ `cp #{RAILS_ROOT}/vendor/plugins/flyapi-0.1.0/assets/api.css #{RAILS_ROOT}/doc/api/api.css`
7
+ puts "Extracting models..."
8
+ models = `ls #{RAILS_ROOT}/app/models`.split("\n")
9
+ models.collect! { |x| x.chomp(".rb").camelize }
10
+ models.reject! { |x| x == "Mailer" }
11
+ puts "Writing files..."
12
+ File.open("#{RAILS_ROOT}/doc/api/index.html", "w") do |file|
13
+ file.puts "<html><head><title>API</title>
14
+ <link href=\"#{RAILS_ROOT}/doc/api/api.css\" rel=\"stylesheet\" type=\"text/css\" />
15
+ <style>
16
+ body { min-width: 970px; }
17
+ ul, h2 { margin: 0; }
18
+ </style></head><body>"
19
+ sidebar(models, file)
20
+ models.each do |x|
21
+ `mkdir #{RAILS_ROOT}/doc/api/#{x}` if File.exist?("#{RAILS_ROOT}/doc/api/#{x}") == false
22
+ File.open("#{RAILS_ROOT}/doc/api/#{x}/index.html", "w") do |s|
23
+ s.puts "<pre>"
24
+ s.puts "<h1>#{x}</h1>"
25
+ Kernel.const_get(x).column_names.each { |c| s.puts " #{c}" }
26
+ s.puts "</pre>"
27
+ end
28
+ end
29
+ file.puts '</body></html>'
30
+ end
31
+ puts "Done!"
32
+ end
33
+ end
34
+
35
+ def sidebar(models, file)
36
+ file.puts "<div id=\"sidebar\">
37
+ <h2>API Pages</h2>
38
+ <ul>"
39
+ models.each do |x|
40
+ file.puts "<li><a href=\"#{x}/index.html\">#{x}</a></li>"
41
+ end
42
+ file.puts "</ul>
43
+ </div>"
44
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flyapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Liam Monahan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-12-26 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Generate API documentation for a REST-styled Rails application.
17
+ email: liammonahan@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ - lib/flyapi.rb
25
+ - tasks/flyapi_tasks.rake
26
+ files:
27
+ - Manifest
28
+ - README.rdoc
29
+ - Rakefile
30
+ - assets/api.css
31
+ - flyapi.gemspec
32
+ - lib/flyapi.rb
33
+ - tasks/flyapi_tasks.rake
34
+ has_rdoc: true
35
+ homepage: http://github.com/liammonahan/flyapi
36
+ licenses: []
37
+
38
+ post_install_message:
39
+ rdoc_options:
40
+ - --line-numbers
41
+ - --inline-source
42
+ - --title
43
+ - Flyapi
44
+ - --main
45
+ - README.rdoc
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "1.2"
59
+ version:
60
+ requirements: []
61
+
62
+ rubyforge_project: flyapi
63
+ rubygems_version: 1.3.5
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Generate API documentation for a REST-styled Rails application.
67
+ test_files: []
68
+