bluplate 0.0.1 → 0.1.0

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/Rakefile CHANGED
@@ -12,6 +12,7 @@ begin
12
12
  gem.authors = ["matthew jording"]
13
13
  gem.add_runtime_dependency "settingslogic"
14
14
  gem.add_runtime_dependency "mongo"
15
+ gem.add_runtime_dependency "tweetstream"
15
16
  gem.add_development_dependency "rspec", ">= 1.2.9"
16
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
18
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bluplate}
8
- s.version = "0.0.1"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["matthew jording"]
12
- s.date = %q{2010-05-23}
12
+ s.date = %q{2010-05-26}
13
13
  s.description = %q{a simple framework to share yourwork}
14
14
  s.email = %q{mjording@opengotham.com}
15
15
  s.extra_rdoc_files = [
@@ -27,12 +27,16 @@ Gem::Specification.new do |s|
27
27
  "config/application.yml",
28
28
  "init.rb",
29
29
  "lib/bluplate.rb",
30
- "lib/persist.rb",
31
- "lib/settings.rb",
32
- "lib/task.rb",
33
- "lib/ticket.rb",
34
- "lib/user.rb",
30
+ "lib/bluplate/inbox.rb",
31
+ "lib/bluplate/inbox_plugins/dummy.rb",
32
+ "lib/bluplate/persist.rb",
33
+ "lib/bluplate/settings.rb",
34
+ "lib/bluplate/source.rb",
35
+ "lib/bluplate/task.rb",
36
+ "lib/bluplate/ticket.rb",
37
+ "lib/bluplate/user.rb",
35
38
  "spec/bluplate_spec.rb",
39
+ "spec/inbox_spec.rb",
36
40
  "spec/spec.opts",
37
41
  "spec/spec_helper.rb",
38
42
  "spec/task_spec.rb",
@@ -46,6 +50,7 @@ Gem::Specification.new do |s|
46
50
  s.summary = %q{share your work}
47
51
  s.test_files = [
48
52
  "spec/bluplate_spec.rb",
53
+ "spec/inbox_spec.rb",
49
54
  "spec/spec_helper.rb",
50
55
  "spec/task_spec.rb",
51
56
  "spec/ticket_spec.rb",
@@ -59,15 +64,18 @@ Gem::Specification.new do |s|
59
64
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
60
65
  s.add_runtime_dependency(%q<settingslogic>, [">= 0"])
61
66
  s.add_runtime_dependency(%q<mongo>, [">= 0"])
67
+ s.add_runtime_dependency(%q<tweetstream>, [">= 0"])
62
68
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
63
69
  else
64
70
  s.add_dependency(%q<settingslogic>, [">= 0"])
65
71
  s.add_dependency(%q<mongo>, [">= 0"])
72
+ s.add_dependency(%q<tweetstream>, [">= 0"])
66
73
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
67
74
  end
68
75
  else
69
76
  s.add_dependency(%q<settingslogic>, [">= 0"])
70
77
  s.add_dependency(%q<mongo>, [">= 0"])
78
+ s.add_dependency(%q<tweetstream>, [">= 0"])
71
79
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
72
80
  end
73
81
  end
data/init.rb CHANGED
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ require 'bluplate'
3
+ require 'bluplate/user'
4
+ require 'bluplate/inbox'
5
+ require 'bluplate/task'
6
+ require 'bluplate/ticket'
7
+ require 'bluplate/persist'
8
+ require 'bluplate/settings'
@@ -0,0 +1,4 @@
1
+
2
+ module Bluplate
3
+
4
+ end
@@ -0,0 +1,23 @@
1
+ module Bluplate
2
+
3
+ class Inbox
4
+ include Persist::Base
5
+ attr_accessor :tasks, :sources
6
+
7
+ def initialize(opts={})
8
+ @tasks = {}
9
+ @sources = opts[:sources]
10
+ end
11
+
12
+ def to_hash
13
+ {:tasks => @tasks }
14
+ end
15
+
16
+ def retrieve
17
+ if @sources && !@sources.empty?
18
+ @sources.inject(@tasks){|e, i| e + i.import}
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ module Bluplate
2
+
3
+ class Dummy
4
+ attr_accessor :tasks
5
+ def initialize
6
+ @tasks = []
7
+ end
8
+ def import
9
+
10
+ 0..10.each do
11
+ @tasks << Task.new("test@tester.com", "this is my task, there are many like it, but this one is mine")
12
+ end
13
+
14
+ end
15
+
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+ require 'mongo'
3
+ require 'settings'
4
+ require 'json'
5
+ require 'active_support/inflector'
6
+ module Bluplate
7
+ module Persist
8
+
9
+ module Base
10
+
11
+ def save
12
+ self.class.db.collection(self.class.to_s.downcase.pluralize).insert(self.to_hash)
13
+ end
14
+
15
+ def self.included(base)
16
+ base.extend ClassMethods
17
+ end
18
+
19
+ module ClassMethods
20
+ def db
21
+ Bluplate::Persist.db
22
+ end
23
+ end
24
+ end
25
+
26
+ def db
27
+ @db ||= begin
28
+ Mongo::Connection.new(Settings.mongo.host).db(Settings.mongo.db)
29
+ end
30
+ end
31
+ module_function :db
32
+ end
33
+ end
@@ -0,0 +1,6 @@
1
+ require 'settingslogic'
2
+ module Bluplate
3
+ class Settings < Settingslogic
4
+ source File.join(File.dirname(__FILE__), '..', 'config', 'application.yml')
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ Dir[File.join(File.dirname(__FILE__), "inbox_plugins","*","*.rb")].each do |plugin|
2
+ require plugin
3
+ end
4
+
5
+ class Source
6
+
7
+
8
+
9
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module Bluplate
3
+ class Task
4
+ include Bluplate::Persist::Base
5
+ attr_accessor :tags, :description, :user_email
6
+
7
+ def initialize(user_email, description)
8
+ @user_email = user_email
9
+ @description = description
10
+ @tags ||= {}
11
+ end
12
+
13
+ def to_hash
14
+ {:tags => @tags, :user_email => @user_email, :description => @description}
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module Bluplate
2
+ class Ticket
3
+
4
+ attr_accessor :task, :user_email
5
+
6
+ def initialize(task, user_email)
7
+ @task = task
8
+ @user_email = user_email
9
+ end
10
+
11
+ def to_hash
12
+ {:task => @task, :user_email => @user_email}
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,43 @@
1
+ require 'persist'
2
+ require 'mongo'
3
+ require 'json'
4
+ module Bluplate
5
+ class User
6
+ include Persist::Base
7
+
8
+ attr_accessor :email, :inbox, :workstream, :contacts
9
+
10
+ def initialize(opts)
11
+
12
+ @email = opts[:email]
13
+ @inbox = opts[:inbox] || {}
14
+ @contacts = opts[:contacts] || {}
15
+ @workstream = opts[:workstream] || {}
16
+ end
17
+
18
+ def to_hash
19
+ {:email => @email, :inbox => @inbox, :workstream => @workstream, :contacts => @contacts }
20
+ end
21
+
22
+ def self.find_by_email(email)
23
+ if user_h = db.collection("users").find_one({"email" => email})
24
+ user_hash = user_h.each{ |doc| doc.inspect }
25
+ else
26
+ user_hash = nil
27
+ end
28
+ inbox = user_hash ? user_hash["inbox"] : {}
29
+ User.new(:email => email, :inbox => inbox)
30
+ end
31
+
32
+ def self.create(opts={})
33
+ u = self.new(opts)
34
+ u.save
35
+ u
36
+ end
37
+
38
+ def add_contacts(contacts)
39
+
40
+ end
41
+ end
42
+
43
+ end
@@ -2,10 +2,10 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "Bluplate" do
4
4
  before(:each) do
5
- @user = User.new(:email => "test@tester.com")
5
+ @user = Bluplate::User.new(:email => "test@tester.com")
6
6
  end
7
7
  it "should have a user" do
8
8
 
9
- @user.class.should == User
9
+ @user.class.should == Bluplate::User
10
10
  end
11
11
  end
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+ describe "Inbox" do
3
+ before(:each) do
4
+ @user = Bluplate::User.find_by_email("test@tester.com") ? Bluplate::User.find_by_email("test@tester.com") : Bluplate::User.create(:email => "test@tester.com")
5
+ @inbox = Bluplate::Inbox.new
6
+ end
7
+
8
+ it "should have a hash of tasks" do
9
+ @inbox.tasks.class == Hash
10
+ @task = Bluplate::Task.new(@user.email, "this is my task, there are many like it, but this one is mine")
11
+ @inbox.tasks["test"] = @task.to_hash
12
+ @inbox.tasks["test"].class == Bluplate::Task
13
+ @inbox.save
14
+ end
15
+
16
+ it "should be able to retrieve tasks from a source" do
17
+ @inbox.retrieve
18
+ @inbox.tasks.should_not be nil
19
+ end
20
+
21
+ end
@@ -3,9 +3,12 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'bluplate'
4
4
  require 'spec'
5
5
  require 'spec/autorun'
6
- require 'task'
7
- require 'user'
8
- require 'ticket'
6
+ require 'bluplate/persist'
7
+ require 'bluplate/task'
8
+ require 'bluplate/user'
9
+ require 'bluplate/ticket'
10
+ require 'bluplate/inbox'
11
+
9
12
  Spec::Runner.configure do |config|
10
13
 
11
14
  end
@@ -3,8 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe "Task" do
4
4
 
5
5
  before(:each) do
6
- @u = User.find_by_email("test@tester.com") ? User.find_by_email("test@tester.com") : User.create(:email => "test@tester.com")
7
- @task = Task.new(@u.email, "this is my task, there are many like it, but this one is mine")
6
+ @u = Bluplate::User.find_by_email("test@tester.com") ? Bluplate::User.find_by_email("test@tester.com") : Bluplate::User.create(:email => "test@tester.com")
7
+ @task = Bluplate::Task.new(@u.email, "this is my task, there are many like it, but this one is mine")
8
8
 
9
9
  end
10
10
 
@@ -12,20 +12,18 @@ describe "Task" do
12
12
  @task.tags.class == Hash
13
13
  end
14
14
 
15
-
16
-
17
15
  it "should persist" do
18
- @u.class.should == User
16
+ @u.class.should == Bluplate::User
19
17
  @u.inbox["test"] = @task.to_hash
20
18
  @u.save
21
- @user = User.find_by_email(@u.email)
19
+ @user = Bluplate::User.find_by_email(@u.email)
22
20
  @user.inbox.first == @task
23
21
  end
24
22
 
25
23
  it "should have a description" do
26
24
  @u.inbox["test"] = @task.to_hash
27
25
  @u.save
28
- @user = User.find_by_email(@u.email)
26
+ @user = Bluplate::User.find_by_email(@u.email)
29
27
 
30
28
 
31
29
  @user.inbox["test"].should_not == nil
@@ -3,8 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe "Ticket" do
4
4
 
5
5
  before(:each) do
6
- @u = User.find_by_email("test@tester.com") ? User.find_by_email("test@tester.com") : User.create(:email => "test@tester.com")
7
- @task = Task.new(@u.email, "this is my task, there are many like it, but this one is mine")
6
+ @u = Bluplate::User.find_by_email("test@tester.com") ? Bluplate::User.find_by_email("test@tester.com") : Bluplate::User.create(:email => "test@tester.com")
7
+ @task = Bluplate::Task.new(@u.email, "this is my task, there are many like it, but this one is mine")
8
8
  @u.inbox["test"] = @task.to_hash
9
9
  @u.save
10
10
 
@@ -12,9 +12,9 @@ describe "Ticket" do
12
12
 
13
13
  it "should have a task" do
14
14
 
15
- @ticket = Ticket.new(@task, @u.email)
15
+ @ticket = Bluplate::Ticket.new(@task, @u.email)
16
16
  @ticket.task.should_not == nil
17
- @ticket.task.class.should == Task
17
+ @ticket.task.class.should == Bluplate::Task
18
18
  end
19
19
 
20
20
  end
@@ -2,18 +2,19 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "User" do
4
4
  before(:each) do
5
- @user = User.find_by_email("test@tester.com") ? User.find_by_email("test@tester.com") : User.create(:email => "test@tester.com")
5
+ @user = Bluplate::User.find_by_email("test@tester.com") ? Bluplate::User.find_by_email("test@tester.com") : Bluplate::User.create(:email => "test@tester.com")
6
6
 
7
7
  # @user = User.new(:email => "test@tester.com", :inbox => {})
8
8
  #@user.save
9
9
  end
10
- it "should have an inbox hash of tasks" do
10
+ it "should have an inbox " do
11
+
12
+
13
+ end
14
+
15
+
16
+ it "should import tasks from twitterstream filter" do
11
17
 
12
- @user.inbox.class == Hash
13
- @task = Task.new(@user.email, "this is my task, there are many like it, but this one is mine")
14
- @user.inbox["test"] = @task.to_hash
15
- @user.inbox["test"].class == Task
16
- @user.save
17
18
  end
18
19
 
19
20
  it "can have a workstream hash" do
@@ -22,15 +23,15 @@ describe "User" do
22
23
  end
23
24
 
24
25
  it "can add a ticket to workstream from inbox task" do
25
- @task = Task.new(@user.email, "this is my task, there are many like it, but this one is mine")
26
+ @task = Bluplate::Task.new(@user.email, "this is my task, there are many like it, but this one is mine")
26
27
  @user.inbox["test"] = @task.to_hash
27
28
  @user.save
28
- @u = User.find_by_email(@user.email)
29
+ @u = Bluplate::User.find_by_email(@user.email)
29
30
  @u.inbox.first == @task
30
- @ticket = Ticket.new(@u.inbox.first, @user.email)
31
+ @ticket = Bluplate::Ticket.new(@u.inbox.first, @user.email)
31
32
  @u.workstream["test"] = @ticket.to_hash
32
33
  @u.save
33
- @uu = User.find_by_email(@user.email)
34
+ @uu = Bluplate::User.find_by_email(@user.email)
34
35
  @uu.workstream.first == @ticket
35
36
  end
36
37
 
@@ -38,18 +39,19 @@ describe "User" do
38
39
  @user.contacts.should_not == nil
39
40
  @user.contacts.class == Hash
40
41
  end
41
-
42
-
43
-
42
+ it "can import contact from twitter" do
43
+ @user.contacts[]
44
+ @user.contacts.class == Hash
45
+ end
44
46
 
45
47
  it "should return a User object on find_by_email" do
46
48
  @user.save
47
- User.find_by_email(@user.email).class.should == User
49
+ Bluplate::User.find_by_email(@user.email).class.should == Bluplate::User
48
50
  end
49
51
 
50
52
  it "should persist" do
51
53
  @user.save
52
- @u = User.find_by_email(@user.email)
54
+ @u = Bluplate::User.find_by_email(@user.email)
53
55
  @u.should_not == nil
54
56
  end
55
57
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 0
8
7
  - 1
9
- version: 0.0.1
8
+ - 0
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - matthew jording
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-23 00:00:00 -04:00
17
+ date: 2010-05-26 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -42,9 +42,21 @@ dependencies:
42
42
  type: :runtime
43
43
  version_requirements: *id002
44
44
  - !ruby/object:Gem::Dependency
45
- name: rspec
45
+ name: tweetstream
46
46
  prerelease: false
47
47
  requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ type: :runtime
55
+ version_requirements: *id003
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ prerelease: false
59
+ requirement: &id004 !ruby/object:Gem::Requirement
48
60
  requirements:
49
61
  - - ">="
50
62
  - !ruby/object:Gem::Version
@@ -54,7 +66,7 @@ dependencies:
54
66
  - 9
55
67
  version: 1.2.9
56
68
  type: :development
57
- version_requirements: *id003
69
+ version_requirements: *id004
58
70
  description: a simple framework to share yourwork
59
71
  email: mjording@opengotham.com
60
72
  executables: []
@@ -75,12 +87,16 @@ files:
75
87
  - config/application.yml
76
88
  - init.rb
77
89
  - lib/bluplate.rb
78
- - lib/persist.rb
79
- - lib/settings.rb
80
- - lib/task.rb
81
- - lib/ticket.rb
82
- - lib/user.rb
90
+ - lib/bluplate/inbox.rb
91
+ - lib/bluplate/inbox_plugins/dummy.rb
92
+ - lib/bluplate/persist.rb
93
+ - lib/bluplate/settings.rb
94
+ - lib/bluplate/source.rb
95
+ - lib/bluplate/task.rb
96
+ - lib/bluplate/ticket.rb
97
+ - lib/bluplate/user.rb
83
98
  - spec/bluplate_spec.rb
99
+ - spec/inbox_spec.rb
84
100
  - spec/spec.opts
85
101
  - spec/spec_helper.rb
86
102
  - spec/task_spec.rb
@@ -118,6 +134,7 @@ specification_version: 3
118
134
  summary: share your work
119
135
  test_files:
120
136
  - spec/bluplate_spec.rb
137
+ - spec/inbox_spec.rb
121
138
  - spec/spec_helper.rb
122
139
  - spec/task_spec.rb
123
140
  - spec/ticket_spec.rb
@@ -1,35 +0,0 @@
1
- require 'rubygems'
2
- require 'mongo'
3
- require 'settings'
4
- require 'json'
5
- require 'active_support/inflector'
6
-
7
- module Persist
8
-
9
-
10
- module Base
11
-
12
-
13
- def save
14
- self.class.db.collection(self.class.to_s.downcase.pluralize).insert(self.to_hash)
15
- end
16
-
17
- def self.included(base)
18
- base.extend ClassMethods
19
- end
20
-
21
- module ClassMethods
22
- def db
23
- Persist.db
24
- end
25
- end
26
- end
27
-
28
- def db
29
- @db ||= begin
30
- Mongo::Connection.new(Settings.mongo.host).db(Settings.mongo.db)
31
- end
32
- end
33
- module_function :db
34
- end
35
-
@@ -1,5 +0,0 @@
1
- require 'settingslogic'
2
-
3
- class Settings < Settingslogic
4
- source File.join(File.dirname(__FILE__), '..', 'config', 'application.yml')
5
- end
@@ -1,18 +0,0 @@
1
- require 'persist'
2
- class Task
3
- include Persist::Base
4
- attr_accessor :tags, :description, :user_email
5
-
6
- def initialize(user_email, description)
7
- @user_email = user_email
8
- @description = description
9
- @tags ||= {}
10
-
11
-
12
- end
13
-
14
- def to_hash
15
- {:tags => @tags, :user_email => @user_email, :description => @description}
16
- end
17
-
18
- end
@@ -1,14 +0,0 @@
1
- class Ticket
2
-
3
- attr_accessor :task, :user_email
4
-
5
- def initialize(task, user_email)
6
- @task = task
7
- @user_email = user_email
8
- end
9
-
10
- def to_hash
11
- {:task => @task, :user_email => @user_email}
12
- end
13
-
14
- end
@@ -1,37 +0,0 @@
1
- require 'persist'
2
- require 'mongo'
3
- require 'json'
4
- class User
5
- include Persist::Base
6
-
7
- attr_accessor :email, :inbox, :workstream, :contacts
8
-
9
- def initialize(opts)
10
-
11
- @email = opts[:email]
12
- @inbox = opts[:inbox] || {}
13
- @contacts = opts[:contacts] || {}
14
- @workstream = opts[:workstream] || {}
15
- end
16
-
17
- def to_hash
18
- {:email => @email, :inbox => @inbox, :workstream => @workstream, :contacts => @contacts }
19
- end
20
-
21
- def self.find_by_email(email)
22
- if user_h = db.collection("users").find_one({"email" => email})
23
- user_hash = user_h.each{ |doc| doc.inspect }
24
- else
25
- user_hash = nil
26
- end
27
- inbox = user_hash ? user_hash["inbox"] : {}
28
- User.new(:email => email, :inbox => inbox)
29
- end
30
-
31
- def self.create(opts={})
32
- u = self.new(opts)
33
- u.save
34
- u
35
- end
36
-
37
- end