state_machine 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Appraisals +9 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/gemfiles/active_model-3.0.0.gemfile.lock +1 -1
- data/gemfiles/active_model-3.0.5.gemfile.lock +1 -1
- data/gemfiles/active_model-3.1.1.gemfile.lock +2 -2
- data/gemfiles/active_model-3.2.0.gemfile +7 -0
- data/gemfiles/active_model-3.2.0.gemfile.lock +32 -0
- data/gemfiles/active_record-2.0.0.gemfile.lock +1 -1
- data/gemfiles/active_record-2.0.5.gemfile.lock +1 -1
- data/gemfiles/active_record-2.1.0.gemfile.lock +1 -1
- data/gemfiles/active_record-2.1.2.gemfile.lock +1 -1
- data/gemfiles/active_record-2.2.3.gemfile.lock +1 -1
- data/gemfiles/active_record-2.3.12.gemfile.lock +1 -1
- data/gemfiles/active_record-3.0.0.gemfile.lock +1 -1
- data/gemfiles/active_record-3.0.5.gemfile.lock +1 -1
- data/gemfiles/active_record-3.1.1.gemfile.lock +2 -2
- data/gemfiles/active_record-3.2.0.gemfile +8 -0
- data/gemfiles/active_record-3.2.0.gemfile.lock +43 -0
- data/gemfiles/data_mapper-0.10.2.gemfile.lock +1 -1
- data/gemfiles/data_mapper-0.9.11.gemfile.lock +1 -1
- data/gemfiles/data_mapper-0.9.4.gemfile.lock +1 -1
- data/gemfiles/data_mapper-0.9.7.gemfile.lock +1 -1
- data/gemfiles/data_mapper-1.0.0.gemfile.lock +1 -1
- data/gemfiles/data_mapper-1.0.1.gemfile.lock +1 -1
- data/gemfiles/data_mapper-1.0.2.gemfile.lock +1 -1
- data/gemfiles/data_mapper-1.1.0.gemfile.lock +1 -1
- data/gemfiles/data_mapper-1.2.0.gemfile.lock +1 -1
- data/gemfiles/default.gemfile.lock +2 -2
- data/gemfiles/graphviz-0.9.0.gemfile.lock +1 -1
- data/gemfiles/graphviz-0.9.21.gemfile.lock +1 -1
- data/gemfiles/graphviz-1.0.0.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.10.0.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.5.5.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.5.8.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.6.0.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.6.10.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.7.0.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.7.5.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.8.0.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.8.3.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.8.4.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.8.6.gemfile.lock +1 -1
- data/gemfiles/mongo_mapper-0.9.0.gemfile.lock +1 -1
- data/gemfiles/mongoid-2.0.0.gemfile.lock +1 -1
- data/gemfiles/mongoid-2.1.4.gemfile.lock +1 -1
- data/gemfiles/mongoid-2.2.4.gemfile.lock +1 -1
- data/gemfiles/mongoid-2.3.3.gemfile.lock +1 -1
- data/gemfiles/sequel-2.11.0.gemfile.lock +1 -1
- data/gemfiles/sequel-2.12.0.gemfile.lock +1 -1
- data/gemfiles/sequel-2.8.0.gemfile.lock +1 -1
- data/gemfiles/sequel-3.0.0.gemfile.lock +1 -1
- data/gemfiles/sequel-3.13.0.gemfile.lock +1 -1
- data/gemfiles/sequel-3.14.0.gemfile.lock +1 -1
- data/gemfiles/sequel-3.23.0.gemfile.lock +1 -1
- data/gemfiles/sequel-3.24.0.gemfile.lock +1 -1
- data/gemfiles/sequel-3.29.0.gemfile.lock +1 -1
- data/lib/state_machine/integrations/active_record.rb +21 -8
- data/lib/state_machine/integrations/active_record/versions.rb +16 -0
- data/lib/state_machine/version.rb +1 -1
- data/test/unit/integrations/active_record_test.rb +1 -1
- metadata +8 -4
data/Appraisals
CHANGED
@@ -64,6 +64,11 @@ if RUBY_VERSION > "1.8.6"
|
|
64
64
|
gem "sqlite3-ruby"
|
65
65
|
gem "activerecord", "3.1.1"
|
66
66
|
end
|
67
|
+
|
68
|
+
appraise "active_record-3.2.0" do
|
69
|
+
gem "sqlite3-ruby"
|
70
|
+
gem "activerecord", "3.2.0"
|
71
|
+
end
|
67
72
|
end
|
68
73
|
|
69
74
|
# ActiveModel integrations
|
@@ -79,6 +84,10 @@ if RUBY_VERSION > "1.8.6"
|
|
79
84
|
appraise "active_model-3.1.1" do
|
80
85
|
gem "activemodel", "3.1.1"
|
81
86
|
end
|
87
|
+
|
88
|
+
appraise "active_model-3.2.0" do
|
89
|
+
gem "activemodel", "3.2.0"
|
90
|
+
end
|
82
91
|
end
|
83
92
|
|
84
93
|
# MongoMapper integrations
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# state_machine [![Build Status](https://secure.travis-ci.org/pluginaweek/state_machine.png "Build Status")](http://travis-ci.org/pluginaweek/state_machine)
|
1
|
+
# state_machine [![Build Status](https://secure.travis-ci.org/pluginaweek/state_machine.png "Build Status")](http://travis-ci.org/pluginaweek/state_machine) [![Dependency Status](https://gemnasium.com/pluginaweek/state_machine.png "Dependency Status")](https://gemnasium.com/pluginaweek/state_machine)
|
2
2
|
|
3
3
|
*state_machine* adds support for creating state machines for attributes on any
|
4
4
|
Ruby class.
|
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /home/aaron/Projects/Personal/pluginaweek/state_machine
|
3
|
+
specs:
|
4
|
+
state_machine (1.1.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://www.rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (3.2.0)
|
10
|
+
activesupport (= 3.2.0)
|
11
|
+
builder (~> 3.0.0)
|
12
|
+
activesupport (3.2.0)
|
13
|
+
i18n (~> 0.6)
|
14
|
+
multi_json (~> 1.0)
|
15
|
+
appraisal (0.4.0)
|
16
|
+
bundler
|
17
|
+
rake
|
18
|
+
builder (3.0.0)
|
19
|
+
i18n (0.6.0)
|
20
|
+
multi_json (1.0.4)
|
21
|
+
rake (0.9.2.2)
|
22
|
+
rcov (0.9.11)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
activemodel (= 3.2.0)
|
29
|
+
appraisal (~> 0.4.0)
|
30
|
+
rake
|
31
|
+
rcov
|
32
|
+
state_machine!
|
@@ -0,0 +1,43 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /home/aaron/Projects/Personal/pluginaweek/state_machine
|
3
|
+
specs:
|
4
|
+
state_machine (1.1.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://www.rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (3.2.0)
|
10
|
+
activesupport (= 3.2.0)
|
11
|
+
builder (~> 3.0.0)
|
12
|
+
activerecord (3.2.0)
|
13
|
+
activemodel (= 3.2.0)
|
14
|
+
activesupport (= 3.2.0)
|
15
|
+
arel (~> 3.0.0)
|
16
|
+
tzinfo (~> 0.3.29)
|
17
|
+
activesupport (3.2.0)
|
18
|
+
i18n (~> 0.6)
|
19
|
+
multi_json (~> 1.0)
|
20
|
+
appraisal (0.4.0)
|
21
|
+
bundler
|
22
|
+
rake
|
23
|
+
arel (3.0.0)
|
24
|
+
builder (3.0.0)
|
25
|
+
i18n (0.6.0)
|
26
|
+
multi_json (1.0.4)
|
27
|
+
rake (0.9.2.2)
|
28
|
+
rcov (0.9.11)
|
29
|
+
sqlite3 (1.3.5)
|
30
|
+
sqlite3-ruby (1.3.3)
|
31
|
+
sqlite3 (>= 1.3.3)
|
32
|
+
tzinfo (0.3.31)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
activerecord (= 3.2.0)
|
39
|
+
appraisal (~> 0.4.0)
|
40
|
+
rake
|
41
|
+
rcov
|
42
|
+
sqlite3-ruby
|
43
|
+
state_machine!
|
@@ -435,21 +435,34 @@ module StateMachine
|
|
435
435
|
# initial state of the machine *before* any attributes are set on the
|
436
436
|
# object
|
437
437
|
def define_state_initializer
|
438
|
+
define_static_state_initializer
|
439
|
+
define_dynamic_state_initializer
|
440
|
+
end
|
441
|
+
|
442
|
+
# Initializes static states
|
443
|
+
def define_static_state_initializer
|
444
|
+
# This is the only available hook where the default set of attributes
|
445
|
+
# can be overridden for a new object *prior* to the processing of the
|
446
|
+
# attributes passed into #initialize
|
447
|
+
define_helper :class, <<-end_eval, __FILE__, __LINE__ + 1
|
448
|
+
def column_defaults(*) #:nodoc:
|
449
|
+
result = super
|
450
|
+
# No need to pass in an object, since the overrides will be forced
|
451
|
+
self.state_machines.initialize_states(nil, :dynamic => false, :to => result)
|
452
|
+
result
|
453
|
+
end
|
454
|
+
end_eval
|
455
|
+
end
|
456
|
+
|
457
|
+
# Initializes dynamic states
|
458
|
+
def define_dynamic_state_initializer
|
438
459
|
define_helper :instance, <<-end_eval, __FILE__, __LINE__ + 1
|
439
|
-
# Initializes dynamic states
|
440
460
|
def initialize(*)
|
441
461
|
super do |*args|
|
442
462
|
self.class.state_machines.initialize_states(self, :static => false)
|
443
463
|
yield(*args) if block_given?
|
444
464
|
end
|
445
465
|
end
|
446
|
-
|
447
|
-
# Initializes static states
|
448
|
-
def attributes_from_column_definition(*)
|
449
|
-
result = super
|
450
|
-
self.class.state_machines.initialize_states(self, :dynamic => false, :to => result)
|
451
|
-
result
|
452
|
-
end
|
453
466
|
end_eval
|
454
467
|
end
|
455
468
|
|
@@ -1,6 +1,22 @@
|
|
1
1
|
module StateMachine
|
2
2
|
module Integrations #:nodoc:
|
3
3
|
module ActiveRecord
|
4
|
+
version '2.x - 3.0.x' do
|
5
|
+
def self.active?
|
6
|
+
::ActiveRecord::VERSION::MAJOR == 2 || ::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR == 0
|
7
|
+
end
|
8
|
+
|
9
|
+
def define_static_state_initializer
|
10
|
+
define_helper :instance, <<-end_eval, __FILE__, __LINE__ + 1
|
11
|
+
def attributes_from_column_definition(*)
|
12
|
+
result = super
|
13
|
+
self.class.state_machines.initialize_states(self, :dynamic => false, :to => result)
|
14
|
+
result
|
15
|
+
end
|
16
|
+
end_eval
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
4
20
|
version '2.x' do
|
5
21
|
def self.active?
|
6
22
|
::ActiveRecord::VERSION::MAJOR == 2
|
@@ -34,7 +34,7 @@ module ActiveRecordTest
|
|
34
34
|
|
35
35
|
model = Class.new(ActiveRecord::Base) do
|
36
36
|
connection.create_table(table_name, :force => true) {|t| t.string(:state)} if create_table
|
37
|
-
|
37
|
+
self.table_name = table_name.to_s
|
38
38
|
|
39
39
|
(class << self; self; end).class_eval do
|
40
40
|
define_method(:name) { "ActiveRecordTest::#{table_name.to_s.capitalize}" }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 2
|
10
|
+
version: 1.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aaron Pfeifer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-20 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -109,6 +109,8 @@ files:
|
|
109
109
|
- gemfiles/active_model-3.0.5.gemfile.lock
|
110
110
|
- gemfiles/active_model-3.1.1.gemfile
|
111
111
|
- gemfiles/active_model-3.1.1.gemfile.lock
|
112
|
+
- gemfiles/active_model-3.2.0.gemfile
|
113
|
+
- gemfiles/active_model-3.2.0.gemfile.lock
|
112
114
|
- gemfiles/active_record-2.0.0.gemfile
|
113
115
|
- gemfiles/active_record-2.0.0.gemfile.lock
|
114
116
|
- gemfiles/active_record-2.0.5.gemfile
|
@@ -127,6 +129,8 @@ files:
|
|
127
129
|
- gemfiles/active_record-3.0.5.gemfile.lock
|
128
130
|
- gemfiles/active_record-3.1.1.gemfile
|
129
131
|
- gemfiles/active_record-3.1.1.gemfile.lock
|
132
|
+
- gemfiles/active_record-3.2.0.gemfile
|
133
|
+
- gemfiles/active_record-3.2.0.gemfile.lock
|
130
134
|
- gemfiles/data_mapper-0.10.2.gemfile
|
131
135
|
- gemfiles/data_mapper-0.10.2.gemfile.lock
|
132
136
|
- gemfiles/data_mapper-0.9.11.gemfile
|