blamer 4.0.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile.lock +18 -15
  3. data/LICENSE +1 -1
  4. data/README.md +30 -19
  5. data/test/test_helper.rb +0 -6
  6. metadata +14 -24
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fd68067aa7ed7f82696509d4f9ac1e55efacb0b9
4
+ data.tar.gz: 5d697b558f31a2a694bd3412ba4b5cf38104bec9
5
+ SHA512:
6
+ metadata.gz: 99640b8d9fe1ab41024720bacbc5dfa0f603ea76c3ce600c501b5cb190bbd3761977823d9996ddc7e30b8e1deb37566aac3dbac5b3c834feb0f672c5458da141
7
+ data.tar.gz: 6755582c62f3c6402f594b6696f9ba730cc8c0b5320339ef77bef1864b2dd3fd3d20216cac96e900635262993312e84620ff74ab0d31584150cc41debc2399e2
@@ -1,37 +1,37 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- blamer (4.0.0)
4
+ blamer (4.0.1)
5
5
  activerecord (> 4.0.8, < 5.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (4.2.0)
11
- activesupport (= 4.2.0)
10
+ activemodel (4.2.10)
11
+ activesupport (= 4.2.10)
12
12
  builder (~> 3.1)
13
- activerecord (4.2.0)
14
- activemodel (= 4.2.0)
15
- activesupport (= 4.2.0)
13
+ activerecord (4.2.10)
14
+ activemodel (= 4.2.10)
15
+ activesupport (= 4.2.10)
16
16
  arel (~> 6.0)
17
- activesupport (4.2.0)
17
+ activesupport (4.2.10)
18
18
  i18n (~> 0.7)
19
- json (~> 1.7, >= 1.7.7)
20
19
  minitest (~> 5.1)
21
20
  thread_safe (~> 0.3, >= 0.3.4)
22
21
  tzinfo (~> 1.1)
23
- arel (6.0.0)
24
- builder (3.2.2)
25
- i18n (0.7.0)
26
- json (1.8.2)
27
- minitest (5.5.1)
22
+ arel (6.0.4)
23
+ builder (3.2.3)
24
+ concurrent-ruby (1.0.5)
25
+ i18n (0.9.1)
26
+ concurrent-ruby (~> 1.0)
27
+ minitest (5.11.1)
28
28
  power_assert (0.2.2)
29
29
  rake (10.4.2)
30
30
  sqlite3 (1.3.10)
31
31
  test-unit (3.0.9)
32
32
  power_assert
33
- thread_safe (0.3.4)
34
- tzinfo (1.2.2)
33
+ thread_safe (0.3.6)
34
+ tzinfo (1.2.4)
35
35
  thread_safe (~> 0.1)
36
36
 
37
37
  PLATFORMS
@@ -42,3 +42,6 @@ DEPENDENCIES
42
42
  rake
43
43
  sqlite3
44
44
  test-unit
45
+
46
+ BUNDLED WITH
47
+ 1.16.1
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008-2015 Keith Morrison <keithm@infused.org>
1
+ Copyright (c) 2008-2018 Keith Morrison <keithm@infused.org>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -6,10 +6,10 @@
6
6
  [![Test Coverage](http://img.shields.io/codeclimate/coverage/github/infused/blamer.svg?style=flat)](https://codeclimate.com/github/infused/blamer)
7
7
  [![Dependency Status](http://img.shields.io/gemnasium/infused/blamer.svg?style=flat)](https://gemnasium.com/infused/blamer)
8
8
 
9
- Automatically userstamps create and update operations if the table has columns named *created_by* and/or *updated_by*.
9
+ Automatically userstamps create and update operations if the table has columns named **created_by** and/or **updated_by**.
10
10
  The Blamer gem attempts to mirror the simplicity of ActiveRecord's timestamp module.
11
11
 
12
- Blamer expects User.current_user to return the current user. Basic setup involves assigning to `User.current_user` in a controller before filter:
12
+ Blamer expects `User.current_user` to return the current user object. Basic setup involves assigning to `User.current_user` in a controller before filter:
13
13
 
14
14
  class User < ActiveRecord::Base
15
15
  cattr_accessor :current_user
@@ -23,7 +23,7 @@ Blamer expects User.current_user to return the current user. Basic setup involve
23
23
  end
24
24
  end
25
25
 
26
- If you don't want to use `User.current_user` you can override this behavior by writing your own *userstamp_object* method in ActiveRecord::Base or any of your models. For example, to use Person.current:
26
+ If you don't want to use `User.current_user` you can override this behavior by writing your own `userstamp_object` method in ActiveRecord::Base or any of your models. For example, to use `Person.current` instead:
27
27
 
28
28
  def userstamp_object
29
29
  Person.current
@@ -33,6 +33,7 @@ If you don't like created_by/updated_by you can customize the column names:
33
33
 
34
34
  # Globally in environment.rb
35
35
  ActiveRecord::Base.created_userstamp_column = :creator_id
36
+ ActiveRecord::Base.updated_userstamp_column = :updator_id
36
37
 
37
38
  # In a model definition
38
39
  class Subscription
@@ -44,7 +45,7 @@ Automatic userstamping can be turned off globally by setting:
44
45
 
45
46
  ActiveRecord::Base.record_userstamps = false
46
47
 
47
- Blamer adds a *userstamps* migration helper which will add the created_by and updated_by columns (or your custom column names) to your table:
48
+ Blamer adds a `userstamps` migration helper which will add the created_by and updated_by columns (or your custom column names) to your table:
48
49
 
49
50
  create_table :widgets do |t|
50
51
  t.string :name
@@ -52,48 +53,58 @@ Blamer adds a *userstamps* migration helper which will add the created_by and up
52
53
  t.userstamps
53
54
  end
54
55
 
56
+ ## Thread Safety
55
57
 
56
- ## Installation
57
-
58
- You must use the correct version of blamer for the version of Rails you are running:
58
+ If you need thread safety make sure that your implementation of `User.current_user` (or your custom user object) is thread safe. Here's one way this can be accomplished:
59
59
 
60
+ class User < ActiveRecord::Base
61
+ def self.current_user
62
+ Thread.current[:current_user]
63
+ end
60
64
 
61
- ### Rails 2.x
65
+ def self.current_user=(user)
66
+ Thread.current[:current_user] = user
67
+ end
68
+ end
62
69
 
63
- Add a line to your environment.rb
70
+ ## Installation
64
71
 
65
- config.gem 'blamer', '~> 3.0.0'
72
+ You must use the correct version of blamer for the version of Rails you are running:
66
73
 
67
- ### Rails 3.0, 3.1 and 3.2
74
+ ### Rails 4 and Rails 5
68
75
 
69
76
  Add to your Gemfile
70
77
 
71
- gem 'blamer', '~> 3.0.0'
78
+ gem 'blamer'
72
79
 
73
80
  Or
74
81
 
75
- gem 'blamer', :github => 'infused/blamer', :branch => '3_stable'
82
+ gem 'blamer', github: 'infused/blamer'
76
83
 
77
- ### Rails 4.0, 4.1 and 4.2
84
+ ### Rails 3.x
78
85
 
79
86
  Add to your Gemfile
80
87
 
81
- gem 'blamer', '~> 4.0.0'
88
+ gem 'blamer', '~> 3.0.0'
82
89
 
83
90
  Or
84
91
 
85
- gem 'blamer', :github => 'infused/blamer'
92
+ gem 'blamer', :github => 'infused/blamer', :branch => '3_stable'
86
93
 
94
+ ### Rails 2.x
87
95
 
88
- ## Credit
96
+ Add a line to your environment.rb
97
+
98
+ config.gem 'blamer', '~> 3.0.0'
99
+
100
+ ## Credits
89
101
 
90
102
  Thanks to DeLynn Berry <delynn@gmail.com> for writing the original Userstamp plugin
91
103
  (http://github.com/delynn/userstamp/), which was the inspiration for this plugin.
92
104
 
93
-
94
105
  ## License
95
106
 
96
- Copyright (c) 2008-2015 Keith Morrison <<keithm@infused.org>>
107
+ Copyright (c) 2008-2018 Keith Morrison <<keithm@infused.org>>
97
108
 
98
109
  Permission is hereby granted, free of charge, to any person
99
110
  obtaining a copy of this software and associated documentation
@@ -3,12 +3,6 @@ Bundler.setup(:default, :test)
3
3
 
4
4
  require 'test/unit'
5
5
 
6
- begin
7
- require 'codeclimate-test-reporter'
8
- CodeClimate::TestReporter.start
9
- rescue LoadError
10
- end
11
-
12
6
  # Initialize the plugin
13
7
  require File.dirname(__FILE__) + '/../lib/blamer'
14
8
 
metadata CHANGED
@@ -1,38 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
5
- prerelease:
4
+ version: 4.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Keith Morrison
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-09-30 00:00:00.000000000 Z
11
+ date: 2018-01-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>'
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: 4.0.8
22
- - - <
23
- - !ruby/object:Gem::Version
24
- version: 5.0.0
19
+ version: '0'
25
20
  type: :runtime
26
21
  prerelease: false
27
22
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
23
  requirements:
30
- - - ! '>'
31
- - !ruby/object:Gem::Version
32
- version: 4.0.8
33
- - - <
24
+ - - ">="
34
25
  - !ruby/object:Gem::Version
35
- version: 5.0.0
26
+ version: '0'
36
27
  description: Automatically userstamps create and update operations if the table has
37
28
  created_by and/or updated_by columns
38
29
  email: keithm@infused.org
@@ -45,10 +36,10 @@ files:
45
36
  - Gemfile
46
37
  - Gemfile.lock
47
38
  - LICENSE
48
- - Rakefile
49
39
  - README.md
50
- - lib/blamer/userstamp.rb
40
+ - Rakefile
51
41
  - lib/blamer.rb
42
+ - lib/blamer/userstamp.rb
52
43
  - test/blame_test.rb
53
44
  - test/models/monkey.rb
54
45
  - test/models/sprocket.rb
@@ -61,28 +52,27 @@ files:
61
52
  homepage: http://github.com/infused/blame
62
53
  licenses:
63
54
  - MIT
55
+ metadata: {}
64
56
  post_install_message:
65
57
  rdoc_options:
66
- - --charset=UTF-8
58
+ - "--charset=UTF-8"
67
59
  require_paths:
68
60
  - lib
69
61
  required_ruby_version: !ruby/object:Gem::Requirement
70
- none: false
71
62
  requirements:
72
- - - ! '>='
63
+ - - ">="
73
64
  - !ruby/object:Gem::Version
74
65
  version: '0'
75
66
  required_rubygems_version: !ruby/object:Gem::Requirement
76
- none: false
77
67
  requirements:
78
- - - ! '>='
68
+ - - ">="
79
69
  - !ruby/object:Gem::Version
80
70
  version: 1.3.0
81
71
  requirements: []
82
72
  rubyforge_project:
83
- rubygems_version: 1.8.25
73
+ rubygems_version: 2.6.11
84
74
  signing_key:
85
- specification_version: 3
75
+ specification_version: 4
86
76
  summary: Userstamps for ActiveRecord
87
77
  test_files:
88
78
  - test/blame_test.rb