notification_pipeline 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 937d64dcbb2a8f97205fe91c6938a810631de9cf
4
+ data.tar.gz: 3984ef8ef709aec650725cf1143ecc9cff1f45b8
5
+ SHA512:
6
+ metadata.gz: 0b814c9c549a9500aa96d3183d20def0159ea44a3929919c9179aa19be77202232f00bf9f6065b9824224df3c66114c3bede87186854f4851b0481489453706e
7
+ data.tar.gz: 379ea2679fd08e108f539fb56d24fbc3c7aac26072c71c367aab25fe14760ff2fcc022dd590a2ee3298bf27143219b347489e68a2534db49be86e469259ad42b
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,4 @@
1
+ notification_pipeline
2
+ =====================
3
+
4
+ Generic social network notifications.
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ task :default => [:test]
5
+ Rake::TestTask.new(:test) do |test|
6
+ test.libs << 'test'
7
+ test.test_files = FileList['test/**/*_test.rb']
8
+ test.verbose = true
9
+ end
@@ -0,0 +1,2 @@
1
+ module NotificationPipeline
2
+ end
@@ -0,0 +1,3 @@
1
+ module NotificationPipeline
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'notification_pipeline/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "notification_pipeline"
8
+ spec.version = NotificationPipeline::VERSION
9
+ spec.authors = ["Nick Sutterer"]
10
+ spec.email = ["apotonick@gmail.com"]
11
+ spec.description = %q{Generic social network notifications.}
12
+ spec.summary = %q{Generic social network notifications engine that allows subscribing and broadcasting notifications along with read-tracking, compression and more. It's awesome.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ # spec.add_dependency "uber"
22
+ # spec.add_dependency "representable", "~> 2.0.3"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "minitest"
27
+ # spec.add_development_dependency "activerecord"
28
+ # spec.add_development_dependency "sqlite3"
29
+ # spec.add_development_dependency "database_cleaner"
30
+ end
@@ -0,0 +1,44 @@
1
+ require 'test_helper'
2
+
3
+ require 'ostruct'
4
+ module NotificationPipeline
5
+ class Broadcast
6
+ def initialize
7
+ @channels = {}
8
+ end
9
+
10
+ def [](name, i=nil)
11
+ return channel(name) unless i
12
+ channel(name).slice(i..-1)
13
+ end
14
+
15
+ def channel(name)
16
+ @channels[name] ||= Channel.new
17
+ end
18
+ end
19
+
20
+ class Channel < Array
21
+ def <<(hash)
22
+ super Notification.new(hash)
23
+ end
24
+ end
25
+
26
+ class Notification < OpenStruct
27
+
28
+ end
29
+ end
30
+
31
+ class PipelineTest < MiniTest::Spec
32
+ Notification = NotificationPipeline::Notification
33
+
34
+ subject { NotificationPipeline::Broadcast.new }
35
+
36
+ # non-existant channel.
37
+ it { subject["non-existent", 0].must_equal [] }
38
+
39
+ # push and read.
40
+ it do
41
+ subject["new-songs"] << {message: "Drones"}
42
+ subject["new-songs", 0].must_equal [Notification.new(message: "Drones")]
43
+ end
44
+ end
@@ -0,0 +1,14 @@
1
+ require 'notification_pipeline'
2
+ require 'minitest/autorun'
3
+
4
+
5
+ # require 'active_record'
6
+ # require 'database_cleaner'
7
+ # DatabaseCleaner.strategy = :truncation
8
+
9
+ MiniTest::Spec.class_eval do
10
+ def self.it(name=nil, *args)
11
+ name ||= Random.rand
12
+ super
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: notification_pipeline
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nick Sutterer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Generic social network notifications.
56
+ email:
57
+ - apotonick@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - Gemfile
63
+ - README.md
64
+ - Rakefile
65
+ - lib/notification_pipeline.rb
66
+ - lib/notification_pipeline/version.rb
67
+ - notification_pipeline.gemspec
68
+ - test/pipeline_test.rb
69
+ - test/test_helper.rb
70
+ homepage: ''
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.2.1
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: Generic social network notifications engine that allows subscribing and broadcasting
94
+ notifications along with read-tracking, compression and more. It's awesome.
95
+ test_files:
96
+ - test/pipeline_test.rb
97
+ - test/test_helper.rb
98
+ has_rdoc: