squealer 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,26 +1,23 @@
1
1
  # Squealer
2
2
 
3
3
  ## Warning
4
- Squealer is for standalone operation. Do not use it from within your application. To make the DSL easy to use, we alter `Object`, `NilClass`, `Time`, and `Hash`.
4
+ Squealer is for standalone operation. Do not use it from within your application. To make the DSL easy to use, we alter `Hash`, `NilClass`, `Object`, and `Time`.
5
5
 
6
+ * `Hash#method_missing` - You prefer dot notation. JSON uses dot notation. You are importing from a data store which represents collections as arrays of hashmaps. Dot notation for navigating those collections is convenient. If you use a field name that happens to be a method on Hash you will have to use index notation. (e.g. `kitten.toys` is good, however `kitten.freeze` is not good. Use `kitten['freeze']` instead.)
7
+ * `NilClass#each` - As you are importing from schemaless repositories and you may be trying to iterate on fields that contain embedded collections, if a specific parent does not contain one of those child collections, the driver will be returning "nil" as the value for that field. Having `NilClass#each` return a `[]` for a nil is convenient, semantically correct in this context, and removes the need for many nil checks in the block you provide to `Object#assign`
6
8
  * `Object` - `#import`, `#export`, `#target`, and `#assign` "keywords" are provided for convenience
7
- * `NilClass`
8
- * `#each` - As you are importing from schemaless repositories and you may be trying to iterate on fields that contain embedded collections, if a specific parent does not contain one of those child collections, the driver will be returning "nil" as the value for that field. Having `NilClass#each` return a `[]` for a nil is convenient, semantically correct in this context, and removes the need for many nil checks in the block you provide to `Object#assign`
9
- * `Time`
10
- * `#to_s` - As you are exporting to a SQL database, we represent your timestamp in a format that it will parse unequivocally (mongodb stores all temporal data as a timestamp)
11
- * `Hash`
12
- * `#method_missing` - You prefer dot notation. JSON uses dot notation. You are importing from a data store which represents collections as arrays of hashmaps. Dot notation for navigating those collections is convenient. If you use a field name that happens to be a method on Hash you will have to use index notation. (e.g. `kitten.toys` is good, however `kitten.freeze` is not good. Use `kitten['freeze']` instead.)
9
+ * `Time#to_s` - As you are exporting to a SQL database, we represent your timestamp in a format that it will parse unequivocally (mongodb stores all temporal data as a timestamp)
13
10
 
14
11
  To run standalone, simply make your data squeal thusly:
15
12
 
16
- `> ruby example_squeal.rb`
13
+ `ruby example_squeal.rb`
17
14
 
18
15
  where the squeal script requires 'squealer'.
19
16
 
20
17
  Squealer doesn't use your application classes. It doesn't use your ActiveRecord models. It's an ETL tool. It could even be called a HRM (Hashmap-Relational-Mapper), but only in hushed tones in the corner boothes of dark pubs.
21
18
 
22
19
  ## Databases supported
23
- For now, this is specifically for MongoDB exporting to mySQL with the assumption that the data will be heavily denormalized.
20
+ For now, this is specifically for _MongoDB_ exporting to _mySQL_ with the assumption that the data will be heavily denormalized - particularly that the hierarchy keys for embedded documents are flattened. This means that a document from `office.room.box` will be exported to a record containing the `id` for `office`, the `id` for `room` and the `id` for `box`.
24
21
 
25
22
  ## Notes
26
23
  The target SQL database must have no foreign keys (because it can't rely on the primary key values and referential integrity is the responsibility of the source data store or the application that uses it).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -0,0 +1,7 @@
1
+ class TrueClass
2
+ def to_i; 1; end
3
+ end
4
+
5
+ class FalseClass
6
+ def to_i; 0; end
7
+ end
data/lib/squealer.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'squealer/boolean'
1
2
  require 'squealer/object'
2
3
  require 'squealer/hash'
3
4
  require 'squealer/time'
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe TrueClass do
4
+
5
+ describe "#to_i" do
6
+
7
+ it "returns 1" do
8
+ true.to_i.should == 1
9
+ end
10
+ end
11
+ end
12
+
13
+ describe FalseClass do
14
+
15
+ it "returns 0" do
16
+ false.to_i.should == 0
17
+ end
18
+ end
data/squealer.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{squealer}
8
- s.version = "1.0.1"
8
+ s.version = "1.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josh Graham", "Durran Jordan"]
12
- s.date = %q{2010-03-26}
12
+ s.date = %q{2010-04-27}
13
13
  s.description = %q{Exports mongodb to mysql. More later.}
14
14
  s.email = %q{joshua.graham@grahamis.com}
15
15
  s.extra_rdoc_files = [
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  "VERSION",
24
24
  "lib/example_squeal.rb",
25
25
  "lib/squealer.rb",
26
+ "lib/squealer/boolean.rb",
26
27
  "lib/squealer/database.rb",
27
28
  "lib/squealer/hash.rb",
28
29
  "lib/squealer/object.rb",
@@ -31,6 +32,7 @@ Gem::Specification.new do |s|
31
32
  "lib/tasks/jeweler.rake",
32
33
  "spec/spec.opts",
33
34
  "spec/spec_helper.rb",
35
+ "spec/squealer/boolean_spec.rb",
34
36
  "spec/squealer/database_spec.rb",
35
37
  "spec/squealer/hash_spec.rb",
36
38
  "spec/squealer/object_spec.rb",
@@ -45,6 +47,7 @@ Gem::Specification.new do |s|
45
47
  s.summary = %q{Document-oriented to Relational database exporter}
46
48
  s.test_files = [
47
49
  "spec/spec_helper.rb",
50
+ "spec/squealer/boolean_spec.rb",
48
51
  "spec/squealer/database_spec.rb",
49
52
  "spec/squealer/hash_spec.rb",
50
53
  "spec/squealer/object_spec.rb",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 1
9
- version: 1.0.1
8
+ - 2
9
+ version: 1.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Josh Graham
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-03-26 00:00:00 -05:00
18
+ date: 2010-04-27 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -62,6 +62,7 @@ files:
62
62
  - VERSION
63
63
  - lib/example_squeal.rb
64
64
  - lib/squealer.rb
65
+ - lib/squealer/boolean.rb
65
66
  - lib/squealer/database.rb
66
67
  - lib/squealer/hash.rb
67
68
  - lib/squealer/object.rb
@@ -70,6 +71,7 @@ files:
70
71
  - lib/tasks/jeweler.rake
71
72
  - spec/spec.opts
72
73
  - spec/spec_helper.rb
74
+ - spec/squealer/boolean_spec.rb
73
75
  - spec/squealer/database_spec.rb
74
76
  - spec/squealer/hash_spec.rb
75
77
  - spec/squealer/object_spec.rb
@@ -108,6 +110,7 @@ specification_version: 3
108
110
  summary: Document-oriented to Relational database exporter
109
111
  test_files:
110
112
  - spec/spec_helper.rb
113
+ - spec/squealer/boolean_spec.rb
111
114
  - spec/squealer/database_spec.rb
112
115
  - spec/squealer/hash_spec.rb
113
116
  - spec/squealer/object_spec.rb