docurium 0.5.0 → 0.6.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
- SHA1:
3
- metadata.gz: de4d14a126896d40e80233637c2d761a962c6b5e
4
- data.tar.gz: a84683f848370319cbdd40829cc7f12d4801fc92
2
+ SHA256:
3
+ metadata.gz: 254c929d02d15703e7a653b44957e8a6e57dfadb3a0d2b62a419e31f44e8cda1
4
+ data.tar.gz: 9dc4b04e2e9b705448e3ff50bb4480fb5fd5466472dcf24a6b2823fdcaf9219d
5
5
  SHA512:
6
- metadata.gz: 4e05fecc1654f57f2d21c4cf68e54bb87d850eaa4ae84f8d84dbc077b7a694079e49b328839c4d27620d90e3fcecce8229e188d30fb6905b1b2a6580fa78508d
7
- data.tar.gz: 7111cfbab6de0b9987e314a065495e80cd9726f5e6e1d637199170b4d0bd7aefafdf20ff2b0fcad3aeaee767475f7f29a050ac1f981adf01dd45fab01ace6120
6
+ metadata.gz: 60e0579913e6f55fc4d34b5c0858cdaca36948425419a5023f080c4903ad1ad22ae62b53c338beee74247654d21400527c3d95cc96a7b4d5ca6b9e5a7110007b
7
+ data.tar.gz: cb64247b31745da479be5599fcf04f8b02a6337ea4e4867acee517b424a9492b1f9cec04b7cf594fa1161008fcf4f7db31c7a9527992f94fdbfb88aa2582d519
@@ -1,13 +1,14 @@
1
1
  language: ruby
2
+ dist: xenial
3
+ addons:
4
+ apt:
5
+ packages:
6
+ - libclang-6.0-dev
7
+ - llvm-6.0
2
8
  rvm:
3
- - ruby-2.0
4
- - ruby-2.1
9
+ - ruby-2.4
10
+ - ruby-2.5
5
11
  - ruby-head
6
- - rbx
7
12
 
8
13
  env:
9
- - LLVM_CONFIG=llvm-config-3.3
10
-
11
- before_install:
12
- - sudo apt-get update
13
- - sudo apt-get install libclang-3.3-dev llvm-3.3
14
+ - LLVM_CONFIG=llvm-config-6.0
data/Gemfile CHANGED
@@ -1,11 +1,9 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  platforms :rbx do
4
- gem 'rubysl', '~> 2.0'
4
+ gem 'rubysl', '~> 2.2'
5
5
  end
6
6
 
7
7
  gemspec
8
8
 
9
- gem 'ffi-clang', :git => 'https://github.com/ioquatix/ffi-clang.git'
10
-
11
9
  # vim:ft=ruby
data/bin/cm CHANGED
@@ -13,6 +13,7 @@ version Docurium::Version
13
13
  desc 'Generate HTML documentation'
14
14
  long_desc 'Generate HTML docs from a Docurium config file'
15
15
  command :doc do |c|
16
+ c.flag :for, :desc => "The version to generate", :multiple => true
16
17
  c.action do |global_options,options,args|
17
18
  file = args.first
18
19
  Docurium::CLI.doc(file, options)
@@ -34,8 +35,10 @@ pre { |global,command,options,args| true }
34
35
  post { |global,command,options,args| true }
35
36
 
36
37
  on_error do |exception|
37
- puts exception
38
- puts exception.backtrace
38
+ if !exception.is_a?(SystemExit)
39
+ puts exception
40
+ puts exception.backtrace
41
+ end
39
42
  end
40
43
 
41
44
  exit run(ARGV)
@@ -14,14 +14,14 @@ Gem::Specification.new do |s|
14
14
  s.license = 'MIT'
15
15
 
16
16
  s.add_dependency "version_sorter", "~>2.0"
17
- s.add_dependency "mustache", "~> 0.99"
17
+ s.add_dependency "mustache", "~> 1.1"
18
18
  s.add_dependency "rocco", "~>0.8"
19
19
  s.add_dependency "gli", "~>2.5"
20
20
  s.add_dependency "rugged", "~>0.21"
21
21
  s.add_dependency "redcarpet", "~>3.0"
22
- s.add_dependency "ffi-clang", "~> 0.2"
23
- s.add_development_dependency "bundler", "~>1.0"
24
- s.add_development_dependency "rake", "~> 10.1"
22
+ s.add_dependency "ffi-clang", "~> 0.5"
23
+ s.add_development_dependency "rake", "~> 12"
24
+ s.add_development_dependency "minitest", "~> 5.11"
25
25
 
26
26
  s.files = `git ls-files`.split("\n")
