api_yard_parser 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76b635be79b1053a4f53fef24a6ffb90493d10e8
4
- data.tar.gz: 5390011d2a7671f99dbcb1b0d609301d5215d43f
3
+ metadata.gz: 62edd8b9dd0389642dc06ece78ac04db6f3d29be
4
+ data.tar.gz: 6a4e0d8198942462bd56f1c5fa03b6e9d3ecea4f
5
5
  SHA512:
6
- metadata.gz: 300d41092a8cf0f775baf16f04f9d4020c885c8c758f9351531916f40fd592b2155ad238ebc1f1d85c3bc941c5845752421b40a3ad3c8a2a39679733ecfc50b2
7
- data.tar.gz: d5f2b0a0656cef48391012247774f67a7af11f10e1883285b886876df07b5a7490367f2a9f3efceec5c8819a60b4e0defe63e0027fc651a09f643390cafdaa6d
6
+ metadata.gz: ce77db8aece89ffc969a6b990c03980c9fc147f865283641cda25c35f770ae4e26e3cf7fb42dacc93ea3bb0ba216c85beee23ba4126e56277bd17f328a872486
7
+ data.tar.gz: f5bfdee78882a5c082938e099c419b56dffd1b59232c2fc8c06429f59e671e0b17354e303bc93a98ab4b0af434a52f51b27dc627da0aed09fd43b27a348cf837
@@ -1,4 +1,4 @@
1
- = ApiYardParser
1
+ = APIYardParser
2
2
 
3
3
  This project rocks and uses MIT-LICENSE.
4
4
 
@@ -8,7 +8,7 @@ www.locaweb.com.br
8
8
  === 1. REQUIREMENTS
9
9
 
10
10
 
11
- Ruby/ApiYardParser requires Ruby version 1.9.1 or newer and Rails ~> 3.2.16.
11
+ Ruby/APIYardParser requires Ruby version 1.9.1 or newer and Rails ~> 3.2.16.
12
12
 
13
13
  === 2. INSTALLATION
14
14
 
@@ -29,16 +29,16 @@ http://localhost:XXXX/docs
29
29
  For your controller add the yard doc:
30
30
 
31
31
 
32
- class ApiController < ApplicationController
32
+ class APIController < ApplicationController
33
33
 
34
34
  # Infos of domain
35
- # @note
35
+ # @note
36
36
  # [ Receive parameters from GET]
37
37
  # https://{APP_URL}/api/:domain
38
38
  #
39
39
  # @param [String] :domain => Domain name
40
- # @return [JSON] Response HTTP 412 - Precondition Failed -> Parameters not valid
41
- # @return [JSON] Response HTTP 500 - Internal error
40
+ # @return [JSON] Response HTTP 412 - Precondition Failed -> Parameters not valid
41
+ # @return [JSON] Response HTTP 500 - Internal error
42
42
  # @return [JSON] Response HTTP 200 - Show -> Info of domain
43
43
  #
44
44
  # {
@@ -54,7 +54,7 @@ For your controller add the yard doc:
54
54
  or......
55
55
 
56
56
 
57
- class ApiController < ApplicationController
57
+ class APIController < ApplicationController
58
58
 
59
59
  # Toggle status of alias from domain
60
60
  # @type PUT
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ end
14
14
 
15
15
  RDoc::Task.new(:rdoc) do |rdoc|
16
16
  rdoc.rdoc_dir = 'rdoc'
17
- rdoc.title = 'ApiYardParser'
17
+ rdoc.title = 'APIYardParser'
18
18
  rdoc.options << '--line-numbers'
19
19
  rdoc.rdoc_files.include('README.rdoc')
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
@@ -1,12 +1,12 @@
1
- module ApiYardParser
2
- class ApiDocsController < ::ActionController::Base
1
+ module APIYardParser
2
+ class APIDocsController < ::ActionController::Base
3
3
 
4
4
  def index
5
- if Rails.env == "production" && ApiYardParser.no_docs_in_production
5
+ if Rails.env == "production" && APIYardParser.no_docs_in_production
6
6
  render :text => "no docs in production"
7
7
  return true
8
8
  end
9
- @list_apis = ApiDocs.get_all
9
+ @list_apis = APIDocs.get_all
10
10
 
11
11
  @without = params[:without].split(",") if !params[:without].nil?
12
12
 
@@ -13,7 +13,7 @@ end
13
13
  <!DOCTYPE html>
14
14
  <html class="colorNavyBlue">
15
15
  <head>
