Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added basic framework

  • Loading branch information...
commit f3314dabcdd0c5d6a6857fee3f09a7a1a24f6898 1 parent 0c80cdd
Carl Sverre authored
Showing with 88 additions and 0 deletions.
  1. +3 −0  .todd
  2. +57 −0 todd.rb
  3. +28 −0 todd_model.rb
View
3  .todd
@@ -0,0 +1,3 @@
+Conf = {
+ :list_hash => 061a4ccf9bd1261d1643b7af39f4e82c
+}
View
57 todd.rb
@@ -0,0 +1,57 @@
+require 'todd_model'
+
+class Todd
+ def initialize(config)
+ @todd_hash = config[:list_hash]
+ end
+
+ # COMMANDS
+
+ def init
+ end
+
+ def add_remote
+ p "Not Implemented"
+ end
+
+ def sync
+ p "Not Implemented"
+ end
+
+ def add
+ end
+
+ def rm
+ end
+
+ def list
+ end
+
+ def find
+ end
+
+ def start
+ end
+
+ # stop <id>
+ def stop id
+ p id
+ end
+end
+
+# Parse the .todd file if it exists
+# Adds the Conf hash to the global namespace for now
+begin
+ eval file.new(".todd").read
+rescue ScriptError=>e
+ warn("An error occured while reading ./.todd",e)
+end
+
+return if Conf.nil?
+
+todd = Todd.new(Conf)
+
+ARGV.each do |a|
+ puts "Argument: #{a}"
+ todd.method(a.intern).call()
+end
View
28 todd_model.rb
@@ -0,0 +1,28 @@
+require 'rubygems'
+require 'dm-core'
+
+# Setup DataMapper
+
+DataMapper.setup(:default, 'sqlite3::memory:')
+
+
+class Category
+ include DataMapper::Resource
+
+ property :id, Serial
+ property :name, String
+ property :created_at, DateTime, :default => DateTime.new
+end
+
+class Task
+ include DataMapper::Resource
+
+ property :id, Serial
+ property :title, String
+ property :notes, Text
+ property :created_at, DateTime, :default => DateTime.new
+ property :deleted, Boolean, :default => false
+ property :deleted_at, DateTime, :default => DateTime.new
+
+ belongs_to :category
+end
Please sign in to comment.
Something went wrong with that request. Please try again.