statesman_mongoid 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 150c388e7dc52a4d1cd5f7dc8aec635bb70d254ecbab0928e151463ac9ca43d1
4
- data.tar.gz: 4db6ce07d5bca4cb8bb8f60cd07e0165072d23c977b1b165e7358e150eb580e5
3
+ metadata.gz: e91c70458d4fc19660876de07d0943d6556dd74b21128224fac9fbff5e949bc3
4
+ data.tar.gz: 7c334f7ab383ba19a2ea4a023069c295f61011fbad0a104dd0953b866201cb01
5
5
  SHA512:
6
- metadata.gz: 172df6b8fe89efababe619552ed5391765b7e18f38998f7cebf7fa00861a05a770436659b23c0ce4f59435643ac32ae5d1f8eb48bcb3a6d19fb01f68a7e65424
7
- data.tar.gz: 15460af6a52050507a9d8443ab696ce89a74a9bca276351ee78decaaed5279f476eac3d0ba3f8e6104cf4b5884100b5a43dccf7d4af59d4282048527e523cf55
6
+ metadata.gz: 6774cea42364ac55c0be27f00de380f6a4404069099b7a0656c4ac36969dfb67d4d8125b05abbf56775b2f0530f1d843270c0f736f5ec9ccfa22302b2f2982ad
7
+ data.tar.gz: b277d6b9e6611b538955fcce1cb75b088f600d053c0e8d0297f6cd5239ba534f01d9af98bc77a1ee7c8ada6afd2807f0530eb9e8b53168b4b10881477c0f797f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- statesman_mongoid (0.3.0)
4
+ statesman_mongoid (0.4.0)
5
5
  statesman (~> 10.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Statesman Mongoid
2
2
 
3
- Restored mongoid adapters for [Statesman](https://github.com/gocardless/statesman).
3
+ Mongoid adapters for [Statesman](https://github.com/gocardless/statesman).
4
4
 
5
- TODO: Restore generators and test units
5
+ TODO: Restore & update specs
6
6
 
7
- NOTE: This is an early salvage of the dropped mongoid support with a refitted queries adapter, a couple of fixes and some manual testing, use at your own risk and feel free to contribute.
7
+ NOTE: Restored Statesman's mongoid support with some fixes & updates. This project is in an early stage, please report any bugs or missing features. Use at your own risk and feel free to contribute.
8
8
 
9
9
  ## Installation
10
10
 
@@ -33,6 +33,11 @@ Statesman::Adapters::MongoidTransition
33
33
  Statesman::Adapters::MongoidQueries
34
34
  ```
35
35
 
36
+ Generator:
37
+ ```
38
+ rails generate statesman:mongoid_transition Order OrderTransition
39
+ ```
40
+
36
41
  ## Development
37
42
 
38
43
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -0,0 +1,27 @@
1
+ # Extracted from commit b9906ee1cf0ac6c1bbdd56c003ffe407c2f59833
2
+
3
+ require "rails/generators"
4
+ require "generators/statesman/generator_helpers"
5
+
6
+ module Statesman
7
+ class MongoidTransitionGenerator < Rails::Generators::Base
8
+ include Statesman::GeneratorHelpers
9
+
10
+ desc "Create a Mongoid-based transition model with the required attributes"
11
+
12
+ argument :parent, type: :string, desc: "Your parent model name"
13
+ argument :klass, type: :string, desc: "Your transition model name"
14
+
15
+ source_root File.expand_path("templates", __dir__)
16
+
17
+ def create_model_file
18
+ template("mongoid_transition_model.rb.erb", model_file_name)
19
+ end
20
+
21
+ private
22
+
23
+ def collection_name
24
+ klass.underscore.pluralize
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,7 @@
1
+ class <%= klass %>
2
+ include Statesman::Adapters::MongoidTransition
3
+
4
+ index({ sort_key: 1 })
5
+
6
+ belongs_to :<%= parent %><%= class_name_option %>, index: true
7
+ end
@@ -1,4 +1,4 @@
1
- # Restored mongoid support, untouched
1
+ # Restored mongoid support with feature parity
2
2
  # Extracted from commit b9906ee1cf0ac6c1bbdd56c003ffe407c2f59833
3
3
 
4
4
  module Statesman
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StatesmanMongoid
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statesman_mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - oz-tal
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-09 00:00:00.000000000 Z
11
+ date: 2023-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: statesman
@@ -36,6 +36,8 @@ files:
36
36
  - LICENSE.txt
37
37
  - README.md
38
38
  - Rakefile
39
+ - lib/generators/statesman/mongoid_transition_generator.rb
40
+ - lib/generators/statesman/templates/mongoid_transition_model.rb.erb
39
41
  - lib/statesman/adapters/mongoid.rb
40
42
  - lib/statesman/adapters/mongoid_queries.rb
41
43
  - lib/statesman/adapters/mongoid_transition.rb