docurium 0.4.2 → 0.5.0

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: 1dcfc42eb8c64c92839d2a857871dc250e0218a3
4
- data.tar.gz: a62b2faed5fcaaffdc4d5fdd96edbddd18d6ee4a
3
+ metadata.gz: de4d14a126896d40e80233637c2d761a962c6b5e
4
+ data.tar.gz: a84683f848370319cbdd40829cc7f12d4801fc92
5
5
  SHA512:
6
- metadata.gz: 676d2cf9763628d932da7b81b22b986ed18323774d3beb65045d0172ced8b7d6ca1cd51795d586327faf961e147826155f11e220ce613e840f68c536e41c2447
7
- data.tar.gz: 4c3d5e0d1f86b0eeb5ffc8588470f88c78cffba34c7d3d56ceaad870bb4a782878a5657073b2ab1ebb420293c9fdcdf5b74d2268fcef2bec4cdc42bda8f20831
6
+ metadata.gz: 4e05fecc1654f57f2d21c4cf68e54bb87d850eaa4ae84f8d84dbc077b7a694079e49b328839c4d27620d90e3fcecce8229e188d30fb6905b1b2a6580fa78508d
7
+ data.tar.gz: 7111cfbab6de0b9987e314a065495e80cd9726f5e6e1d637199170b4d0bd7aefafdf20ff2b0fcad3aeaee767475f7f29a050ac1f981adf01dd45fab01ace6120
data/README.md CHANGED
@@ -57,21 +57,6 @@ Docurium will write your docs directly into the specified Git branch.
57
57
 
58
58
  $ gem install docurium
59
59
 
