sequel_plus 0.0.4 → 0.0.6

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.
data/README.md CHANGED
@@ -19,7 +19,6 @@ This gem is released to gemcutter. Rubyforge is not utilized.
19
19
  And then, in your project:
20
20
 
21
21
  require 'sequel'
22
- require 'sequel_plus'
23
22
 
24
23
  class Node < Sequel::Model
25
24
  plugin :tree
data/Rakefile CHANGED
@@ -14,8 +14,7 @@ begin
14
14
  "LICENSE",
15
15
  "README.md",
16
16
  "Rakefile",
17
- "lib/sequel_plus.rb",
18
- "lib/**/*",
17
+ "lib/*",
19
18
  "test/*"
20
19
  ]
21
20
 
data/lib/sequel_plus.rb CHANGED
@@ -1 +1,2 @@
1
1
  require 'sequel_tree'
2
+ require 'extensions/export'
@@ -0,0 +1,58 @@
1
+ require 'helper'
2
+ require 'sequel_plus'
3
+
4
+ DB = Sequel.sqlite
5
+
6
+ DB.create_table :nodes do
7
+ primary_key :id
8
+ String :name
9
+ Integer :parent_id
10
+ Integer :position
11
+ end
12
+
13
+ NODES = [
14
+ {:id => 1, :name => 'one', :parent_id => nil, :position => 1},
15
+ {:id => 2, :name => 'two', :parent_id => nil, :position => 2},
16
+ {:id => 3, :name => 'three', :parent_id => nil, :position => 3},
17
+ {:id => 4, :name => "two.one", :parent_id => 2, :position => 1},
18
+ {:id => 5, :name => "two.two", :parent_id => 2, :position => 2},
19
+ {:id => 6, :name => "two.two.one", :parent_id => 5, :position => 1},
20
+ {:id => 7, :name => "one.two", :parent_id => 1, :position => 2},
21
+ {:id => 8, :name => "one.one", :parent_id => 1, :position => 1},
22
+ {:id => 9, :name => "five", :parent_id => nil, :position => 5},
23
+ {:id => 10, :name => "four", :parent_id => nil, :position => 4},
24
+ {:id => 11, :name => "five.one", :parent_id => 9, :position => 1},
25
+ {:id => 12, :name => "two.three", :parent_id => 2, :position => 3},
26
+ ]
27
+
28
+ DB.create_table :lorems do
29
+ primary_key :id
30
+ String :name
31
+ Integer :ipsum_id
32
+ Integer :neque
33
+ end
34
+
35
+ LOREMS = [
36
+ {:id => 1, :name => 'Lorem', :ipsum_id => nil, :neque => 4},
37
+ {:id => 2, :name => 'Ipsum', :ipsum_id => nil, :neque => 3},
38
+ {:id => 4, :name => "Neque", :ipsum_id => 2, :neque => 2},
39
+ {:id => 5, :name => "Porro", :ipsum_id => 2, :neque => 1},
40
+ ]
41
+
42
+ NODES.each{|node| DB[:nodes].insert(node)}
43
+ LOREMS.each{|lorem| DB[:lorems].insert(lorem)}
44
+
45
+ describe Sequel::Export do
46
+
47
+ it "should instantiate" do
48
+ DB[:nodes].all.size.should == 12
49
+ end
50
+
51
+ it "should export everything" do
52
+ DB[:nodes].export.should == "id\tname\tparent_id\tposition\n1\tone\t\t1\n2\ttwo\t\t2\n3\tthree\t\t3\n4\ttwo.one\t2\t1\n5\ttwo.two\t2\t2\n6\ttwo.two.one\t5\t1\n7\tone.two\t1\t2\n8\tone.one\t1\t1\n9\tfive\t\t5\n10\tfour\t\t4\n11\tfive.one\t9\t1\n12\ttwo.three\t2\t3"
53
+ end
54
+
55
+ it "should export selected" do
56
+ DB[:nodes].filter(:id < 3).select(:id, :name).export.should == "id\tname\n1\tone\n2\ttwo"
57
+ end
58
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Lang
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-14 00:00:00 -05:00
12
+ date: 2010-02-12 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -48,6 +48,7 @@ files:
48
48
  - lib/sequel_plus.rb
49
49
  - lib/sequel_tree.rb
50
50
  - test/helper.rb
51
+ - test/test_export.rb
51
52
  - test/test_sequel_tree.rb
52
53
  has_rdoc: true
53
54
  homepage: http://github.com/mwlang/sequel_plus
@@ -79,4 +80,5 @@ specification_version: 3
79
80
  summary: provides plugins and extensions for Sequel
80
81
  test_files:
81
82
  - test/helper.rb
83
+ - test/test_export.rb
82
84
  - test/test_sequel_tree.rb