api_doc 0.0.7 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,19 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- api_doc (0.0.7)
4
+ api_doc (0.0.9)
5
5
  jquery-rails
6
6
  rails (>= 3.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionmailer (3.2.7)
12
- actionpack (= 3.2.7)
11
+ actionmailer (3.2.8)
12
+ actionpack (= 3.2.8)
13
13
  mail (~> 2.4.4)
14
- actionpack (3.2.7)
15
- activemodel (= 3.2.7)
16
- activesupport (= 3.2.7)
14
+ actionpack (3.2.8)
15
+ activemodel (= 3.2.8)
16
+ activesupport (= 3.2.8)
17
17
  builder (~> 3.0.0)
18
18
  erubis (~> 2.7.0)
19
19
  journey (~> 1.0.4)
@@ -21,18 +21,18 @@ GEM
21
21
  rack-cache (~> 1.2)
22
22
  rack-test (~> 0.6.1)
23
23
  sprockets (~> 2.1.3)
24
- activemodel (3.2.7)
25
- activesupport (= 3.2.7)
24
+ activemodel (3.2.8)
25
+ activesupport (= 3.2.8)
26
26
  builder (~> 3.0.0)
27
- activerecord (3.2.7)
28
- activemodel (= 3.2.7)
29
- activesupport (= 3.2.7)
27
+ activerecord (3.2.8)
28
+ activemodel (= 3.2.8)
29
+ activesupport (= 3.2.8)
30
30
  arel (~> 3.0.2)
31
31
  tzinfo (~> 0.3.29)
32
- activeresource (3.2.7)
33
- activemodel (= 3.2.7)
34
- activesupport (= 3.2.7)
35
- activesupport (3.2.7)
32
+ activeresource (3.2.8)
33
+ activemodel (= 3.2.8)
34
+ activesupport (= 3.2.8)
35
+ activesupport (3.2.8)
36
36
  i18n (~> 0.6)
37
37
  multi_json (~> 1.0)
38
38
  arel (3.0.2)
@@ -41,10 +41,10 @@ GEM
41
41
  hike (1.2.1)
42
42
  i18n (0.6.0)
43
43
  journey (1.0.4)
44
- jquery-rails (2.0.2)
45
- railties (>= 3.2.0, < 5.0)
44
+ jquery-rails (2.1.1)
45
+ railties (>= 3.1.0, < 5.0)
46
46
  thor (~> 0.14)
47
- json (1.7.4)
47
+ json (1.7.5)
48
48
  mail (2.4.4)
49
49
  i18n (>= 0.4.0)
50
50
  mime-types (~> 1.16)
@@ -59,17 +59,17 @@ GEM
59
59
  rack
60
60
  rack-test (0.6.1)
61
61
  rack (>= 1.0)
62
- rails (3.2.7)
63
- actionmailer (= 3.2.7)
64
- actionpack (= 3.2.7)
65
- activerecord (= 3.2.7)
66
- activeresource (= 3.2.7)
67
- activesupport (= 3.2.7)
62
+ rails (3.2.8)
63
+ actionmailer (= 3.2.8)
64
+ actionpack (= 3.2.8)
65
+ activerecord (= 3.2.8)
66
+ activeresource (= 3.2.8)
67
+ activesupport (= 3.2.8)
68
68
  bundler (~> 1.0)
69
- railties (= 3.2.7)
70
- railties (3.2.7)
71
- actionpack (= 3.2.7)
72
- activesupport (= 3.2.7)
69
+ railties (= 3.2.8)
70
+ railties (3.2.8)
71
+ actionpack (= 3.2.8)
72
+ activesupport (= 3.2.8)
73
73
  rack-ssl (~> 1.3.2)
74
74
  rake (>= 0.8.7)
75
75
  rdoc (~> 3.4)
@@ -81,7 +81,7 @@ GEM
81
81
  hike (~> 1.2)
82
82
  rack (~> 1.0)
83
83
  tilt (~> 1.1, != 1.3.0)
84
- thor (0.15.4)
84
+ thor (0.16.0)
85
85
  tilt (1.3.3)
86
86
  treetop (1.4.10)
87
87
  polyglot
@@ -25,7 +25,7 @@ module ApiDoc
25
25
  Rails.logger.info display_name
26
26
  display_name.gsub!(/\_\(/, " (")
27
27
  Rails.logger.info display_name
28
- html << "<li><a href='#{api_doc_page_path(path: name)}'>#{display_name}</a></li>"
28
+ html << "<li><a href='#{api_doc_page_path(path: name)}'>#{display_name.gsub("_", " ")}</a></li>"
29
29
  end
30
30
  end
31
31
  raw html
@@ -1,3 +1,3 @@
1
1
  <footer>
2
- <p>&copy; <%= Time.now.year %></p>
2
+ <p>&copy; <%= Time.now.year %> - <%= t "api_doc.company_name" %></p>
3
3
  </footer>
@@ -24,7 +24,7 @@
24
24
  <span class="icon-bar"></span>
25
25
  <span class="icon-bar"></span>
26
26
  </a>
27
- <%= link_to(ApiDoc::Config.doc_title, api_doc_home_path, class: "brand") %>
27
+ <%= link_to("#{t 'api_doc.company_name'} #{ApiDoc::Config.doc_title}", api_doc_home_path, class: "brand") %>
28
28
  <%= render partial: "api_doc/shared/nav_bar" %>
29
29
  </div>
30
30
  </div>
@@ -78,7 +78,14 @@ module ApiDoc
78
78
  dir_path = File.join([ApiDoc::Config.view_path, File.dirname(@options[:path]).split("/")].flatten)
79
79
  # puts "dir_path: #{dir_path.inspect}"
80
80
  FileUtils.mkdir_p(dir_path)
81
- File.open(File.join(dir_path, "#{@request.method}_#{File.basename(@options[:path])}_(#{@response.status}).html.erb"), 'w') do |f|
81
+ name = [@request.method, File.basename(@options[:path]), @options[:name].try(:gsub, " ", "_"), "(#{@response.status})"]
82
+ name.compact!
83
+ name = name.join("_")
84
+ # File.open(File.join(dir_path, "#{name.join("_").gsub(" ", "_")}.html.erb"), 'w') do |f|
85
+
86
+ # name = "#{@request.method}_#{File.basename(@options[:path])}_(#{@response.status})"
87
+ # puts "name: #{name.inspect}"
88
+ File.open(File.join(dir_path, "#{name}.html.erb"), 'w') do |f|
82
89
  f.write html
83
90
  end
84
91
  end
data/lib/api_doc/rspec.rb CHANGED
@@ -2,6 +2,8 @@ if ENV["API_DOC"]
2
2
  RSpec.configure do |c|
3
3
  c.treat_symbols_as_metadata_keys_with_true_values = true
4
4
  c.after(:each, :api_doc) do |example|
5
+ # puts "example.example.metadata: #{example.example.metadata.inspect}"
6
+ # puts "example.example.metadata[:description_args]: #{example.example.metadata[:description_args].inspect}"
5
7
  api_doc = example.example.metadata[:api_doc]
6
8
  ApiDoc.document(example, {})
7
9
  end
@@ -23,7 +23,6 @@
23
23
  <%% end %>
24
24
 
25
25
  <h2><%= @request.method %> <%= @request.path_info %></h2>
26
- <h3>Status: <%= @response.status %></h3>
27
26
  <% if @request.method == 'GET' && !request_params.blank? %>
28
27
  <h3>Parameters</h3>
29
28
  <pre class="prettyprint">
@@ -44,6 +43,7 @@
44
43
  <!-- response: -->
45
44
  <div class="page-header">
46
45
  <h1><%%= tr('<%= @options[:slug] %>', :response, :header) %></h1>
46
+ <h3>Status: <%= @response.status %></h3>
47
47
  </div>
48
48
 
49
49
  <%% unless tr('<%= @options[:slug] %>', :request, :description).blank? %>
@@ -1,3 +1,3 @@
1
1
  module ApiDoc
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  en:
2
2
  api_doc:
3
+ company_name: "Your Company Name"
3
4
  page:
4
5
  request:
5
6
  header: "Sample Request"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-13 00:00:00.000000000 Z
12
+ date: 2012-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: 1961050336475124417
118
+ hash: -423127122305336932
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  segments:
126
126
  - 0
127
- hash: 1961050336475124417
127
+ hash: -423127122305336932
128
128
  requirements: []
129
129
  rubyforge_project:
130
130
  rubygems_version: 1.8.24