16
- <title>ApiDocs - <%=Rails.application.class.to_s.split("::").first%></title>
16
+ <title>APIDocs - <%=Rails.application.class.to_s.split("::").first%></title>
17
17
  <link rel="stylesheet" type="text/css" href="https://assets.locaweb.com.br/locastyle/1.1.9/locastyle.css">
18
18
  <script type="text/javascript" src="https://assets.locaweb.com.br/locastyle/1.1.9/locastyle.js"></script>
19
19
  <link rel="stylesheet" type="text/css" href="https://assets.locaweb.com.br/locastyle/1.1.9/bootstrap.css">
@@ -22,7 +22,7 @@ end
22
22
  <body>
23
23
  <header class="headerPrincipal">
24
24
  <div class="limite">
25
- <h1 class="serviceName"><a href="/">ApiDocs - <%=Rails.application.class.to_s.split("::").first%></a></h1>
25
+ <h1 class="serviceName"><a href="/">APIDocs - <%=Rails.application.class.to_s.split("::").first%></a></h1>
26
26
  </div>
27
27
 
28
28
  <menu id="menuPrincipal">
@@ -58,15 +58,15 @@ end
58
58
  </header>
59
59
  <div class="collapse" id="api_routes_<%=route.object_id%>">
60
60
  <% if !route.params.nil? && route.params.count>0%>
61
- <p>
61
+ <p>
62
62
  <div class="alert alert-success">
63
63
  <h3> Params </h3>
64
64
  <div>
65
65
  <% route.params.each do |param| %>
66
66
  <p>
67
- <span><b> <%=param[:name]%> </b> </span> -
68
- <span ><%=param[:type]%></span> -
69
- <span><%=param[:description]%></span>
67
+ <span><b> <%=param[:name]%> </b> </span> -
68
+ <span ><%=param[:type]%></span> -
69
+ <span><%=param[:description]%></span>
70
70
  </p>
71
71
  <%end%>
72
72
  </div>
@@ -75,25 +75,25 @@ end
75
75
  <%end%>
76
76
  <% if !route.returns.nil? && route.returns.count>0%>
77
77
  <% route.returns.each do |myreturn| %>
78
- <p>
78
+ <p>
79
79
  <div class="alert alert-info">
80
80
  <h4> Return </h4>
81
81
  <div>
82
-
82
+
83
83
  <%=myreturn[:name]%> - <%=myreturn[:description]%>
84
84
  <br>
85
85
  <%=myreturn[:type]%>:
86
86
  <%if !myreturn[:body].nil? %>
87
87
  <pre class="lang-json prettyprint linenums"><%=myreturn[:body]%></pre>
88
88
  <%end%>
89
-
89
+
90
90
  </div>
91
91
  </div>
92
92
  </p>
93
93
  <%end%>
94
94
  <%end%>
95
95
  <% if !route.example.nil? %>
96
- <p>
96
+ <p>
97
97
  <div class="alert">
98
98
  <h3> Example </h3>
99
99
  <div>
@@ -103,7 +103,7 @@ end
103
103
  </p>
104
104
  <%end%>
105
105
  <% if !route.notes.nil? && route.notes.count>0%>
106
- <p>
106
+ <p>
107
107
  <div class="alert">
108
108
  <h3> Notes </h3>
109
109
  <div>
@@ -1,7 +1,7 @@
1
1
 
2
2
  require "active_support/dependencies"
3
3
 
4
- module ApiYardParser
4
+ module APIYardParser
5
5
 
6
6
  attr_accessor :no_docs_in_production
7
7
  # %w(api_comment api_controllers ap_docs).each do |entity|
@@ -1,5 +1,5 @@
1
- module ApiYardParser
2
- class ApiComment
1
+ module APIYardParser
2
+ class APIComment
3
3
  attr_reader :url, :type, :params, :returns, :description, :example, :notes
4
4
 
5
5
  def initialize(text)
@@ -70,7 +70,7 @@ module ApiYardParser
70
70
  lines = ""
