aasm 4.11.1 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +5 -5
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. data/.travis.yml +56 -23
  5. data/Appraisals +67 -0
  6. data/CHANGELOG.md +112 -0
  7. data/CONTRIBUTING.md +24 -0
  8. data/Dockerfile +44 -0
  9. data/Gemfile +3 -21
  10. data/Gemfile.lock_old +151 -0
  11. data/LICENSE +1 -1
  12. data/README.md +540 -139
  13. data/Rakefile +6 -1
  14. data/TESTING.md +25 -0
  15. data/aasm.gemspec +5 -0
  16. data/docker-compose.yml +40 -0
  17. data/gemfiles/norails.gemfile +10 -0
  18. data/gemfiles/rails_4.2.gemfile +13 -11
  19. data/gemfiles/rails_4.2_mongoid_5.gemfile +8 -11
  20. data/gemfiles/rails_4.2_nobrainer.gemfile +9 -0
  21. data/gemfiles/rails_5.0.gemfile +11 -18
  22. data/gemfiles/rails_5.0_nobrainer.gemfile +9 -0
  23. data/gemfiles/rails_5.1.gemfile +14 -0
  24. data/gemfiles/rails_5.2.gemfile +14 -0
  25. data/lib/aasm/aasm.rb +40 -29
  26. data/lib/aasm/base.rb +61 -11
  27. data/lib/aasm/configuration.rb +10 -0
  28. data/lib/aasm/core/event.rb +45 -37
  29. data/lib/aasm/core/invoker.rb +129 -0
  30. data/lib/aasm/core/invokers/base_invoker.rb +75 -0
  31. data/lib/aasm/core/invokers/class_invoker.rb +52 -0
  32. data/lib/aasm/core/invokers/literal_invoker.rb +47 -0
  33. data/lib/aasm/core/invokers/proc_invoker.rb +59 -0
  34. data/lib/aasm/core/state.rb +22 -13
  35. data/lib/aasm/core/transition.rb +17 -69
  36. data/lib/aasm/dsl_helper.rb +24 -22
  37. data/lib/aasm/errors.rb +4 -6
  38. data/lib/aasm/instance_base.rb +22 -4
  39. data/lib/aasm/localizer.rb +13 -3
  40. data/lib/aasm/minitest/allow_event.rb +13 -0
  41. data/lib/aasm/minitest/allow_transition_to.rb +13 -0
  42. data/lib/aasm/minitest/have_state.rb +13 -0
  43. data/lib/aasm/minitest/transition_from.rb +21 -0
  44. data/lib/aasm/minitest.rb +5 -0
  45. data/lib/aasm/minitest_spec.rb +15 -0
  46. data/lib/aasm/persistence/active_record_persistence.rb +49 -105
  47. data/lib/aasm/persistence/base.rb +20 -5
  48. data/lib/aasm/persistence/core_data_query_persistence.rb +2 -1
  49. data/lib/aasm/persistence/dynamoid_persistence.rb +1 -1
  50. data/lib/aasm/persistence/mongoid_persistence.rb +26 -32
  51. data/lib/aasm/persistence/no_brainer_persistence.rb +105 -0
  52. data/lib/aasm/persistence/orm.rb +154 -0
  53. data/lib/aasm/persistence/plain_persistence.rb +2 -1
  54. data/lib/aasm/persistence/redis_persistence.rb +16 -11
  55. data/lib/aasm/persistence/sequel_persistence.rb +36 -64
  56. data/lib/aasm/persistence.rb +3 -3
  57. data/lib/aasm/rspec/allow_event.rb +5 -1
  58. data/lib/aasm/rspec/allow_transition_to.rb +5 -1
  59. data/lib/aasm/rspec/transition_from.rb +5 -1
  60. data/lib/aasm/state_machine.rb +4 -2
  61. data/lib/aasm/state_machine_store.rb +5 -2
  62. data/lib/aasm/version.rb +1 -1
  63. data/lib/aasm.rb +5 -2
  64. data/lib/generators/aasm/orm_helpers.rb +6 -0
  65. data/lib/generators/active_record/aasm_generator.rb +3 -1
  66. data/lib/generators/active_record/templates/migration.rb +1 -1
  67. data/lib/generators/active_record/templates/migration_existing.rb +1 -1
  68. data/lib/generators/nobrainer/aasm_generator.rb +28 -0
  69. data/lib/motion-aasm.rb +3 -1
  70. data/spec/database.rb +20 -7
  71. data/spec/en.yml +0 -3
  72. data/spec/generators/active_record_generator_spec.rb +49 -40
  73. data/spec/generators/mongoid_generator_spec.rb +4 -6
  74. data/spec/generators/no_brainer_generator_spec.rb +29 -0
  75. data/spec/{en_deprecated_style.yml → localizer_test_model_deprecated_style.yml} +6 -3
  76. data/spec/localizer_test_model_new_style.yml +11 -0
  77. data/spec/models/active_record/active_record_callback.rb +93 -0
  78. data/spec/models/active_record/complex_active_record_example.rb +5 -1
  79. data/spec/models/active_record/instance_level_skip_validation_example.rb +19 -0
  80. data/spec/models/{invalid_persistor.rb → active_record/invalid_persistor.rb} +0 -2
  81. data/spec/models/active_record/localizer_test_model.rb +11 -3
  82. data/spec/models/active_record/namespaced.rb +16 -0
  83. data/spec/models/active_record/person.rb +23 -0
  84. data/spec/models/{silent_persistor.rb → active_record/silent_persistor.rb} +0 -2
  85. data/spec/models/active_record/simple_new_dsl.rb +15 -0
  86. data/spec/models/active_record/timestamp_example.rb +16 -0
  87. data/spec/models/{transactor.rb → active_record/transactor.rb} +25 -2
  88. data/spec/models/{validator.rb → active_record/validator.rb} +0 -2
  89. data/spec/models/active_record/work.rb +3 -0
  90. data/spec/models/{worker.rb → active_record/worker.rb} +0 -0
  91. data/spec/models/callbacks/basic.rb +5 -2
  92. data/spec/models/callbacks/with_state_arg.rb +5 -1
  93. data/spec/models/callbacks/with_state_arg_multiple.rb +4 -1
  94. data/spec/models/default_state.rb +1 -1
  95. data/spec/models/guard_arguments_check.rb +17 -0
  96. data/spec/models/guard_with_params.rb +1 -1
  97. data/spec/models/guardian_without_from_specified.rb +18 -0
  98. data/spec/models/mongoid/invalid_persistor_mongoid.rb +39 -0
  99. data/spec/models/mongoid/silent_persistor_mongoid.rb +39 -0
  100. data/spec/models/mongoid/timestamp_example_mongoid.rb +20 -0
  101. data/spec/models/mongoid/validator_mongoid.rb +100 -0
  102. data/spec/models/multiple_transitions_that_differ_only_by_guard.rb +31 -0
  103. data/spec/models/namespaced_multiple_example.rb +14 -0
  104. data/spec/models/nobrainer/complex_no_brainer_example.rb +36 -0
  105. data/spec/models/nobrainer/invalid_persistor_no_brainer.rb +39 -0
  106. data/spec/models/nobrainer/no_scope_no_brainer.rb +21 -0
  107. data/spec/models/nobrainer/nobrainer_relationships.rb +25 -0
  108. data/spec/models/nobrainer/silent_persistor_no_brainer.rb +39 -0
  109. data/spec/models/nobrainer/simple_new_dsl_nobrainer.rb +25 -0
  110. data/spec/models/{mongo_mapper/simple_mongo_mapper.rb → nobrainer/simple_no_brainer.rb} +8 -8
  111. data/spec/models/nobrainer/validator_no_brainer.rb +98 -0
  112. data/spec/models/parametrised_event.rb +7 -0
  113. data/spec/models/{mongo_mapper/complex_mongo_mapper_example.rb → redis/complex_redis_example.rb} +8 -5
  114. data/spec/models/redis/redis_multiple.rb +20 -0
  115. data/spec/models/redis/redis_simple.rb +20 -0
  116. data/spec/models/sequel/complex_sequel_example.rb +4 -3
  117. data/spec/models/sequel/invalid_persistor.rb +52 -0
  118. data/spec/models/sequel/sequel_multiple.rb +13 -13
  119. data/spec/models/sequel/sequel_simple.rb +13 -12
  120. data/spec/models/sequel/silent_persistor.rb +50 -0
  121. data/spec/models/sequel/transactor.rb +112 -0
  122. data/spec/models/sequel/validator.rb +93 -0
  123. data/spec/models/sequel/worker.rb +12 -0
  124. data/spec/models/simple_example.rb +8 -0
  125. data/spec/models/simple_example_with_guard_args.rb +17 -0
  126. data/spec/models/simple_multiple_example.rb +12 -0
  127. data/spec/models/sub_class.rb +34 -0
  128. data/spec/models/timestamps_example.rb +19 -0
  129. data/spec/models/timestamps_with_named_machine_example.rb +13 -0
  130. data/spec/spec_helper.rb +15 -33
  131. data/spec/spec_helpers/active_record.rb +8 -0
  132. data/spec/spec_helpers/dynamoid.rb +35 -0
  133. data/spec/spec_helpers/mongoid.rb +26 -0
  134. data/spec/spec_helpers/nobrainer.rb +15 -0
  135. data/spec/spec_helpers/redis.rb +18 -0
  136. data/spec/spec_helpers/remove_warnings.rb +1 -0
  137. data/spec/spec_helpers/sequel.rb +7 -0
  138. data/spec/unit/abstract_class_spec.rb +27 -0
  139. data/spec/unit/api_spec.rb +79 -72
  140. data/spec/unit/callback_multiple_spec.rb +7 -3
  141. data/spec/unit/callbacks_spec.rb +37 -2
  142. data/spec/unit/complex_example_spec.rb +12 -3
  143. data/spec/unit/complex_multiple_example_spec.rb +20 -4
  144. data/spec/unit/event_multiple_spec.rb +1 -1
  145. data/spec/unit/event_spec.rb +29 -4
  146. data/spec/unit/exception_spec.rb +1 -1
  147. data/spec/unit/guard_arguments_check_spec.rb +9 -0
  148. data/spec/unit/guard_spec.rb +17 -0
  149. data/spec/unit/guard_with_params_spec.rb +4 -0
  150. data/spec/unit/guard_without_from_specified_spec.rb +10 -0
  151. data/spec/unit/inspection_multiple_spec.rb +9 -5
  152. data/spec/unit/inspection_spec.rb +7 -3
  153. data/spec/unit/invoker_spec.rb +189 -0
  154. data/spec/unit/invokers/base_invoker_spec.rb +72 -0
  155. data/spec/unit/invokers/class_invoker_spec.rb +95 -0
  156. data/spec/unit/invokers/literal_invoker_spec.rb +86 -0
  157. data/spec/unit/invokers/proc_invoker_spec.rb +86 -0
  158. data/spec/unit/localizer_spec.rb +85 -52
  159. data/spec/unit/multiple_transitions_that_differ_only_by_guard_spec.rb +14 -0
  160. data/spec/unit/namespaced_multiple_example_spec.rb +22 -0
  161. data/spec/unit/override_warning_spec.rb +8 -0
  162. data/spec/unit/persistence/active_record_persistence_multiple_spec.rb +468 -447
  163. data/spec/unit/persistence/active_record_persistence_spec.rb +639 -486
  164. data/spec/unit/persistence/dynamoid_persistence_multiple_spec.rb +4 -9
  165. data/spec/unit/persistence/dynamoid_persistence_spec.rb +4 -9
  166. data/spec/unit/persistence/mongoid_persistence_multiple_spec.rb +83 -13
  167. data/spec/unit/persistence/mongoid_persistence_spec.rb +97 -13
  168. data/spec/unit/persistence/no_brainer_persistence_multiple_spec.rb +198 -0
  169. data/spec/unit/persistence/no_brainer_persistence_spec.rb +158 -0
  170. data/spec/unit/persistence/redis_persistence_multiple_spec.rb +88 -0
  171. data/spec/unit/persistence/redis_persistence_spec.rb +8 -32
  172. data/spec/unit/persistence/sequel_persistence_multiple_spec.rb +6 -11
  173. data/spec/unit/persistence/sequel_persistence_spec.rb +278 -10
  174. data/spec/unit/rspec_matcher_spec.rb +9 -0
  175. data/spec/unit/simple_example_spec.rb +15 -0
  176. data/spec/unit/simple_multiple_example_spec.rb +28 -0
  177. data/spec/unit/state_spec.rb +23 -7
  178. data/spec/unit/subclassing_multiple_spec.rb +37 -2
  179. data/spec/unit/subclassing_spec.rb +17 -2
  180. data/spec/unit/timestamps_spec.rb +32 -0
  181. data/spec/unit/transition_spec.rb +1 -1
  182. data/test/minitest_helper.rb +57 -0
  183. data/test/unit/minitest_matcher_test.rb +80 -0
  184. metadata +213 -37
  185. data/callbacks.txt +0 -51
  186. data/gemfiles/rails_3.2_stable.gemfile +0 -15
  187. data/gemfiles/rails_4.0.gemfile +0 -16
  188. data/gemfiles/rails_4.0_mongo_mapper.gemfile +0 -16
  189. data/gemfiles/rails_4.2_mongo_mapper.gemfile +0 -17
  190. data/lib/aasm/persistence/mongo_mapper_persistence.rb +0 -163
  191. data/spec/models/mongo_mapper/no_scope_mongo_mapper.rb +0 -21
  192. data/spec/models/mongo_mapper/simple_new_dsl_mongo_mapper.rb +0 -25
  193. data/spec/unit/persistence/mongo_mapper_persistence_multiple_spec.rb +0 -149
  194. data/spec/unit/persistence/mongo_mapper_persistence_spec.rb +0 -96
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a57dd3feade6d1aea288f5999b4d93c890b11c60
4
- data.tar.gz: 8e14ba9da4f262ca2f2ba0a40f633af6234e2075
2
+ SHA256:
3
+ metadata.gz: 6e3ec7032fd9c8368ddfb4bed4e931edc5f9d96c02a69f89f7ee26913f7d8698
4
+ data.tar.gz: ddb4ef39501440da1869426eda3b4359e37eeef67b464c9e0d660e9f353510f6
5
5
  SHA512:
6
- metadata.gz: 08b85c55e73ba7b152e7a8344bf706315aa33016047849fee0e64dff8201f2691132d83d1e2c91b7e603b1e5f8e2a23bb8510573b539f142fa38b718c4aa0191
7
- data.tar.gz: 2cdd0ef93171f881ef36bd2b1fe0d06d71dce2a73fffee570515c12f69fdc52fb18ea02e29a5b4591498de9526e3fb1bf6039aff8d4ed9af0c8a069f278150cc
6
+ metadata.gz: c294de071cad6569f855af1455c9d0281622ca5c9a3df0466baacaca569d8974718eb46d4c06e674f54629a77e2634d69829ee2910612ba146b4aaf786891544
7
+ data.tar.gz: a7b0c176cec262ad9d89538fe43e6df484f4d79328f85e853dcc9fe6b6ce9a9629f802e7de14659e5c91135a3a4df09a6066011983b1936eff06b17657c24cc5
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Additional context**
27
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
data/.travis.yml CHANGED
@@ -2,47 +2,80 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
 
5
+ jdk:
6
+ - openjdk8
7
+
8
+ before_install:
9
+ - rvm list
10
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
11
+ - gem install bundler -v '1.16.1'
12
+ - bundle _1.16.1_ install
13
+
5
14
  rvm:
6
- - 1.9.3
7
- - 2.2.5
8
- - 2.3.1
9
- - jruby-1.7 # JRuby in 1.9 mode
10
- - jruby-9.0.5.0
11
- - rbx-2.5.8
15
+ - 2.5.0
16
+ - 2.6.5
17
+ - 2.7.0
18
+ - jruby-9.1.12.0
12
19
 
13
20
  services:
14
21
  - mongodb
15
22
  - redis-server
16
23
 
24
+ #addons:
25
+ # rethinkdb: '2.3.4'
26
+
17
27
  gemfile:
18
- - gemfiles/rails_3.2_stable.gemfile
19
- - gemfiles/rails_4.0.gemfile
20
- - gemfiles/rails_4.0_mongo_mapper.gemfile
28
+ - gemfiles/norails.gemfile
21
29
  - gemfiles/rails_4.2.gemfile
22
30
  - gemfiles/rails_4.2_mongoid_5.gemfile
23
- - gemfiles/rails_4.2_mongo_mapper.gemfile
31
+ # - gemfiles/rails_4.2_nobrainer.gemfile
24
32
  - gemfiles/rails_5.0.gemfile
33
+ # - gemfiles/rails_5.0_nobrainer.gemfile
34
+ - gemfiles/rails_5.1.gemfile
35
+ - gemfiles/rails_5.2.gemfile
25
36
 
