jaxrsdoc 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/jaxrsdoc_version.rb +1 -1
  2. data/lib/parse.rb +19 -24
  3. metadata +2 -2
@@ -1,3 +1,3 @@
1
1
  module JaxrsDoc
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
data/lib/parse.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  require File.expand_path("../annotations.rb", __FILE__)
2
+ require 'javaparse'
3
+
4
+ include JavaParse
2
5
 
3
6
  module JaxrsDoc
4
7
 
@@ -42,22 +45,20 @@ module JaxrsDoc
42
45
  end
43
46
 
44
47
  module ResourceParser
45
- include AnnotationScanner
46
48
 
47
49
  def self.parse(file)
50
+ @java_file = JavaUnit.new(file.path)
48
51
  @filename = File.basename(file.path)
49
- parse_content(file.read)
52
+ parse_content
50
53
  end
51
54
 
52
- def self.parse_content(text)
55
+ def self.parse_content
53
56
  verbs_annotations = {:gets => [], :posts => [], :puts => [], :deletes => []}
54
57
  descriptions = {}
55
- java_sections = text.split(/(?<=\s)({)/);
56
- resource_head_section = java_sections.shift
57
- type_annotations = AnnotationScanner.scan_annotations(resource_head_section)
58
- descriptions.update(ParamDescriptionScanner.scan_params_descriptions(resource_head_section))
59
- type_description = parse_resource_description(resource_head_section)
60
- java_sections.each { |section|
58
+ type_annotations = AnnotationScanner.scan_annotations(@java_file.head.content)
59
+ descriptions.update(ParamDescriptionScanner.scan_params_descriptions(@java_file.head.content))
60
+ type_description = remove_params_description(@java_file.head.javadoc)
61
+ @java_file.method_blocks.each { |section|
61
62
  group = AnnotationScanner.scan_annotations(section)
62
63
  descriptions.update(ParamDescriptionScanner.scan_params_descriptions(section))
63
64
  unless group.empty?
@@ -68,23 +69,17 @@ module JaxrsDoc
68
69
  end
69
70
  }
70
71
  JaxrsDoc::Resource.new(@filename, type_annotations, verbs_annotations, type_description, descriptions)
71
- end
72
+ end
72
73
 
73
- private
74
+ private
74
75
 
75
- def self.parse_resource_description(head_text_section)
76
- from_package_only_head_section = head_text_section.each_line.drop_while {|line|
77
- not line.strip.start_with?("package")
78
- }.join
79
-
80
- if (description_match = /^\/\*\*(.+)\*\/$/m.match(from_package_only_head_section))
81
- full_text = description_match[1].gsub("*", "")
82
- description = ""
83
- full_text.each_line { |line|
84
- description << line unless line.include?("@param")
85
- }
86
- description
87
- end
76
+ def self.remove_params_description(text)
77
+ return nil unless text
78
+ description = ""
79
+ text.each_line { |line|
80
+ description << line unless line.include?("@param")
81
+ }
82
+ description
88
83
  end
89
84
 
90
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jaxrsdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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-07-11 00:00:00.000000000 Z
12
+ date: 2012-07-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: