icss-activesupport-4 0.4.0

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 (101) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.rspec +3 -0
  4. data/.watchr +52 -0
  5. data/CHANGELOG.md +38 -0
  6. data/Gemfile +22 -0
  7. data/LICENSE.textile +20 -0
  8. data/README.md +298 -0
  9. data/Rakefile +39 -0
  10. data/TODO.md +44 -0
  11. data/VERSION +1 -0
  12. data/examples/avro_examples/BulkData.avpr +21 -0
  13. data/examples/avro_examples/complicated.icss.yaml +159 -0
  14. data/examples/avro_examples/interop.avsc +32 -0
  15. data/examples/avro_examples/mail.avpr +20 -0
  16. data/examples/avro_examples/namespace.avpr +28 -0
  17. data/examples/avro_examples/org/apache/avro/ipc/HandshakeRequest.avsc +11 -0
  18. data/examples/avro_examples/org/apache/avro/ipc/HandshakeResponse.avsc +15 -0
  19. data/examples/avro_examples/org/apache/avro/ipc/trace/avroTrace.avdl +64 -0
  20. data/examples/avro_examples/org/apache/avro/ipc/trace/avroTrace.avpr +82 -0
  21. data/examples/avro_examples/org/apache/avro/mapred/tether/InputProtocol.avpr +59 -0
  22. data/examples/avro_examples/org/apache/avro/mapred/tether/OutputProtocol.avpr +75 -0
  23. data/examples/avro_examples/simple.avpr +70 -0
  24. data/examples/avro_examples/weather.avsc +9 -0
  25. data/examples/bnc.icss.yaml +70 -0
  26. data/examples/chronic.icss.yaml +115 -0
  27. data/examples/license.icss.yaml +7 -0
  28. data/examples/source1.icss.yaml +4 -0
  29. data/examples/source2.icss.yaml +4 -0
  30. data/examples/test_icss.yaml +67 -0
  31. data/icss.gemspec +168 -0
  32. data/icss_specification.textile +393 -0
  33. data/lib/icss.rb +53 -0
  34. data/lib/icss/core_types.rb +20 -0
  35. data/lib/icss/error.rb +4 -0
  36. data/lib/icss/init.rb +3 -0
  37. data/lib/icss/message.rb +133 -0
  38. data/lib/icss/message/message_sample.rb +144 -0
  39. data/lib/icss/protocol.rb +199 -0
  40. data/lib/icss/protocol/code_asset.rb +18 -0
  41. data/lib/icss/protocol/data_asset.rb +23 -0
  42. data/lib/icss/protocol/license.rb +41 -0
  43. data/lib/icss/protocol/source.rb +37 -0
  44. data/lib/icss/protocol/target.rb +68 -0
  45. data/lib/icss/receiver_model.rb +24 -0
  46. data/lib/icss/receiver_model/active_model_shim.rb +36 -0
  47. data/lib/icss/receiver_model/acts_as_catalog.rb +174 -0
  48. data/lib/icss/receiver_model/acts_as_hash.rb +177 -0
  49. data/lib/icss/receiver_model/acts_as_loadable.rb +47 -0
  50. data/lib/icss/receiver_model/acts_as_tuple.rb +100 -0
  51. data/lib/icss/receiver_model/locale/en.yml +27 -0
  52. data/lib/icss/receiver_model/to_geo_json.rb +19 -0
  53. data/lib/icss/receiver_model/tree_merge.rb +34 -0
  54. data/lib/icss/receiver_model/validations.rb +31 -0
  55. data/lib/icss/serialization.rb +51 -0
  56. data/lib/icss/serialization/zaml.rb +442 -0
  57. data/lib/icss/type.rb +168 -0
  58. data/lib/icss/type/base_type.rb +0 -0
  59. data/lib/icss/type/named_type.rb +185 -0
  60. data/lib/icss/type/record_field.rb +77 -0
  61. data/lib/icss/type/record_model.rb +49 -0
  62. data/lib/icss/type/record_schema.rb +54 -0
  63. data/lib/icss/type/record_type.rb +325 -0
  64. data/lib/icss/type/simple_types.rb +71 -0
  65. data/lib/icss/type/structured_schema.rb +288 -0
  66. data/lib/icss/type/type_factory.rb +144 -0
  67. data/lib/icss/type/union_schema.rb +41 -0
  68. data/lib/icss/view_helper.rb +65 -0
  69. data/notes/named_array.md +32 -0
  70. data/notes/on_include_vs_extend_etc.rb +176 -0
  71. data/notes/technical_details.md +278 -0
  72. data/spec/core_types_spec.rb +119 -0
  73. data/spec/fixtures/zaml_complex_hash.yaml +35 -0
  74. data/spec/icss_spec.rb +90 -0
  75. data/spec/message/message_sample_spec.rb +4 -0
  76. data/spec/message_spec.rb +139 -0
  77. data/spec/protocol/license_spec.rb +67 -0
  78. data/spec/protocol/protocol_catalog_spec.rb +48 -0
  79. data/spec/protocol/protocol_validations_spec.rb +176 -0
  80. data/spec/protocol/source_spec.rb +65 -0
  81. data/spec/protocol_spec.rb +170 -0
  82. data/spec/receiver_model_spec.rb +115 -0
  83. data/spec/serialization/zaml_spec.rb +82 -0
  84. data/spec/serialization/zaml_test.rb +473 -0
  85. data/spec/serialization_spec.rb +63 -0
  86. data/spec/spec_helper.rb +39 -0
  87. data/spec/support/icss_test_helper.rb +67 -0
  88. data/spec/support/load_example_protocols.rb +17 -0
  89. data/spec/type/base_type_spec.rb +0 -0
  90. data/spec/type/named_type_spec.rb +75 -0
  91. data/spec/type/record_field_spec.rb +44 -0
  92. data/spec/type/record_model_spec.rb +206 -0
  93. data/spec/type/record_schema_spec.rb +161 -0
  94. data/spec/type/record_type_spec.rb +155 -0
  95. data/spec/type/simple_types_spec.rb +121 -0
  96. data/spec/type/structured_schema_spec.rb +300 -0
  97. data/spec/type/type_catalog_spec.rb +44 -0
  98. data/spec/type/type_factory_spec.rb +93 -0
  99. data/spec/type/union_schema_spec.rb +0 -0
  100. data/spec/type_spec.rb +63 -0
  101. metadata +304 -0
@@ -0,0 +1,82 @@
1
+ {
2
+ "namespace" : "org.apache.avro.ipc.trace",
3
+ "protocol" : "AvroTrace",
4
+ "types" : [ {
5
+ "name" : "SpanEvent",
6
+ "type" : "enum",
7
+ "symbols" : [ "SERVER_RECV", "SERVER_SEND", "CLIENT_RECV", "CLIENT_SEND" ]
8
+ }, {
9
+ "name" : "ID",
10
+ "type" : "fixed",
11
+ "size" : 8
12
+ }, {
13
+ "name" : "TimestampedEvent",
14
+ "type" : "record",
15
+ "fields" : [ {
16
+ "name" : "timeStamp",
17
+ "type" : "long"
18
+ }, {
19
+ "name" : "event",
20
+ "type" : [ "SpanEvent", "string" ]
21
+ } ]
22
+ }, {
23
+ "name" : "Span",
24
+ "type" : "record",
25
+ "fields" : [ {
26
+ "name" : "traceID",
27
+ "type" : "ID"
28
+ }, {
29
+ "name" : "spanID",
30
+ "type" : "ID"
31
+ }, {
32
+ "name" : "parentSpanID",
33
+ "type" : [ "ID", "null" ]
34
+ }, {
35
+ "name" : "messageName",
36
+ "type" : "string"
37
+ }, {
38
+ "name" : "requestPayloadSize",
39
+ "type" : "long"
40
+ }, {
41
+ "name" : "responsePayloadSize",
42
+ "type" : "long"
43
+ }, {
44
+ "name" : "requestorHostname",
45
+ "type" : [ "string", "null" ]
46
+ }, {
47
+ "name" : "responderHostname",
48
+ "type" : [ "string", "null" ]
49
+ }, {
50
+ "name" : "events",
51
+ "type" : {
52
+ "type" : "array",
53
+ "items" : "TimestampedEvent"
54
+ }
55
+ }, {
56
+ "name" : "complete",
57
+ "type" : "boolean"
58
+ } ]
59
+ } ],
60
+ "messages" : {
61
+ "getAllSpans" : {
62
+ "request" : [ ],
63
+ "response" : {
64
+ "type" : "array",
65
+ "items" : "Span"
66
+ }
67
+ },
68
+ "getSpansInRange" : {
69
+ "request" : [ {
70
+ "name" : "start",
71
+ "type" : "long"
72
+ }, {
73
+ "name" : "end",
74
+ "type" : "long"
75
+ } ],
76
+ "response" : {
77
+ "type" : "array",
78
+ "items" : "Span"
79
+ }
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,59 @@
1
+ {"namespace":"org.apache.avro.mapred.tether",
2
+ "protocol": "InputProtocol",
3
+ "doc": "Transmit inputs to a map or reduce task sub-process.",
4
+
5
+ "types": [
6
+ {"name": "TaskType", "type": "enum", "symbols": ["MAP","REDUCE"]}
7
+ ],
8
+
9
+ "messages": {
10
+
11
+ "configure": {
12
+ "doc": "Configure the task. Sent before any other message.",
13
+ "request": [
14
+ {"name": "taskType", "type": "TaskType",
15
+ "doc": "Whether this is a map or reduce task."},
16
+ {"name": "inSchema", "type": "string",
17
+ "doc": "The Avro schema for task input data."},
18
+ {"name": "outSchema", "type": "string",
19
+ "doc": "The Avro schema for task output data."}
20
+ ],
21
+ "response": "null"
22
+ },
23
+
24
+ "partitions": {
25
+ "doc": "Set the number of map output partitions.",
26
+ "request": [
27
+ {"name": "partitions", "type": "int",
28
+ "doc": "The number of map output partitions."}
29
+ ],
30
+ "response": "null"
31
+ },
32
+
33
+ "input": {
34
+ "doc": "Send a block of input data to a task.",
35
+ "request": [
36
+ {"name": "data", "type": "bytes",
37
+ "doc": "A sequence of instances of the declared schema."},
38
+ {"name": "count", "type": "long",
39
+ "default": 1,
40
+ "doc": "The number of instances in this block."}
41
+ ],
42
+ "response": "null"
43
+ },
44
+
45
+ "abort": {
46
+ "doc": "Called to abort the task.",
47
+ "request": [],
48
+ "response": "null"
49
+ },
50
+
51
+ "complete": {
52
+ "doc": "Called when a task's input is complete.",
53
+ "request": [],
54
+ "response": "null"
55
+ }
56
+
57
+ }
58
+
59
+ }
@@ -0,0 +1,75 @@
1
+ {"namespace":"org.apache.avro.mapred.tether",
2
+ "protocol": "OutputProtocol",
3
+ "doc": "Transmit outputs from a map or reduce task to parent.",
4
+
5
+ "messages": {
6
+
7
+ "configure": {
8
+ "doc": "Configure task. Sent before any other message.",
9
+ "request": [
10
+ {"name": "port", "type": "int",
11
+ "doc": "The port to transmit inputs to this task on."}
12
+ ],
13
+ "response": "null"
14
+ },
15
+
16
+ "output": {
17
+ "doc": "Send an output datum.",
18
+ "request": [
19
+ {"name": "datum", "type": "bytes",
20
+ "doc": "A binary-encoded instance of the declared schema."}
21
+ ],
22
+ "response": "null"
23
+ },
24
+
25
+ "outputPartitioned": {
26
+ "doc": "Send map output datum explicitly naming its partition.",
27
+ "request": [
28
+ {"name": "partition", "type": "int",
29
+ "doc": "The map output partition for this datum."},
30
+ {"name": "datum", "type": "bytes",
31
+ "doc": "A binary-encoded instance of the declared schema."}
32
+ ],
33
+ "response": "null"
34
+ },
35
+
36
+ "status": {
37
+ "doc": "Update the task's status message. Also acts as keepalive.",
38
+ "request": [
39
+ {"name": "message", "type": "string",
40
+ "doc": "The new status message for the task."}
41
+ ],
42
+ "response": "null"
43
+ },
44
+
45
+ "count": {
46
+ "doc": "Increment a task/job counter.",
47
+ "request": [
48
+ {"name": "group", "type": "string",
49
+ "doc": "The name of the counter group."},
50
+ {"name": "name", "type": "string",
51
+ "doc": "The name of the counter to increment."},
52
+ {"name": "amount", "type": "long",
53
+ "doc": "The amount to incrment the counter."}
54
+ ],
55
+ "response": "null"
56
+ },
57
+
58
+ "fail": {
59
+ "doc": "Called by a failing task to abort.",
60
+ "request": [
61
+ {"name": "message", "type": "string",
62
+ "doc": "The reason for failure."}
63
+ ],
64
+ "response": "null"
65
+ },
66
+
67
+ "complete": {
68
+ "doc": "Called when a task's output has completed without error.",
69
+ "request": [],
70
+ "response": "null"
71
+ }
72
+
73
+ }
74
+
75
+ }
@@ -0,0 +1,70 @@
1
+ {"namespace": "org.apache.avro.test",
2
+ "protocol": "Simple",
3
+ "doc": "Protocol used for testing.",
4
+
5
+ "types": [
6
+ {"name": "Kind", "type": "enum", "symbols": ["FOO","BAR","BAZ"]},
7
+
8
+ {"name": "MD5", "type": "fixed", "size": 16},
9
+
10
+ {"name": "TestRecord", "type": "record",
11
+ "fields": [
12
+ {"name": "name", "type": "string", "order": "ignore"},
13
+ {"name": "kind", "type": "Kind", "order": "descending"},
14
+ {"name": "hash", "type": "MD5"}
15
+ ]
16
+ },
17
+
18
+ {"name": "TestError", "type": "error", "fields": [
19
+ {"name": "message", "type": "string"}
20
+ ]
21
+ },
22
+
23
+ {"name": "TestRecordWithUnion", "type": "record",
24
+ "fields": [
25
+ {"name": "kind", "type": ["null", "Kind"]},
26
+ {"name": "value", "type": ["null", "string"]}
27
+ ]
28
+ }
29
+
30
+ ],
31
+
32
+ "messages": {
33
+
34
+ "hello": {
35
+ "doc": "Send a greeting",
36
+ "request": [{"name": "greeting", "type": "string"}],
37
+ "response": "string"
38
+ },
39
+
40
+ "echo": {
41
+ "doc": "Pretend you're in a cave!",
42
+ "request": [{"name": "record", "type": "TestRecord"}],
43
+ "response": "TestRecord"
44
+ },
45
+
46
+ "add": {
47
+ "request": [{"name": "arg1", "type": "int"}, {"name": "arg2", "type": "int"}],
48
+ "response": "int"
49
+ },
50
+
51
+ "echoBytes": {
52
+ "request": [{"name": "data", "type": "bytes"}],
53
+ "response": "bytes"
54
+ },
55
+
56
+ "error": {
57
+ "doc": "Always throws an error.",
58
+ "request": [],
59
+ "response": "null",
60
+ "errors": ["TestError"]
61
+ },
62
+
63
+ "ack": {
64
+ "doc": "Send a one way message",
65
+ "request": [],
66
+ "response": "null"
67
+ }
68
+ }
69
+
70
+ }
@@ -0,0 +1,9 @@
1
+ {"name": "test.Weather",
2
+ "doc": "A weather reading.",
3
+ "type": "record",
4
+ "fields": [
5
+ {"name": "station", "type": "string", "order": "ignore"},
6
+ {"name": "time", "type": "long"},
7
+ {"name": "temp", "type": "int"}
8
+ ]
9
+ }
@@ -0,0 +1,70 @@
1
+ ---
2
+ namespace: language.corpora.word_freq
3
+ protocol: bnc
4
+
5
+ targets:
6
+ catalog:
7
+ - name: word_freq_bnc
8
+ title: Word Frequencies From the British National Corpus
9
+ description: foobar
10
+ tags:
11
+ - bnc
12
+ - british-national-corpus
13
+ - awesomeapi
14
+ - token
15
+ - word
16
+ - corpus
17
+ - word-frequency
18
+ - british
19
+ - words
20
+ - language
21
+ messages:
22
+ - word_stats
23
+
24
+ messages:
25
+ word_stats:
26
+ request:
27
+ - name: word_stats_request
28
+ type: word_stats_request
29
+ response: word_statistics_record
30
+ doc: Query on a head word to get back word statistics (and word variants) from the British National Corpus.
31
+
32
+ data_assets:
33
+ - name: word_stats_data_asset
34
+ location: data/word_stats
35
+ type: word_statistics_record
36
+
37
+ code_assets:
38
+ - location: code/bnc_endpoint.rb
39
+ name: word_stats
40
+
41
+ types:
42
+
43
+
44
+ - name: test_record
45
+ doc: A record for testing
46
+ type: record
47
+ fields:
48
+ - name: name
49
+ doc: A person's name.
50
+ type: string
51
+ - name: age
52
+ doc: A person's age.
53
+ type: whatever
54
+ - name: email
55
+ doc: A person's email address
56
+ type: string
57
+ validates:
58
+ :length:
59
+ :maximum: 10
60
+
61
+ - name: whatever
62
+ doc: lkajd
63
+ type: record
64
+ fields:
65
+ - name: f
66
+ doc: bar
67
+ type: place
68
+
69
+ - name: place
70
+
@@ -0,0 +1,115 @@
1
+ ---
2
+ namespace: st.time_utils
3
+ protocol: chronic
4
+
5
+ doc: >-
6
+ A series of calls hooking into the Chronic ruby gem
7
+
8
+ code_assets:
9
+ - location: code/chronic_endpoint.rb
10
+ type: apeyeye_endpoint
11
+
12
+ targets:
13
+ catalog:
14
+ - name: st_time_utils_chronic_parse
15
+ title: Utils - Parse Times
16
+ description: An API call to parse human-readable date / time strings
17
+ messages:
18
+ - parse
19
+ tags:
20
+ - apiawesome
21
+ - ruby
22
+ - gems
23
+ - chronic
24
+ - time
25
+ - date
26
+ - util
27
+ - parse
28
+
29
+ types:
30
+ - name: chronic_parse_params
31
+ type: record
32
+ doc: Query API parameters for the /st/time_utils/chronic/parse call
33
+ fields:
34
+ - name: time_str
35
+ type: string
36
+ doc: >-
37
+ The string to parse.
38
+
39
+ - name: context
40
+ type: symbol
41
+ doc: >-
42
+ <tt>past</tt> or <tt>future</tt> (defaults to <tt>future</tt>)
43
+
44
+ If your string represents a birthday, you can set
45
+ <tt>context</tt> to <tt>past</tt> and if an ambiguous string is
46
+ given, it will assume it is in the past. Specify <tt>future</tt>
47
+ or omit to set a future context.
48
+
49
+ - name: now
50
+ type: time
51
+ doc: >-
52
+ Time (defaults to Time.now)
53
+
54
+ By setting <tt>:now</tt> to a Time, all computations will be based off
55
+ of that time instead of Time.now. If set to nil, Chronic will use
56
+ the current time in UTC. You must supply a date that unambiguously
57
+ parses with the much-less-generous ruby Time.parse()
58
+
59
+ - name: ambiguous_time_range
60
+ type: int
61
+ doc: >-
62
+ Integer or <tt>:none</tt> (defaults to <tt>6</tt> (6am-6pm))
63
+
64
+ If an Integer is given, ambiguous times (like 5:00) will be
65
+ assumed to be within the range of that time in the AM to that time
66
+ in the PM. For example, if you set it to <tt>7</tt>, then the parser will
67
+ look for the time between 7am and 7pm. In the case of 5:00, it would
68
+ assume that means 5:00pm. If <tt>:none</tt> is given, no assumption
69
+ will be made, and the first matching instance of that time will
70
+ be used.
71
+
72
+ - name: chronic_parse_response
73
+ type: record
74
+ doc: |-
75
+ Query API response for the /util/time/chronic/parse call
76
+ fields:
77
+ - name: time
78
+ doc: >-
79
+ The UTC parsed time, as a "ISO 8601 combined date time":http://en.wikipedia.org/wiki/ISO_8601 string.
80
+ type: string
81
+ - name: epoch_seconds
82
+ doc: >-
83
+ The UTC parsed time, as "epoch seconds":http://en.wikipedia.org/wiki/Epoch_seconds integer.
84
+ type: int
85
+
86
+ messages:
87
+ parse:
88
+ request:
89
+ - name: chronic_parse_params
90
+ type: chronic_parse_params
91
+ response: chronic_parse_response
92
+ samples:
93
+ - request:
94
+ - time_str: one hour ago
95
+ now: "2007-03-16T12:09:08Z"
96
+ response:
97
+ epoch_seconds: 1174043348
98
+ time: "2007-03-16T11:09:08Z"
99
+ url: ?now=2007-03-16T12%3A09%3A08Z&time_str=one%20hour%20ago
100
+ - request:
101
+ - time_str: Yesterday
102
+ now: 5:06:07T2010-08-08Z
103
+ response:
104
+ epoch_seconds: 1281182400
105
+ time: "2010-08-07T12:00:00Z"
106
+ url: ?now=5%3A06%3A07%202010-08-08&time_str=Yesterday
107
+ - url: "?time_str=5pm+on+November+4th&context=past"
108
+ # - request:
109
+ # - time_str: 2 hours
110
+ # error: Apeyeye::MethodFailedError
111
+
112
+ doc: |-
113
+
114
+ Chronic is a natural language date/time parser written in pure Ruby. See below
115
+ for the wide variety of formats Chronic will parse.