purgatory 3.1.2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YmZmZDQ1M2NjYTQ3YTU4MGY1YjdjNWY4ZjNlNGVjM2QyYjIxNDE4Mw==
5
- data.tar.gz: !binary |-
6
- YmI2MzNkNmUyZmVjNGVhNTJiYTEzMTMwM2YyOWU3ZmNkNzg0NWMyYw==
2
+ SHA256:
3
+ metadata.gz: be4d6f59af39018b4417a418f8e8c2e91eaa1eef4eeb8cb3764bcea91e08911a
4
+ data.tar.gz: f02e6f1cd52fc530db2dc671abec047b896b576e34b988b8749418e29c9bc1bc
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NTEyYTBhMTBkMzc1ODhmYTNjOTFmMjkzMDMwOWI0MzZiZDcxM2JhOTFiNGM2
10
- MGRhZmY3ZWY1MjUyNTdjYTY2MWNlZTkwZjJiMmNiNGFhNDIyNjVjM2NmYTlj
11
- MWMxM2Q2ZmZmM2U4OTRlZmNkYjdhMWZjOTRlNTk4MmYyNmE5NjU=
12
- data.tar.gz: !binary |-
13
- ZTA0NDY5NDliOTFjMTcyMzcyZGRkOGViZGI5ZWUwZTVkNzM4MjliZjUxMzU2
14
- NTNjYTMwMDM0MmRjODZjYzdiNzc0YmVlYzMwYzg2MDY4YTMyZmRkMDViMDBk
15
- ZDYzNmFiMjBkMTg4MjU1MDMzNzhlNzFiNmZiNTg5MTViMjdiMWM=
6
+ metadata.gz: 6aa6ed6eca3b918911dc1fabf5c02d1cdfbebf9a5f720712e39e707742071dbfee26428f4ea6a26663360642351e5e8ccf935df13968f0df3bc25ff2d40dc0e0
7
+ data.tar.gz: 8d88f7c48bdc0956c315e73bcf30493e2c29bd836b6682d6bfeaf804401155e30a7bf186b626f4bc65a750a2b16124bddbd59626cfb82e5be7ed9c6136769cce
@@ -1,7 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
3
+ - 2.2.10
4
+ - 2.3.8
5
+ - 2.4.9
6
+ - 2.5.7
7
+ - 2.6.5
5
8
  cache:
6
9
  bundler: true
7
10
  script: bundle exec rspec
data/Gemfile CHANGED
@@ -3,16 +3,8 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
- group :development do
9
- gem "rdoc", "~> 3.12"
10
- gem "bundler", "~> 1.0"
11
- gem "jeweler", "~> 1.8.7"
12
- end
13
-
14
6
  group :test do
15
- gem "activerecord", ">= 4"
7
+ gem "activerecord", "~> 4.1"
16
8
  gem "rspec"
17
9
  gem "sqlite3"
18
10
  gem "pry"
@@ -1,74 +1,31 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activemodel (4.0.1)
5
- activesupport (= 4.0.1)
6
- builder (~> 3.1.0)
7
- activerecord (4.0.1)
8
- activemodel (= 4.0.1)
9
- activerecord-deprecated_finders (~> 1.0.2)
10
- activesupport (= 4.0.1)
11
- arel (~> 4.0.0)
12
- activerecord-deprecated_finders (1.0.3)
13
- activesupport (4.0.1)
14
- i18n (~> 0.6, >= 0.6.4)
15
- minitest (~> 4.2)
16
- multi_json (~> 1.3)
17
- thread_safe (~> 0.1)
18
- tzinfo (~> 0.3.37)
19
- addressable (2.3.5)
20
- arel (4.0.1)
21
- atomic (1.1.14)
22
- builder (3.1.4)
4
+ activemodel (4.2.11.1)
5
+ activesupport (= 4.2.11.1)
6
+ builder (~> 3.1)
7
+ activerecord (4.2.11.1)
8
+ activemodel (= 4.2.11.1)
9
+ activesupport (= 4.2.11.1)
10
+ arel (~> 6.0)
11
+ activesupport (4.2.11.1)
12
+ i18n (~> 0.7)
13
+ minitest (~> 5.1)
14
+ thread_safe (~> 0.3, >= 0.3.4)
15
+ tzinfo (~> 1.1)
16
+ arel (6.0.4)
17
+ builder (3.2.4)
23
18
  coderay (1.1.0)
19
+ concurrent-ruby (1.1.6)
24
20
  diff-lcs (1.2.5)
