docurium 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,15 +9,6 @@ class DocuriumTest < Minitest::Test
9
9
 
10
10
  @repo = Rugged::Repository.init_at(@dir, :bare)
11
11
 
12
- config = <<END
13
- {
14
- "name": "libgit2",
15
- "github": "libgit2/libgit2",
16
- "prefix": "git_",
17
- "branch": "gh-pages"
18
- }
19
- END
20
-
21
12
  # Create an index as we would have read from the user's repository
22
13
  index = Rugged::Index.new
23
14
  headers = File.dirname(__FILE__) + '/fixtures/git2/'
@@ -29,7 +20,7 @@ END
29
20
  end
30
21
 
31
22
  @path = File.dirname(__FILE__) + '/fixtures/git2/api.docurium'
32
- @doc = Docurium.new(@path, @repo)
23
+ @doc = Docurium.new(@path, {}, @repo)
33
24
  @data = @doc.parse_headers(index, 'HEAD')
34
25
  end
35
26
 
@@ -37,6 +28,13 @@ END
37
28
  FileUtils.remove_entry(@dir)
38
29
  end
39
30
 
31
+ def test_can_parse
32
+ refute_nil @data
33
+ assert_equal [:files, :functions, :callbacks, :globals, :types, :prefix, :groups], @data.keys
34
+ files = %w(blob.h callback.h cherrypick.h commit.h common.h errors.h index.h object.h odb.h odb_backend.h oid.h refs.h repository.h revwalk.h signature.h tag.h tree.h types.h)
35
+ assert_equal files, @data[:files].map {|d| d[:file] }
36
+ end
37
+
40
38
  def test_can_parse_headers
41
39
  keys = @data.keys.map { |k| k.to_s }.sort
42
40
  assert_equal ['callbacks', 'files', 'functions', 'globals', 'groups', 'prefix', 'types'], keys
@@ -61,7 +59,7 @@ END
61
59
  end
62
60
 
63
61
  def test_can_find_type_usage
64
- oid = @data[:types].assoc('git_oid')
62
+ oid = @data[:types].find {|a| a[0] == 'git_oid' }
65
63
  oid_returns = [
66
64
  "git_commit_id",
67
65
  "git_commit_parent_oid",
@@ -161,11 +159,50 @@ END
161
159
  assert_equal 'int (*)(const char *, void *)', func[:args][2][:type]
162
160
  assert_equal 'Function which will be called for every listed ref', func[:args][2][:comment]
163
161
  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>
162
+ <p>The listed references may be filtered by type, or using
163
+ a bitwise OR of several types. Use the magic value
164
+ <code>GIT_REF_LISTALL</code> to obtain all references, including
165
+ packed ones.</p>
166
+
167
+ <p>The <code>callback</code> function will be called for each of the references
168
+ in the repository, and will receive the name of the reference and
169
+ the <code>payload</code> value passed to this method.</p>
167
170
  EOF
168
- assert_equal expect_comment.split("\n").map(&:strip), func[:comments].split("\n")
171
+ assert_equal expect_comment.split("\n"), func[:comments].split("\n")
172
+ end
173
+
174
+ def test_can_handle_bulleted_lists
175
+ type = @data[:types].find {|name, data| name == 'git_repository_init_options' }
176
+ refute_nil type
177
+ expect_comment = <<-EOF
178
+ <p>This contains extra options for <code>git_repository_init_ext</code> that enable
179
+ additional initialization features. The fields are:</p>
180
+
181
+ <ul>
182
+ <li>flags - Combination of GIT_REPOSITORY_INIT flags above.</li>
183
+ <li>mode - Set to one of the standard GIT_REPOSITORY_INIT_SHARED_...
184
+ constants above, or to a custom value that you would like.</li>
185
+ <li>workdir_path - The path to the working dir or NULL for default (i.e.
186
+ repo_path parent on non-bare repos). IF THIS IS RELATIVE PATH,
187
+ IT WILL BE EVALUATED RELATIVE TO THE REPO_PATH. If this is not
188
+ the &quot;natural&quot; working directory, a .git gitlink file will be
189
+ created here linking to the repo_path.</li>
190
+ <li>description - If set, this will be used to initialize the &quot;description&quot;
191
+ file in the repository, instead of using the template content.</li>
192
+ <li>template_path - When GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE is set,
193
+ this contains the path to use for the template directory. If
194
+ this is NULL, the config or default directory options will be
195
+ used instead.</li>
196
+ <li>initial_head - The name of the head to point HEAD at. If NULL, then
197
+ this will be treated as &quot;master&quot; and the HEAD ref will be set
198
+ to &quot;refs/heads/master&quot;. If this begins with &quot;refs/&quot; it will be
199
+ used verbatim; otherwise &quot;refs/heads/&quot; will be prefixed.</li>
200
+ <li>origin_url - If this is non-NULL, then after the rest of the
201
+ repository initialization is completed, an &quot;origin&quot; remote
202
+ will be added pointing to this URL.</li>
203
+ </ul>
204
+ EOF
205
+ assert_equal expect_comment, type[1][:comments]
169
206
  end
170
207
 
171
208
  def test_can_get_the_full_description_from_multi_liners
@@ -15,3 +15,5 @@ GIT_BEGIN_DECL
15
15
  GIT_EXTERN(int) git_cherrypick(char *input);
16
16
 
17
17
  GIT_END_DECL
18
+
19
+ #endif
@@ -28,6 +28,7 @@
28
28
  #include "thread-utils.h"
29
29
  #include <time.h>
30
30
  #include <stdlib.h>
31
+ #include <stdint.h>
31
32
 
32
33
  #ifdef __cplusplus
33
34
  # define GIT_BEGIN_DECL extern "C" {
@@ -39,12 +40,6 @@
39
40
  # define GIT_END_DECL /* empty */
40
41
  #endif
41
42
 
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
-
48
43
  /** Declare a public function exported for application use. */
49
44
  #ifdef __GNUC__
50
45
  # define GIT_EXTERN(type) extern \
@@ -212,6 +212,45 @@ GIT_EXTERN(const char *) git_repository_path(git_repository *repo);
212
212
  */
213
213
  GIT_EXTERN(const char *) git_repository_workdir(git_repository *repo);
214
214
 
215
+ /**
216
+ * Extended options structure for `git_repository_init_ext`.
217
+ *
218
+ * This contains extra options for `git_repository_init_ext` that enable
219
+ * additional initialization features. The fields are:
220
+ *
221
+ * * flags - Combination of GIT_REPOSITORY_INIT flags above.
222
+ * * mode - Set to one of the standard GIT_REPOSITORY_INIT_SHARED_...
223
+ * constants above, or to a custom value that you would like.
224
+ * * workdir_path - The path to the working dir or NULL for default (i.e.
225
+ * repo_path parent on non-bare repos). IF THIS IS RELATIVE PATH,
226
+ * IT WILL BE EVALUATED RELATIVE TO THE REPO_PATH. If this is not
227
+ * the "natural" working directory, a .git gitlink file will be
228
+ * created here linking to the repo_path.
229
+ * * description - If set, this will be used to initialize the "description"
230
+ * file in the repository, instead of using the template content.
231
+ * * template_path - When GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE is set,
232
+ * this contains the path to use for the template directory. If
233
+ * this is NULL, the config or default directory options will be
234
+ * used instead.
235
+ * * initial_head - The name of the head to point HEAD at. If NULL, then
236
+ * this will be treated as "master" and the HEAD ref will be set
237
+ * to "refs/heads/master". If this begins with "refs/" it will be
238
+ * used verbatim; otherwise "refs/heads/" will be prefixed.
239
+ * * origin_url - If this is non-NULL, then after the rest of the
240
+ * repository initialization is completed, an "origin" remote
241
+ * will be added pointing to this URL.
242
+ */
243
+ typedef struct {
244
+ unsigned int version;
245
+ uint32_t flags;
246
+ uint32_t mode;
247
+ const char *workdir_path;
248
+ const char *description;
249
+ const char *template_path;
250
+ const char *initial_head;
251
+ const char *origin_url;
252
+ } git_repository_init_options;
253
+
215
254
  /** @} */
216
255
  GIT_END_DECL
217
256
  #endif
@@ -25,6 +25,8 @@
25
25
  #ifndef INCLUDE_git_types_h__
26
26
  #define INCLUDE_git_types_h__
27
27
 
28
+ #include "common.h"
29
+
28
30
  /**
29
31
  * @file git2/types.h
30
32
  * @brief libgit2 base & compatibility types
data/test/parser_test.rb CHANGED
@@ -4,13 +4,17 @@ require 'pp'
4
4
 
5
5
  class ParserTest < Minitest::Test
6
6
 
7
- def setup
8
- @parser = Docurium::DocParser.new
7
+ def teardown
8
+ @parser.cleanup! if @parser
9
9
  end
10
10
 
11
11
  # e.g. parse('git2/refs.h')
12
+ # contents is either a string (the contents of "path")
13
+ # or a hash of paths => contents
12
14
  def parse(path, contents)
13
- @parser.parse_file(path, [[path, contents]])
15
+ contents = [[path, contents]] if contents.is_a? String
16
+ @parser = Docurium::DocParser.new(contents)
17
+ @parser.parse_file(path)
14
18
  end
15
19
 
16
20
  def test_single_function
@@ -122,7 +126,7 @@ EOF
122
126
  GIT_EXTERN(int) some_public_function(int val);
123
127
  EOF
124
128
 
125
- actual = @parser.parse_file(name_b, [[name_a, contents_a], [name_b, contents_b]])
129
+ actual = parse(name_b, [[name_a, contents_a], [name_b, contents_b]])
126
130
  # "Fix" the path so we remove the temp dir
127
131
  actual[0][:file] = File.split(actual[0][:file])[-1]
128
132
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docurium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Martín Nieto
8
8
  - Scott Chacon
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-18 00:00:00.000000000 Z
12
+ date: 2022-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: version_sorter
@@ -73,14 +73,14 @@ dependencies:
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '0.21'
76
+ version: '1.1'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '0.21'
83
+ version: '1.1'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: redcarpet
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -109,20 +109,34 @@ dependencies:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0.5'
112
+ - !ruby/object:Gem::Dependency
113
+ name: parallel
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '1.20'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '1.20'
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: rake
114
128
  requirement: !ruby/object:Gem::Requirement
115
129
  requirements:
116
130
  - - "~>"
117
131
  - !ruby/object:Gem::Version
118
- version: '12'
132
+ version: '13'
119
133
  type: :development
120
134
  prerelease: false
121
135
  version_requirements: !ruby/object:Gem::Requirement
122
136
  requirements:
123
137
  - - "~>"
124
138
  - !ruby/object:Gem::Version
125
- version: '12'
139
+ version: '13'
126
140
  - !ruby/object:Gem::Dependency
127
141
  name: minitest
128
142
  requirement: !ruby/object:Gem::Requirement
@@ -146,8 +160,8 @@ executables:
146
160
  extensions: []
147
161
  extra_rdoc_files: []
148
162
  files:
163
+ - ".github/workflows/main.yml"
149
164
  - ".gitignore"
150
- - ".travis.yml"
151
165
  - Gemfile
152
166
  - LICENCE
153
167
  - README.md
@@ -159,6 +173,7 @@ files:
159
173
  - lib/docurium/cli.rb
160
174
  - lib/docurium/cparser.rb
161
175
  - lib/docurium/css.css
176
+ - lib/docurium/debug.rb
162
177
  - lib/docurium/docparser.rb
163
178
  - lib/docurium/layout.mustache
164
179
  - lib/docurium/layout.rb
@@ -211,7 +226,7 @@ homepage: https://github.com/libgit2/docurium
211
226
  licenses:
212
227
  - MIT
213
228
  metadata: {}
214
- post_install_message:
229
+ post_install_message:
215
230
  rdoc_options: []
216
231
  require_paths:
217
232
  - lib
@@ -226,9 +241,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
241
  - !ruby/object:Gem::Version
227
242
  version: '0'
228
243
  requirements: []
229
- rubyforge_project:
230
- rubygems_version: 2.7.6
231
- signing_key:
244
+ rubygems_version: 3.2.32
245
+ signing_key:
232
246
  specification_version: 4
233
247
  summary: A simpler, prettier Doxygen replacement.
234
248
  test_files: []
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- dist: xenial
3
- addons:
4
- apt:
5
- packages:
6
- - libclang-6.0-dev
7
- - llvm-6.0
8
- rvm:
9
- - ruby-2.4
10
- - ruby-2.5
11
- - ruby-head
12
-
13
- env:
14
- - LLVM_CONFIG=llvm-config-6.0