maintain 0.2.23 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,12 +25,12 @@ if proceed
25
25
  property :status, String
26
26
 
27
27
  maintain :status do
28
- state :new, :default => true
28
+ state :new, default: true
29
29
  state :old
30
30
  state :foo
31
31
  state :bar
32
- aggregate :everything, :as => [:new, :old, :foo, :bar]
33
- aggregate :fakes, :as => [:foo, :bar]
32
+ aggregate :everything, as: [:new, :old, :foo, :bar]
33
+ aggregate :fakes, as: [:foo, :bar]
34
34
  end
35
35
  end
36
36
 
@@ -48,7 +48,7 @@ if proceed
48
48
  end
49
49
 
50
50
  it "should allow us to update its status to 'old'" do
51
- active_maintain_test = DataMapperMaintainTest.new(:status => 'old')
51
+ active_maintain_test = DataMapperMaintainTest.new(status: 'old')
52
52
  active_maintain_test.status.should == 'old'
53
53
  lambda {
54
54
  active_maintain_test.save!
@@ -57,7 +57,7 @@ if proceed
57
57
  end
58
58
 
59
59
  it "should return the correct name when told to" do
60
- active_maintain_test = DataMapperMaintainTest.create(:status => 'old')
60
+ active_maintain_test = DataMapperMaintainTest.create(status: 'old')
61
61
  DataMapperMaintainTest.first.status.name.should == 'old'
62
62
  end
63
63
  end
@@ -75,14 +75,14 @@ if proceed
75
75
 
76
76
  it "should return the correct collections on aggregates" do
77
77
  DataMapperMaintainTest.all.destroy!
78
- one = DataMapperMaintainTest.create(:status => :foo)
79
- two = DataMapperMaintainTest.create(:status => :bar)
80
- three = DataMapperMaintainTest.create(:status => :new)
81
- four = DataMapperMaintainTest.create(:status => :old)
78
+ one = DataMapperMaintainTest.create(status: :foo)
79
+ two = DataMapperMaintainTest.create(status: :bar)
80
+ three = DataMapperMaintainTest.create(status: :new)
81
+ four = DataMapperMaintainTest.create(status: :old)
82
82
  DataMapperMaintainTest.fakes.should == [one, two]
83
83
  DataMapperMaintainTest.everything.should == [one, two, three, four]
84
84
  end
85
85
 
86
86
  end
87
87
  end
88
- end
88
+ end
@@ -23,20 +23,20 @@ describe Maintain do
23
23
 
24
24
  it "should support default values" do
25
25
  MaintainTest.maintain :existant_attribute do
26
- state :new, :default => true
26
+ state :new, default: true
27
27
  end
28
28
  MaintainTest.new.existant_attribute.should == :new
29
29
  end
30
30
 
31
31
  it "should support integer values" do
32
32
  MaintainTest.maintain :existant_attribute do
33
- state :new, 1, :default => true
33
+ state :new, 1, default: true
34
34
  end
35
35
  MaintainTest.new.existant_attribute.should == 1
36
36
  end
37
37
 
38
38
  it "should provide accessor methods on the Maintain::Maintainer class for state values" do
39
- maintainer = MaintainTest.maintain :permissions, :bitmask => true do
39
+ maintainer = MaintainTest.maintain :permissions, bitmask: true do
40
40
  state :edit, 1
41
41
  state :delete, 2
42
42
  state :update, 3
@@ -45,7 +45,7 @@ describe Maintain do
45
45
  end
46
46
 
47
47
  it "should not trap all methods when providing accessor methods for state values" do
48
- maintainer = MaintainTest.maintain :permissions, :bitmask => true do
48
+ maintainer = MaintainTest.maintain :permissions, bitmask: true do
49
49
  state :edit, 1
50
50
  state :delete, 2
51
51
  state :update, 3
@@ -57,7 +57,7 @@ describe Maintain do
57
57
 
58
58
  it "should pass valid methods to the actual value object" do
59
59
  MaintainTest.maintain :existant_attribute do
60
- state :new, :default => true
60
+ state :new, default: true
61
61
  end
62
62
  # This changed in Ruby 1.9.2 on account of the String class not knowing WTF "to_i" is
63
63
  MaintainTest.new.existant_attribute.size.should == 3
@@ -66,7 +66,7 @@ describe Maintain do
66
66
 
67
67
  describe "as bitmask" do
68
68
  it "should calculate a base-2 compatible integer" do
69
- maintainer = MaintainTest.maintain :permissions, :bitmask => true do
69
+ maintainer = MaintainTest.maintain :permissions, bitmask: true do
70
70
  state :edit, 1
71
71
  state :delete, 2
72
72
  state :update, 3
@@ -75,7 +75,7 @@ describe Maintain do
75
75
  end
76
76
 
77
77
  it "should auto-increment bitmask column values (but dangerously!)" do
78
- maintainer = MaintainTest.maintain :permissions, :bitmask => true do
78
+ maintainer = MaintainTest.maintain :permissions, bitmask: true do
79
79
  state :edit
80
80
  state :delete
81
81
  state :update
@@ -86,4 +86,4 @@ describe Maintain do
86
86
  end
87
87
  end
88
88
  end
89
- end
89
+ end
@@ -13,8 +13,8 @@ describe Maintain, "hooks" do
13
13
  it "should allow me to hook into entry and exit" do
14
14
  lambda {
15
15
  MaintainTest.maintain :state do
16
- state :new, :enter => :new_entered
17
- state :old, :enter => :old_entered
16
+ state :new, enter: :new_entered
17
+ state :old, enter: :old_entered
18
18
  on :enter, :new, :new_entered
19
19
  on :exit, :old do
20
20
  self.old_entered
@@ -46,7 +46,7 @@ describe Maintain, "hooks" do
46
46
  MaintainTest.maintain :state do
47
47
  state :new
48
48
  state :old
49
- on :enter, :new, :new_entered, :if => :run_hook?
49
+ on :enter, :new, :new_entered, if: :run_hook?
50
50
  end
51
51
 
52
52
  maintain = MaintainTest.new
@@ -59,4 +59,4 @@ describe Maintain, "hooks" do
59
59
  maintain.state = :old
60
60
  end
61
61
  end
62
- end
62
+ end
@@ -12,9 +12,9 @@ describe Maintain do
12
12
 
13
13
  describe "integer" do
14
14
  before :each do
15
- MaintainTest.maintain :kind, :integer => true do
15
+ MaintainTest.maintain :kind, integer: true do
16
16
  state :man, 1
17
- state :woman, 2, :default => true
17
+ state :woman, 2, default: true
18
18
  state :none, 3
19
19
  end
20
20
  @maintainer = MaintainTest.new
@@ -35,4 +35,4 @@ describe Maintain do
35
35
  @maintainer.kind.name.should == "woman"
36
36
  end
37
37
  end
38
- end
38
+ end
@@ -23,7 +23,7 @@ describe Maintain do
23
23
  it "should accept a block" do
24
24
  lambda {
25
25
  MaintainTest.maintain :non_existant_attribute do
26
-
26
+
27
27
  end
28
28
  }.should_not raise_error
29
29
  end
@@ -43,4 +43,4 @@ describe Maintain do
43
43
  MaintainTest.maintain :existant_attribute
44
44
  }.should_not raise_error
45
45
  end
46
- end
46
+ end
@@ -6,4 +6,4 @@ describe 'Maintain' do
6
6
  require 'maintain'
7
7
  }.should_not change(Object, :methods)
8
8
  end
9
- end
9
+ end
@@ -56,7 +56,7 @@ describe Maintain do
56
56
  end
57
57
 
58
58
  it "should return ':new' for a state with a default value of :new" do
59
- MaintainTest.maintain :state, :default => :new do
59
+ MaintainTest.maintain :state, default: :new do
60
60
  state :new
61
61
  state :overdue
62
62
  state :closed
@@ -65,7 +65,7 @@ describe Maintain do
65
65
  end
66
66
 
67
67
  it "should return '2' for a state with a default value of :new, 2 and an :integer column" do
68
- MaintainTest.maintain :state, :default => :new do
68
+ MaintainTest.maintain :state, default: :new do
69
69
  state :new, 2
70
70
  state :overdue, 5
71
71
  state :closed, 22
@@ -85,7 +85,7 @@ describe Maintain do
85
85
  end
86
86
 
87
87
  it "should return false for states with a default" do
88
- MaintainTest.maintain :state, :default => :new do
88
+ MaintainTest.maintain :state, default: :new do
89
89
  state :new
90
90
  state :overdue
91
91
  state :closed
@@ -105,7 +105,7 @@ describe Maintain do
105
105
  end
106
106
 
107
107
  it "should return 'new' for a state with a default value of :new" do
108
- MaintainTest.maintain :state, :default => :new do
108
+ MaintainTest.maintain :state, default: :new do
109
109
  state :new
110
110
  state :overdue
111
111
  state :closed
@@ -114,7 +114,7 @@ describe Maintain do
114
114
  end
115
115
 
116
116
  it "should return '2' for a state with a default value of :new, 2 and an :integer column" do
117
- MaintainTest.maintain :state, :default => :new do
117
+ MaintainTest.maintain :state, default: :new do
118
118
  state :new, 2
119
119
  state :overdue, 5
120
120
  state :closed, 22
@@ -122,4 +122,4 @@ describe Maintain do
122
122
  MaintainTest.new.state.to_s.should == '2'
123
123
  end
124
124
  end
125
- end
125
+ end
@@ -64,4 +64,4 @@ describe Maintain do
64
64
  end
65
65
  end
66
66
  end
67
- end
67
+ end
metadata CHANGED
@@ -1,32 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maintain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.23
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Flip Sasser
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-21 00:00:00.000000000 Z
11
+ date: 2013-09-27 00:00:00.000000000 Z
13
12
  dependencies: []
14
- description: ! "\n Maintain is a simple state machine mixin for Ruby objects.
15
- It supports comparisons, bitmasks,\n and hooks that really work. It can be
16
- used for multiple attributes and will always do its best to\n stay out of your
17
- way and let your code drive the machine, and not vice versa.\n "
13
+ description: "\n Maintain is a simple state machine mixin for Ruby objects. It
14
+ supports comparisons, bitmasks,\n and hooks that really work. It can be used
15
+ for multiple attributes and will always do its best to\n stay out of your way
16
+ and let your code drive the machine, and not vice versa.\n "
18
17
  email: flip@x451.com
19
18
  executables: []
20
19
  extensions: []
21
20
  extra_rdoc_files:
22
21
  - README.markdown
23
22
  files:
24
- - .rspec
25
- - CHANGES
23
+ - CHANGES.md
26
24
  - README.markdown
27
- - Rakefile
28
- - VERSION
29
- - autotest/discover.rb
30
25
  - lib/maintain.rb
31
26
  - lib/maintain/backend.rb
32
27
  - lib/maintain/backend/active_record.rb
@@ -36,7 +31,6 @@ files:
36
31
  - lib/maintain/integer_value.rb
37
32
  - lib/maintain/maintainer.rb
38
33
  - lib/maintain/value.rb
39
- - maintain.gemspec
40
34
  - spec/active_record_spec.rb
41
35
  - spec/aggregates_spec.rb
42
36
  - spec/bitwise_spec.rb
@@ -55,26 +49,41 @@ files:
55
49
  - spec/subclass_spec.rb
56
50
  homepage: http://github.com/flipsasser/maintain
57
51
  licenses: []
52
+ metadata: {}
58
53
  post_install_message:
59
54
  rdoc_options: []
60
55
  require_paths:
61
56
  - lib
62
57
  required_ruby_version: !ruby/object:Gem::Requirement
63
- none: false
64
58
  requirements:
65
- - - ! '>='
59
+ - - '>='
66
60
  - !ruby/object:Gem::Version
67
- version: '0'
61
+ version: '1.9'
68
62
  required_rubygems_version: !ruby/object:Gem::Requirement
69
- none: false
70
63
  requirements:
71
- - - ! '>='
64
+ - - '>='
72
65
  - !ruby/object:Gem::Version
73
66
  version: '0'
74
67
  requirements: []
75
68
  rubyforge_project:
76
- rubygems_version: 1.8.24
69
+ rubygems_version: 2.0.3
77
70
  signing_key:
78
- specification_version: 3
71
+ specification_version: 4
79
72
  summary: A Ruby state machine that lets your code do the driving
80
- test_files: []
73
+ test_files:
74
+ - spec/active_record_spec.rb
75
+ - spec/aggregates_spec.rb
76
+ - spec/bitwise_spec.rb
77
+ - spec/class_methods_spec.rb
78
+ - spec/comparing_state_spec.rb
79
+ - spec/data_mapper_spec.rb
80
+ - spec/defining_states_spec.rb
81
+ - spec/hooks_spec.rb
82
+ - spec/integer_spec.rb
83
+ - spec/maintain_spec.rb
84
+ - spec/object_spec.rb
85
+ - spec/proxy_spec.rb
86
+ - spec/setting_state_spec.rb
87
+ - spec/spec.opts
88
+ - spec/spec_helper.rb
89
+ - spec/subclass_spec.rb
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --colour
data/CHANGES DELETED
@@ -1,27 +0,0 @@
1
- 0.2.22
2
- * Added `bang!` method support, so now you can call `@object.awesome!`
3
- and its state will be set to "awesome." Like all Maintain methods,
4
- I'm saying f*ck you to convention and letting you go nuts; you can
5
- achieve the same effect one of three ways:
6
-
7
- @object.awesome!
8
- @object.state.awesome!
9
- @object.state_awesome!
10
-
11
- 0.2.21
12
- * Added Enumerable support to bitmask values, so now you can parse
13
- through flags with each, select, map, find, and more! This also
14
- means `to_a` is now a method on @object.maintained_attribute.
15
-
16
- 0.2.20
17
- * Removed accidental debugging `puts` calls from ActiveRecord backend
18
-
19
- 0.2.19
20
- * Added :force option to state and aggregate definitions, allowing you
21
- to force a method overwrite
22
- * Added an attribute_name alias to named scopes in the ActiveRecord
23
- backend, since Rails 3.1 has eaten up a number of previously
24
- usable state names
25
-
26
- 0.2.18
27
- * Ruby 1.9.2 and Rails 3.1 compatibility updates (no API changes)
data/Rakefile DELETED
@@ -1,18 +0,0 @@
1
- require 'rake'
2
-
3
- begin
4
- require 'jeweler'
5
- Jeweler::Tasks.new do |gemspec|
6
- gemspec.name = "maintain"
7
- gemspec.summary = "A Ruby state machine that lets your code do the driving"
8
- gemspec.description = %{
9
- Maintain is a simple state machine mixin for Ruby objects. It supports comparisons, bitmasks,
10
- and hooks that really work. It can be used for multiple attributes and will always do its best to
11
- stay out of your way and let your code drive the machine, and not vice versa.
12
- }
13
- gemspec.email = "flip@x451.com"
14
- gemspec.homepage = "http://github.com/flipsasser/maintain"
15
- gemspec.authors = ["Flip Sasser"]
16
- end
17
- rescue LoadError
18
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.23
@@ -1,4 +0,0 @@
1
- require 'autotest/fsevent'
2
-
3
- Autotest.add_discovery { "rspec2" }
4
-
@@ -1,66 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "maintain"
8
- s.version = "0.2.23"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Flip Sasser"]
12
- s.date = "2012-08-21"
13
- s.description = "\n Maintain is a simple state machine mixin for Ruby objects. It supports comparisons, bitmasks,\n and hooks that really work. It can be used for multiple attributes and will always do its best to\n stay out of your way and let your code drive the machine, and not vice versa.\n "
14
- s.email = "flip@x451.com"
15
- s.extra_rdoc_files = [
16
- "README.markdown"
17
- ]
18
- s.files = [
19
- ".rspec",
20
- "CHANGES",
21
- "README.markdown",
22
- "Rakefile",
23
- "VERSION",
24
- "autotest/discover.rb",
25
- "lib/maintain.rb",
26
- "lib/maintain/backend.rb",
27
- "lib/maintain/backend/active_record.rb",
28
- "lib/maintain/backend/base.rb",
29
- "lib/maintain/backend/data_mapper.rb",
30
- "lib/maintain/bitmask_value.rb",
31
- "lib/maintain/integer_value.rb",
32
- "lib/maintain/maintainer.rb",
33
- "lib/maintain/value.rb",
34
- "maintain.gemspec",
35
- "spec/active_record_spec.rb",
36
- "spec/aggregates_spec.rb",
37
- "spec/bitwise_spec.rb",
38
- "spec/class_methods_spec.rb",
39
- "spec/comparing_state_spec.rb",
40
- "spec/data_mapper_spec.rb",
41
- "spec/defining_states_spec.rb",
42
- "spec/hooks_spec.rb",
43
- "spec/integer_spec.rb",
44
- "spec/maintain_spec.rb",
45
- "spec/object_spec.rb",
46
- "spec/proxy_spec.rb",
47
- "spec/setting_state_spec.rb",
48
- "spec/spec.opts",
49
- "spec/spec_helper.rb",
50
- "spec/subclass_spec.rb"
51
- ]
52
- s.homepage = "http://github.com/flipsasser/maintain"
53
- s.require_paths = ["lib"]
54
- s.rubygems_version = "1.8.24"
55
- s.summary = "A Ruby state machine that lets your code do the driving"
56
-
57
- if s.respond_to? :specification_version then
58
- s.specification_version = 3
59
-
60
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
61
- else
62
- end
63
- else
64
- end
65
- end
66
-