27
27
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -23,7 +23,7 @@ class Docurium
23
23
  raise "You need to specify a config file" if !config_file
24
24
  raise "You need to specify a valid config file" if !valid_config(config_file)
25
25
  @sigs = {}
26
- @repo = repo || Rugged::Repository.discover('.')
26
+ @repo = repo || Rugged::Repository.discover(config_file)
27
27
  end
28
28
 
29
29
  def init_data(version = 'HEAD')
@@ -119,12 +119,22 @@ class Docurium
119
119
  data
120
120
  end
121
121
 
122
- def generate_docs
122
+ def generate_docs(options)
123
123
  output_index = Rugged::Index.new
124
124
  write_site(output_index)
125
125
  @tf = File.expand_path(File.join(File.dirname(__FILE__), 'docurium', 'layout.mustache'))
126
126
  versions = get_versions
127
127
  versions << 'HEAD'
128
+ # If the user specified versions, validate them and overwrite
129
+ if !(vers = options[:for]).empty?
130
+ vers.each do |v|
131
+ next if versions.include?(v)
132
+ puts "Unknown version #{v}"
133
+ exit(false)
134
+ end
135
+ versions = vers
136
+ end
137
+
128
138
  nversions = versions.size
129
139
  output = Queue.new
130
140
  pipes = {}
@@ -364,9 +374,9 @@ class Docurium
364
374
  k = key
365
375
  end
366
376
  group, rest = k.split('_', 2)
367
- next if group.empty?
368
- if !rest
369
- group = value[:file].gsub('.h', '').gsub('/', '_')
377
+ if group.empty?
378
+ puts "empty group for function #{key}"
379
+ next
370
380
  end
371
381
  data[:functions][key][:group] = group
372
382
  func[group] ||= []
@@ -3,7 +3,7 @@ class Docurium
3
3
 
4
4
  def self.doc(idir, options)
5
5
  doc = Docurium.new(idir)
6
- doc.generate_docs
6
+ doc.generate_docs(options)
7
7
  end
8
8
 
9
9
  def self.gen(file)
@@ -18,7 +18,7 @@ class Docurium
18
18
  unsaved = files.map do |name, contents|
19
19
  full_path = File.join(tmpdir, name)
20
20
  dirname = File.dirname(full_path)
21
- FileUtils.mkdir_p(dirname) unless Dir.exists? dirname
21
+ FileUtils.mkdir_p(dirname) unless Dir.exist? dirname
22
22
  File.new(full_path, File::CREAT).close()
23
23
 
24
24
  UnsavedFile.new(full_path, contents)
@@ -1,3 +1,3 @@
1
1
  class Docurium
2
- Version = VERSION = '0.5.0'
2
+ Version = VERSION = '0.6.0'
3
3
  end
@@ -2,7 +2,7 @@ require 'minitest/autorun'
2
2
  require 'docurium'
3
3
  require 'rugged'
4
4
 
5
- class DocuriumTest < MiniTest::Unit::TestCase
5
+ class DocuriumTest < Minitest::Test
6
6
 
7
7
  def setup
8
8
  @dir = Dir.mktmpdir()
@@ -40,7 +40,7 @@ END
40
40
  def test_can_parse_headers
41
41
  keys = @data.keys.map { |k| k.to_s }.sort
42
42
  assert_equal ['callbacks', 'files', 'functions', 'globals', 'groups', 'prefix', 'types'], keys
43
- assert_equal 154, @data[:functions].size
43
+ assert_equal 155, @data[:functions].size
44
44
  end
45
45
 
46
46
  def test_can_extract_enum_from_define
@@ -62,8 +62,64 @@ END
62
62
 
63
63
  def test_can_find_type_usage
64
64
  oid = @data[:types].assoc('git_oid')
65
- assert_equal 10, oid[1][:used][:returns].size
66
- assert_equal 39, oid[1][:used][:needs].size
65
+ oid_returns = [
66
+ "git_commit_id",
67
+ "git_commit_parent_oid",
68
+ "git_commit_tree_oid",
69
+ "git_object_id",
70
+ "git_odb_object_id",
71
+ "git_oid_shorten_new",
72
+ "git_reference_oid",
73
+ "git_tag_id",
74
+ "git_tag_target_oid",
75
+ "git_tree_entry_id",
76
+ "git_tree_id"
77
+ ]
78
+ assert_equal oid_returns, oid[1][:used][:returns]
79
+ oid_needs = [
80
+ "git_blob_create_frombuffer",
81
+ "git_blob_create_fromfile",
82
+ "git_blob_lookup",
83
+ "git_commit_create",
84
+ "git_commit_create_o",
85
+ "git_commit_create_ov",
86
+ "git_commit_create_v",
87
+ "git_commit_lookup",
88
+ "git_object_lookup",
89
+ "git_odb_exists",
90
+ "git_odb_hash",
91
+ "git_odb_open_rstream",
92
+ "git_odb_read",
93
+ "git_odb_read_header",
94
+ "git_odb_write",
95
+ "git_oid_allocfmt",
96
+ "git_oid_cmp",
97
+ "git_oid_cpy",
98
+ "git_oid_fmt",
99
+ "git_oid_mkraw",
100
+ "git_oid_mkstr",
101
+ "git_oid_pathfmt",
102
+ "git_oid_shorten_add",
103
+ "git_oid_shorten_free",
104
+ "git_oid_to_string",
105
+ "git_reference_create_oid",
106
+ "git_reference_create_oid_f",
107
+ "git_reference_set_oid",
108
+ "git_revwalk_hide",
109
+ "git_revwalk_next",
110
+ "git_revwalk_push",
111
+ "git_tag_create",
112
+ "git_tag_create_f",
113
+ "git_tag_create_fo",
114
+ "git_tag_create_frombuffer",
115
+ "git_tag_create_o",
116
+ "git_tag_lookup",
117
+ "git_tree_create_fromindex",
118
+ "git_tree_lookup",
119
+ "git_treebuilder_insert",
120
+ "git_treebuilder_write"
121
+ ]
122
+ assert_equal oid_needs, oid[1][:used][:needs].sort
67
123
  end
68
124
 
69
125
  def test_can_parse_normal_functions
@@ -104,7 +160,12 @@ END
104
160
  assert_equal 'callback', func[:args][2][:name]
105
161
  assert_equal 'int (*)(const char *, void *)', func[:args][2][:type]
106
162
  assert_equal 'Function which will be called for every listed ref', func[:args][2][:comment]
107
- assert_equal 8, func[:comments].split("\n").size
163
+ expect_comment =<<-EOF
164
+ <p>The listed references may be filtered by type, or using a bitwise OR of several types. Use the magic value <code>GIT_REF_LISTALL</code> to obtain all references, including packed ones.</p>
165
+
166
+ <p>The <code>callback</code> function will be called for each of the references in the repository, and will receive the name of the reference and the <code>payload</code> value passed to this method.</p>
167
+ EOF
168
+ assert_equal expect_comment.split("\n").map(&:strip), func[:comments].split("\n")
108
169
  end
109
170
 
110
171
  def test_can_get_the_full_description_from_multi_liners
@@ -114,7 +175,8 @@ END
114
175
  end
115
176
 
116
177
  def test_can_group_functions
117
- assert_equal 15, @data[:groups].size
178
+ groups = %w(blob cherrypick commit index lasterror object odb oid reference repository revwalk signature strerror tag tree treebuilder work)
179
+ assert_equal groups, @data[:groups].map {|g| g[0]}.sort
118
180
  group, funcs = @data[:groups].first
119
181
  assert_equal 'blob', group
120
182
  assert_equal 6, funcs.size
@@ -0,0 +1,17 @@
1
+ #ifndef INCLUDE_git_blob_h__
2
+ #define INCLUDE_git_blob_h__
3
+
4
+ #include "common.h"
5
+ #include "types.h"
6
+
7
+ GIT_BEGIN_DECL
8
+
9
+ /**
10
+ * Perform a cherry-pick
11
+ *
12
+ * @param input dummy input
13
+ * @returns the usual
14
+ */
15
+ GIT_EXTERN(int) git_cherrypick(char *input);
16
+
17
+ GIT_END_DECL
@@ -39,6 +39,12 @@
39
39
  # define GIT_END_DECL /* empty */
40
40
  #endif
41
41
 
42
+ /*
43
+ * libclang won't consider anything with size_t to have comments unless we use
44
+ * this hack.
45
+ */
46
+ typedef size_t size_t;
47
+
42
48
  /** Declare a public function exported for application use. */
43
49
  #ifdef __GNUC__
44
50
  # define GIT_EXTERN(type) extern \
@@ -3,7 +3,7 @@ require 'docurium'
3
3
  require 'docurium/cli'
4
4
  require 'tempfile'
5
5
 
6
- class GenTest < MiniTest::Unit::TestCase
6
+ class GenTest < Minitest::Test
7
7
 
8
8
  # make sure we can read what we give the user
9
9
  def test_read_generated_file
@@ -12,7 +12,7 @@ class GenTest < MiniTest::Unit::TestCase
12
12
  Docurium::CLI.gen(file.path)
13
13
  end
14
14
 
15
- Docurium.new file.path
15
+ assert_raises(Rugged::RepositoryError) { Docurium.new file.path }
16
16
  end
17
17
 
18
18
  end
