docurium 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/TODO.txt +1 -2
  2. data/lib/docurium.rb +6 -3
  3. data/site/js/docurium.js +17 -9
  4. metadata +4 -4
data/TODO.txt CHANGED
@@ -1,8 +1,7 @@
1
1
  TODO
2
2
 
3
- * cross-link rocco code
3
+ * broken changelog & index page highlighting
4
4
 
5
- * fix to group chooser
6
5
 
7
6
  * version history for types, too
8
7
 
data/lib/docurium.rb CHANGED
@@ -6,7 +6,7 @@ require 'docurium/layout'
6
6
  require 'pp'
7
7
 
8
8
  class Docurium
9
- Version = VERSION = '0.0.3'
9
+ Version = VERSION = '0.0.4'
10
10
 
11
11
  attr_accessor :branch, :output_dir, :data
12
12
 
@@ -14,6 +14,7 @@ class Docurium
14
14
  raise "You need to specify a config file" if !config_file
15
15
  raise "You need to specify a valid config file" if !valid_config(config_file)
16
16
  @sigs = {}
17
+ @groups = {}
17
18
  clear_data
18
19
  end
19
20
 
@@ -63,7 +64,7 @@ class Docurium
63
64
  `git checkout-index -a`
64
65
 
65
66
  files = []
66
- Dir.glob("**/*") do |file|
67
+ Dir.glob("**/*.c") do |file|
67
68
  next if !File.file?(file)
68
69
  files << file
69
70
  end
@@ -122,7 +123,8 @@ class Docurium
122
123
  :versions => versions.reverse,
123
124
  :github => @options['github'],
124
125
  :name => @options['name'],
125
- :signatures => @sigs
126
+ :signatures => @sigs,
127
+ :groups => @groups
126
128
  }
127
129
  File.open("project.json", 'w+') do |f|
128
130
  f.write(project.to_json)
@@ -260,6 +262,7 @@ class Docurium
260
262
  group = value[:file].gsub('.h', '').gsub('/', '_')
261
263
  end
262
264
  @data[:functions][key][:group] = group
265
+ @groups[key] = group
263
266
  func[group] ||= []
264
267
  func[group] << key
265
268
  func[group].sort!
data/site/js/docurium.js CHANGED
@@ -10,7 +10,7 @@ $(function() {
10
10
 
11
11
  loadVersions: function() {
12
12
  $.getJSON("project.json", function(data) {
13
- docurium.set({'versions': data.versions, 'github': data.github, 'signatures': data.signatures, 'name': data.name})
13
+ docurium.set({'versions': data.versions, 'github': data.github, 'signatures': data.signatures, 'name': data.name, 'groups': data.groups})
14
14
  if(data.name) {
15
15
  $('#site-title').text(data.name + ' API')
16
16
  document.title = data.name + ' API'
@@ -100,11 +100,18 @@ $(function() {
100
100
  }
101
101
  },
102
102
 
103
+ getGroup: function(gname) {
104
+ var groups = docurium.get('data')['groups']
105
+ for(var i in groups) {
106
+ if(groups[i][0] == gname) {
107
+ return groups[i]
108
+ }
109
+ }
110
+ },
111
+
103
112
  showFun: function(gname, fname) {
104
- id = '#groupItem' + gname
105
- ref = parseInt($(id).attr('ref'))
113
+ group = docurium.getGroup(gname)
106
114
 
107
- group = docurium.get('data')['groups'][ref]
108
115
  fdata = docurium.get('data')['functions']
109
116
  gname = group[0]
110
117
  functions = group[1]
@@ -200,7 +207,7 @@ $(function() {
200
207
 
201
208
  // Show other functions in this group
202
209
  also = $('<div>').addClass('also')
203
- flink = $('<a href="#" ref="' + ref.toString() + '" id="groupItem' + group[0] + '">' + group[0] + '</a>')
210
+ flink = $('<a href="#' + docurium.get('version') + '/group/' + group[0] + '">' + group[0] + '</a>')
204
211
  flink.click( docurium.showGroup )
205
212
  also.append("Also in ")
206
213
  also.append(flink)
@@ -259,14 +266,16 @@ $(function() {
259
266
  content.append($('<h3>').append(version))
260
267
  cl = $('<div>').addClass('changelog')
261
268
 
269
+ console.log(version)
270
+
262
271
  for(var type in changelog[version]) {
263
272
  adds = changelog[version][type]
264
273
  adds.sort()
265
274
  addsection = $('<p>')
266
275
  for(var j in adds) {
267
276
  add = adds[j]
268
- gname = docurium.groupOf(add)
269
277
  if(type != 'deletes') {
278
+ gname = docurium.groupOf(add)
270
279
  addlink = $('<a>').attr('href', '#' + groupLink(gname, add, version)).append(add)
271
280
  } else {
272
281
  addlink = add
@@ -392,9 +401,8 @@ $(function() {
392
401
  return text
393
402
  },
394
403
 
395
- groupHash: false,
396
404
  groupOf: function (func) {
397
- return this.get('data').functions[func].group
405
+ return this.get('groups')[func]
398
406
  },
399
407
 
400
408
  addHotlinks: function() {
@@ -488,7 +496,7 @@ $(function() {
488
496
  menu.append(filelist)
489
497
 
490
498
  // Examples List
491
- if(data['examples'].length > 0) {
499
+ if(data['examples'] && (data['examples'].length > 0)) {
492
500
  title = $('<h3><a href="#">Examples</a></h3>').click( this.collapseSection )
493
501
  menu.append(title)
494
502
  filelist = $('<ul>')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docurium
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Scott Chacon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-14 00:00:00 -07:00
18
+ date: 2011-06-15 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency