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,162 @@
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_types_h__
26
+ #define INCLUDE_git_types_h__
27
+
28
+ /**
29
+ * @file git2/types.h
30
+ * @brief libgit2 base & compatibility types
31
+ * @ingroup Git
32
+ * @{
33
+ */
34
+ GIT_BEGIN_DECL
35
+
36
+ /**
37
+ * Cross-platform compatibility types for off_t / time_t
38
+ *
39
+ * NOTE: This needs to be in a public header so that both the library
40
+ * implementation and client applications both agree on the same types.
41
+ * Otherwise we get undefined behavior.
42
+ *
43
+ * Use the "best" types that each platform provides. Currently we truncate
44
+ * these intermediate representations for compatibility with the git ABI, but
45
+ * if and when it changes to support 64 bit types, our code will naturally
46
+ * adapt.
47
+ * NOTE: These types should match those that are returned by our internal
48
+ * stat() functions, for all platforms.
49
+ */
50
+ #include <sys/types.h>
51
+
52
+ #if defined(_MSC_VER)
53
+
54
+ typedef __int64 git_off_t;
55
+ typedef __time64_t git_time_t;
56
+
57
+ #elif defined(__MINGW32__)
58
+
59
+ typedef off64_t git_off_t;
60
+ typedef __time64_t git_time_t;
61
+
62
+ #else /* POSIX */
63
+
64
+ /*
65
+ * Note: Can't use off_t since if a client program includes <sys/types.h>
66
+ * before us (directly or indirectly), they'll get 32 bit off_t in their client
67
+ * app, even though /we/ define _FILE_OFFSET_BITS=64.
68
+ */
69
+ typedef int64_t git_off_t;
70
+ typedef int64_t git_time_t;
71
+
72
+ #endif
73
+
74
+ /** Basic type (loose or packed) of any Git object. */
75
+ typedef enum {
76
+ GIT_OBJ_ANY = -2, /**< Object can be any of the following */
77
+ GIT_OBJ_BAD = -1, /**< Object is invalid. */
78
+ GIT_OBJ__EXT1 = 0, /**< Reserved for future use. */
79
+ GIT_OBJ_COMMIT = 1, /**< A commit object. */
80
+ GIT_OBJ_TREE = 2, /**< A tree (directory listing) object. */
81
+ GIT_OBJ_BLOB = 3, /**< A file revision object. */
82
+ GIT_OBJ_TAG = 4, /**< An annotated tag object. */
83
+ GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */
84
+ GIT_OBJ_OFS_DELTA = 6, /**< A delta, base is given by an offset. */
85
+ GIT_OBJ_REF_DELTA = 7, /**< A delta, base is given by object id. */
86
+ } git_otype;
87
+
88
+ /** An open object database handle. */
89
+ typedef struct git_odb git_odb;
90
+
91
+ /** A custom backend in an ODB */
92
+ typedef struct git_odb_backend git_odb_backend;
93
+
94
+ /** An object read from the ODB */
95
+ typedef struct git_odb_object git_odb_object;
96
+
97
+ /** A stream to read/write from the ODB */
98
+ typedef struct git_odb_stream git_odb_stream;
99
+
100
+ /**
101
+ * Representation of an existing git repository,
102
+ * including all its object contents
103
+ */
104
+ typedef struct git_repository git_repository;
105
+
106
+ /** Representation of a generic object in a repository */
107
+ typedef struct git_object git_object;
108
+
109
+ /** Representation of an in-progress walk through the commits in a repo */
110
+ typedef struct git_revwalk git_revwalk;
111
+
112
+ /** Parsed representation of a tag object. */
113
+ typedef struct git_tag git_tag;
114
+
115
+ /** In-memory representation of a blob object. */
116
+ typedef struct git_blob git_blob;
117
+
118
+ /** Parsed representation of a commit object. */
119
+ typedef struct git_commit git_commit;
120
+
121
+ /** Representation of each one of the entries in a tree object. */
122
+ typedef struct git_tree_entry git_tree_entry;
123
+
124
+ /** Representation of a tree object. */
125
+ typedef struct git_tree git_tree;
126
+
127
+ /** Constructor for in-memory trees */
128
+ typedef struct git_treebuilder git_treebuilder;
129
+
130
+ /** Memory representation of an index file. */
131
+ typedef struct git_index git_index;
132
+
133
+ /** Time in a signature */
134
+ typedef struct git_time {
135
+ git_time_t time; /** time in seconds from epoch */
136
+ int offset; /** timezone offset, in minutes */
137
+ } git_time;
138
+
139
+ /** An action signature (e.g. for committers, taggers, etc) */
140
+ typedef struct git_signature {
141
+ char *name; /** full name of the author */
142
+ char *email; /** email of the author */
143
+ git_time when; /** time when the action happened */
144
+ } git_signature;
145
+
146
+ /** In-memory representation of a reference. */
147
+ typedef struct git_reference git_reference;
148
+
149
+ /** Basic type of any Git reference. */
150
+ typedef enum {
151
+ GIT_REF_INVALID = 0, /** Invalid reference */
152
+ GIT_REF_OID = 1, /** A reference which points at an object id */
153
+ GIT_REF_SYMBOLIC = 2, /** A reference which points at another reference */
154
+ GIT_REF_PACKED = 4,
155
+ GIT_REF_HAS_PEEL = 8,
156
+ GIT_REF_LISTALL = GIT_REF_OID|GIT_REF_SYMBOLIC|GIT_REF_PACKED,
157
+ } git_rtype;
158
+
159
+ /** @} */
160
+ GIT_END_DECL
161
+
162
+ #endif
@@ -0,0 +1,58 @@
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_zlib_h__
26
+ #define INCLUDE_git_zlib_h__
27
+
28
+ #include <zlib.h>
29
+
30
+ /**
31
+ * @file git2/zlib.h
32
+ * @brief Git data compression routines
33
+ * @defgroup git_zlib Git data compression routines
34
+ * @ingroup Git
35
+ * @{
36
+ */
37
+ GIT_BEGIN_DECL
38
+
39
+ #if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200
40
+ /**
41
+ * deflateBound returns an upper bound on the compressed size.
42
+ *
43
+ * This is a stub function used when zlib does not supply the
44
+ * deflateBound() implementation itself.
45
+ *
46
+ * @param stream the stream pointer.
47
+ * @param s total length of the source data (in bytes).
48
+ * @return maximum length of the compressed data.
49
+ */
50
+ GIT_INLINE(size_t) deflateBound(z_streamp stream, size_t s)
51
+ {
52
+ return (s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11);
53
+ }
54
+ #endif
55
+
56
+ /** @} */
57
+ GIT_END_DECL
58
+ #endif
data/test/repo_test.rb ADDED
@@ -0,0 +1,101 @@
1
+ require File.expand_path "../test_helper", __FILE__
2
+ require 'base64'
3
+
4
+ context "Docurium Header Parsing" do
5
+ setup do
6
+ @path = File.dirname(__FILE__) + '/fixtures/git2/api.docurium'
7
+ @doc = Docurium.new(@path)
8
+ Dir.chdir(File.dirname(@path)) do
9
+ @doc.parse_headers
10
+ end
11
+ @data = @doc.data
12
+ end
13
+
14
+ test "can parse header files" do
15
+ keys = @data.keys.map { |k| k.to_s }.sort
16
+ assert_equal ['files', 'functions', 'globals', 'groups', 'prefix', 'types'], keys
17
+ assert_equal 150, @data[:functions].size
18
+ end
19
+
20
+ test "can extract globals" do
21
+ assert_equal 55, @data[:globals].size
22
+ entry = @data[:globals]['GIT_IDXENTRY_EXTENDED2']
23
+ assert_equal "index.h", entry[:file]
24
+ assert_equal 73, entry[:line]
25
+ end
26
+
27
+ test "can extract structs and enums" do
28
+ assert_equal 25, @data[:types].size
29
+ end
30
+
31
+ test "can parse sequential sigs" do
32
+ func = @data[:functions]['git_odb_backend_pack']
33
+ assert_equal 'const char *', func[:args][1][:type]
34
+ func = @data[:functions]['git_odb_backend_loose']
35
+ assert_equal 'const char *', func[:args][1][:type]
36
+ end
37
+
38
+ test "can find type usage" do
39
+ oid = @data[:types].assoc('git_oid')
40
+ assert_equal 10, oid[1][:used][:returns].size
41
+ assert_equal 39, oid[1][:used][:needs].size
42
+ end
43
+
44
+ test "can parse normal functions" do
45
+ func = @data[:functions]['git_blob_rawcontent']
46
+ assert_equal 'Get a read-only buffer with the raw content of a blob.', func[:description]
47
+ assert_equal 'const void *', func[:return][:type]
48
+ assert_equal 'the pointer; NULL if the blob has no contents', func[:return][:comment]
49
+ assert_equal 73, func[:line]
50
+ assert_equal 84, func[:lineto]
51
+ assert_equal 'blob.h', func[:file]
52
+ assert_equal 'git_blob *blob',func[:argline]
53
+ assert_equal 'blob', func[:args][0][:name]
54
+ assert_equal 'git_blob *', func[:args][0][:type]
55
+ assert_equal 'pointer to the blob', func[:args][0][:comment]
56
+ end
57
+
58
+ test "can parse defined functions" do
59
+ func = @data[:functions]['git_tree_lookup']
60
+ assert_equal 'int', func[:return][:type]
61
+ assert_equal '0 on success; error code otherwise', func[:return][:comment]
62
+ assert_equal 42, func[:line]
63
+ assert_equal 'tree.h', func[:file]
64
+ assert_equal 'id', func[:args][2][:name]
65
+ assert_equal 'const git_oid *', func[:args][2][:type]
66
+ assert_equal 'identity of the tree to locate.', func[:args][2][:comment]
67
+ end
68
+
69
+ test "can parse function cast args" do
70
+ func = @data[:functions]['git_reference_listcb']
71
+ assert_equal 'int', func[:return][:type]
72
+ assert_equal '0 on success; error code otherwise', func[:return][:comment]
73
+ assert_equal 301, func[:line]
74
+ assert_equal 'refs.h', func[:file]
75
+ assert_equal 'repo', func[:args][0][:name]
76
+ assert_equal 'git_repository *', func[:args][0][:type]
77
+ assert_equal 'list_flags', func[:args][1][:name]
78
+ assert_equal 'unsigned int', func[:args][1][:type]
79
+ assert_equal 'callback', func[:args][2][:name]
80
+ assert_equal 'int(*)(const char *, void *)', func[:args][2][:type]
81
+ assert_equal 'Function which will be called for every listed ref', func[:args][2][:comment]
82
+ assert_equal 8, func[:comments].split("\n").size
83
+ end
84
+
85
+ test "can get the full description from multi liners" do
86
+ func = @data[:functions]['git_commit_create_o']
87
+ desc = "Create a new commit in the repository using `git_object` instances as parameters."
88
+ assert_equal desc, func[:description]
89
+ end
90
+
91
+ test "can group functions" do
92
+ assert_equal 15, @data[:groups].size
93
+ group, funcs = @data[:groups].first
94
+ assert_equal 'blob', group
95
+ assert_equal 6, funcs.size
96
+ end
97
+
98
+ test "can parse data structures" do
99
+ end
100
+
101
+ end
@@ -0,0 +1,29 @@
1
+ dir = File.dirname(File.expand_path(__FILE__))
2
+ $LOAD_PATH.unshift dir + '/../lib'
3
+ $TESTING = true
4
+ require 'test/unit'
5
+ require 'rubygems'
6
+ require 'docurium'
7
+ require 'pp'
8
+
9
+ ##
10
+ # test/spec/mini 3
11
+ # http://gist.github.com/25455
12
+ # chris@ozmm.org
13
+ #
14
+ def context(*args, &block)
15
+ return super unless (name = args.first) && block
16
+ require 'test/unit'
17
+ klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do
18
+ def self.test(name, &block)
19
+ define_method("test_#{name.gsub(/\W/,'_')}", &block) if block
20
+ end
21
+ def self.xtest(*args) end
22
+ def self.setup(&block) define_method(:setup, &block) end
23
+ def self.teardown(&block) define_method(:teardown, &block) end
24
+ end
25
+ (class << klass; self end).send(:define_method, :name) { name.gsub(/\W/,'_') }
26
+ klass.class_eval &block
27
+ ($contexts ||= []) << klass # make sure klass doesn't get GC'd
28
+ klass
29
+ end
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: docurium
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Scott Chacon
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-06-13 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: version_sorter
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 19
30
+ segments:
31
+ - 1
32
+ - 1
33
+ - 0
34
+ version: 1.1.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: bundler
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 15
46
+ segments:
47
+ - 1
48
+ - 0
49
+ version: "1.0"
50
+ type: :development
51
+ version_requirements: *id002
52
+ description: A simpler, prettier Doxygen replacement.
53
+ email:
54
+ - schacon@gmail.com
55
+ executables:
56
+ - cm
57
+ extensions: []
58
+
59
+ extra_rdoc_files: []
60
+
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENCE
65
+ - README.md
66
+ - TODO.txt
67
+ - bin/cm
68
+ - docurium.gemspec
69
+ - lib/docurium.rb
70
+ - lib/docurium/cli.rb
71
+ - site/css/style.css
72
+ - site/images/search_icon.png
73
+ - site/index.html
74
+ - site/js/backbone.js
75
+ - site/js/docurium.js
76
+ - site/js/json2.js
77
+ - site/js/underscore.js
78
+ - site/shared/css/documentation.css
79
+ - site/shared/css/pygments.css
80
+ - site/shared/images/active-arrow.png
81
+ - site/shared/images/background-v2.png
82
+ - site/shared/images/background-white.png
83
+ - site/shared/images/dropdown_sprites.jpg
84
+ - site/shared/images/footer_logo.png
85
+ - site/shared/images/logo.png
86
+ - site/shared/images/nav-rule.png
87
+ - site/shared/images/next_step_arrow.gif
88
+ - site/shared/images/qmark.png
89
+ - site/shared/js/documentation.js
90
+ - site/shared/js/jquery.js
91
+ - test/fixtures/git2/api.docurium
92
+ - test/fixtures/git2/blob.h
93
+ - test/fixtures/git2/commit.h
94
+ - test/fixtures/git2/common.h
95
+ - test/fixtures/git2/errors.h
96
+ - test/fixtures/git2/index.h
97
+ - test/fixtures/git2/object.h
98
+ - test/fixtures/git2/odb.h
99
+ - test/fixtures/git2/odb_backend.h
100
+ - test/fixtures/git2/oid.h
101
+ - test/fixtures/git2/refs.h
102
+ - test/fixtures/git2/repository.h
103
+ - test/fixtures/git2/revwalk.h
104
+ - test/fixtures/git2/signature.h
105
+ - test/fixtures/git2/tag.h
106
+ - test/fixtures/git2/thread-utils.h
107
+ - test/fixtures/git2/tree.h
108
+ - test/fixtures/git2/types.h
109
+ - test/fixtures/git2/zlib.h
110
+ - test/repo_test.rb
111
+ - test/test_helper.rb
112
+ has_rdoc: true
113
+ homepage: http://github.com/schacon/docurium
114
+ licenses: []
115
+
116
+ post_install_message:
117
+ rdoc_options: []
118
+
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ hash: 3
127
+ segments:
128
+ - 0
129
+ version: "0"
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ hash: 3
136
+ segments:
137
+ - 0
138
+ version: "0"
139
+ requirements: []
140
+
141
+ rubyforge_project: docurium
142
+ rubygems_version: 1.3.7
143
+ signing_key:
144
+ specification_version: 3
145
+ summary: A simpler, prettier Doxygen replacement.
146
+ test_files:
147
+ - test/fixtures/git2/api.docurium
148
+ - test/fixtures/git2/blob.h
149
+ - test/fixtures/git2/commit.h
150
+ - test/fixtures/git2/common.h
151
+ - test/fixtures/git2/errors.h
152
+ - test/fixtures/git2/index.h
153
+ - test/fixtures/git2/object.h
154
+ - test/fixtures/git2/odb.h
155
+ - test/fixtures/git2/odb_backend.h
156
+ - test/fixtures/git2/oid.h
157
+ - test/fixtures/git2/refs.h
158
+ - test/fixtures/git2/repository.h
159
+ - test/fixtures/git2/revwalk.h
160
+ - test/fixtures/git2/signature.h
161
+ - test/fixtures/git2/tag.h
162
+ - test/fixtures/git2/thread-utils.h
163
+ - test/fixtures/git2/tree.h
164
+ - test/fixtures/git2/types.h
165
+ - test/fixtures/git2/zlib.h
166
+ - test/repo_test.rb
167
+ - test/test_helper.rb