@@ -2,7 +2,7 @@ require 'minitest/autorun'
2
2
  require 'docurium'
3
3
  require 'pp'
4
4
 
5
- class TestParser < Minitest::Unit::TestCase
5
+ class ParserTest < Minitest::Test
6
6
 
7
7
  def setup
8
8
  @parser = Docurium::DocParser.new
@@ -70,7 +70,7 @@ EOF
70
70
  */
71
71
  int some_function(
72
72
  char *string,
73
- size_t len);
73
+ int len);
74
74
  EOF
75
75
 
76
76
  actual = parse(name, contents)
@@ -80,10 +80,10 @@ EOF
80
80
  :tdef => nil,
81
81
  :type => :function,
82
82
  :name => 'some_function',
83
- :body => "int some_function(char *string, size_t len);",
83
+ :body => "int some_function(char *string, int len);",
84
84
  :description => ' Do something',
85
85
  :comments => " More explanation of what we do\n\n ",
86
- :sig => 'char *::size_t',
86
+ :sig => 'char *::int',
87
87
  :args => [{
88
88
  :name => 'string',
89
89
  :type => 'char *',
@@ -91,15 +91,15 @@ EOF
91
91
  },
92
92
  {
93
93
  :name => 'len',
94
- :type => 'size_t',
94
+ :type => 'int',
95
95
  :comment => nil
96
96
  }],
97
97
  :return => {
98
98
  :type => 'int',
99
99
  :comment => ' an integer value'
100
100
  },
101
- :decl => "int some_function(char *string, size_t len)",
102
- :argline => "char *string, size_t len",
101
+ :decl => "int some_function(char *string, int len)",
102
+ :argline => "char *string, int len",
103
103
  }]
104
104
 
105
105
  assert_equal expected, actual
@@ -192,7 +192,7 @@ EOF
192
192
  :argline => "git_tree *tree"
193
193
  }]
194
194
 
195
- assert_equal actual, expected
195
+ assert_equal expected, actual
196
196
 
197
197
  end
198
198
 
@@ -377,7 +377,7 @@ EOF
377
377
  :underlying_type => "int"
378
378
  }]
379
379
 
380
- assert_equal actual, expected
380
+ assert_equal expected, actual
381
381
 
382
382
  name = 'typeref.h'
383
383
  contents = <<EOF
@@ -401,7 +401,7 @@ EOF
401
401
  :comments => '',
402
402
  }]
403
403
 
404
- assert_equal actual, expected
404
+ assert_equal expected, actual
405
405
 
406
406
 
407
407
  end
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.5.0
4
+ version: 0.6.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: 2016-03-31 00:00:00.000000000 Z
12
+ date: 2019-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: version_sorter
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0.99'
34
+ version: '1.1'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.99'
41
+ version: '1.1'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rocco
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -101,42 +101,42 @@ dependencies:
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: '0.2'
104
+ version: '0.5'
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '0.2'
111
+ version: '0.5'
112
112
  - !ruby/object:Gem::Dependency
113
- name: bundler
113
+ name: rake
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '1.0'
118
+ version: '12'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '1.0'
125
+ version: '12'
126
126
  - !ruby/object:Gem::Dependency
127
- name: rake
127
+ name: minitest
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '10.1'
132
+ version: '5.11'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: '10.1'
139
+ version: '5.11'
140
140
  description: A simpler, prettier Doxygen replacement.
141
141
  email:
142
142
  - cmn@dwim.me
@@ -183,9 +183,11 @@ files:
183
183
  - site/shared/images/next_step_arrow.gif
184
184
  - site/shared/images/qmark.png
185
185
  - site/shared/js/jquery.js
186
+ - test/docurium_test.rb
186
187
  - test/fixtures/git2/api.docurium
187
188
  - test/fixtures/git2/blob.h
188
189
  - test/fixtures/git2/callback.h
190
+ - test/fixtures/git2/cherrypick.h
189
191
  - test/fixtures/git2/commit.h
190
192
  - test/fixtures/git2/common.h
191
193
  - test/fixtures/git2/errors.h
@@ -204,7 +206,6 @@ files:
204
206
  - test/fixtures/git2/types.h
205
207
  - test/gen_test.rb
206
208
  - test/parser_test.rb
207
- - test/repo_test.rb
208
209
  - test/test_helper.rb
209
210
  homepage: https://github.com/libgit2/docurium
210
211
  licenses:
@@ -226,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
227
  version: '0'
227
228
  requirements: []
228
229
  rubyforge_project:
229
- rubygems_version: 2.5.1
230
+ rubygems_version: 2.7.6
230
231
  signing_key:
231
232
  specification_version: 4
232
233
  summary: A simpler, prettier Doxygen replacement.