25
- faraday (0.8.8)
26
- multipart-post (~> 1.2.0)
27
- git (1.2.6)
28
- github_api (0.10.1)
29
- addressable
30
- faraday (~> 0.8.1)
31
- hashie (>= 1.2)
32
- multi_json (~> 1.4)
33
- nokogiri (~> 1.5.2)
34
- oauth2
35
- hashie (2.0.5)
36
- highline (1.6.20)
37
- httpauth (0.2.0)
38
- i18n (0.6.5)
39
- jeweler (1.8.8)
40
- builder
41
- bundler (~> 1.0)
42
- git (>= 1.2.5)
43
- github_api (= 0.10.1)
44
- highline (>= 1.6.15)
45
- nokogiri (= 1.5.10)
46
- rake
47
- rdoc
48
- json (1.8.1)
49
- jwt (0.1.8)
50
- multi_json (>= 1.5)
21
+ i18n (0.9.5)
22
+ concurrent-ruby (~> 1.0)
51
23
  method_source (0.8.2)
52
- minitest (4.7.5)
53
- multi_json (1.8.2)
54
- multi_xml (0.5.5)
55
- multipart-post (1.2.0)
56
- nokogiri (1.5.10)
57
- oauth2 (0.9.2)
58
- faraday (~> 0.8)
59
- httpauth (~> 0.2)
60
- jwt (~> 0.1.4)
61
- multi_json (~> 1.0)
62
- multi_xml (~> 0.5)
63
- rack (~> 1.2)
24
+ minitest (5.14.0)
64
25
  pry (0.9.12.4)
65
26
  coderay (~> 1.0)
66
27
  method_source (~> 0.8)
67
28
  slop (~> 3.4)
68
- rack (1.5.2)
69
- rake (10.1.0)
70
- rdoc (3.12.2)
71
- json (~> 1.4)
72
29
  rspec (2.14.1)
73
30
  rspec-core (~> 2.14.0)
74
31
  rspec-expectations (~> 2.14.0)
@@ -78,19 +35,19 @@ GEM
78
35
  diff-lcs (>= 1.1.3, < 2.0)
79
36
  rspec-mocks (2.14.4)
80
37
  slop (3.4.7)
81
- sqlite3 (1.3.8)
82
- thread_safe (0.1.3)
83
- atomic
84
- tzinfo (0.3.38)
38
+ sqlite3 (1.3.13)
39
+ thread_safe (0.3.6)
40
+ tzinfo (1.2.6)
41
+ thread_safe (~> 0.1)
85
42
 
86
43
  PLATFORMS
87
44
  ruby
88
45
 
89
46
  DEPENDENCIES
90
- activerecord (>= 4)
91
- bundler (~> 1.0)
92
- jeweler (~> 1.8.7)
47
+ activerecord (~> 4.1)
93
48
  pry
94
- rdoc (~> 3.12)
95
49
  rspec
96
50
  sqlite3
51
+
52
+ BUNDLED WITH
53
+ 1.17.3
@@ -25,13 +25,15 @@ To put your changes to an ActiveRecord class into Purgatory, simply make your ch
25
25
 
26
26
  item = Item.find(10)
27
27
  item.price = 200
28
- purgatory = item.purgatory!(current_user) # returns the newly created purgatory or nil if the item is changes are invalid
28
+ purgatory = item.purgatory!(current_user) # returns the newly created purgatory or nil if the item's changes are invalid
29
29
 
30
- By default, if you call purgatory! on an object then any pending purgatories whose soul is that same object will be destroyed. If you'd prefer this not to happen then you can pass fail_if_matching_soul as a parameter and this will make it so if there are pending purgatories with a matching soul then purgatory! will return nil and nothing will happen:
30
+ The object `purgatory!` is called on is known as its *soul*.
31
+
32
+ By default, if you call `purgatory!` on an object then any pending purgatories whose soul is that same object will be destroyed. If you'd prefer this not to happen then you can pass `fail_if_matching_soul: true` as a parameter and this will make it so if there are pending purgatories with a matching soul then `purgatory!` will return `nil` and nothing will happen:
31
33
 
32
34
  purgatory = item.purgatory!(current_user, fail_if_matching_soul: true) # Returns nil and does nothing if there is already a pending purgatory on same soul
33
35
 
34
- To apply the changes, simply call the approve! method on the associated Pergatory instance. You can pass in the approving user as an optional parameter
36
+ To apply the changes, simply call the `approve!` method on the associated `Purgatory` instance. You can pass in the approving user as an optional parameter:
35
37
 
36
38
  purgatory = item.purgatories.last
37
39
  purgatory.approve!(current_user) # returns a boolean for whether or not this succeeded
@@ -41,12 +43,12 @@ You can also put the creation of a new object into Purgatory
41
43
  item = Item.new price: 100
42
44
  purgatory = item.purgatory!
43
45
 
44
- Call .purgatize.method(params) to put a method call into Purgatory. When the purgatory is approved the method will be called on the soul. The purgatory will only be approved if the method returns true to indicate it succeeded.
46
+ Call `.purgatize.method(params)` to put a method call into Purgatory. When the purgatory is approved the method will be called on the soul. The purgatory will only be approved if the method returns true to indicate it succeeded.
45
47
 
46
- #without purgatory:
48
+ # without purgatory:
47
49
  item.increase_price(200)
48
50
 
49
- #with purgatory:
51
+ # with purgatory:
50
52
  item.purgatize(current_user).increase_price(200)
51
53
 
52
54
  The following are some attributes of a purgatory:
@@ -64,8 +66,8 @@ Here are some handy class and instance methods available to you:
64
66
  ### Class methods
65
67
  Purgatory.pending # Returns a relation of all pending purgatories
66
68
  Purgatory.approved # Returns a relation of all approved purgatories
67
- Purgatory.pending_with_matching_soul(soul) # Returns a relation of
68
- all pending purgatories with soul matching the object passed in
69
+ Purgatory.pending_with_matching_soul(soul) # Returns a relation of all pending purgatories
70
+ # with soul matching the object passed in
69
71
 
70
72
  ### Instance methods
71
73
  purgatory.pending? # Returns true if the purgatory is pending, false otherwise
@@ -110,13 +112,13 @@ Here are some handy class and instance methods available to you:
110
112
 
111
113
  1. Manual
112
114
 
113
- use_purgatory :local_attributes => [:foo, :bar]
115
+ `use_purgatory :local_attributes => [:foo, :bar]`
114
116
 
115
117
  When you pass a hash that contains a list of virtual attributes that you want to save, purgatory will save the values of these attributes into the purgatory table during the "purgatory!" phase, so that when "approve!" is later called, the virtual attributes will be retrieved and will continue to be available in the remaining activerecord lifecyle.
116
118
 
117
119
  2. Automatic
118
120
 
119
- use_purgatory :local_attributes => :all
121
+ `use_purgatory :local_attributes => :all`
120
122
 
121
123
  By specifying all, Purgatory will programmatically determine what the virtual attributes are and save them when "purgatory!" is called, so that they will be available during "approve!".
122
124
 
data/VERSION CHANGED
@@ -1,2 +1 @@
1
- 3.1.2
2
-
1
+ 4.0.0
@@ -1,12 +1,9 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
5
- # stub: purgatory 3.1.2 ruby lib
2
+ # stub: purgatory 4.0.0 ruby lib
6
3
 
7
4
  Gem::Specification.new do |s|
8
5
  s.name = "purgatory"
9
- s.version = "3.1.2"
6
+ s.version = "4.0.0"
10
7
 
11
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
9
  s.require_paths = ["lib"]
@@ -26,7 +23,6 @@ Gem::Specification.new do |s|
26
23
  "Gemfile.lock",
27
24
  "LICENSE.txt",
28
25
  "README.markdown",
29
- "Rakefile",
30
26
  "VERSION",
31
27
  "init.rb",
32
28
  "lib/generators/purgatory/purgatory_generator.rb",
@@ -50,22 +46,7 @@ Gem::Specification.new do |s|
50
46
  s.rubygems_version = "2.2.5"
51
47
  s.summary = "Allow changes to a model to be put in purgatory until they are approved"
52
48
 
53
- if s.respond_to? :specification_version then
49
+ if s.respond_to? :specification_version
54
50
  s.specification_version = 4
55
-
56
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
58
- s.add_development_dependency(%q<bundler>, ["~> 1.0"])
59
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.7"])
60
- else
61
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
62
- s.add_dependency(%q<bundler>, ["~> 1.0"])
63
- s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
64
- end
65
- else
66
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
67
- s.add_dependency(%q<bundler>, ["~> 1.0"])
68
- s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
69
51
  end
70
52
  end
71
-
@@ -214,7 +214,7 @@ describe Purgatory do
214
214
  context "approving object change purgatory" do
215
215
  before do
216
216
  create_object_change_purgatory
217
- @purgatory.approve!(user2).should be_true
217
+ @purgatory.approve!(user2).should be true
218
218
  @widget.reload
219
219
  end
220
220
 
@@ -233,7 +233,7 @@ describe Purgatory do
233
233
  end
234
234
 
235
235
  it "should fail if you try to approve again" do
236
- @purgatory.approve!(user2).should be_false
236
+ @purgatory.approve!(user2).should be false
237
237
  end
238
238
  end
239
239
 
@@ -251,7 +251,7 @@ describe Purgatory do
251
251
  end
252
252
 
253
253
  it "should fail when performable method returns false" do
254
- @purgatory.approve!(user2).should be_false
254
+ @purgatory.approve!(user2).should be false
255
255
  end
256
256
 
257
257
  it "it should not be approved" do
@@ -287,14 +287,14 @@ describe Purgatory do
287
287
  end
288
288
 
289
289
  it "should fail if you try to approve again" do
290
- @purgatory.approve!(user2).should be_false
290
+ @purgatory.approve!(user2).should be false
291
291
  end
292
292
  end
293
293
 
294
294
  context "approving new object creation" do
295
295
  before do
296
296
  create_new_object_purgatory
297
- @purgatory.approve!(user2).should be_true
297
+ @purgatory.approve!(user2).should be true
298
298
  end
299
299
 
300
300
  it "should create the new object and apply any callbacks" do
@@ -321,14 +321,14 @@ describe Purgatory do
321
321
  end
322
322
 
323
323
  it "should fail if you try to approve again" do
324
- @purgatory.approve!(user2).should be_false
324
+ @purgatory.approve!(user2).should be false
325
325
  end
326
326
  end
327
327
 
328
328
  context "approving new object creation using STI" do
329
329
  before do
330
330
  create_new_object_purgatory_with_sti
331
- @purgatory.approve!(user2).should be_true
331
+ @purgatory.approve!(user2).should be true
332
332
  end
333
333
 
334
334
  it "should create the new object and apply any callbacks" do
@@ -367,7 +367,7 @@ describe Purgatory do
367
367
  end
368
368
 
369
369
  it "should fail if you try to approve again" do
370
- @purgatory.approve!(user2).should be_false
370
+ @purgatory.approve!(user2).should be false
371
371
  end
372
372
  end
373
373
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: purgatory
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elan Dubrofsky
@@ -9,49 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2017-08-24 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rdoc
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '3.12'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: '3.12'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: '1.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '1.0'
41
- - !ruby/object:Gem::Dependency
42
- name: jeweler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- version: 1.8.7
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: 1.8.7
12
+ dependencies: []
55
13
  description: Put your model changes in purgatory and allow them to remain lost souls
56
14
  until they are approved
57
15
  email: elan.dubrofsky@gmail.com
@@ -61,14 +19,13 @@ extra_rdoc_files:
61
19
  - LICENSE.txt
62
20
  - README.markdown
63
21
  files:
64
- - .document
65
- - .rspec
66
- - .travis.yml
22
+ - ".document"
23
+ - ".rspec"
24
+ - ".travis.yml"
67
25
  - Gemfile
68
26
  - Gemfile.lock
69
27
  - LICENSE.txt
70
28
  - README.markdown
71
- - Rakefile
72
29
  - VERSION
73
30
  - init.rb
74
31
  - lib/generators/purgatory/purgatory_generator.rb
@@ -96,17 +53,17 @@ require_paths:
96
53
  - lib
97
54
  required_ruby_version: !ruby/object:Gem::Requirement
98
55
  requirements:
99
- - - ! '>='
56
+ - - ">="
100
57
  - !ruby/object:Gem::Version
101
58
  version: '0'
102
59
  required_rubygems_version: !ruby/object:Gem::Requirement
103
60
  requirements:
104
- - - ! '>='
61
+ - - ">="
105
62
  - !ruby/object:Gem::Version
106
63
  version: '0'
107
64
  requirements: []
108
65
  rubyforge_project:
109
- rubygems_version: 2.2.5
66
+ rubygems_version: 2.7.8
110
67
  signing_key:
111
68
  specification_version: 4
112
69
  summary: Allow changes to a model to be put in purgatory until they are approved
data/Rakefile DELETED
@@ -1,45 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "purgatory"
18
- gem.homepage = "http://github.com/financeit/purgatory"
19
- gem.license = "MIT"
20
- gem.summary = %Q{Allow changes to a model to be put in purgatory until they are approved}
21
- gem.description = %Q{Put your model changes in purgatory and allow them to remain lost souls until they are approved}
22
- gem.email = "elan.dubrofsky@gmail.com"
23
- gem.authors = ["Elan Dubrofsky"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
27
-
28
- require 'rake/testtask'
29
- Rake::TestTask.new(:test) do |test|
30
- test.libs << 'lib' << 'test'
31
- test.pattern = 'test/**/test_*.rb'
32
- test.verbose = true
33
- end
34
-
35
- task :default => :test
36
-
37
- require 'rdoc/task'
38
- Rake::RDocTask.new do |rdoc|
39
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
-
41
- rdoc.rdoc_dir = 'rdoc'
42
- rdoc.title = "purgatory #{version}"
43
- rdoc.rdoc_files.include('README*')
44
- rdoc.rdoc_files.include('lib/**/*.rb')
45
- end