hound 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.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/Gemfile +17 -0
  4. data/Gemfile.lock +98 -0
  5. data/LICENSE +20 -0
  6. data/README.md +19 -0
  7. data/Rakefile +35 -0
  8. data/hound.gemspec +22 -0
  9. data/lib/generators/hound/USAGE +2 -0
  10. data/lib/generators/hound/install_generator.rb +17 -0
  11. data/lib/generators/hound/templates/create_hound_actions.rb +16 -0
  12. data/lib/hound/action.rb +11 -0
  13. data/lib/hound/config.rb +15 -0
  14. data/lib/hound/controller.rb +36 -0
  15. data/lib/hound/model.rb +55 -0
  16. data/lib/hound/version.rb +3 -0
  17. data/lib/hound.rb +38 -0
  18. data/lib/tasks/hound_tasks.rake +4 -0
  19. data/test/dummy/README.rdoc +261 -0
  20. data/test/dummy/Rakefile +7 -0
  21. data/test/dummy/app/assets/javascripts/application.js +15 -0
  22. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  23. data/test/dummy/app/controllers/application_controller.rb +3 -0
  24. data/test/dummy/app/helpers/application_helper.rb +2 -0
  25. data/test/dummy/app/mailers/.gitkeep +0 -0
  26. data/test/dummy/app/models/.gitkeep +0 -0
  27. data/test/dummy/app/models/article.rb +4 -0
  28. data/test/dummy/app/models/post.rb +4 -0
  29. data/test/dummy/app/models/user.rb +3 -0
  30. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  31. data/test/dummy/config/application.rb +59 -0
  32. data/test/dummy/config/boot.rb +10 -0
  33. data/test/dummy/config/database.yml +25 -0
  34. data/test/dummy/config/environment.rb +5 -0
  35. data/test/dummy/config/environments/development.rb +37 -0
  36. data/test/dummy/config/environments/production.rb +67 -0
  37. data/test/dummy/config/environments/test.rb +37 -0
  38. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/test/dummy/config/initializers/inflections.rb +15 -0
  40. data/test/dummy/config/initializers/mime_types.rb +5 -0
  41. data/test/dummy/config/initializers/secret_token.rb +7 -0
  42. data/test/dummy/config/initializers/session_store.rb +8 -0
  43. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  44. data/test/dummy/config/locales/en.yml +5 -0
  45. data/test/dummy/config/routes.rb +58 -0
  46. data/test/dummy/config.ru +4 -0
  47. data/test/dummy/db/migrate/20130307165752_create_users.rb +9 -0
  48. data/test/dummy/db/migrate/20130307165837_create_articles.rb +10 -0
  49. data/test/dummy/db/migrate/20130307175522_create_persued_actions.rb +16 -0
  50. data/test/dummy/db/migrate/20130307183451_create_posts.rb +9 -0
  51. data/test/dummy/db/schema.rb +44 -0
  52. data/test/dummy/lib/assets/.gitkeep +0 -0
  53. data/test/dummy/log/.gitkeep +0 -0
  54. data/test/dummy/public/404.html +26 -0
  55. data/test/dummy/public/422.html +26 -0
  56. data/test/dummy/public/500.html +25 -0
  57. data/test/dummy/public/favicon.ico +0 -0
  58. data/test/dummy/script/rails +6 -0
  59. data/test/dummy/test/fixtures/articles.yml +9 -0
  60. data/test/dummy/test/fixtures/posts.yml +7 -0
  61. data/test/dummy/test/fixtures/users.yml +7 -0
  62. data/test/dummy/test/unit/article_test.rb +7 -0
  63. data/test/dummy/test/unit/post_test.rb +7 -0
  64. data/test/dummy/test/unit/user_test.rb +7 -0
  65. data/test/hound_test.rb +31 -0
  66. data/test/test_helper.rb +21 -0
  67. metadata +184 -0