60
- # Screenshots
61
-
62
- ## Main Page
63
-
64
- ![Main Page](https://img.skitch.com/20110614-c98pp6c9p9mn35jn4iskjim7hk.png)
65
-
66
- Each version of your app has a landing page that lists out all the functions available. Functions that are new in that version from the previous version are highlighted in green, functions that have changed signatures are in orange.
67
-
68
- ## Function Page
69
-
70
- ![Func Page](https://img.skitch.com/20110614-mdasyhip3swxtngwxrce8wqy3h.png)
71
-
72
- Each function has a page showing all the relevant info for that function including metadata extracted from Doxygen-style comments. I also list all the versions of the library that this function is included in and in which versions the signature changed.
73
-
74
-
75
60
  # Contributing
76
61
 
77
62
  If you want to fix or change something, please fork on GitHub, push your change to a branch named after your change and send me a pull request.
@@ -167,6 +167,7 @@ class Docurium
167
167
 
168
168
  # There's still some work we need to do serially
169
169
  tally_sigs!(version, data)
170
+ force_utf8(data)
170
171
  sha = @repo.write(data.to_json, :blob)
171
172
 
172
173
  print "Generating documentation [#{i}/#{nversions}]\r"
@@ -225,6 +226,21 @@ class Docurium
225
226
  puts "\tupdated #{br}"
226
227
  end
227
228
 
229
+ def force_utf8(data)
230
+ # Walk the data to force strings encoding to UTF-8.
231
+ if data.instance_of? Hash
232
+ data.each do |key, value|
233
+ if [:comment, :comments, :description].include?(key)
234
+ data[key] = value.force_encoding('UTF-8') unless value.nil?
235
+ else
236
+ force_utf8(value)
237
+ end
238
+ end
239
+ elsif data.respond_to?(:each)
240
+ data.each { |x| force_utf8(x) }
241
+ end
242
+ end
243
+
228
244
  def show_warnings(data)
229
245
  out '* checking your api'
230
246
 
@@ -362,17 +378,20 @@ class Docurium
362
378
  end
363
379
 
364
380
  def find_type_usage!(data)
365
- # go through all the functions and see where types are used and returned
381
+ # go through all the functions and callbacks and see where other types are used and returned
366
382
  # store them in the types data
367
- data[:functions].each do |func, fdata|
383
+ h = {}
384
+ h.merge!(data[:functions])
385
+ h.merge!(data[:callbacks])
386
+ h.each do |func, fdata|
368
387
  data[:types].each_with_index do |tdata, i|
369
388
  type, typeData = tdata
370
389
  data[:types][i][1][:used] ||= {:returns => [], :needs => []}
371
- if fdata[:return][:type].index(/#{type}[ ;\)\*]/)
390
+ if fdata[:return][:type].index(/#{type}[ ;\)\*]?/)
372
391
  data[:types][i][1][:used][:returns] << func
373
392
  data[:types][i][1][:used][:returns].sort!
374
393
  end
375
- if fdata[:argline].index(/#{type}[ ;\)\*]/)
394
+ if fdata[:argline].index(/#{type}[ ;\)\*]?/)
376
395
  data[:types][i][1][:used][:needs] << func
377
396
  data[:types][i][1][:used][:needs].sort!
378
397
  end
@@ -26,7 +26,7 @@ class Docurium
26
26
 
27
27
  # Override the path we want to filter by
28
28
  filename = File.join(tmpdir, orig_filename)
29
- tu = Index.new.parse_translation_unit(filename, [], unsaved, {:detailed_preprocessing_record => 1})
29
+ tu = Index.new.parse_translation_unit(filename, ["-DDOCURIUM=1"], unsaved, {:detailed_preprocessing_record => 1})
30
30
 
31
31
  FileUtils.remove_entry(tmpdir)
32
32
 
@@ -149,7 +149,8 @@ class Docurium
149
149
 
150
150
  def extract_subject_desc(comment)
151
151
  subject = comment.child.text
152
- desc = (comment.find_all { |cmt| cmt.kind == :comment_paragraph }).drop(1).map(&:text).join("\n\n")
152
+ paras = comment.find_all { |cmt| cmt.kind == :comment_paragraph }.drop(1).map { |p| p.map(&:text).join() }
153
+ desc = paras.join("\n\n")
153
154
  return subject, desc
154
155
  end
155
156
 
@@ -1,3 +1,3 @@
1
1
  class Docurium
2
- Version = VERSION = '0.4.2'
2
+ Version = VERSION = '0.5.0'
3
3
  end
@@ -15,7 +15,7 @@ module LibDetect
15
15
  ENV['LIBCLANG'] = DARWIN_LIBCLANG
16
16
  when /linux/
17
17
  prog = 'llvm-config'
18
- if find_executable(prog)
18
+ if find_executable(prog) and not ENV.has_key?('LLVM_CONFIG')
19
19
  ENV['LLVM_CONFIG'] = prog
20
20
  end
21
21
  end
@@ -92,6 +92,7 @@
92
92
  <% }) %>
93
93
  </ul>
94
94
  </li>
95
+ <% if (examples.length > 0) { %>
95
96
  <li>
96
97
  <h3><a href="#">Examples</a></h3>
97
98
  <ul>
@@ -102,6 +103,7 @@
102
103
  <% }) %>
103
104
  </ul>
104
105
  </li>
106
+ <% } %> <!-- if we have examples -->
105
107
  </script>
106
108
 
107
109
  <!-- Listing of the details of a single function -->
@@ -162,14 +164,14 @@
162
164
  </ul>
163
165
  </div>
164
166
  <% } %> <!-- if we have examples -->
165
- <% if (alsoLinks) { %>
167
+ <% if (alsoLinks && (alsoLinks.length > 0)) { %>
166
168
  <div class="also">
167
169
  Also in <a href="<%= alsoGroup %>"><%= groupName %></a> group: <br/>
168
170
  <% _.each(_.initial(alsoLinks), function(link) { %>
169
171
  <a href="<%= link.url %>"><%= link.name %></a>,
170
172
  <% }) %>
171
173
  <% var link = _.last(alsoLinks) %>
172
- <a href="<%= link.url %>"><%= link.name %></a>
174
+ <a href="<%= link.url %>"><%= link.name %></a>.
173
175
  </div>
174
176
  <% } %> <!-- if we have "also" links -->
175
177
  </script>
@@ -191,21 +193,21 @@
191
193
 
192
194
  <script type="text/template" id="uses-template">
193
195
  <% if (returns.length > 0) { %>
194
- <h3>Returns</h3>
196
+ <h3>Returned by</h3>
195
197
  <% _.each(_.initial(returns), function(fun) { %>
196
- <a href="<%= fun.url %>"><%= fun.name %></a>
198
+ <a href="<%= fun.url %>"><%= fun.name %></a>,
197
199
  <% }) %> <!-- loop over each 'return' -->
198
200
  <% var fun = _.last(returns) %>
199
- <a href="<%= fun.url %>"><%= fun.name %></a>
201
+ <a href="<%= fun.url %>"><%= fun.name %></a>.
200
202
  <% } %> <!-- if we have 'returns' -->
201
203
 
202
204
  <% if (needs.length > 0) { %>
203
- <h3>Argument In</h3>
205
+ <h3>Argument in</h3>
204
206
  <% _.each(_.initial(needs), function(fun) { %>
205
- <a href="<%= fun.url %>"><%= fun.name %></a>
207
+ <a href="<%= fun.url %>"><%= fun.name %></a>,
206
208
  <% }) %> <!-- loop over each 'need' -->
207
209
  <% var fun = _.last(needs) %>
208
- <a href="<%= fun.url %>"><%= fun.name %></a>
210
+ <a href="<%= fun.url %>"><%= fun.name %></a>.
209
211
  <% } %> <!-- if we have 'needs' -->
210
212
 
211
213
  <div class="fileLink">
@@ -17,6 +17,12 @@ $(function() {
17
17
  return {name: name, link: link, num: group[1].length}
18
18
  })
19
19
 
20
+ // Callbacks
21
+ var callbacks = _.map(_.keys(data['callbacks']), function(name) {
22
+ var link = functionLink('callback', name, version)
23
+ return {name: name, link: link}
24
+ })
25
+
20
26
  // Types
21
27
  var getName = function(type) {
22
28
  var name = type[0];
@@ -50,8 +56,8 @@ $(function() {
50
56
  })
51
57
  }
52
58
 
53
- this.set('data', {funs: funs, enums: enums, structs: structs, opaques: opaques,
54
- files: files, examples: examples})
59
+ this.set('data', {funs: funs, callbacks: callbacks, enums: enums, structs: structs,
60
+ opaques: opaques, files: files, examples: examples})
55
61
  },
56
62
  })
57
63
 
@@ -78,12 +84,24 @@ $(function() {
78
84
  render: function() {
79
85
  var data = this.model.get('data')
80
86
 
81
- var enumList = this.typeTemplate({title: 'Enums', elements: data.enums})
82
- var structList = this.typeTemplate({title: 'Structs', elements: data.structs})
83
- var opaquesList = this.typeTemplate({title: 'Opaque Structs', elements: data.opaques})
84
87
  var menu = $(this.template({funs: data.funs, files: data.files, examples: data.examples}))
85
88
 
86
- $('#types-list', menu).append(enumList, structList, opaquesList)
89
+ if (data.enums.length) {
90
+ var enumList = this.typeTemplate({title: 'Enums', elements: data.enums})
91
+ $('#types-list', menu).append(enumList)
92
+ }
93
+ if (data.structs.length) {
94
+ var structList = this.typeTemplate({title: 'Structs', elements: data.structs})
95
+ $('#types-list', menu).append(structList)
96
+ }
97
+ if (data.opaques.length) {
98
+ var opaquesList = this.typeTemplate({title: 'Opaque Structs', elements: data.opaques})
99
+ $('#types-list', menu).append(opaquesList)
100
+ }
101
+ if (data.callbacks.length) {
102
+ var callbacksList = this.typeTemplate({title: 'Callbacks', elements: data.callbacks})
103
+ $('#types-list', menu).append(callbacksList)
104
+ }
87
105
 
88
106
  this.$el.html(menu)
89
107
  return this
@@ -223,7 +241,7 @@ $(function() {
223
241
  var cdata = docurium.get('data')['callbacks']
224
242
  ldata = cdata
225
243
  } else {
226
- var functions = group[1]
244
+ var functions = _.filter(group[1], function(f){ return f != fname})
227
245
  }
228
246
 
229
247
  // Function Arguments
@@ -391,6 +409,7 @@ $(function() {
391
409
  var cdata = o.callbacks
392
410
  var version = o.version
393
411
 
412
+ this.gname = gname.charAt(0).toUpperCase() + gname.substring(1).toLowerCase()
394
413
  this.functions = _.map(group[1], function(name) {
395
414
  var url = '#' + functionLink(gname, name, version)
396
415
  var d = fdata[name]
@@ -581,7 +600,7 @@ $(function() {
581
600
  })
582
601
  },
583
602
 
584
- // look for structs and link them
603
+ // look for structs and link them
585
604
  hotLink: function(text) {
586
605
  types = this.get('data')['types']
587
606
  var version = this.get('version')
@@ -606,7 +625,10 @@ $(function() {
606
625
  },
607
626
 
608
627
  groupOf: function (func) {
609
- return this.get('data')['functions'][func]['group']
628
+ if(func in this.get('data')['functions']) {
629
+ return this.get('data')['functions'][func]['group']
630
+ }
631
+ return 'callback'
610
632
  },
611
633
 
612
634
  github_file: function(file, line, lineto) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docurium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Martín Nieto
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-30 00:00:00.000000000 Z
12
+ date: 2016-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: version_sorter
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  version: '0'
227
227
  requirements: []
228
228
  rubyforge_project:
229
- rubygems_version: 2.2.2
229
+ rubygems_version: 2.5.1
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: A simpler, prettier Doxygen replacement.