71
71
  text.split("\n").each{|line| lines += line.sub(/^\s+#/,"") + "\n"}
72
72
  res = lines.scan(/(GET|POST|PUT|DELETE).+\n+\s+(http.+)/)[0]
73
- if !res.nil?
73
+ if !res.nil?
74
74
  @type = res[0]
75
75
  @url = res[1]
76
76
  end
@@ -1,5 +1,5 @@
1
- module ApiYardParser
2
- class ApiControllers
1
+ module APIYardParser
2
+ class APIControllers
3
3
  attr_accessor :name, :routes
4
4
 
5
5
  def initialize(name)
@@ -1,5 +1,5 @@
1
- module ApiYardParser
2
- class ApiDocs
1
+ module APIYardParser
2
+ class APIDocs
3
3
 
4
4
  attr_accessor :controller_dirs
5
5
 
@@ -13,7 +13,7 @@ module ApiYardParser
13
13
  #files = ["#{Rails.root}/app/controllers/clients_controller.rb"] #TEMP!!!!!!!!
14
14
 
15
15
  files.each do |file|
16
- content += [ApiDocs.new(file).contents]
16
+ content += [APIDocs.new(file).contents]
17
17
  end
18
18
  content
19
19
  end
@@ -26,9 +26,9 @@ module ApiYardParser
26
26
  @file_content = File.new(@file).read
27
27
  name = @file_content.scan(/class\s(\S+)Controller/ )
28
28
  name = (name.count > 0) ? name[0][0] : ""
29
- controller = ApiControllers.new(name)
29
+ controller = APIControllers.new(name)
30
30
  comments.each do |my_method|
31
- controller.add_route ApiComment.new(my_method) unless my_method =~ /^# -\*- coding: UTF-8 -\*-/
31
+ controller.add_route APIComment.new(my_method) unless my_method =~ /^# -\*- coding: UTF-8 -\*-/
32
32
  end
33
33
  controller
34
34
 
@@ -65,7 +65,7 @@ module ApiYardParser
65
65
  method = ""
66
66
  inside_def = false
67
67
  inside_count = 0
68
-
68
+
69
69
  @file_content.split("\n").each do |line|
70
70
  next if line =~ /# TODO:/
71
71
 
@@ -1,3 +1,3 @@
1
- module ApiYardParser
1
+ module APIYardParser
2
2
  class Engine < Rails::Engine; end
3
3
  end
@@ -1,3 +1,3 @@
1
- module ApiYardParser
2
- VERSION = "0.0.7"
1
+ module APIYardParser
2
+ VERSION = "0.0.8"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
- class ApiYardParserTest < ActiveSupport::TestCase
3
+ class APIYardParserTest < ActiveSupport::TestCase
4
4
  test "truth" do
5
- assert_kind_of Module, ApiYardParser
5
+ assert_kind_of Module, APIYardParser
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_yard_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Coutinho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-26 00:00:00.000000000 Z
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -92,38 +92,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.2.2
95
+ rubygems_version: 2.6.8
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: This gem parse a yard doc and generate a page with api description
99
99
  test_files:
100
100
  - test/api_yard_parser_test.rb
101
- - test/dummy/app/assets/javascripts/application.js
101
+ - test/dummy/Rakefile
102
102
  - test/dummy/app/assets/stylesheets/application.css
103
- - test/dummy/app/controllers/application_controller.rb
103
+ - test/dummy/app/assets/javascripts/application.js
104
104
  - test/dummy/app/helpers/application_helper.rb
105
+ - test/dummy/app/controllers/application_controller.rb
105
106
  - test/dummy/app/views/layouts/application.html.erb
106
- - test/dummy/config/application.rb
107
- - test/dummy/config/boot.rb
107
+ - test/dummy/script/rails
108
108
  - test/dummy/config/database.yml
109
- - test/dummy/config/environment.rb
109
+ - test/dummy/config/routes.rb
110
+ - test/dummy/config/application.rb
111
+ - test/dummy/config/environments/test.rb
110
112
  - test/dummy/config/environments/development.rb
111
113
  - test/dummy/config/environments/production.rb
112
- - test/dummy/config/environments/test.rb
113
- - test/dummy/config/initializers/backtrace_silencers.rb
114
- - test/dummy/config/initializers/inflections.rb
115
114
  - test/dummy/config/initializers/mime_types.rb
116
- - test/dummy/config/initializers/secret_token.rb
117
115
  - test/dummy/config/initializers/session_store.rb
116
+ - test/dummy/config/initializers/backtrace_silencers.rb
118
117
  - test/dummy/config/initializers/wrap_parameters.rb
118
+ - test/dummy/config/initializers/secret_token.rb
119
+ - test/dummy/config/initializers/inflections.rb
119
120
  - test/dummy/config/locales/en.yml
120
- - test/dummy/config/routes.rb
121
- - test/dummy/config.ru
122
- - test/dummy/public/404.html
123
- - test/dummy/public/422.html
121
+ - test/dummy/config/environment.rb
122
+ - test/dummy/config/boot.rb
124
123
  - test/dummy/public/500.html
125
124
  - test/dummy/public/favicon.ico
126
- - test/dummy/Rakefile
125
+ - test/dummy/public/404.html
126
+ - test/dummy/public/422.html
127
127
  - test/dummy/README.rdoc
128
- - test/dummy/script/rails
128
+ - test/dummy/config.ru
129
129
  - test/test_helper.rb
130
+ has_rdoc: