docurium 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. data/.gitignore +3 -0
  2. data/Gemfile +5 -0
  3. data/LICENCE +19 -0
  4. data/README.md +39 -0
  5. data/TODO.txt +19 -0
  6. data/bin/cm +31 -0
  7. data/docurium.gemspec +25 -0
  8. data/lib/docurium.rb +435 -0
  9. data/lib/docurium/cli.rb +10 -0
  10. data/site/css/style.css +236 -0
  11. data/site/images/search_icon.png +0 -0
  12. data/site/index.html +65 -0
  13. data/site/js/backbone.js +27 -0
  14. data/site/js/docurium.js +649 -0
  15. data/site/js/json2.js +26 -0
  16. data/site/js/underscore.js +26 -0
  17. data/site/shared/css/documentation.css +797 -0
  18. data/site/shared/css/pygments.css +60 -0
  19. data/site/shared/images/active-arrow.png +0 -0
  20. data/site/shared/images/background-v2.png +0 -0
  21. data/site/shared/images/background-white.png +0 -0
  22. data/site/shared/images/dropdown_sprites.jpg +0 -0
  23. data/site/shared/images/footer_logo.png +0 -0
  24. data/site/shared/images/logo.png +0 -0
  25. data/site/shared/images/nav-rule.png +0 -0
  26. data/site/shared/images/next_step_arrow.gif +0 -0
  27. data/site/shared/images/qmark.png +0 -0
  28. data/site/shared/js/documentation.js +43 -0
  29. data/site/shared/js/jquery.js +154 -0
  30. data/test/fixtures/git2/api.docurium +6 -0
  31. data/test/fixtures/git2/blob.h +121 -0
  32. data/test/fixtures/git2/commit.h +302 -0
  33. data/test/fixtures/git2/common.h +98 -0
  34. data/test/fixtures/git2/errors.h +149 -0
  35. data/test/fixtures/git2/index.h +270 -0
  36. data/test/fixtures/git2/object.h +147 -0
  37. data/test/fixtures/git2/odb.h +302 -0
  38. data/test/fixtures/git2/odb_backend.h +107 -0
  39. data/test/fixtures/git2/oid.h +191 -0
  40. data/test/fixtures/git2/refs.h +325 -0
  41. data/test/fixtures/git2/repository.h +217 -0
  42. data/test/fixtures/git2/revwalk.h +187 -0
  43. data/test/fixtures/git2/signature.h +81 -0
  44. data/test/fixtures/git2/tag.h +297 -0
  45. data/test/fixtures/git2/thread-utils.h +71 -0
  46. data/test/fixtures/git2/tree.h +266 -0
  47. data/test/fixtures/git2/types.h +162 -0
  48. data/test/fixtures/git2/zlib.h +58 -0
  49. data/test/repo_test.rb +101 -0
  50. data/test/test_helper.rb +29 -0
  51. metadata +167 -0
