indexer 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.index +54 -0
  2. data/HISTORY.md +9 -0
  3. data/README.md +145 -0
  4. data/bin/index +7 -0
  5. data/data/indexer/r2013/index.kwalify +175 -0
  6. data/data/indexer/r2013/index.yes +172 -0
  7. data/data/indexer/r2013/index.yesi +67 -0
  8. data/data/indexer/r2013/ruby.txt +35 -0
  9. data/data/indexer/r2013/yaml.txt +30 -0
  10. data/lib/indexer.rb +65 -0
  11. data/lib/indexer/attributes.rb +171 -0
  12. data/lib/indexer/command.rb +260 -0
  13. data/lib/indexer/components.rb +8 -0
  14. data/lib/indexer/components/author.rb +140 -0
  15. data/lib/indexer/components/conflict.rb +78 -0
  16. data/lib/indexer/components/copyright.rb +95 -0
  17. data/lib/indexer/components/dependency.rb +18 -0
  18. data/lib/indexer/components/organization.rb +133 -0
  19. data/lib/indexer/components/repository.rb +140 -0
  20. data/lib/indexer/components/requirement.rb +360 -0
  21. data/lib/indexer/components/resource.rb +209 -0
  22. data/lib/indexer/conversion.rb +14 -0
  23. data/lib/indexer/conversion/gemfile.rb +44 -0
  24. data/lib/indexer/conversion/gemspec.rb +114 -0
  25. data/lib/indexer/conversion/gemspec_exporter.rb +304 -0
  26. data/lib/indexer/core_ext.rb +4 -0
  27. data/lib/indexer/error.rb +23 -0
  28. data/lib/indexer/gemfile.rb +75 -0
  29. data/lib/indexer/importer.rb +144 -0
  30. data/lib/indexer/importer/file.rb +94 -0
  31. data/lib/indexer/importer/gemfile.rb +27 -0
  32. data/lib/indexer/importer/gemspec.rb +43 -0
  33. data/lib/indexer/importer/html.rb +289 -0
  34. data/lib/indexer/importer/markdown.rb +45 -0
  35. data/lib/indexer/importer/ruby.rb +47 -0
  36. data/lib/indexer/importer/version.rb +38 -0
  37. data/lib/indexer/importer/yaml.rb +46 -0
  38. data/lib/indexer/loadable.rb +159 -0
  39. data/lib/indexer/metadata.rb +879 -0
  40. data/lib/indexer/model.rb +237 -0
  41. data/lib/indexer/revision.rb +43 -0
  42. data/lib/indexer/valid.rb +287 -0
  43. data/lib/indexer/validator.rb +313 -0
  44. data/lib/indexer/version/constraint.rb +124 -0
  45. data/lib/indexer/version/exceptions.rb +11 -0
  46. data/lib/indexer/version/number.rb +497 -0
  47. metadata +141 -0
