icss 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +3 -0
- data/.watchr +20 -0
- data/CHANGELOG.textile +8 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +34 -0
- data/LICENSE.textile +20 -0
- data/README.textile +19 -0
- data/Rakefile +43 -0
- data/VERSION +1 -0
- data/examples/BulkData.avpr +21 -0
- data/examples/complicated.icss.yaml +158 -0
- data/examples/interop.avsc +32 -0
- data/examples/mail.avpr +20 -0
- data/examples/namespace.avpr +28 -0
- data/examples/org/apache/avro/ipc/HandshakeRequest.avsc +11 -0
- data/examples/org/apache/avro/ipc/HandshakeResponse.avsc +15 -0
- data/examples/org/apache/avro/ipc/trace/avroTrace.avdl +64 -0
- data/examples/org/apache/avro/ipc/trace/avroTrace.avpr +82 -0
- data/examples/org/apache/avro/mapred/tether/InputProtocol.avpr +59 -0
- data/examples/org/apache/avro/mapred/tether/OutputProtocol.avpr +75 -0
- data/examples/simple.avpr +70 -0
- data/examples/weather.avsc +9 -0
- data/icss.gemspec +104 -0
- data/icss_specification.textile +370 -0
- data/init.rb +3 -0
- data/lib/icss.rb +19 -0
- data/lib/icss/brevity.rb +136 -0
- data/lib/icss/code_asset.rb +16 -0
- data/lib/icss/core_ext.rb +4 -0
- data/lib/icss/data_asset.rb +22 -0
- data/lib/icss/message.rb +72 -0
- data/lib/icss/old.rb +96 -0
- data/lib/icss/protocol.rb +138 -0
- data/lib/icss/protocol_set.rb +48 -0
- data/lib/icss/sample_message_call.rb +140 -0
- data/lib/icss/target.rb +71 -0
- data/lib/icss/type.rb +517 -0
- data/lib/icss/type/factory.rb +196 -0
- data/lib/icss/validations.rb +16 -0
- data/lib/icss/view_helper.rb +28 -0
- data/spec/icss_spec.rb +7 -0
- data/spec/spec_helper.rb +31 -0
- metadata +218 -0
data/.document
ADDED
data/.rspec
ADDED
data/.watchr
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
def run_spec(file)
|
4
|
+
unless File.exist?(file)
|
5
|
+
puts "#{file} does not exist"
|
6
|
+
return
|
7
|
+
end
|
8
|
+
|
9
|
+
puts "Running #{file}"
|
10
|
+
system "bundle exec rspec #{file}"
|
11
|
+
puts
|
12
|
+
end
|
13
|
+
|
14
|
+
watch("spec/.*/*_spec\.rb") do |match|
|
15
|
+
run_spec match[0]
|
16
|
+
end
|
17
|
+
|
18
|
+
watch("app/(.*)\.rb") do |match|
|
19
|
+
run_spec %{spec/#{match[1]}_spec.rb}
|
20
|
+
end
|
data/CHANGELOG.textile
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem 'yajl-ruby', "~> 0.8.2"
|
7
|
+
gem 'gorillib', "~> 0.0.7"
|
8
|
+
|
9
|
+
# Add dependencies to develop your gem here.
|
10
|
+
# Include everything needed to run rake, tests, features, etc.
|
11
|
+
group :development do
|
12
|
+
gem "rspec", "~> 2.3.0"
|
13
|
+
gem "yard", "~> 0.6.0"
|
14
|
+
gem "bundler", "~> 1.0.0"
|
15
|
+
gem "jeweler", "~> 1.5.2"
|
16
|
+
gem "rcov", ">= 0"
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
git (1.2.5)
|
6
|
+
gorillib (0.0.7)
|
7
|
+
jeweler (1.5.2)
|
8
|
+
bundler (~> 1.0.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rake
|
11
|
+
rake (0.8.7)
|
12
|
+
rcov (0.9.9)
|
13
|
+
rspec (2.3.0)
|
14
|
+
rspec-core (~> 2.3.0)
|
15
|
+
rspec-expectations (~> 2.3.0)
|
16
|
+
rspec-mocks (~> 2.3.0)
|
17
|
+
rspec-core (2.3.1)
|
18
|
+
rspec-expectations (2.3.0)
|
19
|
+
diff-lcs (~> 1.1.2)
|
20
|
+
rspec-mocks (2.3.0)
|
21
|
+
yajl-ruby (0.8.2)
|
22
|
+
yard (0.6.8)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
bundler (~> 1.0.0)
|
29
|
+
gorillib (~> 0.0.7)
|
30
|
+
jeweler (~> 1.5.2)
|
31
|
+
rcov
|
32
|
+
rspec (~> 2.3.0)
|
33
|
+
yajl-ruby (~> 0.8.2)
|
34
|
+
yard (~> 0.6.0)
|
data/LICENSE.textile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Philip (flip) Kromer for Infochimps
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= icss
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to icss
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 Philip (flip) Kromer for Infochimps. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "icss"
|
16
|
+
gem.homepage = "http://github.com/mrflip/icss"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{Infochimps Stupid Schema library: an avro-compatible data description standard. ICSS completely describes a collection of data (and associated assets) in a way that is expressive, scalable and sufficient to drive remarkably complex downstream processes.}
|
19
|
+
gem.description = %Q{Infochimps Stupid Schema library: an avro-compatible data description standard. ICSS completely describes a collection of data (and associated assets) in a way that is expressive, scalable and sufficient to drive remarkably complex downstream processes.}
|
20
|
+
gem.email = "coders@infochimps.com"
|
21
|
+
gem.authors = ["Philip (flip) Kromer for Infochimps"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
36
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
37
|
+
spec.rcov = true
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'yard'
|
43
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
{"namespace": "org.apache.avro.test",
|
3
|
+
"protocol": "BulkData",
|
4
|
+
|
5
|
+
"types": [],
|
6
|
+
|
7
|
+
"messages": {
|
8
|
+
|
9
|
+
"read": {
|
10
|
+
"request": [],
|
11
|
+
"response": "bytes"
|
12
|
+
},
|
13
|
+
|
14
|
+
"write": {
|
15
|
+
"request": [ {"name": "data", "type": "bytes"} ],
|
16
|
+
"response": "null"
|
17
|
+
}
|
18
|
+
|
19
|
+
}
|
20
|
+
|
21
|
+
}
|
@@ -0,0 +1,158 @@
|
|
1
|
+
---
|
2
|
+
namespace: util.time
|
3
|
+
protocol: chronic
|
4
|
+
|
5
|
+
doc: >-
|
6
|
+
An API call to parse human-readable date / time strings
|
7
|
+
|
8
|
+
data_assets: []
|
9
|
+
|
10
|
+
code_assets:
|
11
|
+
- location: code/chronic_endpoint.rb
|
12
|
+
type: apeyeye_endpoint
|
13
|
+
|
14
|
+
types:
|
15
|
+
- name: a_atsigns_b_params
|
16
|
+
type: record
|
17
|
+
doc: ""
|
18
|
+
fields:
|
19
|
+
- name: user_a_id
|
20
|
+
type: int
|
21
|
+
- name: user_a_sn
|
22
|
+
type: string
|
23
|
+
- name: user_b_id
|
24
|
+
type: int
|
25
|
+
- name: user_b_sn
|
26
|
+
type: string
|
27
|
+
|
28
|
+
|
29
|
+
- name: your_mom
|
30
|
+
type: record
|
31
|
+
doc: "hi"
|
32
|
+
fields:
|
33
|
+
- name: went_to_college
|
34
|
+
type: int
|
35
|
+
|
36
|
+
- name: chronic_parse_params
|
37
|
+
type: record
|
38
|
+
doc:
|
39
|
+
Query API parameters for the /util/time/chronic/parse call
|
40
|
+
fields:
|
41
|
+
- name: context
|
42
|
+
type: string
|
43
|
+
doc: >-
|
44
|
+
<tt>:past</tt> or <tt>:future</tt> (defaults to <tt>:future</tt>)
|
45
|
+
|
46
|
+
If your string represents a birthday, you can set
|
47
|
+
<tt>:context</tt> to <tt>:past</tt> and if an ambiguous string is
|
48
|
+
given, it will assume it is in the past. Specify <tt>:future</tt>
|
49
|
+
or omit to set a future context.
|
50
|
+
|
51
|
+
- name: now
|
52
|
+
type: string
|
53
|
+
doc: >-
|
54
|
+
Time (defaults to Time.now)
|
55
|
+
|
56
|
+
By setting <tt>:now</tt> to a Time, all computations will be based off
|
57
|
+
of that time instead of Time.now. If set to nil, Chronic will use Time.now.
|
58
|
+
|
59
|
+
- name: guess
|
60
|
+
type: boolean
|
61
|
+
doc: >-
|
62
|
+
+true+ or +false+ (defaults to +true+)
|
63
|
+
|
64
|
+
By default, the parser will guess a single point in time for the
|
65
|
+
given date or time. If you'd rather have the entire time span returned,
|
66
|
+
set <tt>:guess</tt> to +false+ and a Chronic::Span will be returned.
|
67
|
+
|
68
|
+
- name: ambiguous_time_range
|
69
|
+
type: int
|
70
|
+
doc: >-
|
71
|
+
Integer or <tt>:none</tt> (defaults to <tt>6</tt> (6am-6pm))
|
72
|
+
|
73
|
+
If an Integer is given, ambiguous times (like 5:00) will be
|
74
|
+
assumed to be within the range of that time in the AM to that time
|
75
|
+
in the PM. For example, if you set it to <tt>7</tt>, then the parser will
|
76
|
+
look for the time between 7am and 7pm. In the case of 5:00, it would
|
77
|
+
assume that means 5:00pm. If <tt>:none</tt> is given, no assumption
|
78
|
+
will be made, and the first matching instance of that time will
|
79
|
+
be used.
|
80
|
+
- name: field_that_is_recursive
|
81
|
+
type: your_mom
|
82
|
+
doc: wears combat boots
|
83
|
+
|
84
|
+
# - name: field_that_is_an_array
|
85
|
+
# type: array
|
86
|
+
# items: int
|
87
|
+
# doc: I am an array of primitives
|
88
|
+
# - name: field_that_is_a_named_type_holy_fuck
|
89
|
+
# type: array
|
90
|
+
# items: your_mom
|
91
|
+
# doc: I am an array of Iccs::Type::YourMomType
|
92
|
+
|
93
|
+
- name: chronic_parse_response
|
94
|
+
type: record
|
95
|
+
doc: |-
|
96
|
+
Query API response for the /util/time/chronic/parse call
|
97
|
+
fields:
|
98
|
+
- name: time
|
99
|
+
doc: >-
|
100
|
+
The UTC parsed time, as a "ISO 8601 combined date time":http://en.wikipedia.org/wiki/ISO_8601 string.
|
101
|
+
type: string
|
102
|
+
- name: epoch_seconds
|
103
|
+
doc: >-
|
104
|
+
The UTC parsed time, as "epoch seconds":http://en.wikipedia.org/wiki/Epoch_seconds integer.
|
105
|
+
type: int
|
106
|
+
- name: params
|
107
|
+
doc: >-
|
108
|
+
Your params, right back atcha'
|
109
|
+
type: string # map
|
110
|
+
# - name: errors
|
111
|
+
# doc: >-
|
112
|
+
# Error conditions
|
113
|
+
# type: array
|
114
|
+
# optional: true
|
115
|
+
- name: whatever
|
116
|
+
doc: dummy string
|
117
|
+
type:
|
118
|
+
name: embedded_record_def
|
119
|
+
type: record
|
120
|
+
doc: I am an inline record definition
|
121
|
+
fields:
|
122
|
+
- name: name
|
123
|
+
type: string
|
124
|
+
|
125
|
+
messages:
|
126
|
+
parse:
|
127
|
+
request:
|
128
|
+
- name: params
|
129
|
+
type: chronic_parse_params
|
130
|
+
response: chronic_parse_response
|
131
|
+
doc_file:
|
132
|
+
README.md
|
133
|
+
|
134
|
+
#
|
135
|
+
# targets:
|
136
|
+
# mysql:
|
137
|
+
# # Name of the data asset, mysql table name will derived from this
|
138
|
+
# - table_name: word_freq_bnc
|
139
|
+
# database: lang_corp_word_freq_bnc
|
140
|
+
# data_assets:
|
141
|
+
# - word_freq_bnc_data_asset
|
142
|
+
#
|
143
|
+
# apidocs:
|
144
|
+
# - dest_path: /language/corpora/word_freq_bnc/token_frequency
|
145
|
+
#
|
146
|
+
# bulkdownload:
|
147
|
+
# - package_name: word_freq_bnc
|
148
|
+
# data_assets:
|
149
|
+
# - word_freq_bnc_data_asset
|
150
|
+
#
|
151
|
+
# catalog:
|
152
|
+
# # Name of the catalogue entry
|
153
|
+
# - name: word_freq_bnc
|
154
|
+
# title: Word Frequencies From the British National Corpus
|
155
|
+
# messages:
|
156
|
+
# - token_frequency
|
157
|
+
# packages:
|
158
|
+
# - word_freq_bnc
|
@@ -0,0 +1,32 @@
|
|
1
|
+
{ "name":"Interop",
|
2
|
+
"namespace": "org.apache.avro",
|
3
|
+
"type": "record",
|
4
|
+
"fields": [
|
5
|
+
{"name": "intField", "type": "int"},
|
6
|
+
{"name": "longField", "type": "long"},
|
7
|
+
{"name": "stringField", "type": "string"},
|
8
|
+
{"name": "boolField", "type": "boolean"},
|
9
|
+
{"name": "floatField", "type": "float"},
|
10
|
+
{"name": "doubleField", "type": "double"},
|
11
|
+
{"name": "bytesField", "type": "bytes"},
|
12
|
+
{"name": "nullField", "type": "null"},
|
13
|
+
{"name": "arrayField", "type": {"type": "array", "items": "double"}},
|
14
|
+
{"name": "mapField", "type":
|
15
|
+
{ "type": "map", "values":
|
16
|
+
{ "name": "Foo",
|
17
|
+
"type": "record",
|
18
|
+
"fields": [{"name": "label", "type": "string"}]}
|
19
|
+
}},
|
20
|
+
{"name": "unionField", "type":
|
21
|
+
["boolean", "double", {"type": "array", "items": "bytes"}] },
|
22
|
+
{"name": "enumField", "type":
|
23
|
+
{"name": "Kind", "type": "enum", "symbols": ["A","B","C"]} },
|
24
|
+
{"name": "fixedField", "type":
|
25
|
+
{"name": "MD5", "type": "fixed", "size": 16} },
|
26
|
+
{"name": "recordField", "type":
|
27
|
+
{"name": "Node", "type": "record",
|
28
|
+
"fields": [
|
29
|
+
{"name": "label", "type": "string"},
|
30
|
+
{"name": "children", "type": {"type": "array", "items": "Node"}}]}}
|
31
|
+
]
|
32
|
+
}
|
data/examples/mail.avpr
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
{"namespace": "org.apache.avro.test",
|
2
|
+
"protocol": "Mail",
|
3
|
+
|
4
|
+
"types": [
|
5
|
+
{"name": "Message", "type": "record",
|
6
|
+
"fields": [
|
7
|
+
{"name": "to", "type": "string"},
|
8
|
+
{"name": "from", "type": "string"},
|
9
|
+
{"name": "body", "type": "string"}
|
10
|
+
]
|
11
|
+
}
|
12
|
+
],
|
13
|
+
|
14
|
+
"messages": {
|
15
|
+
"send": {
|
16
|
+
"request": [{"name": "message", "type": "Message"}],
|
17
|
+
"response": "string"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
{"namespace": "org.apache.avro.test.namespace",
|
2
|
+
"protocol": "TestNamespace",
|
3
|
+
|
4
|
+
"types": [
|
5
|
+
{"name": "org.apache.avro.test.util.MD5", "type": "fixed", "size": 16},
|
6
|
+
{"name": "TestRecord", "type": "record",
|
7
|
+
"fields": [ {"name": "hash", "type": "org.apache.avro.test.util.MD5"} ]
|
8
|
+
},
|
9
|
+
{"name": "TestError", "namespace": "org.apache.avro.test.errors",
|
10
|
+
"type": "error", "fields": [ {"name": "message", "type": "string"} ]
|
11
|
+
}
|
12
|
+
],
|
13
|
+
|
14
|
+
"messages": {
|
15
|
+
"echo": {
|
16
|
+
"request": [{"name": "record", "type": "TestRecord"}],
|
17
|
+
"response": "TestRecord"
|
18
|
+
},
|
19
|
+
|
20
|
+
"error": {
|
21
|
+
"request": [],
|
22
|
+
"response": "null",
|
23
|
+
"errors": ["org.apache.avro.test.errors.TestError"]
|
24
|
+
}
|
25
|
+
|
26
|
+
}
|
27
|
+
|
28
|
+
}
|