@@ -0,0 +1,191 @@
1
+ /*
2
+ * This file is free software; you can redistribute it and/or modify
3
+ * it under the terms of the GNU General Public License, version 2,
4
+ * as published by the Free Software Foundation.
5
+ *
6
+ * In addition to the permissions in the GNU General Public License,
7
+ * the authors give you unlimited permission to link the compiled
8
+ * version of this file into combinations with other programs,
9
+ * and to distribute those combinations without any restriction
10
+ * coming from the use of this file. (The General Public License
11
+ * restrictions do apply in other respects; for example, they cover
12
+ * modification of the file, and distribution when not linked into
13
+ * a combined executable.)
14
+ *
15
+ * This file is distributed in the hope that it will be useful, but
16
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ * General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program; see the file COPYING. If not, write to
22
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23
+ * Boston, MA 02110-1301, USA.
24
+ */
25
+ #ifndef INCLUDE_git_oid_h__
26
+ #define INCLUDE_git_oid_h__
27
+
28
+ #include "common.h"
29
+ #include "types.h"
30
+
31
+ /**
32
+ * @file git2/oid.h
33
+ * @brief Git object id routines
34
+ * @defgroup git_oid Git object id routines
35
+ * @ingroup Git
36
+ * @{
37
+ */
38
+ GIT_BEGIN_DECL
39
+
40
+ /** Size (in bytes) of a raw/binary oid */
41
+ #define GIT_OID_RAWSZ 20
42
+
43
+ /** Size (in bytes) of a hex formatted oid */
44
+ #define GIT_OID_HEXSZ (GIT_OID_RAWSZ * 2)
45
+
46
+ /** Unique identity of any object (commit, tree, blob, tag). */
47
+ typedef struct {
48
+ /** raw binary formatted id */
49
+ unsigned char id[GIT_OID_RAWSZ];
50
+ } git_oid;
51
+
52
+ /**
53
+ * Parse a hex formatted object id into a git_oid.
54
+ * @param out oid structure the result is written into.
55
+ * @param str input hex string; must be pointing at the start of
56
+ * the hex sequence and have at least the number of bytes
57
+ * needed for an oid encoded in hex (40 bytes).
58
+ * @return GIT_SUCCESS if valid; GIT_ENOTOID on failure.
59
+ */
60
+ GIT_EXTERN(int) git_oid_mkstr(git_oid *out, const char *str);
61
+
62
+ /**
63
+ * Copy an already raw oid into a git_oid structure.
64
+ * @param out oid structure the result is written into.
65
+ * @param raw the raw input bytes to be copied.
66
+ */
67
+ GIT_EXTERN(void) git_oid_mkraw(git_oid *out, const unsigned char *raw);
68
+
69
+ /**
70
+ * Format a git_oid into a hex string.
71
+ * @param str output hex string; must be pointing at the start of
72
+ * the hex sequence and have at least the number of bytes
73
+ * needed for an oid encoded in hex (40 bytes). Only the
74
+ * oid digits are written; a '\\0' terminator must be added
75
+ * by the caller if it is required.
76
+ * @param oid oid structure to format.
77
+ */
78
+ GIT_EXTERN(void) git_oid_fmt(char *str, const git_oid *oid);
79
+
80
+ /**
81
+ * Format a git_oid into a loose-object path string.
82
+ * <p>
83
+ * The resulting string is "aa/...", where "aa" is the first two
84
+ * hex digitis of the oid and "..." is the remaining 38 digits.
85
+ *
86
+ * @param str output hex string; must be pointing at the start of
87
+ * the hex sequence and have at least the number of bytes
88
+ * needed for an oid encoded in hex (41 bytes). Only the
89
+ * oid digits are written; a '\\0' terminator must be added
90
+ * by the caller if it is required.
91
+ * @param oid oid structure to format.
92
+ */
93
+ GIT_EXTERN(void) git_oid_pathfmt(char *str, const git_oid *oid);
94
+
95
+ /**
96
+ * Format a gid_oid into a newly allocated c-string.
97
+ * @param oid the oid structure to format
98
+ * @return the c-string; NULL if memory is exhausted. Caller must
99
+ * deallocate the string with free().
100
+ */
101
+ GIT_EXTERN(char *) git_oid_allocfmt(const git_oid *oid);
102
+
103
+ /**
104
+ * Format a git_oid into a buffer as a hex format c-string.
105
+ * <p>
106
+ * If the buffer is smaller than GIT_OID_HEXSZ+1, then the resulting
107
+ * oid c-string will be truncated to n-1 characters. If there are
108
+ * any input parameter errors (out == NULL, n == 0, oid == NULL),
109
+ * then a pointer to an empty string is returned, so that the return
110
+ * value can always be printed.
111
+ *
112
+ * @param out the buffer into which the oid string is output.
113
+ * @param n the size of the out buffer.
114
+ * @param oid the oid structure to format.
115
+ * @return the out buffer pointer, assuming no input parameter
116
+ * errors, otherwise a pointer to an empty string.
117
+ */
118
+ GIT_EXTERN(char *) git_oid_to_string(char *out, size_t n, const git_oid *oid);
119
+
120
+ /**
121
+ * Copy an oid from one structure to another.
122
+ * @param out oid structure the result is written into.
123
+ * @param src oid structure to copy from.
124
+ */
125
+ GIT_EXTERN(void) git_oid_cpy(git_oid *out, const git_oid *src);
126
+
127
+ /**
128
+ * Compare two oid structures.
129
+ * @param a first oid structure.
130
+ * @param b second oid structure.
131
+ * @return <0, 0, >0 if a < b, a == b, a > b.
132
+ */
133
+ GIT_EXTERN(int) git_oid_cmp(const git_oid *a, const git_oid *b);
134
+
135
+ /**
136
+ * OID Shortener object
137
+ */
138
+ typedef struct git_oid_shorten git_oid_shorten;
139
+
140
+ /**
141
+ * Create a new OID shortener.
142
+ *
143
+ * The OID shortener is used to process a list of OIDs
144
+ * in text form and return the shortest length that would
145
+ * uniquely identify all of them.
146
+ *
147
+ * E.g. look at the result of `git log --abbrev`.
148
+ *
149
+ * @param min_length The minimal length for all identifiers,
150
+ * which will be used even if shorter OIDs would still
151
+ * be unique.
152
+ * @return a `git_oid_shorten` instance, NULL if OOM
153
+ */
154
+ git_oid_shorten *git_oid_shorten_new(size_t min_length);
155
+
156
+ /**
157
+ * Add a new OID to set of shortened OIDs and calculate
158
+ * the minimal length to uniquely identify all the OIDs in
159
+ * the set.
160
+ *
161
+ * The OID is expected to be a 40-char hexadecimal string.
162
+ * The OID is owned by the user and will not be modified
163
+ * or freed.
164
+ *
165
+ * For performance reasons, there is a hard-limit of how many
166
+ * OIDs can be added to a single set (around ~22000, assuming
167
+ * a mostly randomized distribution), which should be enough
168
+ * for any kind of program, and keeps the algorithm fast and
169
+ * memory-efficient.
170
+ *
171
+ * Attempting to add more than those OIDs will result in a
172
+ * GIT_ENOMEM error
173
+ *
174
+ * @param os a `git_oid_shorten` instance
175
+ * @param text_oid an OID in text form
176
+ * @return the minimal length to uniquely identify all OIDs
177
+ * added so far to the set; or an error code (<0) if an
178
+ * error occurs.
179
+ */
180
+ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid);
181
+
182
+ /**
183
+ * Free an OID shortener instance
184
+ *
185
+ * @param os a `git_oid_shorten` instance
186
+ */
187
+ void git_oid_shorten_free(git_oid_shorten *os);
188
+
189
+ /** @} */
190
+ GIT_END_DECL
191
+ #endif
@@ -0,0 +1,325 @@
1
+ /*
2
+ * This file is free software; you can redistribute it and/or modify
3
+ * it under the terms of the GNU General Public License, version 2,
4
+ * as published by the Free Software Foundation.
5
+ *
6
+ * In addition to the permissions in the GNU General Public License,
7
+ * the authors give you unlimited permission to link the compiled
8
+ * version of this file into combinations with other programs,
9
+ * and to distribute those combinations without any restriction
10
+ * coming from the use of this file. (The General Public License
11
+ * restrictions do apply in other respects; for example, they cover
12
+ * modification of the file, and distribution when not linked into
13
+ * a combined executable.)
14
+ *
15
+ * This file is distributed in the hope that it will be useful, but
16
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ * General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program; see the file COPYING. If not, write to
22
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23
+ * Boston, MA 02110-1301, USA.
24
+ */
25
+ #ifndef INCLUDE_git_refs_h__
26
+ #define INCLUDE_git_refs_h__
27
+
28
+ #include "common.h"
29
+ #include "types.h"
30
+ #include "oid.h"
31
+
32
+ /**
33
+ * @file git2/refs.h
34
+ * @brief Git reference management routines
35
+ * @defgroup git_reference Git reference management routines
36
+ * @ingroup Git
37
+ * @{
38
+ */
39
+ GIT_BEGIN_DECL
40
+
41
+ /**
42
+ * Lookup a reference by its name in a repository.
43
+ *
44
+ * The generated reference is owned by the repository and
45
+ * should not be freed by the user.
46
+ *
47
+ * @param reference_out pointer to the looked-up reference
48
+ * @param repo the repository to look up the reference
49
+ * @param name the long name for the reference (e.g. HEAD, ref/heads/master, refs/tags/v0.1.0, ...)
50
+ * @return 0 on success; error code otherwise
51
+ */
52
+ GIT_EXTERN(int) git_reference_lookup(git_reference **reference_out, git_repository *repo, const char *name);
53
+
54
+ /**
55
+ * Create a new symbolic reference.
56
+ *
57
+ * The reference will be created in the repository and written
58
+ * to the disk.
59
+ *
60
+ * This reference is owned by the repository and shall not
61
+ * be free'd by the user.
62
+ *
63
+ * @param ref_out Pointer to the newly created reference
64
+ * @param repo Repository where that reference will live
65
+ * @param name The name of the reference
66
+ * @param target The target of the reference
67
+ * @return 0 on success; error code otherwise
68
+ */
69
+ GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repository *repo, const char *name, const char *target);
70
+
71
+ /**
72
+ * Create a new symbolic reference, overwriting an existing one with
73
+ * the same name, if it exists.
74
+ *
75
+ * If the new reference isn't a symbolic one, any pointers to the old
76
+ * reference become invalid.
77
+ *
78
+ * The reference will be created in the repository and written
79
+ * to the disk.
80
+ *
81
+ * This reference is owned by the repository and shall not
82
+ * be free'd by the user.
83
+ *
84
+ * @param ref_out Pointer to the newly created reference
85
+ * @param repo Repository where that reference will live
86
+ * @param name The name of the reference
87
+ * @param target The target of the reference
88
+ * @return 0 on success; error code otherwise
89
+ */
90
+ GIT_EXTERN(int) git_reference_create_symbolic_f(git_reference **ref_out, git_repository *repo, const char *name, const char *target);
91
+
92
+ /**
93
+ * Create a new object id reference.
94
+ *
95
+ * The reference will be created in the repository and written
96
+ * to the disk.
97
+ *
98
+ * This reference is owned by the repository and shall not
99
+ * be free'd by the user.
100
+ *
101
+ * @param ref_out Pointer to the newly created reference
102
+ * @param repo Repository where that reference will live
103
+ * @param name The name of the reference
104
+ * @param id The object id pointed to by the reference.
105
+ * @return 0 on success; error code otherwise
106
+ */
107
+ GIT_EXTERN(int) git_reference_create_oid(git_reference **ref_out, git_repository *repo, const char *name, const git_oid *id);
108
+
109
+ /**
110
+ * Create a new object id reference, overwriting an existing one with
111
+ * the same name, if it exists.
112
+ *
113
+ * If the new reference isn't an object id one, any pointers to the
114
+ * old reference become invalid.
115
+ *
116
+ * The reference will be created in the repository and written
117
+ * to the disk.
118
+ *
119
+ * This reference is owned by the repository and shall not
120
+ * be free'd by the user.
121
+ *
122
+ * @param ref_out Pointer to the newly created reference
123
+ * @param repo Repository where that reference will live
124
+ * @param name The name of the reference
125
+ * @param id The object id pointed to by the reference.
126
+ * @return 0 on success; error code otherwise
127
+ */
128
+ GIT_EXTERN(int) git_reference_create_oid_f(git_reference **ref_out, git_repository *repo, const char *name, const git_oid *id);
129
+
130
+ /**
131
+ * Get the OID pointed to by a reference.
132
+ *
133
+ * Only available if the reference is direct (i.e. not symbolic)
134
+ *
135
+ * @param ref The reference
136
+ * @return a pointer to the oid if available, NULL otherwise
137
+ */
138
+ GIT_EXTERN(const git_oid *) git_reference_oid(git_reference *ref);
139
+
140
+ /**
141
+ * Get full name to the reference pointed by this reference
142
+ *
143
+ * Only available if the reference is symbolic
144
+ *
145
+ * @param ref The reference
146
+ * @return a pointer to the name if available, NULL otherwise
147
+ */
148
+ GIT_EXTERN(const char *) git_reference_target(git_reference *ref);
149
+
150
+ /**
151
+ * Get the type of a reference
152
+ *
153
+ * Either direct (GIT_REF_OID) or symbolic (GIT_REF_SYMBOLIC)
154
+ *
155
+ * @param ref The reference
156
+ * @return the type
157
+ */
158
+ GIT_EXTERN(git_rtype) git_reference_type(git_reference *ref);
159
+
160
+ /**
161
+ * Get the full name of a reference
162
+ *
163
+ * @param ref The reference
164
+ * @return the full name for the ref
165
+ */
166
+ GIT_EXTERN(const char *) git_reference_name(git_reference *ref);
167
+
168
+ /**
169
+ * Resolve a symbolic reference
170
+ *
171
+ * Thie method iteratively peels a symbolic reference
172
+ * until it resolves to a direct reference to an OID.
173
+ *
174
+ * If a direct reference is passed as an argument,
175
+ * that reference is returned immediately
176
+ *
177
+ * @param resolved_ref Pointer to the peeled reference
178
+ * @param ref The reference
179
+ * @return 0 on success; error code otherwise
180
+ */
181
+ GIT_EXTERN(int) git_reference_resolve(git_reference **resolved_ref, git_reference *ref);
182
+
183
+ /**
184
+ * Get the repository where a reference resides
185
+ *
186
+ * @param ref The reference
187
+ * @return a pointer to the repo
188
+ */
189
+ GIT_EXTERN(git_repository *) git_reference_owner(git_reference *ref);
190
+
191
+ /**
192
+ * Set the symbolic target of a reference.
193
+ *
194
+ * The reference must be a symbolic reference, otherwise
195
+ * this method will fail.
196
+ *
197
+ * The reference will be automatically updated in
198
+ * memory and on disk.
199
+ *
200
+ * @param ref The reference
201
+ * @param target The new target for the reference
202
+ * @return 0 on success; error code otherwise
203
+ */
204
+ GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const char *target);
205
+
206
+ /**
207
+ * Set the OID target of a reference.
208
+ *
209
+ * The reference must be a direct reference, otherwise
210
+ * this method will fail.
211
+ *
212
+ * The reference will be automatically updated in
213
+ * memory and on disk.
214
+ *
215
+ * @param ref The reference
216
+ * @param target The new target OID for the reference
217
+ * @return 0 on success; error code otherwise
218
+ */
219
+ GIT_EXTERN(int) git_reference_set_oid(git_reference *ref, const git_oid *id);
220
+
221
+ /**
222
+ * Rename an existing reference
223
+ *
224
+ * This method works for both direct and symbolic references.
225
+ * The new name will be checked for validity and may be
226
+ * modified into a normalized form.
227
+ *
228
+ * The refernece will be immediately renamed in-memory
229
+ * and on disk.
230
+ *
231
+ */
232
+ GIT_EXTERN(int) git_reference_rename(git_reference *ref, const char *new_name);
233
+
234
+ /**
235
+ * Rename an existing reference, overwriting an existing one with the
236
+ * same name, if it exists.
237
+ *
238
+ * This method works for both direct and symbolic references.
239
+ * The new name will be checked for validity and may be
240
+ * modified into a normalized form.
241
+ *
242
+ * The refernece will be immediately renamed in-memory
243
+ * and on disk.
244
+ *
245
+ */
246
+ GIT_EXTERN(int) git_reference_rename_f(git_reference *ref, const char *new_name);
247
+
248
+ /**
249
+ * Delete an existing reference
250
+ *
251
+ * This method works for both direct and symbolic references.
252
+ *
253
+ * The reference will be immediately removed on disk and from
254
+ * memory. The given reference pointer will no longer be valid.
255
+ *
256
+ */
257
+ GIT_EXTERN(int) git_reference_delete(git_reference *ref);
258
+
259
+ /**
260
+ * Pack all the loose references in the repository
261
+ *
262
+ * This method will load into the cache all the loose
263
+ * references on the repository and update the
264
+ * `packed-refs` file with them.
265
+ *
266
+ * Once the `packed-refs` file has been written properly,
267
+ * the loose references will be removed from disk.
268
+ *
269
+ * WARNING: calling this method may invalidate any existing
270
+ * references previously loaded on the cache.
271
+ *
272
+ * @param repo Repository where the loose refs will be packed
273
+ * @return 0 on success; error code otherwise
274
+ */
275
+ GIT_EXTERN(int) git_reference_packall(git_repository *repo);
276
+
277
+ /**
278
+ * Fill a list with all the references that can be found
279
+ * in a repository.
280
+ *
281
+ * The listed references may be filtered by type, or using
282
+ * a bitwise OR of several types. Use the magic value
283
+ * `GIT_REF_LISTALL` to obtain all references, including
284
+ * packed ones.
285
+ *
286
+ * The string array will be filled with the names of all
287
+ * references; these values are owned by the user and
288
+ * should be free'd manually when no longer needed, using
289
+ * `git_strarray_free`.
290
+ *
291
+ * @param array Pointer to a git_strarray structure where
292
+ * the reference names will be stored
293
+ * @param repo Repository where to find the refs
294
+ * @param list_flags Filtering flags for the reference
295
+ * listing.
296
+ * @return 0 on success; error code otherwise
297
+ */
298
+ GIT_EXTERN(int) git_reference_listall(git_strarray *array, git_repository *repo, unsigned int list_flags);
299
+
300
+
301
+ /**
302
+ * List all the references in the repository, calling a custom
303
+ * callback for each one.
304
+ *
305
+ * The listed references may be filtered by type, or using
306
+ * a bitwise OR of several types. Use the magic value
307
+ * `GIT_REF_LISTALL` to obtain all references, including
308
+ * packed ones.
309
+ *
310
+ * The `callback` function will be called for each of the references
311
+ * in the repository, and will receive the name of the reference and
312
+ * the `payload` value passed to this method.
313
+ *
314
+ * @param repo Repository where to find the refs
315
+ * @param list_flags Filtering flags for the reference
316
+ * listing.
317
+ * @param callback Function which will be called for every listed ref
318
+ * @param payload Additional data to pass to the callback
319
+ * @return 0 on success; error code otherwise
320
+ */
321
+ GIT_EXTERN(int) git_reference_listcb(git_repository *repo, unsigned int list_flags, int (*callback)(const char *, void *), void *payload);
322
+
323
+ /** @} */
324
+ GIT_END_DECL
325
+ #endif