icss 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/README.textile +14 -4
- data/VERSION +1 -1
- data/examples/chronic.icss.yaml +112 -0
- data/icss.gemspec +9 -6
- data/icss_specification.textile +5 -1
- data/lib/icss.rb +11 -1
- data/lib/icss/core_ext.rb +3 -0
- data/lib/icss/message.rb +6 -3
- data/lib/icss/protocol.rb +8 -4
- data/lib/icss/sample_message_call.rb +11 -9
- data/lib/icss/target.rb +1 -0
- data/lib/icss/type.rb +7 -3
- data/spec/icss_spec.rb +20 -3
- data/spec/protocol_spec.rb +10 -0
- data/spec/spec_helper.rb +0 -1
- metadata +77 -35
data/Gemfile
CHANGED
@@ -4,7 +4,7 @@ source "http://rubygems.org"
|
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
5
5
|
|
6
6
|
gem 'yajl-ruby', "~> 0.8.2"
|
7
|
-
gem 'gorillib', "~> 0.1.
|
7
|
+
gem 'gorillib', "~> 0.1.1"
|
8
8
|
|
9
9
|
# Add dependencies to develop your gem here.
|
10
10
|
# Include everything needed to run rake, tests, features, etc.
|
data/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ GEM
|
|
3
3
|
specs:
|
4
4
|
diff-lcs (1.1.2)
|
5
5
|
git (1.2.5)
|
6
|
-
gorillib (0.1.
|
6
|
+
gorillib (0.1.1)
|
7
7
|
jeweler (1.5.2)
|
8
8
|
bundler (~> 1.0.0)
|
9
9
|
git (>= 1.2.5)
|
@@ -26,7 +26,7 @@ PLATFORMS
|
|
26
26
|
|
27
27
|
DEPENDENCIES
|
28
28
|
bundler (~> 1.0.0)
|
29
|
-
gorillib (~> 0.1.
|
29
|
+
gorillib (~> 0.1.1)
|
30
30
|
jeweler (~> 1.5.2)
|
31
31
|
rcov
|
32
32
|
rspec (~> 2.3.0)
|
data/README.textile
CHANGED
@@ -1,8 +1,18 @@
|
|
1
|
-
|
1
|
+
h2. The Infochimps Stupid Schema (ICSS)
|
2
2
|
|
3
|
-
|
3
|
+
An ICSS file is a *complete*, *expressive* description of a collection of related data and all associated assets.
|
4
4
|
|
5
|
-
|
5
|
+
Assets may include
|
6
|
+
* data assets (including their location and schema)
|
7
|
+
* code for api calls (messages) based on the the described records (including their call signature and schema)
|
8
|
+
* other referenced schema
|
9
|
+
|
10
|
+
See "icss_specification.textile":icss/blob/master/icss_specification.textile for more.
|
11
|
+
|
12
|
+
|
13
|
+
h2. Colophon
|
14
|
+
|
15
|
+
h3. Contributing to icss
|
6
16
|
|
7
17
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
18
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
@@ -12,7 +22,7 @@ Description goes here.
|
|
12
22
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
23
|
* 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
24
|
|
15
|
-
|
25
|
+
h3. Copyright
|
16
26
|
|
17
27
|
Copyright (c) 2011 Philip (flip) Kromer for Infochimps. See LICENSE.txt for
|
18
28
|
further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -0,0 +1,112 @@
|
|
1
|
+
---
|
2
|
+
namespace: util.time
|
3
|
+
protocol: chronic
|
4
|
+
|
5
|
+
code_assets:
|
6
|
+
- location: code/chronic_endpoint.rb
|
7
|
+
type: apeyeye_endpoint
|
8
|
+
|
9
|
+
targets:
|
10
|
+
catalog:
|
11
|
+
- name: util_time_chronic_parse
|
12
|
+
title: Utils - Parse Times
|
13
|
+
description: An API call to parse human-readable date / time strings
|
14
|
+
messages:
|
15
|
+
- parse
|
16
|
+
tags:
|
17
|
+
- apiawesome
|
18
|
+
- ruby
|
19
|
+
- gems
|
20
|
+
- chronic
|
21
|
+
- time
|
22
|
+
- date
|
23
|
+
- util
|
24
|
+
- parse
|
25
|
+
|
26
|
+
types:
|
27
|
+
- name: chronic_parse_params
|
28
|
+
type: record
|
29
|
+
doc: Query API parameters for the /util/time/chronic/parse call
|
30
|
+
fields:
|
31
|
+
- name: time_str
|
32
|
+
type: string
|
33
|
+
doc: >-
|
34
|
+
The string to parse.
|
35
|
+
|
36
|
+
- name: context
|
37
|
+
type: symbol
|
38
|
+
doc: >-
|
39
|
+
<tt>past</tt> or <tt>future</tt> (defaults to <tt>future</tt>)
|
40
|
+
|
41
|
+
If your string represents a birthday, you can set
|
42
|
+
<tt>context</tt> to <tt>past</tt> and if an ambiguous string is
|
43
|
+
given, it will assume it is in the past. Specify <tt>future</tt>
|
44
|
+
or omit to set a future context.
|
45
|
+
|
46
|
+
- name: now
|
47
|
+
type: time
|
48
|
+
doc: >-
|
49
|
+
Time (defaults to Time.now)
|
50
|
+
|
51
|
+
By setting <tt>:now</tt> to a Time, all computations will be based off
|
52
|
+
of that time instead of Time.now. If set to nil, Chronic will use
|
53
|
+
the current time in UTC. You must supply a date that unambiguously
|
54
|
+
parses with the much-less-generous ruby Time.parse()
|
55
|
+
|
56
|
+
- name: ambiguous_time_range
|
57
|
+
type: int
|
58
|
+
doc: >-
|
59
|
+
Integer or <tt>:none</tt> (defaults to <tt>6</tt> (6am-6pm))
|
60
|
+
|
61
|
+
If an Integer is given, ambiguous times (like 5:00) will be
|
62
|
+
assumed to be within the range of that time in the AM to that time
|
63
|
+
in the PM. For example, if you set it to <tt>7</tt>, then the parser will
|
64
|
+
look for the time between 7am and 7pm. In the case of 5:00, it would
|
65
|
+
assume that means 5:00pm. If <tt>:none</tt> is given, no assumption
|
66
|
+
will be made, and the first matching instance of that time will
|
67
|
+
be used.
|
68
|
+
|
69
|
+
- name: chronic_parse_response
|
70
|
+
type: record
|
71
|
+
doc: |-
|
72
|
+
Query API response for the /util/time/chronic/parse call
|
73
|
+
fields:
|
74
|
+
- name: time
|
75
|
+
doc: >-
|
76
|
+
The UTC parsed time, as a "ISO 8601 combined date time":http://en.wikipedia.org/wiki/ISO_8601 string.
|
77
|
+
type: string
|
78
|
+
- name: epoch_seconds
|
79
|
+
doc: >-
|
80
|
+
The UTC parsed time, as "epoch seconds":http://en.wikipedia.org/wiki/Epoch_seconds integer.
|
81
|
+
type: int
|
82
|
+
|
83
|
+
messages:
|
84
|
+
parse:
|
85
|
+
request:
|
86
|
+
- name: chronic_parse_params
|
87
|
+
type: chronic_parse_params
|
88
|
+
response: chronic_parse_response
|
89
|
+
samples:
|
90
|
+
- request:
|
91
|
+
- time_str: one hour ago
|
92
|
+
now: "2007-03-16T12:09:08Z"
|
93
|
+
response:
|
94
|
+
epoch_seconds: 1174043348
|
95
|
+
time: "2007-03-16T11:09:08Z"
|
96
|
+
url: ?now=2007-03-16T12%3A09%3A08Z&time_str=one%20hour%20ago
|
97
|
+
- request:
|
98
|
+
- time_str: Yesterday
|
99
|
+
now: 5:06:07T2010-08-08Z
|
100
|
+
response:
|
101
|
+
epoch_seconds: 1281182400
|
102
|
+
time: "2010-08-07T12:00:00Z"
|
103
|
+
url: ?now=5%3A06%3A07%202010-08-08&time_str=Yesterday
|
104
|
+
- url: "?time_str=5pm+on+November+4th&context=past"
|
105
|
+
# - request:
|
106
|
+
# - time_str: 2 hours
|
107
|
+
# error: Apeyeye::MethodFailedError
|
108
|
+
|
109
|
+
doc: |-
|
110
|
+
|
111
|
+
Chronic is a natural language date/time parser written in pure Ruby. See below
|
112
|
+
for the wide variety of formats Chronic will parse.
|
data/icss.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{icss}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Philip (flip) Kromer for Infochimps"]
|
12
|
-
s.date = %q{2011-06-
|
12
|
+
s.date = %q{2011-06-10}
|
13
13
|
s.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.}
|
14
14
|
s.email = %q{coders@infochimps.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -40,6 +40,7 @@ Gem::Specification.new do |s|
|
|
40
40
|
"examples/avro_examples/org/apache/avro/mapred/tether/OutputProtocol.avpr",
|
41
41
|
"examples/avro_examples/simple.avpr",
|
42
42
|
"examples/avro_examples/weather.avsc",
|
43
|
+
"examples/chronic.icss.yaml",
|
43
44
|
"icss.gemspec",
|
44
45
|
"icss_specification.textile",
|
45
46
|
"init.rb",
|
@@ -59,15 +60,17 @@ Gem::Specification.new do |s|
|
|
59
60
|
"lib/icss/validations.rb",
|
60
61
|
"lib/icss/view_helper.rb",
|
61
62
|
"spec/icss_spec.rb",
|
63
|
+
"spec/protocol_spec.rb",
|
62
64
|
"spec/spec_helper.rb"
|
63
65
|
]
|
64
66
|
s.homepage = %q{http://github.com/mrflip/icss}
|
65
67
|
s.licenses = ["MIT"]
|
66
68
|
s.require_paths = ["lib"]
|
67
|
-
s.rubygems_version = %q{1.
|
69
|
+
s.rubygems_version = %q{1.7.2}
|
68
70
|
s.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.}
|
69
71
|
s.test_files = [
|
70
72
|
"spec/icss_spec.rb",
|
73
|
+
"spec/protocol_spec.rb",
|
71
74
|
"spec/spec_helper.rb"
|
72
75
|
]
|
73
76
|
|
@@ -76,7 +79,7 @@ Gem::Specification.new do |s|
|
|
76
79
|
|
77
80
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
78
81
|
s.add_runtime_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
|
79
|
-
s.add_runtime_dependency(%q<gorillib>, ["~> 0.1.
|
82
|
+
s.add_runtime_dependency(%q<gorillib>, ["~> 0.1.1"])
|
80
83
|
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
81
84
|
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
82
85
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -84,7 +87,7 @@ Gem::Specification.new do |s|
|
|
84
87
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
85
88
|
else
|
86
89
|
s.add_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
|
87
|
-
s.add_dependency(%q<gorillib>, ["~> 0.1.
|
90
|
+
s.add_dependency(%q<gorillib>, ["~> 0.1.1"])
|
88
91
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
89
92
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
90
93
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -93,7 +96,7 @@ Gem::Specification.new do |s|
|
|
93
96
|
end
|
94
97
|
else
|
95
98
|
s.add_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
|
96
|
-
s.add_dependency(%q<gorillib>, ["~> 0.1.
|
99
|
+
s.add_dependency(%q<gorillib>, ["~> 0.1.1"])
|
97
100
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
98
101
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
99
102
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
data/icss_specification.textile
CHANGED
@@ -251,7 +251,7 @@ An array of CatalogTarget hashes. Each CatalogTarget hash describes a catalog en
|
|
251
251
|
* @messages@ - An array of message names to attach to the catalog entry. Each message will be fully documented on the catalog. The last message in the array will be available to explore with the api explorer.
|
252
252
|
* @packages@ - An array of hashes. Each hash has a field called @data_assets@ which is an array of named data assets. Each data asset in the array will be bundled together into a single bulk download on the catalog.
|
253
253
|
|
254
|
-
h3.
|
254
|
+
h3. apeyeye
|
255
255
|
|
256
256
|
* @code_assets@ - An array of named code_assets (required to exist in the top-level @code_assets@ section) to copy to an Apeyeye repository
|
257
257
|
|
@@ -324,6 +324,10 @@ An array of ElasticSearchTarget hashes. Each ElasticSearchTarget hash describes
|
|
324
324
|
* @data_assets@ - An array of named data assets (required to exist in the @data_assets@ section), to write to the index specified by @index_name@ with the schema mapping specified by @object_type@.
|
325
325
|
* @loader@ - The way in which to load the data. One of @tsv_loader@ or @json_loader@. Choose the appropriate one based on what type of data you have.
|
326
326
|
|
327
|
+
h3. apitest
|
328
|
+
|
329
|
+
**AWAITING DOCUMENTATION**
|
330
|
+
|
327
331
|
h2. Differences between ICSS and Avro
|
328
332
|
|
329
333
|
Note the following limitations on the avro spec:
|
data/lib/icss.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
-
require '
|
1
|
+
require 'gorillib/object/blank'
|
2
|
+
require 'gorillib/string/inflections'
|
3
|
+
require 'gorillib/string/constantize'
|
4
|
+
require 'gorillib/array/compact_blank'
|
5
|
+
require 'gorillib/array/extract_options'
|
6
|
+
require 'gorillib/hash/compact'
|
7
|
+
require 'gorillib/hash/keys'
|
8
|
+
require 'gorillib/hash/tree_merge'
|
9
|
+
require 'gorillib/metaprogramming/class_attribute'
|
2
10
|
|
11
|
+
require 'gorillib/hashlike'
|
3
12
|
require 'gorillib/receiver'
|
4
13
|
require 'gorillib/receiver/acts_as_hash'
|
5
14
|
require 'gorillib/receiver/acts_as_loadable'
|
@@ -7,6 +16,7 @@ require 'gorillib/receiver/validations'
|
|
7
16
|
require 'time' # ain't that always the way
|
8
17
|
|
9
18
|
$: << File.dirname(__FILE__)
|
19
|
+
#require 'icss/core_ext' unless Object.respond_to?(:class_attribute)
|
10
20
|
require 'icss/validations'
|
11
21
|
require 'icss/type'
|
12
22
|
require 'icss/message'
|
data/lib/icss/core_ext.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'gorillib/object/blank'
|
2
2
|
require 'gorillib/string/inflections'
|
3
3
|
require 'gorillib/string/constantize'
|
4
|
+
require 'gorillib/array/compact_blank'
|
4
5
|
require 'gorillib/array/extract_options'
|
6
|
+
require 'gorillib/hash/compact'
|
5
7
|
require 'gorillib/hash/keys'
|
8
|
+
require 'gorillib/hash/tree_merge'
|
6
9
|
require 'gorillib/metaprogramming/class_attribute'
|
data/lib/icss/message.rb
CHANGED
@@ -54,19 +54,22 @@ module Icss
|
|
54
54
|
def to_hash()
|
55
55
|
{
|
56
56
|
:doc => doc,
|
57
|
+
:initial_free_qty => initial_free_qty,
|
58
|
+
:price_per_k_in_cents => price_per_k_in_cents,
|
57
59
|
:request => summary_of_request_attr,
|
58
60
|
:response => summary_of_response_attr,
|
59
|
-
:
|
61
|
+
:samples => samples.map(&:to_hash).map(&:compact_blank),
|
62
|
+
:errors => (errors.blank? ? nil : errors),
|
60
63
|
}.reject{|k,v| v.nil? }
|
61
64
|
end
|
62
65
|
def to_json(*args) to_hash.to_json(*args) ; end
|
63
66
|
|
64
67
|
private
|
65
68
|
def summary_of_response_attr
|
66
|
-
case when response.blank? then response when @response_is_reference then response.name else response.to_hash end
|
69
|
+
case when response.blank? then response when @response_is_reference then response.name else response.to_hash.compact_blank end
|
67
70
|
end
|
68
71
|
def summary_of_request_attr
|
69
|
-
request.map(&:to_hash)
|
72
|
+
request.map(&:to_hash).compact_blank
|
70
73
|
end
|
71
74
|
end
|
72
75
|
end
|
data/lib/icss/protocol.rb
CHANGED
@@ -91,6 +91,10 @@ module Icss
|
|
91
91
|
fullname.gsub('.', '/')
|
92
92
|
end
|
93
93
|
|
94
|
+
def tree_merge! arg
|
95
|
+
to_hash.tree_merge!(arg)
|
96
|
+
end
|
97
|
+
|
94
98
|
def find_message nm
|
95
99
|
return if messages.blank?
|
96
100
|
nm = nm.to_s.gsub("/", ".").split(".").last
|
@@ -119,16 +123,16 @@ module Icss
|
|
119
123
|
:update_frequency => update_frequency,
|
120
124
|
:types => (types && types.map(&:to_hash)),
|
121
125
|
:messages => messages.inject({}){|h,(k,v)| h[k] = v.to_hash; h },
|
122
|
-
:data_assets => data_assets.map(&:to_hash),
|
123
|
-
:code_assets => code_assets.map(&:to_hash),
|
126
|
+
:data_assets => data_assets.map(&:to_hash).map(&:compact_blank),
|
127
|
+
:code_assets => code_assets.map(&:to_hash).map(&:compact_blank),
|
124
128
|
:targets => targets_to_hash,
|
125
|
-
}.reject{|k,v| v.nil? }
|
129
|
+
}.reject{|k,v| v.nil? }
|
126
130
|
end
|
127
131
|
|
128
132
|
def targets_to_hash
|
129
133
|
return unless targets
|
130
134
|
targets.inject({}) do |hsh,(k,targs)|
|
131
|
-
hsh[k] = targs.map
|
135
|
+
hsh[k] = targs.map(&:to_hash).map(&:compact_blank) ; hsh
|
132
136
|
end
|
133
137
|
end
|
134
138
|
|
@@ -9,6 +9,7 @@ module Icss
|
|
9
9
|
#
|
10
10
|
class SampleMessageCall
|
11
11
|
include Receiver
|
12
|
+
include Receiver::ActsAsHash
|
12
13
|
rcvr_accessor :name, String
|
13
14
|
rcvr_accessor :doc, String
|
14
15
|
rcvr_accessor :request, Array, :default => []
|
@@ -115,23 +116,24 @@ class Icss::Protocol
|
|
115
116
|
# response: { "time": "2010-08-07 05:06:07 UTC", "epoch_seconds": 1281225967 }
|
116
117
|
#
|
117
118
|
def message_samples_hash
|
118
|
-
hsh = {
|
119
|
+
hsh = { :namespace => namespace, :protocol => protocol, :messages => {} }
|
119
120
|
messages.each do |msg_name, msg|
|
120
|
-
hsh[
|
121
|
+
hsh[:messages][msg_name] = { :samples => [] }
|
121
122
|
msg.samples.each do |sample_req|
|
122
123
|
sample_hsh = {
|
123
|
-
|
124
|
-
|
124
|
+
:name => sample_req.name,
|
125
|
+
:doc => sample_req.doc,
|
125
126
|
}
|
126
127
|
if sample_req.response.present?
|
127
|
-
then sample_hsh[
|
128
|
-
else sample_hsh[
|
128
|
+
then sample_hsh[:response] = sample_req.response
|
129
|
+
else sample_hsh[:error] = sample_req.error
|
129
130
|
end
|
130
131
|
if sample_req.url.present?
|
131
|
-
then sample_hsh[
|
132
|
-
else sample_hsh[
|
132
|
+
then sample_hsh[:url] = sample_req.url.to_s
|
133
|
+
else sample_hsh[:request] = sample_req.request
|
133
134
|
end
|
134
|
-
|
135
|
+
sample_hsh.compact_blank!
|
136
|
+
hsh[:messages][msg_name][:samples] << sample_hsh
|
135
137
|
end
|
136
138
|
end
|
137
139
|
return hsh
|
data/lib/icss/target.rb
CHANGED
data/lib/icss/type.rb
CHANGED
@@ -19,7 +19,7 @@ module Icss
|
|
19
19
|
# Schema factory
|
20
20
|
rcvr_accessor :ruby_klass, Object
|
21
21
|
rcvr_accessor :pig_name, String
|
22
|
-
rcvr_accessor :mysql_name,
|
22
|
+
rcvr_accessor :mysql_name, String
|
23
23
|
|
24
24
|
#
|
25
25
|
# Factory methods
|
@@ -37,7 +37,7 @@ module Icss
|
|
37
37
|
warn "crap. can't properly do namespaced types yet."
|
38
38
|
type_name = type_name.to_s.gsub(/(.*)\./, "")
|
39
39
|
end
|
40
|
-
VALID_TYPES[type_name.to_sym] || DERIVED_TYPES[type_name.to_sym]
|
40
|
+
Icss::Type::VALID_TYPES[type_name.to_sym] || Icss::Type::DERIVED_TYPES[type_name.to_sym]
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.primitive? name
|
@@ -203,7 +203,7 @@ module Icss
|
|
203
203
|
#
|
204
204
|
class TypeFactory
|
205
205
|
def self.receive type_info
|
206
|
-
# p ['----------', self, 'receive', type_info
|
206
|
+
# p ['----------', self, 'receive', type_info, Icss::Type::DERIVED_TYPES] if type_info.is_a?(String) && type_info =~ /abstr/
|
207
207
|
case
|
208
208
|
when type_info.is_a?(Icss::Type)
|
209
209
|
type_info
|
@@ -342,6 +342,10 @@ module Icss
|
|
342
342
|
rcvr_accessor :fields, Array, :of => Icss::RecordField, :required => true
|
343
343
|
self.type = :record
|
344
344
|
|
345
|
+
after_receive do |hsh|
|
346
|
+
Icss::Type::DERIVED_TYPES[name.to_sym] = self
|
347
|
+
end
|
348
|
+
|
345
349
|
def to_hash
|
346
350
|
super.merge( :fields => (fields||[]).map{|field| field.to_hash} )
|
347
351
|
end
|
data/spec/icss_spec.rb
CHANGED
@@ -2,9 +2,26 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
require 'icss'
|
3
3
|
|
4
4
|
describe Icss do
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
describe "loading ICSS files from hackboxen and apeyeye" do
|
6
|
+
[
|
7
|
+
Dir[ICSS_ROOT_DIR('examples/hackboxen/**/*.icss.yaml')],
|
8
|
+
Dir[ICSS_ROOT_DIR('examples/apeyeye_endpoints/**/*.icss.yaml')],
|
9
|
+
].flatten[0.. -1].each do |icss_filename|
|
10
|
+
next if icss_filename =~ %r{culture/art}
|
11
|
+
|
12
|
+
describe "#{icss_filename}" do
|
13
|
+
before do
|
14
|
+
@icss = Icss::Protocol.receive_from_file(icss_filename)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "serializes out and in again" do
|
18
|
+
#convert the icss to json and back
|
19
|
+
raw_json = JSON.generate(@icss)
|
20
|
+
json_icss = Icss::Protocol.receive(JSON.parse(raw_json))
|
21
|
+
|
22
|
+
json_icss.to_hash.should == @icss.to_hash
|
23
|
+
end
|
24
|
+
end
|
8
25
|
end
|
9
26
|
end
|
10
27
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Philip (flip) Kromer for Infochimps
|
@@ -10,86 +15,118 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-06-
|
14
|
-
default_executable:
|
18
|
+
date: 2011-06-10 00:00:00 Z
|
15
19
|
dependencies:
|
16
20
|
- !ruby/object:Gem::Dependency
|
21
|
+
prerelease: false
|
17
22
|
name: yajl-ruby
|
18
|
-
|
23
|
+
type: :runtime
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
19
25
|
none: false
|
20
26
|
requirements:
|
21
27
|
- - ~>
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 59
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 8
|
33
|
+
- 2
|
23
34
|
version: 0.8.2
|
24
|
-
|
25
|
-
prerelease: false
|
26
|
-
version_requirements: *id001
|
35
|
+
requirement: *id001
|
27
36
|
- !ruby/object:Gem::Dependency
|
37
|
+
prerelease: false
|
28
38
|
name: gorillib
|
29
|
-
|
39
|
+
type: :runtime
|
40
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
30
41
|
none: false
|
31
42
|
requirements:
|
32
43
|
- - ~>
|
33
44
|
- !ruby/object:Gem::Version
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
45
|
+
hash: 25
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 1
|
49
|
+
- 1
|
50
|
+
version: 0.1.1
|
51
|
+
requirement: *id002
|
38
52
|
- !ruby/object:Gem::Dependency
|
53
|
+
prerelease: false
|
39
54
|
name: rspec
|
40
|
-
|
55
|
+
type: :development
|
56
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
41
57
|
none: false
|
42
58
|
requirements:
|
43
59
|
- - ~>
|
44
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
62
|
+
segments:
|
63
|
+
- 2
|
64
|
+
- 3
|
65
|
+
- 0
|
45
66
|
version: 2.3.0
|
46
|
-
|
47
|
-
prerelease: false
|
48
|
-
version_requirements: *id003
|
67
|
+
requirement: *id003
|
49
68
|
- !ruby/object:Gem::Dependency
|
69
|
+
prerelease: false
|
50
70
|
name: yard
|
51
|
-
|
71
|
+
type: :development
|
72
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
52
73
|
none: false
|
53
74
|
requirements:
|
54
75
|
- - ~>
|
55
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 7
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
- 6
|
81
|
+
- 0
|
56
82
|
version: 0.6.0
|
57
|
-
|
58
|
-
prerelease: false
|
59
|
-
version_requirements: *id004
|
83
|
+
requirement: *id004
|
60
84
|
- !ruby/object:Gem::Dependency
|
85
|
+
prerelease: false
|
61
86
|
name: bundler
|
62
|
-
|
87
|
+
type: :development
|
88
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
63
89
|
none: false
|
64
90
|
requirements:
|
65
91
|
- - ~>
|
66
92
|
- !ruby/object:Gem::Version
|
93
|
+
hash: 23
|
94
|
+
segments:
|
95
|
+
- 1
|
96
|
+
- 0
|
97
|
+
- 0
|
67
98
|
version: 1.0.0
|
68
|
-
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: *id005
|
99
|
+
requirement: *id005
|
71
100
|
- !ruby/object:Gem::Dependency
|
101
|
+
prerelease: false
|
72
102
|
name: jeweler
|
73
|
-
|
103
|
+
type: :development
|
104
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
74
105
|
none: false
|
75
106
|
requirements:
|
76
107
|
- - ~>
|
77
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 7
|
110
|
+
segments:
|
111
|
+
- 1
|
112
|
+
- 5
|
113
|
+
- 2
|
78
114
|
version: 1.5.2
|
79
|
-
|
80
|
-
prerelease: false
|
81
|
-
version_requirements: *id006
|
115
|
+
requirement: *id006
|
82
116
|
- !ruby/object:Gem::Dependency
|
117
|
+
prerelease: false
|
83
118
|
name: rcov
|
84
|
-
|
119
|
+
type: :development
|
120
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
85
121
|
none: false
|
86
122
|
requirements:
|
87
123
|
- - ">="
|
88
124
|
- !ruby/object:Gem::Version
|
125
|
+
hash: 3
|
126
|
+
segments:
|
127
|
+
- 0
|
89
128
|
version: "0"
|
90
|
-
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: *id007
|
129
|
+
requirement: *id007
|
93
130
|
description: "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."
|
94
131
|
email: coders@infochimps.com
|
95
132
|
executables: []
|
@@ -123,6 +160,7 @@ files:
|
|
123
160
|
- examples/avro_examples/org/apache/avro/mapred/tether/OutputProtocol.avpr
|
124
161
|
- examples/avro_examples/simple.avpr
|
125
162
|
- examples/avro_examples/weather.avsc
|
163
|
+
- examples/chronic.icss.yaml
|
126
164
|
- icss.gemspec
|
127
165
|
- icss_specification.textile
|
128
166
|
- init.rb
|
@@ -142,8 +180,8 @@ files:
|
|
142
180
|
- lib/icss/validations.rb
|
143
181
|
- lib/icss/view_helper.rb
|
144
182
|
- spec/icss_spec.rb
|
183
|
+
- spec/protocol_spec.rb
|
145
184
|
- spec/spec_helper.rb
|
146
|
-
has_rdoc: true
|
147
185
|
homepage: http://github.com/mrflip/icss
|
148
186
|
licenses:
|
149
187
|
- MIT
|
@@ -157,7 +195,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
195
|
requirements:
|
158
196
|
- - ">="
|
159
197
|
- !ruby/object:Gem::Version
|
160
|
-
hash:
|
198
|
+
hash: 3
|
161
199
|
segments:
|
162
200
|
- 0
|
163
201
|
version: "0"
|
@@ -166,14 +204,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
204
|
requirements:
|
167
205
|
- - ">="
|
168
206
|
- !ruby/object:Gem::Version
|
207
|
+
hash: 3
|
208
|
+
segments:
|
209
|
+
- 0
|
169
210
|
version: "0"
|
170
211
|
requirements: []
|
171
212
|
|
172
213
|
rubyforge_project:
|
173
|
-
rubygems_version: 1.
|
214
|
+
rubygems_version: 1.7.2
|
174
215
|
signing_key:
|
175
216
|
specification_version: 3
|
176
217
|
summary: "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."
|
177
218
|
test_files:
|
178
219
|
- spec/icss_spec.rb
|
220
|
+
- spec/protocol_spec.rb
|
179
221
|
- spec/spec_helper.rb
|