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.
- data/Gemfile +12 -9
- data/README.rdoc +4 -3
- data/Rakefile +11 -1
- data/app/views/streamit/streams/fetch.html.erb +3 -1
- data/lib/generators/streamit/streamit_generator.rb +26 -0
- data/lib/generators/templates/stream.rb +4 -0
- data/lib/generators/templates/streamit.rb +1 -1
- data/lib/streamit.rb +10 -22
- data/lib/streamit/async_queue.rb +32 -0
- data/lib/streamit/dsl.rb +1 -1
- data/lib/streamit/engine.rb +1 -7
- data/lib/streamit/orm/mongo_mapper.rb +1 -1
- data/lib/streamit/version.rb +3 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/{models → model}/stream.rb +0 -0
- data/test/dummy/app/model/user.rb +3 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +2 -29
- data/test/dummy/config/database.yml +22 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/streamit.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +46 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +1902 -0
- data/test/dummy/log/production.log +0 -0
- data/test/dummy/log/server.log +0 -0
- data/test/dummy/log/test.log +18904 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/capybara/capybara-20110207142855.html +31 -0
- data/test/dummy/tmp/capybara/capybara-20110207143000.html +31 -0
- data/test/dummy/tmp/capybara/capybara-20110207143054.html +31 -0
- data/test/dummy/tmp/capybara/capybara-20110207144949.html +31 -0
- data/test/dummy/tmp/capybara/capybara-20110207145341.html +33 -0
- data/test/generators/streamit_generator_test.rb +17 -0
- data/test/integration/navigation_test.rb +2 -2
- data/test/stream_test.rb +9 -0
- data/test/streamit_test.rb +7 -7
- data/test/support/fixtures.rb +6 -7
- data/test/test_helper.rb +9 -5
- data/test/tmp/app/models/goblin.rb +4 -0
- data/test/tmp/app/views/streamit/streams/_stream.html.erb +3 -0
- data/test/tmp/config/initializers/streamit.rb +3 -0
- data/test/tmp/config/locales/streamit.en.yml +4 -0
- metadata +127 -28
- data/TODO +0 -4
- data/lib/generators/streamit_generator.rb +0 -39
- data/lib/streamit/orm/active_record.rb +0 -21
- data/test/dummy/app/models/user.rb +0 -7
@@ -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
|