26
37
  before_script:
27
38
  - mkdir /tmp/dynamodb
28
- - wget -O - http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest | tar xz --directory /tmp/dynamodb
39
+ - wget -O - https://s3-ap-southeast-1.amazonaws.com/dynamodb-local-singapore/dynamodb_local_latest.tar.gz | tar xz --directory /tmp/dynamodb
29
40
  - java -Djava.library.path=/tmp/dynamodb/DynamoDBLocal_lib -jar /tmp/dynamodb/DynamoDBLocal.jar -inMemory -delayTransientStatuses -port 30180 &
41
+ - mongod --version
42
+
43
+ script:
44
+ - bundle exec rspec spec
45
+ - bundle exec rake test
30
46
 
31
47
  matrix:
32
- allow_failures:
33
- - rvm: jruby-9.0.5.0
34
- gemfile: gemfiles/rails_5.0.gemfile
35
- - rvm: rbx-2.5.8
36
- gemfile: gemfiles/rails_5.0.gemfile
37
48
  exclude:
38
- - rvm: 1.9.3
39
- gemfile: gemfiles/rails_5.0.gemfile
40
- - rvm: 2.2.5
41
- gemfile: gemfiles/rails_3.2_stable.gemfile
42
- - rvm: 2.3.1
43
- gemfile: gemfiles/rails_3.2_stable.gemfile
44
- - rvm: jruby-1.7
49
+ - rvm: 2.7.0
50
+ gemfile: gemfiles/rails_5.2.gemfile
51
+ - rvm: 2.6.5
52
+ gemfile: gemfiles/rails_5.2.gemfile
53
+ - rvm: 2.5.0
54
+ gemfile: gemfiles/rails_4.2.gemfile
55
+ - rvm: 2.6.5
56
+ gemfile: gemfiles/rails_4.2.gemfile
57
+ - rvm: 2.7.0
58
+ gemfile: gemfiles/rails_4.2.gemfile
59
+ - rvm: 2.5.0
60
+ gemfile: gemfiles/rails_4.2_mongoid_5.gemfile
61
+ - rvm: 2.6.5
62
+ gemfile: gemfiles/rails_4.2_mongoid_5.gemfile
63
+ - rvm: 2.7.0
64
+ gemfile: gemfiles/rails_4.2_mongoid_5.gemfile
65
+ # - rvm: 2.5.0
66
+ # gemfile: gemfiles/rails_4.2_nobrainer.gemfile
67
+ - rvm: jruby-9.1.12.0
68
+ gemfile: gemfiles/norails.gemfile
69
+ - rvm: jruby-9.1.12.0
45
70
  gemfile: gemfiles/rails_5.0.gemfile
71
+ - rvm: jruby-9.1.12.0
72
+ gemfile: gemfiles/rails_5.1.gemfile
73
+ - rvm: jruby-9.1.12.0
74
+ gemfile: gemfiles/rails_5.2.gemfile
75
+ # - rvm: jruby-9.1.12.0
76
+ # gemfile: gemfiles/rails_4.2_nobrainer.gemfile
77
+ # - rvm: jruby-9.1.12.0
78
+ # gemfile: gemfiles/rails_5.0_nobrainer.gemfile
46
79
 
47
80
  notifications:
48
81
  slack:
data/Appraisals ADDED
@@ -0,0 +1,67 @@
1
+ appraise 'rails_4.2' do
2
+ gem 'nokogiri', '1.6.8.1', platforms: %i[ruby_19]
3
+ gem 'mime-types', '~> 2', platforms: %i[ruby_19 jruby]
4
+ gem 'rails', '4.2.5'
5
+ gem 'mongoid', '~> 4.0'
6
+ gem 'sequel'
7
+ gem 'dynamoid', '~> 1', platforms: :ruby
8
+ gem 'aws-sdk', '~> 2', platforms: :ruby
9
+ gem 'redis-objects'
10
+ gem 'activerecord-jdbcsqlite3-adapter', '1.3.24', platforms: :jruby
11
+ gem "after_commit_everywhere", "~> 1.0"
12
+ end
13
+
14
+ appraise 'rails_4.2_nobrainer' do
15
+ gem 'rails', '4.2.5'
16
+ gem 'nobrainer', '~> 0.33.0'
17
+ end
18
+
19
+ appraise 'rails_4.2_mongoid_5' do
20
+ gem 'mime-types', '~> 2', platforms: %i[ruby_19 jruby]
21
+ gem 'rails', '4.2.5'
22
+ gem 'mongoid', '~> 5.0'
23
+ gem 'activerecord-jdbcsqlite3-adapter', '1.3.24', platforms: :jruby
24
+ gem "after_commit_everywhere", "~> 1.0"
25
+ end
26
+
27
+ appraise 'rails_5.0' do
28
+ gem 'rails', '5.0.0'
29
+ gem 'mongoid', '~> 6.0'
30
+ gem 'sequel'
31
+ gem 'dynamoid', '~> 1.3', platforms: :ruby
32
+ gem 'aws-sdk', '~> 2', platforms: :ruby
33
+ gem 'redis-objects'
34
+ gem "after_commit_everywhere", "~> 1.0"
35
+ end
36
+
37
+ appraise 'rails_5.0_nobrainer' do
38
+ gem 'rails', '5.0.0'
39
+ gem 'nobrainer', '~> 0.33.0'
40
+ end
41
+
42
+ appraise 'rails_5.1' do
43
+ gem 'rails', '5.1'
44
+ gem 'mongoid', '~>6.0'
45
+ gem 'sequel'
46
+ gem 'dynamoid', '~> 1.3', platforms: :ruby
47
+ gem 'aws-sdk', '~>2', platforms: :ruby
48
+ gem 'redis-objects'
49
+ gem "after_commit_everywhere", "~> 1.0"
50
+ end
51
+
52
+ appraise 'rails_5.2' do
53
+ gem 'rails', '5.2'
54
+ gem 'mongoid', '~>6.0'
55
+ gem 'sequel'
56
+ gem 'dynamoid', '~>2.2', platforms: :ruby
57
+ gem 'aws-sdk', '~>2', platforms: :ruby
58
+ gem 'redis-objects'
59
+ gem "after_commit_everywhere", "~> 1.0"
60
+ end
61
+
62
+ appraise 'norails' do
63
+ gem 'sqlite3', '~> 1.3', '>= 1.3.5', platforms: :ruby
64
+ gem 'rails', install_if: false
65
+ gem 'sequel'
66
+ gem 'redis-objects'
67
+ end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,117 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## unreleased
4
+ ## 5.2.0
5
+
6
+ * fix: timestamp will work with named machine [#739](https://github.com/aasm/aasm/pull/739), thanks to [RolandStuder](https://github.com/RolandStuder)
7
+ * Create namespaced scopes in PR [#735](https://github.com/aasm/aasm/pull/735), thanks to [caiohsramos](https://github.com/caiohsramos)
8
+ * Fix multiple state machines example per class on README in PR [#732](https://github.com/aasm/aasm/pull/732), thanks to [RodrigoVitiello](https://github.com/RodrigoVitiello)
9
+ * Update version in recommendation to add after_commit_everywhere in PR [#729](https://github.com/aasm/aasm/pull/729), thanks to [Envek](https://github.com/Envek)
10
+ * Fix i18n Event translations failing [#721](https://github.com/aasm/aasm/issues/721) in PR [#723](https://github.com/aasm/aasm/pull/723), thanks to [the-spectator](https://github.com/the-spectator)
11
+ * Add documentation to the Readme about how parameters are handled in AASM events in PR [#722](https://github.com/aasm/aasm/pull/722), thanks to [dstuebe](https://github.com/dstuebe)
12
+ * Fix human_state cached across locales [#709](https://github.com/aasm/aasm/issues/709) in PR [716](https://github.com/aasm/aasm/pull/716), thanks to [the-spectator](https://github.com/the-spectator)
13
+ * Relocate DslHelper from root namespace to under AASM namespace in PR [#711](https://github.com/aasm/aasm/pull/711) thank to [yujideveloper ](https://github.com/yujideveloper )
14
+ * Document how to define transitions from any state in in PR [#699](https://github.com/aasm/aasm/pull/699) thanks to [hedgesky](https://github.com/hedgesky)
15
+ * Add simple option for auto-generated timestamps in PR [#677](https://github.com/aasm/aasm/pull/677), thanks to [jaynetics](https://github.com/jaynetics)
16
+ ## 5.1.1
17
+
18
+ * Fix Depreciation message for after_commit_everywhere [#695](https://github.com/aasm/aasm/issues/695) in PR [#696](https://github.com/aasm/aasm/pull/696)
19
+ * Fix human_state to use display option [#684](https://github.com/aasm/aasm/issues/684) in PR [#697](https://github.com/aasm/aasm/pull/697)
20
+ * Remove support for ruby 2.3
21
+
22
+ ## 5.1.0
23
+
24
+ * Fix after_commit in nested transactions [#536](https://github.com/aasm/aasm/issues/536) without explicit AR dependency in PR [#668](https://github.com/aasm/aasm/pull/668), thanks to [stokarenko](https://github.com/stokarenko)
25
+ * Remove support for Rails 3.2
26
+
27
+ ## 5.0.8
28
+
29
+ * Revert Fix for :after_commit within nested transaction because it adds after_commit_action dependency which is dependent on many gems.
30
+
31
+ ## 5.0.7
32
+
33
+ * Fix :after_commit within nested transaction [#666](https://github.com/aasm/aasm/pull/666), thanks to [stokarenko](https://github.com/stokarenko)
34
+ * Add permitted_transitions to group permitted event with state [#664](https://github.com/aasm/aasm/pull/664), thanks to [dnamsons](https://github.com/dnamsons)
35
+ * Add Ruby 2.7.0 & 2.6.5 to Travis CI Test Matrix [#661](https://github.com/aasm/aasm/pull/661), thanks to [the-spectator](https://github.com/the-spectator)
36
+ * Handle InvalidTransition in transition_from matcher [#653](https://github.com/aasm/aasm/pull/653), thanks to [ryanwood](https://github.com/ryanwood)
37
+
38
+ ## 5.0.6
39
+
40
+ * Fix no_direct_assignment, couldn't be turned off pragmatically [#636](https://github.com/aasm/aasm/issues/636)
41
+ * Add instance level validation skip option [#644](https://github.com/aasm/aasm/pull/644), thanks to [Nitin-Salunke](https://github.com/Nitin-Salunke)
42
+ * Fixed aasm.current_event incorrectly yields nil when calling aasm.fire!(:event) [#551](https://github.com/aasm/aasm/issues/551) in [#638](https://github.com/aasm/aasm/pull/638), thanks to [DoubleJarvis](https://github.com/DoubleJarvis)
43
+ * Code Refactor [#634](https://github.com/aasm/aasm/pull/634) , thanks to [rahulknojha](https://github.com/rahulknojha)
44
+ * Fixed callback argument for :before_success & :success callback, [#630](https://github.com/aasm/aasm/pull/630)
45
+
46
+ ## 5.0.5
47
+
48
+ * Independent of ActiveSupport methods, [#627](https://github.com/aasm/aasm/pull/627),
49
+ thanks to [tristandruyen](https://github.com/tristandruyen). Fixes [#508](https://github.com/aasm/aasm/issues/508)
50
+
51
+ ## 5.0.4
52
+
53
+ * Specify dynamoid version for Rails > 5, [#625](https://github.com/aasm/aasm/pull/625),
54
+ thanks to [waghanza](https://github.com/waghanza)
55
+ * Add travis runner for Rails 5.2, [#624](https://github.com/aasm/aasm/pull/624), thanks
56
+ to [waghanza](https://github.com/waghanza)
57
+ * Cleanup Abstract class issue, [#620](https://github.com/aasm/aasm/pull/620), thanks to
58
+ [dennym](https://github.com/dennym)
59
+
60
+ ## 5.0.3
61
+
62
+ * Fix Abstract class issue, [#619](https://github.com/aasm/aasm/pull/619)
63
+
64
+ ## 5.0.2
65
+
66
+ * Clear failed callbacks, [#600](https://github.com/aasm/aasm/pull/600), thanks to
67
+ [nedgar](https://github.com/nedgar)
68
+ * README improvements, [#594](https://github.com/aasm/aasm/pull/594),
69
+ [#589](https://github.com/aasm/aasm/pull/589), [#587](https://github.com/aasm/aasm/pull/587),
70
+ [#597](https://github.com/aasm/aasm/pull/597), thanks to [jackscotti](https://github.com/jackscotti), [krmbzds](https://github.com/krmbzds),
71
+ [zegomesjf](https://github.com/zegomesjf), [BKSpurgeon](https://github.com/BKSpurgeon)
72
+ * Update InvalidTransition to include state_machine_name [#592](https://github.com/aasm/aasm/pull/592), thanks to [a14m](https://github.com/a14m)
73
+ * Do not add migration if model and column already exists [#586](https://github.com/aasm/aasm/pull/586), thanks to [KiranJosh](https://github.com/KiranJosh)
74
+
75
+ ## 5.0.1
76
+
77
+ * Fix failures array in transition not being reset [#383](https://github.com/aasm/aasm/issues/383)
78
+ * Enable AASM scopes to be defined on abstract classes.
79
+
80
+ ## 5.0.0
81
+
82
+ * Chore(invokers): Refactor callback invokers, add class-callbacks support [#541](https://github.com/aasm/aasm/pull/541), thanks to [pandomic](https://github.com/pandomic)
83
+ * Add docker setup to readme
84
+ * Add support for Nobrainer (RethinkDB) [#522](https://github.com/aasm/aasm/pull/522), thanks to [zedtux](https://github.com/zedtux)
85
+ * Patch `allow_event` to accept event with custom arguments [#419](https://github.com/aasm/aasm/pull/419), thanks to [czhc](https://github.com/czhc)
86
+
87
+ ## 4.12.3
88
+
89
+ * Add to AASM fire(event) and fire!(event) methods [#494](https://github.com/aasm/aasm/pull/494), thanks to [slayer](https://github.com/slayer)
90
+ * Add `use_transactions` flag to persist changes to the database even when some error occurs. [#493](https://github.com/aasm/aasm/pull/493), thanks to Peter Lampesberger.
91
+
92
+ ## 4.12.2
93
+
94
+ * Fix guards parameter [#484](https://github.com/aasm/aasm/pull/484), thanks to [teohm](https://github.com/teohm)
95
+ * Make errors more inspectable [#452](https://github.com/aasm/aasm/pull/452), thanks to [flexoid](https://github.com/flexoid)
96
+ * Enable Dynamoid for Rails 5 [#483](https://github.com/aasm/aasm/pull/483), thanks to [focusshifter](https://github.com/focusshifter)
97
+
98
+ ## 4.12.1
99
+
100
+ * DRY-up Mongoid and ActiveRecord Persistence, Add Sequel transactions and locking [#475](https://github.com/aasm/aasm/pull/475), thanks to [@Aryk](https://github.com/Aryk)
101
+ * Add aliases for event methods [#476](https://github.com/aasm/aasm/pull/476), thanks to [@Aryk](https://github.com/Aryk)
102
+ * Support Minitest spec expectations [#387](https://github.com/aasm/aasm/pull/387), thanks to [@faragorn](https://github.com/faragorn)
103
+ ## 4.12.0
104
+
105
+ * Fix thread safe issue with concurrent-ruby gem [see [pull-request #422](https://github.com/aasm/aasm/pull/442), thanks to [@reidmorrison](https://github.com/reidmorrison)
106
+ * Drop Support for Mongo Mapper [see [pull-request #439](https://github.com/aasm/aasm/pull/439)], thanks to [@reidmorrison](https://github.com/reidmorrison)
107
+ * add :binding_event option to event [see [pull-request #438](https://github.com/aasm/aasm/pull/438)], thanks to [@leanhdaovn](https://github.com/leanhdaovn)
108
+ * fix: `skip_validation_on_save: true` for default_scope records, [see [pull-request #433](https://github.com/aasm/aasm/pull/433)], thanks to [@larissa](https://github.com/larissa)
109
+ * Deep clone state machine during inheritance so that state machines in child classes can be modified (see [pull-request #429](https://github.com/aasm/aasm/pull/429)), thanks to [@reidmorrison](https://github.com/reidmorrison) and [@Tybot204](https://github.com/Tybot204)
110
+ * add before_success callback for event (see [pull-request #422](https://github.com/aasm/aasm/pull/422)), thanks to [@timsly ](https://github.com/timsly)
111
+ * fix: multiple transitions in a single event with the same to and from states (see [issue #372](https://github.com/aasm/aasm/issues/372) and [issue #362](https://github.com/aasm/aasm/issues/362) for details, fixed with [pull-request #408](https://github.com/aasm/aasm/pull/408), thanks to [@dathanb](https://github.com/dathanb))
112
+ * fix: passing nil as a argument to callbacks (see [issue #404](https://github.com/aasm/aasm/issues/404) for details, fixed with [pull-request #406](https://github.com/aasm/aasm/pull/406), thanks to [@yogeshjain999](https://github.com/yogeshjain999))
113
+
114
+
3
115
  ## 4.11.1
4
116
 
5
117
  * fix: generator file name when using custom column name instead of
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,24 @@
1
+ ## Contributing ##
2
+
3
+ While not required to contribute, we recommend [RVM](https://rvm.io/) to manage your rubies.
4
+
5
+ 1. Read the [Contributor Code of Conduct](https://github.com/aasm/aasm/blob/master/CODE_OF_CONDUCT.md)
6
+ 2. [Fork it](https://help.github.com/articles/about-forks/)
7
+ 3. Clone the project `git clone git@github.com:[YOUR GITHUB USERNAME]/aasm.git`
8
+ 4. `cd aasm`
9
+ 5. Create your feature branch `git checkout -b my-new-feature`
10
+ 6. Write tests for your changes (feature/bug)
11
+ 7. Write your (feature/bugfix)
12
+ 8. Install the dependencies `appraisal install`
13
+ 9. Run the tests `appraisal rspec`
14
+ 10. Commit your changes `git commit -am 'Added some feature'`
15
+ 11. Push to the branch `git push origin my-new-feature`
16
+ 12. Create new [Pull Request](https://help.github.com/articles/creating-a-pull-request/)
17
+
18
+ There are some option dependencies as well.
19
+
20
+ - [MongoDB server](https://www.mongodb.com/download-center)
21
+ - [Redis](https://redis.io/topics/quickstart)
22
+ - [DynamoDB (local)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html)
23
+
24
+ If we've missed something please open an [issue](https://github.com/aasm/aasm/issues/new)
data/Dockerfile ADDED
@@ -0,0 +1,44 @@
1
+ FROM ruby:2.3.4-slim
2
+
3
+ LABEL maintainer="AASM"
4
+
5
+ ENV DEBIAN_FRONTEND noninteractive
6
+
7
+ # ~~~~ System locales ~~~~
8
+ RUN apt-get update && apt-get install -y locales && \
9
+ dpkg-reconfigure locales && \
10
+ locale-gen C.UTF-8 && \
11
+ /usr/sbin/update-locale LANG=C.UTF-8 && \
12
+ echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && \
13
+ locale-gen
14
+
15
+ # Set default locale for the environment
16
+ ENV LC_ALL C.UTF-8
17
+ ENV LANG en_US.UTF-8
18
+ ENV LANGUAGE en_US.UTF-8
19
+ ENV APP_HOME /application
20
+
21
+ # ~~~~ Application dependencies ~~~~
22
+ RUN apt-get update
23
+ RUN apt-get install -y libsqlite3-dev \
24
+ build-essential \
25
+ git
26
+
27
+ # ~~~~ Bundler ~~~~
28
+ RUN gem install bundler
29
+
30
+ WORKDIR $APP_HOME
31
+ RUN mkdir -p $APP_HOME/lib/aasm/
32
+
33
+ COPY Gemfile* $APP_HOME/
34
+ COPY *.gemspec $APP_HOME/
35
+ COPY lib/aasm/version.rb $APP_HOME/lib/aasm/
36
+
37
+ ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile \
38
+ BUNDLE_JOBS=8 \
39
+ BUNDLE_PATH=/bundle
40
+
41
+ RUN bundle install
42
+
43
+ # ~~~~ Import application ~~~~
44
+ COPY . $APP_HOME
data/Gemfile CHANGED
@@ -1,24 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "sqlite3", :platforms => :ruby
4
- gem 'rubysl', :platforms => :rbx
5
- gem "jruby-openssl", :platforms => :jruby
6
- gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
7
- gem "mime-types", "~> 2" if Gem::Version.create(RUBY_VERSION.dup) <= Gem::Version.create('1.9.3')
8
- gem "rails", "~>4.2"
9
- gem 'mongoid', '~>4.0' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
10
- gem 'sequel'
11
-
12
- # testing dynamoid
13
- # gem 'dynamoid', '~> 1'
14
- # gem 'aws-sdk', '~>2'
15
-
16
- # Since mongoid V4 requires incompatible bson V2, cannot have mongoid (V4 or greater)
17
- # and mongo_mapper ( or mongo ) in the same application
18
- # gem 'mongo_mapper', '~> 0.13'
19
- # gem 'bson_ext', :platforms => :ruby
20
-
21
- # uncomment if you want to run specs for Redis persistence
22
- # gem "redis-objects"
23
-
24
3
  gemspec
4
+
5
+ gem 'sqlite3', '~> 1.3.5', :platforms => :ruby
6
+ gem 'rails', '5.1.4'
data/Gemfile.lock_old ADDED
@@ -0,0 +1,151 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ aasm (4.11.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (4.2.7.1)
10
+ actionpack (= 4.2.7.1)
11
+ actionview (= 4.2.7.1)
12
+ activejob (= 4.2.7.1)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ rails-dom-testing (~> 1.0, >= 1.0.5)
15
+ actionpack (4.2.7.1)
16
+ actionview (= 4.2.7.1)
17
+ activesupport (= 4.2.7.1)
18
+ rack (~> 1.6)
19
+ rack-test (~> 0.6.2)
20
+ rails-dom-testing (~> 1.0, >= 1.0.5)
21
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
22
+ actionview (4.2.7.1)
23
+ activesupport (= 4.2.7.1)
24
+ builder (~> 3.1)
25
+ erubis (~> 2.7.0)
26
+ rails-dom-testing (~> 1.0, >= 1.0.5)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ activejob (4.2.7.1)
29
+ activesupport (= 4.2.7.1)
30
+ globalid (>= 0.3.0)
31
+ activemodel (4.2.7.1)
32
+ activesupport (= 4.2.7.1)
33
+ builder (~> 3.1)
34
+ activerecord (4.2.7.1)
35
+ activemodel (= 4.2.7.1)
36
+ activesupport (= 4.2.7.1)
37
+ arel (~> 6.0)
38
+ activesupport (4.2.7.1)
39
+ i18n (~> 0.7)
40
+ json (~> 1.7, >= 1.7.7)
41
+ minitest (~> 5.1)
42
+ thread_safe (~> 0.3, >= 0.3.4)
43
+ tzinfo (~> 1.1)
44
+ appraisal (2.1.0)
45
+ bundler
46
+ rake
47
+ thor (>= 0.14.0)
48
+ arel (6.0.4)
49
+ builder (3.2.3)
50
+ coderay (1.1.1)
51
+ concurrent-ruby (1.0.5)
52
+ diff-lcs (1.3)
53
+ erubis (2.7.0)
54
+ generator_spec (0.9.3)
55
+ activesupport (>= 3.0.0)
56
+ railties (>= 3.0.0)
57
+ globalid (0.3.7)
58
+ activesupport (>= 4.1.0)
59
+ i18n (0.8.1)
60
+ json (1.8.6)
61
+ loofah (2.0.3)
62
+ nokogiri (>= 1.5.9)
63
+ mail (2.6.4)
64
+ mime-types (>= 1.16, < 4)
65
+ method_source (0.8.2)
66
+ mime-types (3.1)
67
+ mime-types-data (~> 3.2015)
68
+ mime-types-data (3.2016.0521)
69
+ mini_portile2 (2.1.0)
70
+ minitest (5.10.1)
71
+ nokogiri (1.7.0.1)
72
+ mini_portile2 (~> 2.1.0)
73
+ pry (0.10.4)
74
+ coderay (~> 1.1.0)
75
+ method_source (~> 0.8.1)
76
+ slop (~> 3.4)
77
+ rack (1.6.5)
78
+ rack-test (0.6.3)
79
+ rack (>= 1.0)
80
+ rails (4.2.7.1)
81
+ actionmailer (= 4.2.7.1)
82
+ actionpack (= 4.2.7.1)
83
+ actionview (= 4.2.7.1)
84
+ activejob (= 4.2.7.1)
85
+ activemodel (= 4.2.7.1)
86
+ activerecord (= 4.2.7.1)
87
+ activesupport (= 4.2.7.1)
88
+ bundler (>= 1.3.0, < 2.0)
89
+ railties (= 4.2.7.1)
90
+ sprockets-rails
91
+ rails-deprecated_sanitizer (1.0.3)
92
+ activesupport (>= 4.2.0.alpha)
93
+ rails-dom-testing (1.0.8)
94
+ activesupport (>= 4.2.0.beta, < 5.0)
95
+ nokogiri (~> 1.6)
96
+ rails-deprecated_sanitizer (>= 1.0.1)
97
+ rails-html-sanitizer (1.0.3)
98
+ loofah (~> 2.0)
99
+ railties (4.2.7.1)
100
+ actionpack (= 4.2.7.1)
101
+ activesupport (= 4.2.7.1)
102
+ rake (>= 0.8.7)
103
+ thor (>= 0.18.1, < 2.0)
104
+ rake (12.0.0)
105
+ rdoc (4.3.0)
106
+ rspec (3.5.0)
107
+ rspec-core (~> 3.5.0)
108
+ rspec-expectations (~> 3.5.0)
109
+ rspec-mocks (~> 3.5.0)
110
+ rspec-core (3.5.4)
111
+ rspec-support (~> 3.5.0)
112
+ rspec-expectations (3.5.0)
113
+ diff-lcs (>= 1.2.0, < 2.0)
114
+ rspec-support (~> 3.5.0)
115
+ rspec-mocks (3.5.0)
116
+ diff-lcs (>= 1.2.0, < 2.0)
117
+ rspec-support (~> 3.5.0)
118
+ rspec-support (3.5.0)
119
+ sdoc (0.4.2)
120
+ json (~> 1.7, >= 1.7.7)
121
+ rdoc (~> 4.0)
122
+ slop (3.6.0)
123
+ sprockets (3.7.1)
124
+ concurrent-ruby (~> 1.0)
125
+ rack (> 1, < 3)
126
+ sprockets-rails (3.2.0)
127
+ actionpack (>= 4.0)
128
+ activesupport (>= 4.0)
129
+ sprockets (>= 3.0.0)
130
+ sqlite3 (1.3.13)
131
+ thor (0.19.4)
132
+ thread_safe (0.3.6)
133
+ tzinfo (1.2.2)
134
+ thread_safe (~> 0.1)
135
+
136
+ PLATFORMS
137
+ ruby
138
+
139
+ DEPENDENCIES
140
+ aasm!
141
+ appraisal
142
+ generator_spec
143
+ pry
144
+ rails (= 4.2.7.1)
145
+ rake
146
+ rspec (>= 3)
147
+ sdoc
148
+ sqlite3
149
+
150
+ BUNDLED WITH
151
+ 1.12.4
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2016 Scott Barron
1
+ Copyright (c) 2006-2017 Scott Barron
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