active_metadata 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/Rakefile +31 -0
- data/app/assets/javascripts/active_metadata/application.js +15 -0
- data/app/assets/stylesheets/active_metadata/application.css +13 -0
- data/app/controllers/active_metadata/application_controller.rb +4 -0
- data/app/controllers/active_metadata/attachments_controller.rb +4 -6
- data/app/controllers/active_metadata/notes_controller.rb +7 -10
- data/app/controllers/active_metadata/stream_controller.rb +12 -0
- data/app/helpers/active_metadata/application_helper.rb +4 -0
- data/app/helpers/active_metadata/stream_helper.rb +14 -0
- data/app/models/active_metadata/attachment.rb +26 -0
- data/app/models/active_metadata/history.rb +4 -0
- data/app/models/active_metadata/note.rb +4 -0
- data/app/models/active_metadata/watcher.rb +6 -0
- data/app/views/active_metadata/attachments/_attachment.html.erb +7 -0
- data/app/views/active_metadata/attachments/index.html.erb +2 -10
- data/app/views/active_metadata/notes/_note.html.erb +7 -0
- data/app/views/active_metadata/notes/index.html.erb +1 -9
- data/app/views/active_metadata/stream/_element.html.erb +1 -0
- data/app/views/active_metadata/stream/index.html.erb +3 -0
- data/app/views/layouts/active_metadata/application.html.erb +11 -0
- data/config/active_metadata.yml +6 -0
- data/config/cucumber.yml +8 -0
- data/config/database.yml +4 -2
- data/config/routes.rb +25 -26
- data/db/migrate/02_active_metadata_migrations.rb +24 -24
- data/features/{watchlist/add_a_user_to_a_watcher.feature → add_a_user_to_a_watcher.feature} +0 -0
- data/features/support/env.rb +8 -0
- data/features/supports/file.txt +0 -1
- data/features/supports/updated_file.txt +0 -1
- data/features/{watchlist/trigger_alert_on_modify.feature → trigger_alert_on_modify.feature} +0 -0
- data/lib/active_metadata/base.rb +3 -1
- data/lib/active_metadata/engine.rb +11 -0
- data/lib/active_metadata/helpers.rb +15 -1
- data/lib/active_metadata/persistence/{active_record/attachment.rb → attachment.rb} +10 -10
- data/lib/active_metadata/persistence/{active_record/history.rb → history.rb} +4 -4
- data/lib/active_metadata/persistence/{active_record/note.rb → note.rb} +8 -8
- data/lib/active_metadata/persistence/persistence.rb +14 -4
- data/lib/active_metadata/persistence/{active_record/watcher.rb → watcher.rb} +5 -5
- data/lib/active_metadata/streamable.rb +25 -0
- data/lib/active_metadata/version.rb +1 -1
- data/lib/active_metadata.rb +3 -3
- data/lib/{rake/ci.rb → tasks/active_metadata_tasks.rake} +27 -6
- data/lib/tasks/cucumber.rake +65 -0
- data/spec/active_metadata_yml.rb +25 -0
- data/spec/controllers/active_metadata/attachments_controller_spec.rb +40 -0
- data/spec/controllers/active_metadata/notes_controller_spec.rb +41 -0
- data/spec/controllers/active_metadata/stream_controller_spec.rb +46 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/{config/application.rb → spec/dummy/app/mailers/.gitkeep} +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +56 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +106 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/helpers/active_metadata/stream_helpers_spec.rb +23 -0
- data/spec/routing/active_metadata/stream_controller_routing_spec.rb +17 -0
- data/spec/spec_helper.rb +18 -31
- data/spec/streamable_spec.rb +120 -0
- data/spec/support/document.rb +0 -1
- data/spec/support/pdf_test_1.pdf +0 -0
- data/spec/support/section.rb +0 -1
- data/spec/support/user.rb +0 -2
- data/spec/views/active_metadata/stream/index.html.erb_spec.rb +5 -0
- metadata +165 -73
- data/app/helpers/application_helper.rb +0 -2
- data/config/initializers/inflections.rb +0 -7
- data/config/mongoid.yml +0 -28
- data/db/test.sqlite3 +0 -0
- data/features/supports/initializer.rb +0 -1
- data/lib/active_metadata/persistence/active_record.rb +0 -26
- data/lib/application_controller.rb +0 -28
- data/lib/application_helper.rb +0 -7
- data/lib/engine.rb +0 -29
- data/lib/model/active_record/attachment.rb +0 -22
- data/lib/model/active_record/history.rb +0 -2
- data/lib/model/active_record/note.rb +0 -2
- data/lib/model/active_record/watcher.rb +0 -4
- data/lib/rails/railties/tasks.rake +0 -16
- data/lib/rake/active_record_tasks.rb +0 -77
- data/lib/templates/active_metadata.yml +0 -17
- data/lib/templates/active_metadata_migrations +0 -71
- data/lib/templates/mongoid.yml +0 -20
- data/spec/benchmark_spec.rb +0 -35
- data/spec/controllers/metadata_controller_spec.rb +0 -14
@@ -1,71 +0,0 @@
|
|
1
|
-
class ActiveMetadataMigrations < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
|
4
|
-
create_table :notes do |t|
|
5
|
-
t.text :note
|
6
|
-
t.string :label
|
7
|
-
t.string :document_class
|
8
|
-
t.integer :document_id
|
9
|
-
t.integer :created_by
|
10
|
-
t.integer :updated_by
|
11
|
-
t.timestamps
|
12
|
-
end
|
13
|
-
|
14
|
-
add_index :notes, :document_id
|
15
|
-
add_index :notes, :label
|
16
|
-
add_index :notes, :updated_at
|
17
|
-
|
18
|
-
create_table :histories do |t|
|
19
|
-
t.text :value
|
20
|
-
t.string :label
|
21
|
-
t.string :document_class
|
22
|
-
t.integer :document_id
|
23
|
-
t.integer :created_by
|
24
|
-
t.timestamps
|
25
|
-
end
|
26
|
-
|
27
|
-
add_index :histories, :document_id
|
28
|
-
add_index :histories, :label
|
29
|
-
add_index :histories, :created_at
|
30
|
-
|
31
|
-
create_table :attachments do |t|
|
32
|
-
t.string :label
|
33
|
-
t.integer :document_id
|
34
|
-
t.string :document_class
|
35
|
-
t.integer :created_by
|
36
|
-
t.integer :updated_by
|
37
|
-
t.integer :counter
|
38
|
-
t.string :attach_file_name
|
39
|
-
t.string :attach_content_type
|
40
|
-
t.integer :attach_file_size
|
41
|
-
t.datetime :attach_updated_at
|
42
|
-
t.timestamps
|
43
|
-
end
|
44
|
-
|
45
|
-
add_index :attachments, :document_id
|
46
|
-
add_index :attachments, :label
|
47
|
-
add_index :attachments, :attach_updated_at
|
48
|
-
|
49
|
-
create_table :watchers do |t|
|
50
|
-
t.integer :owner_id
|
51
|
-
t.string :label
|
52
|
-
t.string :document_class
|
53
|
-
t.integer :document_id
|
54
|
-
t.timestamps
|
55
|
-
end
|
56
|
-
|
57
|
-
add_index :watchers, :document_id
|
58
|
-
add_index :watchers, :label
|
59
|
-
add_index :watchers, :owner_id
|
60
|
-
add_index :watchers, :created_at
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.down
|
65
|
-
drop_table :notes
|
66
|
-
drop_table :histories
|
67
|
-
drop_table :attachments
|
68
|
-
drop_table :watchers
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
data/lib/templates/mongoid.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
development:
|
2
|
-
host: localhost
|
3
|
-
database: metadata_d
|
4
|
-
|
5
|
-
test:
|
6
|
-
host: localhost
|
7
|
-
database: metadata_t
|
8
|
-
|
9
|
-
# set these environment variables on your prod server
|
10
|
-
production:
|
11
|
-
host: <%= ENV['MONGOID_HOST'] %>
|
12
|
-
port: <%= ENV['MONGOID_PORT'] %>
|
13
|
-
username: <%= ENV['MONGOID_USERNAME'] %>
|
14
|
-
password: <%= ENV['MONGOID_PASSWORD'] %>
|
15
|
-
database: <%= ENV['MONGOID_DATABASE'] %>
|
16
|
-
# slaves:
|
17
|
-
# - host: slave1.local
|
18
|
-
# port: 27018
|
19
|
-
# - host: slave2.local
|
20
|
-
# port: 27019
|
data/spec/benchmark_spec.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "rack/test/uploaded_file"
|
3
|
-
require "benchmark"
|
4
|
-
|
5
|
-
describe "ActiveMetadata" do
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
@document = Document.create! { |d| d.name = "John" }
|
9
|
-
@document.reload
|
10
|
-
end
|
11
|
-
|
12
|
-
context "running on mongo" do
|
13
|
-
|
14
|
-
# it "should insert xxx notes" do
|
15
|
-
# notes = 1000000
|
16
|
-
# result = []
|
17
|
-
# Benchmark.bm do |x|
|
18
|
-
# x.report do
|
19
|
-
# notes.times do |i|
|
20
|
-
# start = Time.now
|
21
|
-
# @document.create_note_for(:name, "Note number #{i}")
|
22
|
-
# result.push Time.now - start
|
23
|
-
# end
|
24
|
-
# end
|
25
|
-
# end
|
26
|
-
# puts "Total = #{result.sum}"
|
27
|
-
# puts "Average = #{result.sum / notes}"
|
28
|
-
# @document.notes_for(:name).count.should eq notes
|
29
|
-
# end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
|