streamit 0.0.6.2 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/Gemfile +12 -9
  2. data/README.rdoc +4 -3
  3. data/Rakefile +11 -1
  4. data/app/views/streamit/streams/fetch.html.erb +3 -1
  5. data/lib/generators/streamit/streamit_generator.rb +26 -0
  6. data/lib/generators/templates/stream.rb +4 -0
  7. data/lib/generators/templates/streamit.rb +1 -1
  8. data/lib/streamit.rb +10 -22
  9. data/lib/streamit/async_queue.rb +32 -0
  10. data/lib/streamit/dsl.rb +1 -1
  11. data/lib/streamit/engine.rb +1 -7
  12. data/lib/streamit/orm/mongo_mapper.rb +1 -1
  13. data/lib/streamit/version.rb +3 -0
  14. data/test/dummy/Rakefile +7 -0
  15. data/test/dummy/app/{models → model}/stream.rb +0 -0
  16. data/test/dummy/app/model/user.rb +3 -0
  17. data/test/dummy/config.ru +4 -0
  18. data/test/dummy/config/application.rb +2 -29
  19. data/test/dummy/config/database.yml +22 -0
  20. data/test/dummy/config/initializers/inflections.rb +10 -0
  21. data/test/dummy/config/initializers/mime_types.rb +5 -0
  22. data/test/dummy/config/initializers/streamit.rb +1 -1
  23. data/test/dummy/db/development.sqlite3 +0 -0
  24. data/test/dummy/db/schema.rb +46 -0
  25. data/test/dummy/db/test.sqlite3 +0 -0
  26. data/test/dummy/log/development.log +1902 -0
  27. data/test/dummy/log/production.log +0 -0
  28. data/test/dummy/log/server.log +0 -0
  29. data/test/dummy/log/test.log +18904 -0
  30. data/test/dummy/public/404.html +26 -0
  31. data/test/dummy/public/422.html +26 -0
  32. data/test/dummy/public/500.html +26 -0
  33. data/test/dummy/public/favicon.ico +0 -0
  34. data/test/dummy/tmp/capybara/capybara-20110207142855.html +31 -0
  35. data/test/dummy/tmp/capybara/capybara-20110207143000.html +31 -0
  36. data/test/dummy/tmp/capybara/capybara-20110207143054.html +31 -0
  37. data/test/dummy/tmp/capybara/capybara-20110207144949.html +31 -0
  38. data/test/dummy/tmp/capybara/capybara-20110207145341.html +33 -0
  39. data/test/generators/streamit_generator_test.rb +17 -0
  40. data/test/integration/navigation_test.rb +2 -2
  41. data/test/stream_test.rb +9 -0
  42. data/test/streamit_test.rb +7 -7
  43. data/test/support/fixtures.rb +6 -7
  44. data/test/test_helper.rb +9 -5
  45. data/test/tmp/app/models/goblin.rb +4 -0
  46. data/test/tmp/app/views/streamit/streams/_stream.html.erb +3 -0
  47. data/test/tmp/config/initializers/streamit.rb +3 -0
  48. data/test/tmp/config/locales/streamit.en.yml +4 -0
  49. metadata +127 -28
  50. data/TODO +0 -4
  51. data/lib/generators/streamit_generator.rb +0 -39
  52. data/lib/streamit/orm/active_record.rb +0 -21
  53. data/test/dummy/app/models/user.rb +0 -7
data/TODO DELETED
@@ -1,4 +0,0 @@
1
- TODO:
2
-
3
- Support json format
4
- Refactor
@@ -1,39 +0,0 @@
1
- class StreamitGenerator < Rails::Generators::NamedBase
2
-
3
- source_root File.expand_path("../templates", __FILE__)
4
-
5
- class_option :migration, :type => :boolean, :default => true
6
-
7
- def invoke_model
8
- invoke "model", [name].concat(migration_columns),
9
- :timestamps => false, :test_framework => false, :migration => options.migration?
10
- end
11
-
12
- def add_model_config
13
- inject_into_class "app/models/#{file_name}.rb", class_name, <<-CONTENT
14
- include Streamit::ORM::#{Rails::Generators.options[:rails][:orm].to_s.camelize}
15
- CONTENT
16
- end
17
-
18
- def add_application_config
19
- inject_into_class "config/application.rb", "Application", <<-CONTENT
20
- # Set stream store
21
- config.streamit.set_store = lambda { ::#{class_name} }
22
-
23
- CONTENT
24
- end
25
-
26
- def create_stream_view
27
- copy_file "_stream.html.erb", "app/views/streamit/streams/_stream.html.erb"
28
- end
29
-
30
- def create_initializer
31
- copy_file "streamit.rb", "app/config/initializers/streamit.rb"
32
- end
33
-
34
- protected
35
-
36
- def migration_columns
37
- %w(stream_type:string started_at:datetime actor_id:integer actor_type:string subject_id:integer subject_type:string receiver_id:integer receiver_type:string)
38
- end
39
- end
@@ -1,21 +0,0 @@
1
- module Streamit
2
- module ORM
3
- module ActiveRecord
4
- extend ActiveSupport::Concern
5
- include Streamit::Store
6
-
7
- included do
8
- belongs_to :actor, :polymorphic => true
9
- belongs_to :subject, :polymorphic => true
10
- belongs_to :receiver, :polymorphic => true
11
-
12
- default_scope order("started_at DESC")
13
- scope :ago, lambda { |num| where ["started_at > ?", Time.now - num.to_i.seconds] }
14
- end
15
-
16
- def save_stream!
17
- save!
18
- end
19
- end
20
- end
21
- end
@@ -1,7 +0,0 @@
1
- class User < ActiveRecord::Base
2
- has_many :watched_items, :through => :watchings
3
- has_many :watchings, :dependent => :destroy
4
-
5
- stream :create
6
- stream :update, :attributes => [:image_url, :name]
7
- end