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.
Files changed (113) hide show
  1. data/README.md +4 -0
  2. data/Rakefile +31 -0
  3. data/app/assets/javascripts/active_metadata/application.js +15 -0
  4. data/app/assets/stylesheets/active_metadata/application.css +13 -0
  5. data/app/controllers/active_metadata/application_controller.rb +4 -0
  6. data/app/controllers/active_metadata/attachments_controller.rb +4 -6
  7. data/app/controllers/active_metadata/notes_controller.rb +7 -10
  8. data/app/controllers/active_metadata/stream_controller.rb +12 -0
  9. data/app/helpers/active_metadata/application_helper.rb +4 -0
  10. data/app/helpers/active_metadata/stream_helper.rb +14 -0
  11. data/app/models/active_metadata/attachment.rb +26 -0
  12. data/app/models/active_metadata/history.rb +4 -0
  13. data/app/models/active_metadata/note.rb +4 -0
  14. data/app/models/active_metadata/watcher.rb +6 -0
  15. data/app/views/active_metadata/attachments/_attachment.html.erb +7 -0
  16. data/app/views/active_metadata/attachments/index.html.erb +2 -10
  17. data/app/views/active_metadata/notes/_note.html.erb +7 -0
  18. data/app/views/active_metadata/notes/index.html.erb +1 -9
  19. data/app/views/active_metadata/stream/_element.html.erb +1 -0
  20. data/app/views/active_metadata/stream/index.html.erb +3 -0
  21. data/app/views/layouts/active_metadata/application.html.erb +11 -0
  22. data/config/active_metadata.yml +6 -0
  23. data/config/cucumber.yml +8 -0
  24. data/config/database.yml +4 -2
  25. data/config/routes.rb +25 -26
  26. data/db/migrate/02_active_metadata_migrations.rb +24 -24
  27. data/features/{watchlist/add_a_user_to_a_watcher.feature → add_a_user_to_a_watcher.feature} +0 -0
  28. data/features/support/env.rb +8 -0
  29. data/features/supports/file.txt +0 -1
  30. data/features/supports/updated_file.txt +0 -1
  31. data/features/{watchlist/trigger_alert_on_modify.feature → trigger_alert_on_modify.feature} +0 -0
  32. data/lib/active_metadata/base.rb +3 -1
  33. data/lib/active_metadata/engine.rb +11 -0
  34. data/lib/active_metadata/helpers.rb +15 -1
  35. data/lib/active_metadata/persistence/{active_record/attachment.rb → attachment.rb} +10 -10
  36. data/lib/active_metadata/persistence/{active_record/history.rb → history.rb} +4 -4
  37. data/lib/active_metadata/persistence/{active_record/note.rb → note.rb} +8 -8
  38. data/lib/active_metadata/persistence/persistence.rb +14 -4
  39. data/lib/active_metadata/persistence/{active_record/watcher.rb → watcher.rb} +5 -5
  40. data/lib/active_metadata/streamable.rb +25 -0
  41. data/lib/active_metadata/version.rb +1 -1
  42. data/lib/active_metadata.rb +3 -3
  43. data/lib/{rake/ci.rb → tasks/active_metadata_tasks.rake} +27 -6
  44. data/lib/tasks/cucumber.rake +65 -0
  45. data/spec/active_metadata_yml.rb +25 -0
  46. data/spec/controllers/active_metadata/attachments_controller_spec.rb +40 -0
  47. data/spec/controllers/active_metadata/notes_controller_spec.rb +41 -0
  48. data/spec/controllers/active_metadata/stream_controller_spec.rb +46 -0
  49. data/spec/dummy/README.rdoc +261 -0
  50. data/spec/dummy/Rakefile +7 -0
  51. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  52. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  53. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  54. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  55. data/{config/application.rb → spec/dummy/app/mailers/.gitkeep} +0 -0
  56. data/spec/dummy/app/models/.gitkeep +0 -0
  57. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  58. data/spec/dummy/config/application.rb +56 -0
  59. data/spec/dummy/config/boot.rb +10 -0
  60. data/spec/dummy/config/database.yml +25 -0
  61. data/spec/dummy/config/environment.rb +5 -0
  62. data/spec/dummy/config/environments/development.rb +37 -0
  63. data/spec/dummy/config/environments/production.rb +67 -0
  64. data/spec/dummy/config/environments/test.rb +37 -0
  65. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  66. data/spec/dummy/config/initializers/inflections.rb +15 -0
  67. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  68. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  69. data/spec/dummy/config/initializers/session_store.rb +8 -0
  70. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  71. data/spec/dummy/config/locales/en.yml +5 -0
  72. data/spec/dummy/config/routes.rb +4 -0
  73. data/spec/dummy/config.ru +4 -0
  74. data/spec/dummy/db/development.sqlite3 +0 -0
  75. data/spec/dummy/db/schema.rb +106 -0
  76. data/spec/dummy/db/test.sqlite3 +0 -0
  77. data/spec/dummy/lib/assets/.gitkeep +0 -0
  78. data/spec/dummy/log/.gitkeep +0 -0
  79. data/spec/dummy/public/404.html +26 -0
  80. data/spec/dummy/public/422.html +26 -0
  81. data/spec/dummy/public/500.html +25 -0
  82. data/spec/dummy/public/favicon.ico +0 -0
  83. data/spec/dummy/script/rails +6 -0
  84. data/spec/helpers/active_metadata/stream_helpers_spec.rb +23 -0
  85. data/spec/routing/active_metadata/stream_controller_routing_spec.rb +17 -0
  86. data/spec/spec_helper.rb +18 -31
  87. data/spec/streamable_spec.rb +120 -0
  88. data/spec/support/document.rb +0 -1
  89. data/spec/support/pdf_test_1.pdf +0 -0
  90. data/spec/support/section.rb +0 -1
  91. data/spec/support/user.rb +0 -2
  92. data/spec/views/active_metadata/stream/index.html.erb_spec.rb +5 -0
  93. metadata +165 -73
  94. data/app/helpers/application_helper.rb +0 -2
  95. data/config/initializers/inflections.rb +0 -7
  96. data/config/mongoid.yml +0 -28
  97. data/db/test.sqlite3 +0 -0
  98. data/features/supports/initializer.rb +0 -1
  99. data/lib/active_metadata/persistence/active_record.rb +0 -26
  100. data/lib/application_controller.rb +0 -28
  101. data/lib/application_helper.rb +0 -7
  102. data/lib/engine.rb +0 -29
  103. data/lib/model/active_record/attachment.rb +0 -22
  104. data/lib/model/active_record/history.rb +0 -2
  105. data/lib/model/active_record/note.rb +0 -2
  106. data/lib/model/active_record/watcher.rb +0 -4
  107. data/lib/rails/railties/tasks.rake +0 -16
  108. data/lib/rake/active_record_tasks.rb +0 -77
  109. data/lib/templates/active_metadata.yml +0 -17
  110. data/lib/templates/active_metadata_migrations +0 -71
  111. data/lib/templates/mongoid.yml +0 -20
  112. data/spec/benchmark_spec.rb +0 -35
  113. 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
@@ -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
@@ -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
-
@@ -1,14 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "NotesController" do
4
-
5
- context "create" do
6
- it "should create a new note" do
7
- pending
8
- # post :create
9
- # response.should be_success
10
- #
11
- end
12
- end
13
-
14
- end