Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added rake tasks to mimic those found in Rails projects

  • Loading branch information...
commit ad45aa040e3594e1ecb801ea7c1a83387d51e772 1 parent a081a1d
@mwlang authored
Showing with 50 additions and 3 deletions.
  1. +3 −3 README.md
  2. +47 −0 test/rake/Rakefile
View
6 README.md
@@ -5,9 +5,9 @@ The library is in very early infancy stage, so there's not much presently, but w
in specs and tested and used in production-level deployments already.
-Currently, sequel_plus contains:
- * plugin for Trees to mimic the Rails acts_as_tree plugin.
- * extension for exporting data using Dataset#export.
+### Currently, sequel_plus contains:
+* plugin for Trees to mimic the Rails acts_as_tree plugin.
+* extension for exporting data using Dataset#export.
NOTE: Authors of other plugins and extensions for Sequel are welcome to contact me for inclusion
of your plugin and extension to this project.
View
47 test/rake/Rakefile
@@ -0,0 +1,47 @@
+require 'sequel'
+require 'sequel_plus'
+require 'tasks/sequel'
+
+task :environment do
+ DB = Sequel.sqlite
+
+ DB.create_table :nodes do
+ primary_key :id
+ String :name
+ Integer :parent_id
+ Integer :position
+ end
+
+ NODES = [
+ {:id => 1, :name => 'one', :parent_id => nil, :position => 1},
+ {:id => 2, :name => 'two', :parent_id => nil, :position => 2},
+ {:id => 3, :name => 'three', :parent_id => nil, :position => 3},
+ {:id => 4, :name => "two.one", :parent_id => 2, :position => 1},
+ {:id => 5, :name => "two.two", :parent_id => 2, :position => 2},
+ {:id => 6, :name => "two.two.one", :parent_id => 5, :position => 1},
+ {:id => 7, :name => "one.two", :parent_id => 1, :position => 2},
+ {:id => 8, :name => "one.one", :parent_id => 1, :position => 1},
+ {:id => 9, :name => "five", :parent_id => nil, :position => 5},
+ {:id => 10, :name => "four", :parent_id => nil, :position => 4},
+ {:id => 11, :name => "five.one", :parent_id => 9, :position => 1},
+ {:id => 12, :name => "two.three", :parent_id => 2, :position => 3},
+ ]
+
+ DB.create_table :lorems do
+ primary_key :id
+ String :name
+ Integer :ipsum_id
+ Integer :neque
+ end
+
+ LOREMS = [
+ {:id => 1, :name => 'Lorem', :ipsum_id => nil, :neque => 4},
+ {:id => 2, :name => 'Ipsum', :ipsum_id => nil, :neque => 3},
+ {:id => 4, :name => "Neque", :ipsum_id => 2, :neque => 2},
+ {:id => 5, :name => "Porro", :ipsum_id => 2, :neque => 1},
+ ]
+
+ NODES.each{|node| DB[:nodes].insert(node)}
+ LOREMS.each{|lorem| DB[:lorems].insert(lorem)}
+end
+
Please sign in to comment.
Something went wrong with that request. Please try again.