data/.index ADDED
@@ -0,0 +1,54 @@
1
+ ---
2
+ type: ruby
3
+ revision: 2013
4
+ sources:
5
+ - README.md
6
+ authors:
7
+ - name: trans
8
+ email: transfire@gmail.com
9
+ website: http://trans.gihub.com/
10
+ - name: postmodern
11
+ website: http://postmodern.github.com/
12
+ organizations: []
13
+ requirements:
14
+ - version: 1.5+
15
+ name: nokogiri
16
+ - version: 2.0+
17
+ name: redcarpet
18
+ - groups:
19
+ - test
20
+ version: 2.9+
21
+ development: true
22
+ name: qed
23
+ - groups:
24
+ - test
25
+ version: 0+
26
+ development: true
27
+ name: ae
28
+ conflicts: []
29
+ alternatives: []
30
+ resources:
31
+ - type: home
32
+ uri: http://rubyworks.github.com/indexer
33
+ label: Homepage
34
+ - type: code
35
+ uri: http://github.com/rubyworks/indexer
36
+ label: Source Code
37
+ - type: api
38
+ uri: http://rubydoc.info/gems/indexer/frames
39
+ label: API Reference
40
+ repositories: []
41
+ categories:
42
+ - metadata
43
+ load_path:
44
+ - lib
45
+ copyrights:
46
+ - holder: Rubyworks
47
+ year: '2012'
48
+ license: BSD-2-Clause
49
+ version: 0.1.0
50
+ summary: Enable Your Project's Metadata
51
+ description: Indexer provides projects with a universal metadata format.
52
+ name: indexer
53
+ title: Indexer
54
+ date: '2012-12-09'
@@ -0,0 +1,9 @@
1
+ # RELEASE HISTORY
2
+
3
+ ## 0.1.0 / 2012-12-08
4
+
5
+ Initial release of Indexer.
6
+
7
+ Changes:
8
+
9
+ * All of them ;)
@@ -0,0 +1,145 @@
1
+ # <span class="ititle">Indexer</span> (v<span class="iversion">0.1.0</span>)
2
+
3
+ <b class="isummary">Enable Your Project's Metadata<b>
4
+
5
+ [![Build Status](https://secure.travis-ci.org/rubyworks/indexer.png)](http://travis-ci.org/rubyworks/indexer)
6
+
7
+
8
+ ## Description
9
+
10
+ <p class="idescription">Indexer provides projects with a universal metadata format.</p>
11
+
12
+ Indexer defines a *canonical*, detailed and strict, project <span class="icategory">metadata</span> specification.
13
+ The strictness of the specification makes the format simple enough for developers to use without an intermediate API.
14
+ Although Indexer also provides a convenience API for working with the specification and its data
15
+ more loosely when suitable to the usecase. Indexer also specifies a stanadard location for canonized
16
+ metadata to be kept, in a `.index` file.
17
+
18
+ Indexer provides a tool to import metadata from external sources. Indexer can handle a variety of metadata
19
+ source formats, including YAML, HTML Microformats and Ruby DSL scripts.
20
+
21
+
22
+ ## Installation
23
+
24
+ Indexer is a Ruby application, so as long as you have Ruby installed, it is easy to install Indexer via RubyGems.
25
+
26
+ $ gem install indexer
27
+
28
+
29
+ ## Instruction
30
+
31
+ Indexer is capable of generating a canonical `.index` file from a variety of sources. Being so flexiable, exactly
32
+ how a developer descides to store a project's metadata is a largely a matter of taste. But in general there are
33
+ three overall approaches:
34
+
35
+ 1. Specify the metadata using microformats in a project's README file.
36
+ 2. Specify the metadata in one or more static files, often a single YAML file.
37
+ 3. Construct the metadata via a Ruby DSL, customizing the generation in any way.
38
+
39
+ The first choice is, in many respects, the nicest because it does not require any additional files be added
40
+ to a project and it helps to ensure a good README file. On the downside, it requires some HTML be hand-coded
41
+ into the README.
42
+
43
+ The second approach is a great option in the it is the easiest. One can quickly put together a YAML document
44
+ covering a project's metadata. Since Indexer is very flexible in it's parsing of the YAML, it really is a
45
+ quick and user-friendly way to go. Typically this file will be called `Index.yml`, but there is no name
46
+ requirement. In fact, Indexer will let you split the metadata up over mutliple files, and even use a whole
47
+ directory of files, one per field.
48
+
49
+ The last approach provides maximum flexablity. Using the Ruby DSL one can literally script the metadata,
50
+ which means it can come from anywhere at all. For example, you might want to pull the project's version
51
+ from the `lib/project/version.rb` file, i.e. Bundler style. The DSL is as intutive and as flexible as
52
+ using plain YAML, so it's nearly as easy to take this approach. By convention this file is called `Indexfile`
53
+ or `Index.rb`, but it too can be any file path one prefers.
54
+
55
+ On the Indexer wiki you can find detailed tutorials on a variety of setups, along with thier pros and cons.
56
+
57
+ As an example of getting started, lets say we want to customize our index metadata via a YAML file,
58
+ but we want to keep the version information is a separate `VERSION` file. That's a common layout so Indexer
59
+ is designed to handle it out of the box. First create the `VERSION` file.
60
+
61
+ $ echo '0.1.0' > VERSION
62
+
63
+ Next we need our YAML file. Indexer makes out life easier by offering us some template generation for
64
+ common approaches. In this case we use the `-g/--generate` command option, specifying that we want an
65
+ `Index.yml`.
66
+
67
+ $ index --generate Index.yml
68
+
69
+ Now we can edit the `Index.yaml` file to suite our project.
70
+
71
+ $ vim Index.yml
72
+
73
+ Once we have the source files setup, its easy to build the canonical `.index` file using the `index`
74
+ command line interface. We can simply issue the `index` command with the `-u/--using` command option:
75
+
76
+ $ index --using VERSION Index.yml
77
+
78
+ Indexer will utilize both sources and create the `.index` file.
79
+
80
+ Over time project metadata tends to evolve and change. To keep the canoncial `.index` file up to date simply
81
+ call the `index` command without any options.
82
+
83
+ $ index
84
+
85
+ By default the `.index` file will not be updated if it has a modification time newer than its source files.
86
+ If need be, use the `-f/--force` option to override this.
87
+
88
+ That's the quick "one two". For more information on using Indexer, see the Wiki, API documentation, QED specifications
89
+ and the Manpages.
90
+
91
+
92
+ ## Resources
93
+
94
+ <ul>
95
+ <li><a class="iresource" href="http://rubyworks.github.com/indexer" name="home">Homepage</a></li>
96
+ <li><a class="iresource" href="http://github.com/rubyworks/indexer" name="code">Source Code</a> (Github)</li>
97
+ <li><a class="iresource" href="http://rubydoc.info/gems/indexer/frames" name="docs">API Reference</a></li>
98
+ <li><a class="irepository" href="http://github.com/rubyworks/indexer/indexer.git" name="upstream">Master Git Repo</a></li>
99
+ </ul>
100
+
101
+
102
+ ## Requirements
103
+
104
+ <ul>
105
+ <li class="irequirement">
106
+ <a class="name" href="http://nokogiri.org/">nokogiri</a> <span class="version">1.5+</span></span>
107
+ </li>
108
+ <li class="irequirement">
109
+ <a class="name" href="https://github.com/vmg/redcarpet">redcarpet</a> <span class="version">2.0+</span></span>
110
+ </li>
111
+ <li class="irequirement">
112
+ <a class="name" href="http://rubyworks.github.com/qed/">qed</a> <span class="version">2.9+</span> <span class="groups">(test)</span>
113
+ </li>
114
+ <li class="irequirement">
115
+ <a class="name" href="http://rubyworks.github.com/ae/">ae</a> <span class="version"></span> <span class="groups">(test)</span>
116
+ </li>
117
+ </ul>
118
+
119
+
120
+ ## Authors
121
+
122
+ <ul>
123
+ <li class="iauthor vcard">
124
+ <div class="nickname">trans</div>
125
+ <div><a class="email" href="mailto:transfire@gmail.com">transfire@gmail.com</a></div>
126
+ <div><a class="url" href="http://trans.gihub.com/">http://trans.github.com/</a></div>
127
+ </li>
128
+ <li class="iauthor vcard">
129
+ <div class="nickname">postmodern</div>
130
+ <div><a class="url" href="http://postmodern.github.com/">http://postmodern.github.com/</a></div>
131
+ </li>
132
+ </ul>
133
+
134
+
135
+ ## Copyrights
136
+
137
+ <ul>
138
+ <li class="icopyright">
139
+ &copy; <span class="year">2012</span> <span class="holder">Rubyworks</span>
140
+ <div class="license">
141
+ <a href="http://www.spdx.org/licenses/BSD-2-Clause" rel="license">BSD-2-Clause License</a>
142
+ </div>
143
+ </li>
144
+ <ul>
145
+
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ #require 'indexer/cli/index'
3
+ #Indexer::CLI::Index.execute
4
+
5
+ require 'indexer'
6
+ Indexer::Command.run
7
+
@@ -0,0 +1,175 @@
1
+ ---
2
+ type: map
3
+ mapping:
4
+ revision
5
+ type: int
6
+ required: true
7
+ name:
8
+ type: str
9
+ pattern: /^\w+$/ # package name
10
+ required: true
11
+ version:
12
+ type: str
13
+ pattern: /^\d(\.\w+)*/
14
+ required: true
15
+ codename:
16
+ type: str
17
+ pattern: /[^\n]/ # no newline
18
+ title
19
+ type: str
20
+ pattern: /[^\n]/ # no newline
21
+ date:
22
+ type: str
23
+ pattern: /^\d{4}-\d{2}-\d{2}(\d{2}){0,3}$/ # utc date
24
+ created:
25
+ type: str
26
+ pattern: /^\d{4}-\d{2}-\d{2}(\d{2}){0,3}$/ # utc date
27
+ summary:
28
+ type: str
29
+ pattern: /[^\n]/ # no newline
30
+ description:
31
+ type: str
32
+ authors:
33
+ type: seq
34
+ sequence:
35
+ - type: map
36
+ mapping:
37
+ name:
38
+ type: str
39
+ email:
40
+ type: str
41
+ pattern: /@/
42
+ url:
43
+ type: str
44
+ role:
45
+ type: seq
46
+ suite:
47
+ type: str
48
+ pattern: /[^\n]/ # no newline
49
+ organization:
50
+ type: str
51
+ pattern: /[^\n]/ # no newline
52
+ copyright:
53
+ type: seq
54
+ sequence:
55
+ - type: map
56
+ mapping:
57
+ holder:
58
+ type: str
59
+ pattern: /[^\n]/ # no newline
60
+ year:
61
+ type: str
62
+ pattern: /^\d{4}([-,]^\d{4})?$/
63
+ license:
64
+ type: str
65
+ pattern: /[^\n]/ # no newline
66
+ requirements: &requirements
67
+ type: seq
68
+ sequence:
69
+ - type: map
70
+ mapping:
71
+ name:
72
+ type: str
73
+ pattern: /[^\n]/ # no newline
74
+ version:
75
+ type: seq
76
+ sequence:
77
+ - type: str
78
+ pattern: /^\d(\.\w+)*/
79
+ group:
80
+ type: seq
81
+ sequence:
82
+ - type: str
83
+ pattern: /[^\n]/ # no newline
84
+ development:
85
+ type: bool
86
+ optional:
87
+ type: bool
88
+ engine:
89
+ type: seq
90
+ sequence:
91
+ - type: map
92
+ mapping:
93
+ name:
94
+ type: str
95
+ pattern: /[^\n]/ # no newline
96
+ version:
97
+ type: str
98
+ pattern: /^\d/
99
+ platform:
100
+ type: seq
101
+ sequence:
102
+ - type: str
103
+ pattern: /[^\n]/ # no newline
104
+ repository:
105
+ - type: map
106
+ mapping:
107
+ url:
108
+ type: str
109
+ pattern: /[^\n]/ # url
110
+ scm:
111
+ type: str
112
+ pattern: /[^\n]/ # no newline
113
+ dependencies: *requirements
114
+ conflicts:
115
+ type: seq
116
+ sequence:
117
+ - type: map
118
+ mapping:
119
+ name:
120
+ type: str
121
+ pattern: /^\w+$/ # package name
122
+ version:
123
+ type: seq
124
+ sequence:
125
+ - type: str
126
+ pattern: /[^\n]/ # version constraint
127
+ substitues:
128
+ type: seq
129
+ sequence:
130
+ - type: str
131
+ pattern: /^\w+$/ # package name
132
+ replaces:
133
+ type: seq
134
+ sequence:
135
+ - type: str
136
+ pattern: /^\w+$/ # package name
137
+
138
+ resources:
139
+ type: seq
140
+ sequence:
141
+ - type: map
142
+ mapping:
143
+ id:
144
+ type: str
145
+ pattern: /[^\n]/ # no newline
146
+ url:
147
+ type: str
148
+ pattern: // # url
149
+ required: true
150
+ repositories:
151
+ type: seq
152
+ sequence:
153
+ - type: map
154
+ mapping:
155
+ id:
156
+ type: str
157
+ pattern: /[^\n]/ # no newline
158
+ url:
159
+ type: str
160
+ pattern: // # url
161
+ required: true
162
+ scm:
163
+ type: str
164
+ pattern: /^\w$/ # word
165
+ load_path:
166
+ type: seq
167
+ sequence:
168
+ - type: str
169
+ pattern: /\S/ # path
170
+ default: [lib]
171
+ install_message:
172
+ type: str
173
+ extra:
174
+ type: map
175
+
@@ -0,0 +1,172 @@
1
+ ---
2
+ revision:
3
+ type: int
4
+ required: true
5
+ name:
6
+ type: str
7
+ regexp: /^\w+$/ # package name
8
+ required: true
9
+ version:
10
+ type: str
11
+ regexp: /^\d(\.\w+)*/
12
+ required: true
13
+ codename:
14
+ type: str
15
+ regexp: /[^\n]/ # no newline
16
+ title
17
+ type: str
18
+ regexp: /[^\n]/ # no newline
19
+ date:
20
+ type: str
21
+ pic: &pic-date 9999-99-99[ 99:99:99]
22
+ created:
23
+ type: str
24
+ pic: &pic-date
25
+ summary:
26
+ type: str
27
+ regexp: /[^\n]/ # no newline
28
+ description:
29
+ type: str
30
+ authors:
31
+ type: seq
32
+ value:
33
+ type: map
34
+ mapping:
35
+ name:
36
+ type: str
37
+ email:
38
+ type: str
39
+ regexp: /@/
40
+ url:
41
+ type: str
42
+ roles:
43
+ type: seq
44
+ suite:
45
+ type: str
46
+ regexp: /[^\n]/ # no newline
47
+ organization:
48
+ type: str
49
+ regexp: /[^\n]/ # no newline
50
+ copyrights:
51
+ type: seq
52
+ value:
53
+ type: map
54
+ template:
55
+ holder:
56
+ type: str
57
+ regexp: /[^\n]/ # no newline
58
+ year:
59
+ type: str
60
+ regexp: /^\d{4}([-,]^\d{4})?$/
61
+ license:
62
+ type: str
63
+ regexp: /[^\n]/ # no newline
64
+ requirements: &requirements
65
+ type: seq
66
+ value:
67
+ type: map
68
+ template:
69
+ name:
70
+ type: str
71
+ regexp: /[^\n]/ # no newline
72
+ version:
73
+ type: seq
74
+ value:
75
+ type: str
76
+ regexp: /^\d(\.\w+)*/
77
+ groups:
78
+ type: seq
79
+ value:
80
+ type: str
81
+ regexp: /[^\n]/ # no newline
82
+ development:
83
+ type: bool
84
+ optional:
85
+ type: bool
86
+ engine:
87
+ type: seq
88
+ value:
89
+ type: map
90
+ template:
91
+ name:
92
+ type: str
93
+ regexp: /[^\n]/ # no newline
94
+ version:
95
+ type: str
96
+ regexp: /^\d/
97
+ platform:
98
+ type: seq
99
+ value:
100
+ type: str
101
+ regexp: /[^\n]/ # no newline
102
+ repository:
103
+ type: map
104
+ template:
105
+ url:
106
+ type: str
107
+ regexp: /[^\n]/ # url
108
+ scm:
109
+ type: str
110
+ regexp: /[^\n]/ # no newline
111
+ dependencies: *requirements
112
+ conflicts:
113
+ type: seq
114
+ value:
115
+ type: map
116
+ map:
117
+ name:
118
+ type: str
119
+ regexp: /^\w+$/ # package name
120
+ version:
121
+ type: seq
122
+ value:
123
+ type: str
124
+ regexp: /[^\n]/ # version constraint
125
+ substitues:
126
+ type: seq
127
+ value:
128
+ type: str
129
+ regexp: /^\w+$/ # package name
130
+ replaces:
131
+ type: seq
132
+ value:
133
+ type: str
134
+ regexp: /^\w+$/ # package name
135
+ resources:
136
+ type: seq
137
+ value:
138
+ type: map
139
+ map:
140
+ name:
141
+ type: str
142
+ regexp: /[^\n]/ # no newline
143
+ uri:
144
+ type: str
145
+ regexp: /^http/ # url/irc
146
+ required: true
147
+ repositories:
148
+ type: seq
149
+ value:
150
+ type: map
151
+ map:
152
+ name:
153
+ type: str
154
+ regexp: /[^\n]/ # no newline
155
+ url:
156
+ type: str
157
+ regexp: // # url
158
+ required: true
159
+ scm:
160
+ type: str
161
+ regexp: /^\w$/ # word
162
+ load_path:
163
+ type: seq
164
+ value:
165
+ type: str
166
+ regexp: /\S/ # path
167
+ default: [lib]
168
+ install_message:
169
+ type: str
170
+ extra:
171
+ type: map
172
+