docurium 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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,217 @@
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_repository_h__
26
+ #define INCLUDE_git_repository_h__
27
+
28
+ #include "common.h"
29
+ #include "types.h"
30
+ #include "oid.h"
31
+
32
+ /**
33
+ * @file git2/repository.h
34
+ * @brief Git repository management routines
35
+ * @defgroup git_repository Git repository management routines
36
+ * @ingroup Git
37
+ * @{
38
+ */
39
+ GIT_BEGIN_DECL
40
+
41
+ /**
42
+ * Open a git repository.
43
+ *
44
+ * The 'path' argument must point to an existing git repository
45
+ * folder, e.g.
46
+ *
47
+ * /path/to/my_repo/.git/ (normal repository)
48
+ * objects/
49
+ * index
50
+ * HEAD
51
+ *
52
+ * /path/to/bare_repo/ (bare repository)
53
+ * objects/
54
+ * index
55
+ * HEAD
56
+ *
57
+ * The method will automatically detect if 'path' is a normal
58
+ * or bare repository or fail is 'path' is neither.
59
+ *
60
+ * @param repository pointer to the repo which will be opened
61
+ * @param path the path to the repository
62
+ * @return 0 on success; error code otherwise
63
+ */
64
+ GIT_EXTERN(int) git_repository_open(git_repository **repository, const char *path);
65
+
66
+
67
+ /**
68
+ * Open a git repository by manually specifying all its paths
69
+ *
70
+ * @param repository pointer to the repo which will be opened
71
+ *
72
+ * @param git_dir The full path to the repository folder
73
+ * e.g. a '.git' folder for live repos, any folder for bare
74
+ * Equivalent to $GIT_DIR.
75
+ * Cannot be NULL.
76
+ *
77
+ * @param git_object_directory The full path to the ODB folder.
78
+ * the folder where all the loose and packed objects are stored
79
+ * Equivalent to $GIT_OBJECT_DIRECTORY.
80
+ * If NULL, "$GIT_DIR/objects/" is assumed.
81
+ *
82
+ * @param git_index_file The full path to the index (dircache) file
83
+ * Equivalent to $GIT_INDEX_FILE.
84
+ * If NULL, "$GIT_DIR/index" is assumed.
85
+ *
86
+ * @param git_work_tree The full path to the working tree of the repository,
87
+ * if the repository is not bare.
88
+ * Equivalent to $GIT_WORK_TREE.
89
+ * If NULL, the repository is assumed to be bare.
90
+ *
91
+ * @return 0 on success; error code otherwise
92
+ */
93
+ GIT_EXTERN(int) git_repository_open2(git_repository **repository,
94
+ const char *git_dir,
95
+ const char *git_object_directory,
96
+ const char *git_index_file,
97
+ const char *git_work_tree);
98
+
99
+
100
+ /**
101
+ * Open a git repository by manually specifying its paths and
102
+ * the object database it will use.
103
+ *
104
+ * @param repository pointer to the repo which will be opened
105
+ *
106
+ * @param git_dir The full path to the repository folder
107
+ * e.g. a '.git' folder for live repos, any folder for bare
108
+ * Equivalent to $GIT_DIR.
109
+ * Cannot be NULL.
110
+ *
111
+ * @param object_database A pointer to a git_odb created & initialized
112
+ * by the user (e.g. with custom backends). This object database
113
+ * will be owned by the repository and will be automatically free'd.
114
+ * It should not be manually free'd by the user, or this
115
+ * git_repository object will become invalid.
116
+ *
117
+ * @param git_index_file The full path to the index (dircache) file
118
+ * Equivalent to $GIT_INDEX_FILE.
119
+ * If NULL, "$GIT_DIR/index" is assumed.
120
+ *
121
+ * @param git_work_tree The full path to the working tree of the repository,
122
+ * if the repository is not bare.
123
+ * Equivalent to $GIT_WORK_TREE.
124
+ * If NULL, the repository is assumed to be bare.
125
+ *
126
+ * @return 0 on success; error code otherwise
127
+ */
128
+
129
+ GIT_EXTERN(int) git_repository_open3(git_repository **repository,
130
+ const char *git_dir,
131
+ git_odb *object_database,
132
+ const char *git_index_file,
133
+ const char *git_work_tree);
134
+
135
+ /**
136
+ * Get the object database behind a Git repository
137
+ *
138
+ * @param repo a repository object
139
+ * @return a pointer to the object db
140
+ */
141
+ GIT_EXTERN(git_odb *) git_repository_database(git_repository *repo);
142
+
143
+ /**
144
+ * Get the Index file of a Git repository
145
+ *
146
+ * This is a cheap operation; the index is only opened on the first call,
147
+ * and subsequent calls only retrieve the previous pointer.
148
+ *
149
+ * @param index Pointer where to store the index
150
+ * @param repo a repository object
151
+ * @return 0 on success; error code if the index could not be opened
152
+ */
153
+ GIT_EXTERN(int) git_repository_index(git_index **index, git_repository *repo);
154
+
155
+ /**
156
+ * Free a previously allocated repository
157
+ *
158
+ * Note that after a repository is free'd, all the objects it has spawned
159
+ * will still exist until they are manually closed by the user
160
+ * with `git_object_close`, but accessing any of the attributes of
161
+ * an object without a backing repository will result in undefined
162
+ * behavior
163
+ *
164
+ * @param repo repository handle to close. If NULL nothing occurs.
165
+ */
166
+ GIT_EXTERN(void) git_repository_free(git_repository *repo);
167
+
168
+ /**
169
+ * Creates a new Git repository in the given folder.
170
+ *
171
+ * TODO:
172
+ * - Reinit the repository
173
+ * - Create config files
174
+ *
175
+ * @param repo_out pointer to the repo which will be created or reinitialized
176
+ * @param path the path to the repository
177
+ * @param is_bare if true, a Git repository without a working directory is created
178
+ * at the pointed path. If false, provided path will be considered as the working
179
+ * directory into which the .git directory will be created.
180
+ *
181
+ * @return 0 on success; error code otherwise
182
+ */
183
+ GIT_EXTERN(int) git_repository_init(git_repository **repo_out, const char *path, unsigned is_bare);
184
+
185
+ /**
186
+ * Check if a repository is empty
187
+ *
188
+ * An empty repository has just been initialized and contains
189
+ * no commits.
190
+ *
191
+ * @param repo Repo to test
192
+ * @return 1 if the repository is empty, 0 if it isn't, error code
193
+ * if the repository is corrupted
194
+ */
195
+ GIT_EXTERN(int) git_repository_is_empty(git_repository *repo);
196
+
197
+ /**
198
+ * Get the normalized path to the git repository.
199
+ *
200
+ * @param repo a repository object
201
+ * @return absolute path to the git directory
202
+ */
203
+ GIT_EXTERN(const char *) git_repository_path(git_repository *repo);
204
+
205
+ /**
206
+ * Get the normalized path to the working directory of the repository.
207
+ *
208
+ * If the repository is bare, there is no working directory and NULL we be returned.
209
+ *
210
+ * @param repo a repository object
211
+ * @return NULL if the repository is bare; absolute path to the working directory otherwise.
212
+ */
213
+ GIT_EXTERN(const char *) git_repository_workdir(git_repository *repo);
214
+
215
+ /** @} */
216
+ GIT_END_DECL
217
+ #endif
@@ -0,0 +1,187 @@
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_revwalk_h__
26
+ #define INCLUDE_git_revwalk_h__
27
+
28
+ #include "common.h"
29
+ #include "types.h"
30
+ #include "oid.h"
31
+
32
+ /**
33
+ * @file git2/revwalk.h
34
+ * @brief Git revision traversal routines
35
+ * @defgroup git_revwalk Git revision traversal routines
36
+ * @ingroup Git
37
+ * @{
38
+ */
39
+ GIT_BEGIN_DECL
40
+
41
+ /**
42
+ * Sort the repository contents in no particular ordering;
43
+ * this sorting is arbitrary, implementation-specific
44
+ * and subject to change at any time.
45
+ * This is the default sorting for new walkers.
46
+ */
47
+ #define GIT_SORT_NONE (0)
48
+
49
+ /**
50
+ * Sort the repository contents in topological order
51
+ * (parents before children); this sorting mode
52
+ * can be combined with time sorting.
53
+ */
54
+ #define GIT_SORT_TOPOLOGICAL (1 << 0)
55
+
56
+ /**
57
+ * Sort the repository contents by commit time;
58
+ * this sorting mode can be combined with
59
+ * topological sorting.
60
+ */
61
+ #define GIT_SORT_TIME (1 << 1)
62
+
63
+ /**
64
+ * Iterate through the repository contents in reverse
65
+ * order; this sorting mode can be combined with
66
+ * any of the above.
67
+ */
68
+ #define GIT_SORT_REVERSE (1 << 2)
69
+
70
+ /**
71
+ * Allocate a new revision walker to iterate through a repo.
72
+ *
73
+ * This revision walker uses a custom memory pool and an internal
74
+ * commit cache, so it is relatively expensive to allocate.
75
+ *
76
+ * For maximum performance, this revision walker should be
77
+ * reused for different walks.
78
+ *
79
+ * This revision walker is *not* thread safe: it may only be
80
+ * used to walk a repository on a single thread; however,
81
+ * it is possible to have several revision walkers in
82
+ * several different threads walking the same repository.
83
+ *
84
+ * @param walker pointer to the new revision walker
85
+ * @param repo the repo to walk through
86
+ * @return 0 on success; error code otherwise
87
+ */
88
+ GIT_EXTERN(int) git_revwalk_new(git_revwalk **walker, git_repository *repo);
89
+
90
+ /**
91
+ * Reset the revision walker for reuse.
92
+ *
93
+ * This will clear all the pushed and hidden commits, and
94
+ * leave the walker in a blank state (just like at
95
+ * creation) ready to receive new commit pushes and
96
+ * start a new walk.
97
+ *
98
+ * The revision walk is automatically reset when a walk
99
+ * is over.
100
+ *
101
+ * @param walker handle to reset.
102
+ */
103
+ GIT_EXTERN(void) git_revwalk_reset(git_revwalk *walker);
104
+
105
+ /**
106
+ * Mark a commit to start traversal from.
107
+ *
108
+ * The given OID must belong to a commit on the walked
109
+ * repository.
110
+ *
111
+ * The given commit will be used as one of the roots
112
+ * when starting the revision walk. At least one commit
113
+ * must be pushed the repository before a walk can
114
+ * be started.
115
+ *
116
+ * @param walker the walker being used for the traversal.
117
+ * @param oid the oid of the commit to start from.
118
+ * @return 0 on success; error code otherwise
119
+ */
120
+ GIT_EXTERN(int) git_revwalk_push(git_revwalk *walk, const git_oid *oid);
121
+
122
+
123
+ /**
124
+ * Mark a commit (and its ancestors) uninteresting for the output.
125
+ *
126
+ * The given OID must belong to a commit on the walked
127
+ * repository.
128
+ *
129
+ * The resolved commit and all its parents will be hidden from the
130
+ * output on the revision walk.
131
+ *
132
+ * @param walker the walker being used for the traversal.
133
+ * @param commit the commit that will be ignored during the traversal
134
+ * @return 0 on success; error code otherwise
135
+ */
136
+ GIT_EXTERN(int) git_revwalk_hide(git_revwalk *walk, const git_oid *oid);
137
+
138
+ /**
139
+ * Get the next commit from the revision walk.
140
+ *
141
+ * The initial call to this method is *not* blocking when
142
+ * iterating through a repo with a time-sorting mode.
143
+ *
144
+ * Iterating with Topological or inverted modes makes the initial
145
+ * call blocking to preprocess the commit list, but this block should be
146
+ * mostly unnoticeable on most repositories (topological preprocessing
147
+ * times at 0.3s on the git.git repo).
148
+ *
149
+ * The revision walker is reset when the walk is over.
150
+ *
151
+ * @param oid Pointer where to store the oid of the next commit
152
+ * @param walk the walker to pop the commit from.
153
+ * @return GIT_SUCCESS if the next commit was found;
154
+ * GIT_EREVWALKOVER if there are no commits left to iterate
155
+ */
156
+ GIT_EXTERN(int) git_revwalk_next(git_oid *oid, git_revwalk *walk);
157
+
158
+ /**
159
+ * Change the sorting mode when iterating through the
160
+ * repository's contents.
161
+ *
162
+ * Changing the sorting mode resets the walker.
163
+ *
164
+ * @param walk the walker being used for the traversal.
165
+ * @param sort_mode combination of GIT_SORT_XXX flags
166
+ */
167
+ GIT_EXTERN(void) git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode);
168
+
169
+ /**
170
+ * Free a revision walker previously allocated.
171
+ *
172
+ * @param walk traversal handle to close. If NULL nothing occurs.
173
+ */
174
+ GIT_EXTERN(void) git_revwalk_free(git_revwalk *walk);
175
+
176
+ /**
177
+ * Return the repository on which this walker
178
+ * is operating.
179
+ *
180
+ * @param walk the revision walker
181
+ * @return the repository being walked
182
+ */
183
+ GIT_EXTERN(git_repository *) git_revwalk_repository(git_revwalk *walk);
184
+
185
+ /** @} */
186
+ GIT_END_DECL
187
+ #endif
@@ -0,0 +1,81 @@
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_signature_h__
26
+ #define INCLUDE_git_signature_h__
27
+
28
+ #include "common.h"
29
+ #include "types.h"
30
+
31
+ /**
32
+ * @file git2/signature.h
33
+ * @brief Git signature creation
34
+ * @defgroup git_signature Git signature creation
35
+ * @ingroup Git
36
+ * @{
37
+ */
38
+ GIT_BEGIN_DECL
39
+
40
+ /**
41
+ * Create a new action signature. The signature must be freed
42
+ * manually or using git_signature_free
43
+ *
44
+ * @param name name of the person
45
+ * @param mail email of the person
46
+ * @param time time when the action happened
47
+ * @param offset timezone offset in minutes for the time
48
+ * @return the new sig, NULL on out of memory
49
+ */
50
+ GIT_EXTERN(git_signature *) git_signature_new(const char *name, const char *email, git_time_t time, int offset);
51
+
52
+ /**
53
+ * Create a new action signature with a timestamp of 'now'. The
54
+ * signature must be freed manually or using git_signature_free
55
+ *
56
+ * @param name name of the person
57
+ * @param email email of the person
58
+ * @return the new sig, NULL on out of memory
59
+ */
60
+ GIT_EXTERN(git_signature *) git_signature_now(const char *name, const char *email);
61
+
62
+
63
+ /**
64
+ * Create a copy of an existing signature.
65
+ *
66
+ * All internal strings are also duplicated.
67
+ * @param sig signature to duplicated
68
+ * @return a copy of sig, NULL on out of memory
69
+ */
70
+ GIT_EXTERN(git_signature *) git_signature_dup(const git_signature *sig);
71
+
72
+ /**
73
+ * Free an existing signature
74
+ *
75
+ * @param sig signature to free
76
+ */
77
+ GIT_EXTERN(void) git_signature_free(git_signature *sig);
78
+
79
+ /** @} */
80
+ GIT_END_DECL
81
+ #endif