@@ -0,0 +1,58 @@
1
+ Dummy::Application.routes.draw do
2
+ # The priority is based upon order of creation:
3
+ # first created -> highest priority.
4
+
5
+ # Sample of regular route:
6
+ # match 'products/:id' => 'catalog#view'
7
+ # Keep in mind you can assign values other than :controller and :action
8
+
9
+ # Sample of named route:
10
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
+ # This route can be invoked with purchase_url(:id => product.id)
12
+
13
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
14
+ # resources :products
15
+
16
+ # Sample resource route with options:
17
+ # resources :products do
18
+ # member do
19
+ # get 'short'
20
+ # post 'toggle'
21
+ # end
22
+ #
23
+ # collection do
24
+ # get 'sold'
25
+ # end
26
+ # end
27
+
28
+ # Sample resource route with sub-resources:
29
+ # resources :products do
30
+ # resources :comments, :sales
31
+ # resource :seller
32
+ # end
33
+
34
+ # Sample resource route with more complex sub-resources
35
+ # resources :products do
36
+ # resources :comments
37
+ # resources :sales do
38
+ # get 'recent', :on => :collection
39
+ # end
40
+ # end
41
+
42
+ # Sample resource route within a namespace:
43
+ # namespace :admin do
44
+ # # Directs /admin/products/* to Admin::ProductsController
45
+ # # (app/controllers/admin/products_controller.rb)
46
+ # resources :products
47
+ # end
48
+
49
+ # You can have the root of your site routed with "root"
50
+ # just remember to delete public/index.html.
51
+ # root :to => 'welcome#index'
52
+
53
+ # See how all your routes lay out with "rake routes"
54
+
55
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
56
+ # Note: This route will make all actions in every controller accessible via GET requests.
57
+ # match ':controller(/:action(/:id))(.:format)'
58
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,9 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class CreateArticles < ActiveRecord::Migration
2
+ def change
3
+ create_table :articles do |t|
4
+ t.string :title
5
+ t.text :body
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ class CreateHoundActions < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :hound_actions do |t|
4
+ t.string :action, null: false
5
+ t.string :actionable_type, null: false
6
+ t.integer :actionable_id, null: false
7
+ t.datetime :created_at
8
+ end
9
+ add_index :hound_actions, [:actionable_type, :actionable_id]
10
+ end
11
+
12
+ def self.down
13
+ remove_index :hound_actions, [:actionable_type, :actionable_id]
14
+ drop_table :hound_actions
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts do |t|
4
+ t.text :text
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,44 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20130307183451) do
15
+
16
+ create_table "articles", :force => true do |t|
17
+ t.string "title"
18
+ t.text "body"
19
+ t.datetime "created_at", :null => false
20
+ t.datetime "updated_at", :null => false
21
+ end
22
+
23
+ create_table "hound_actions", :force => true do |t|
24
+ t.string "action", :null => false
25
+ t.string "actionable_type", :null => false
26
+ t.integer "actionable_id", :null => false
27
+ t.datetime "created_at"
28
+ end
29
+
30
+ add_index "hound_actions", ["actionable_type", "actionable_id"], :name => "index_houndd_actions_on_actionable_type_and_actionable_id"
31
+
32
+ create_table "posts", :force => true do |t|
33
+ t.text "text"
34
+ t.datetime "created_at", :null => false
35
+ t.datetime "updated_at", :null => false
36
+ end
37
+
38
+ create_table "users", :force => true do |t|
39
+ t.string "name"
40
+ t.datetime "created_at", :null => false
41
+ t.datetime "updated_at", :null => false
42
+ end
43
+
44
+ end
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ title: MyString
5
+ body: MyText
6
+
7
+ two:
8
+ title: MyString
9
+ body: MyText
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ text: MyText
5
+
6
+ two:
7
+ text: MyText
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ name: MyString
5
+
6
+ two:
7
+ name: MyString
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class ArticleTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PostTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ class HoundTest < ActiveSupport::TestCase
4
+ setup do
5
+ @article = Article.create! title: 'Hello, World!', body: 'Some body'
6
+ end
7
+
8
+ test 'hound_options' do
9
+ assert_equal %w'create update destroy', Article.hound_options[:actions]
10
+ assert_equal %w'create', Post.hound_options[:actions]
11
+ end
12
+
13
+ test 'hound model creation' do
14
+ assert_equal 1, @article.actions.size
15
+ assert_kind_of Hound::Action, @article.actions.first
16
+ assert_equal 'create', @article.actions.first.action
17
+ end
18
+
19
+ test 'hound model update' do
20
+ @article.update_attributes(title: 'Salut, World!')
21
+ assert_equal 'update', @article.actions.last.action
22
+ end
23
+
24
+ test 'hound model destroy' do
25
+ @article.destroy
26
+ action = @article.actions.last
27
+ assert_equal 'destroy', action.action
28
+ assert_equal 'Article', action.actionable_type
29
+ assert_equal @article.id, action.actionable_id
30
+ end
31
+ end
@@ -0,0 +1,21 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ class ActiveSupport::TestCase
13
+ teardown do
14
+ Thread.current[:hound] = nil
15
+ end
16
+ end
17
+
18
+ # Load fixtures from the engine
19
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
20
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
21
+ end
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hound
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Lee Jarvis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
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
+ description: Trace your model actions and create activity lists
42
+ email:
43
+ - ljjarvis@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - LICENSE
52
+ - README.md
53
+ - Rakefile
54
+ - hound.gemspec
55
+ - lib/generators/hound/USAGE
56
+ - lib/generators/hound/install_generator.rb
57
+ - lib/generators/hound/templates/create_hound_actions.rb
58
+ - lib/hound.rb
59
+ - lib/hound/action.rb
60
+ - lib/hound/config.rb
61
+ - lib/hound/controller.rb
62
+ - lib/hound/model.rb
63
+ - lib/hound/version.rb
64
+ - lib/tasks/hound_tasks.rake
65
+ - test/dummy/README.rdoc
66
+ - test/dummy/Rakefile
67
+ - test/dummy/app/assets/javascripts/application.js
68
+ - test/dummy/app/assets/stylesheets/application.css
69
+ - test/dummy/app/controllers/application_controller.rb
70
+ - test/dummy/app/helpers/application_helper.rb
71
+ - test/dummy/app/mailers/.gitkeep
72
+ - test/dummy/app/models/.gitkeep
73
+ - test/dummy/app/models/article.rb
74
+ - test/dummy/app/models/post.rb
75
+ - test/dummy/app/models/user.rb
76
+ - test/dummy/app/views/layouts/application.html.erb
77
+ - test/dummy/config.ru
78
+ - test/dummy/config/application.rb
79
+ - test/dummy/config/boot.rb
80
+ - test/dummy/config/database.yml
81
+ - test/dummy/config/environment.rb
82
+ - test/dummy/config/environments/development.rb
83
+ - test/dummy/config/environments/production.rb
84
+ - test/dummy/config/environments/test.rb
85
+ - test/dummy/config/initializers/backtrace_silencers.rb
86
+ - test/dummy/config/initializers/inflections.rb
87
+ - test/dummy/config/initializers/mime_types.rb
88
+ - test/dummy/config/initializers/secret_token.rb
89
+ - test/dummy/config/initializers/session_store.rb
90
+ - test/dummy/config/initializers/wrap_parameters.rb
91
+ - test/dummy/config/locales/en.yml
92
+ - test/dummy/config/routes.rb
93
+ - test/dummy/db/migrate/20130307165752_create_users.rb
94
+ - test/dummy/db/migrate/20130307165837_create_articles.rb
95
+ - test/dummy/db/migrate/20130307175522_create_persued_actions.rb
96
+ - test/dummy/db/migrate/20130307183451_create_posts.rb
97
+ - test/dummy/db/schema.rb
98
+ - test/dummy/lib/assets/.gitkeep
99
+ - test/dummy/log/.gitkeep
100
+ - test/dummy/public/404.html
101
+ - test/dummy/public/422.html
102
+ - test/dummy/public/500.html
103
+ - test/dummy/public/favicon.ico
104
+ - test/dummy/script/rails
105
+ - test/dummy/test/fixtures/articles.yml
106
+ - test/dummy/test/fixtures/posts.yml
107
+ - test/dummy/test/fixtures/users.yml
108
+ - test/dummy/test/unit/article_test.rb
109
+ - test/dummy/test/unit/post_test.rb
110
+ - test/dummy/test/unit/user_test.rb
111
+ - test/hound_test.rb
112
+ - test/test_helper.rb
113
+ homepage: https://github.com/injekt/hound
114
+ licenses: []
115
+ metadata: {}
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 2.0.0
133
+ signing_key:
134
+ specification_version: 4
135
+ summary: Trace changes to your models
136
+ test_files:
137
+ - test/dummy/README.rdoc
138
+ - test/dummy/Rakefile
139
+ - test/dummy/app/assets/javascripts/application.js
140
+ - test/dummy/app/assets/stylesheets/application.css
141
+ - test/dummy/app/controllers/application_controller.rb
142
+ - test/dummy/app/helpers/application_helper.rb
143
+ - test/dummy/app/mailers/.gitkeep
144
+ - test/dummy/app/models/.gitkeep
145
+ - test/dummy/app/models/article.rb
146
+ - test/dummy/app/models/post.rb
147
+ - test/dummy/app/models/user.rb
148
+ - test/dummy/app/views/layouts/application.html.erb
149
+ - test/dummy/config.ru
150
+ - test/dummy/config/application.rb
151
+ - test/dummy/config/boot.rb
152
+ - test/dummy/config/database.yml
153
+ - test/dummy/config/environment.rb
154
+ - test/dummy/config/environments/development.rb
155
+ - test/dummy/config/environments/production.rb
156
+ - test/dummy/config/environments/test.rb
157
+ - test/dummy/config/initializers/backtrace_silencers.rb
158
+ - test/dummy/config/initializers/inflections.rb
159
+ - test/dummy/config/initializers/mime_types.rb
160
+ - test/dummy/config/initializers/secret_token.rb
161
+ - test/dummy/config/initializers/session_store.rb
162
+ - test/dummy/config/initializers/wrap_parameters.rb
163
+ - test/dummy/config/locales/en.yml
164
+ - test/dummy/config/routes.rb
165
+ - test/dummy/db/migrate/20130307165752_create_users.rb
166
+ - test/dummy/db/migrate/20130307165837_create_articles.rb
167
+ - test/dummy/db/migrate/20130307175522_create_persued_actions.rb
168
+ - test/dummy/db/migrate/20130307183451_create_posts.rb
169
+ - test/dummy/db/schema.rb
170
+ - test/dummy/lib/assets/.gitkeep
171
+ - test/dummy/log/.gitkeep
172
+ - test/dummy/public/404.html
173
+ - test/dummy/public/422.html
174
+ - test/dummy/public/500.html
175
+ - test/dummy/public/favicon.ico
176
+ - test/dummy/script/rails
177
+ - test/dummy/test/fixtures/articles.yml
178
+ - test/dummy/test/fixtures/posts.yml
179
+ - test/dummy/test/fixtures/users.yml
180
+ - test/dummy/test/unit/article_test.rb
181
+ - test/dummy/test/unit/post_test.rb
182
+ - test/dummy/test/unit/user_test.rb
183
+ - test/hound_test.rb
184
+ - test/test_helper.rb